Hello, I am trying to us the digital out of my arduino to toggle a 12v power supply on and off. I have been trying to us transistors but with no luck. Any ideas on how to do it?
I am working on exactly this, except 110v is the goal.
Start small. Use a transistor to turn an LED on and off. Once you get that working, try adding external power, and possibly change that LED to a relay.
jkexbx:
Hello, I am trying to us the digital out of my arduino to toggle a 12v power supply on and off. I have been trying to us transistors but with no luck. Any ideas on how to do it?
12v into load, load ground into NPN transistor collector, transistor emitter to ground, Arduino pin through resistor into transistor base.
Ground is common and goes back to both 12v load and Arduino supply.
blah44:
I am working on exactly this, except 110v is the goal.
If that is a relay off to the side in that pic of your progress, don't just jam that thing into a breadboard and try to switch it.
If you haven't worked with mains voltage, you might want to consider an inexpensive relay module:
Something like:
https://dx.com/p/arduino-5v-relay-module-blue-black-121354#.UwoyDPmuRIY
Shop around.
bigred1212:
blah44:
I am working on exactly this, except 110v is the goal.If that is a relay off to the side in that pic of your progress, don't just jam that thing into a breadboard and try to switch it.
If you haven't worked with mains voltage, you might want to consider an inexpensive relay module:
Something like:
https://dx.com/p/arduino-5v-relay-module-blue-black-121354#.UwoyDPmuRIYShop around.
Oh, those modules look nice. Maybe I will go with that before shocking myself.
That is a relay off to the side. I assume you meant, do not simply plug the 110v business end into the breadboard, and that the 5-12v coil side is fine there?
I did mean that I wouldn't jam that relay into a breadboard and try to run mains voltage through it, or through anything sticking in a breadboard.
Yes, that is a 5vDC relay and the Arduino can probably supply enough voltage and current to switch it directly, but as you have figured out using a transistor to switch the voltage that switches the relay is a nice solution.
When you are working with a relay "in the raw" like that, one thing you want to pay attention to is the "back current" that is generated by the coil in the relay. You need a diode (an N4001 will probably do) across the 5v poles of the relay to kill that from coming back on you.
Look at this schematic:
Note the diode and the optoisolator. Those are protective elements that are in the predone modules intended to keep you from frying things. If you want to want to work with the relay you have, using those things would be a good idea.