Can I use a transistor as a relay?

Carl asked Jan 27,2021
0

I have a hardware component that requires 5V and 300mA to work. The Arduino output current of the Pins is 50mA, to the best of my knowledge. Only 40mA for 5V Pins.

My idea was to use the 5V and 2A of a phone charger, and switch it on using a relay and one of the IO pins. The relay is designed for 230V usage. Not sure if that would even work.

I thought of using a transistor, which is capable to handle that kind of voltage and current (TIP120). However, I am not sure how to connect the circuit around it, as the Collector and Emitter would be connected to the 5V 2A from the phone charger, but the Base would be connected to the Arduino, without the same ground. Anyone have ideas to design this? Thanks.

  • Your Answer(11)
Upload photo
You can only upload 5 files in total. Each file cannot exceed 2MB. Supports JPG, JPEG, GIF, PNG, BMP
0 / 10000
  • 0

    Use a finished, sealed USB power supply to keep the mains voltages out of your project. You need to connect the grounds. Then you can use a transistor (although I think what you really want is a MOSFET) to switch the external load. connect both the load and the Arduino to the USB power supply, the load via the MOSFET and the Arduino directly. Then they will share the same ground, and you will have no problems.

    Nikola Krneta 2021-02-20 02:32:31Reply

    In this case, a MOSFET is not a good idea unless it is a P channel. Using an N channel would shift the remote device ground depending on the current. As far as the question is understood, the poster also needs some form of isolation so MOSFETs, in general, wont work.

    Richard Unger 2021-02-20 03:17:15Reply

    A fair point you make... if isolation is needed, a different solution must be found. But my assumption is the poster just wanted to know how to switch a 300mA load. And at that level, either P- or N- channel will work just fine, although you'd obviously put them in different ends of the circuit... You posted elsewhere that it would be good if people explained their use cases more clearly. I so agree with that. Usually one has to just kinda guess what on earth people are trying to do with the things they propose, and I think sometimes that can be even a real safety issue.

    Nikola Krneta 2021-02-20 23:31:43Reply

    Agreed. That is why I tell people to better explain what they want to achieve. Having little to no information on the subject can only yield partial answers or very broad advice which is often rather useless.

    Reply
  • 0

    Hello! >> The relay is designed for 230V usage. Bad idea. I think it's a pretty dangerous. You should take a 5V relay, the contacts of which can handle the load you need, be it 230V or less.

    Reply
  • 0

    Well, do you need the same ground? i am not a professional. I have almost no idea 😅

    Reply
  • 0

    Like you said, powering the relay directly from a GPIO pin would not work since it likely cannot source enough current. However, you could probably use the same 5V supply that powers your Arduino for the relay. You will have to make sure the relay can actuate on 5V, of course. Your phone charger will be the power source for your external hardware and can be switched on by the relay. In this way, there would be two different grounds. Based on your question, I'm assuming this is desired/intentional.

    Scott Card 2021-01-29 01:42:32Reply

    May want to add a pull-down resistor to the base (and be sure that you include the free-wheeling diode as @Pete Dudash suggests) but, why not power your Arduino from the same 2A supply?

    Nikola Krneta 2021-01-29 23:16:29Reply

    Depends on what Carl is trying to achieve. I asked him for more information so that we can provide better answers. No reply yet, obviously.

    Bastian 2021-02-03 17:38:16Reply

    That Design looks correct

    Reply
  • 0

    Given that you have said "without the same ground" near the end of your question/explanation, the short answer is NO. The transistor requires a common emitter connection to function as a switch. This basically means that you need to connect the emitter of the transistor to the ground of the circuit you are trying to switch and you also need to connect the Arduino ground to the same circuit ground so that the Arduino can actually control the transistor. If you really need the relay, well, you can get 5 V relays from online stores. For example, https://www.mouser.com/ProductDetail/Fujitsu/FTR-LYCA005Y/?qs=VpmqhlS1mnMXlaHR0GcsBw%3D%3D If you provide a bit more information what you're tying to do, we might be able to give you better advice.

    Reply
Browse other questions tagged or ask your own question.
List of Questions
pause
Ranking Name Answers
1 PCBWay Team 15
2 Malcolm Low 4
3 Engineer 2
4 Engineer 1
5 Engineer 1
6 RODNEY THAYER 1
7 Arno Sommer 1