Arduino cannot power my relays

Hi all,

I am starting a new project using 2 air solenoids to control pneumatic air cylinders. The solenoids require more voltage than the Arduino can supply so I wll use an external power supply to power them, but the relays I currently have require 5V to activate and the Arduino pins only supply 3.3v.

I found the video Tutorial: How to design a transistor circuit that controls low-power devices - YouTube today that makes me wonder if I can simply use a transistor to switch the solenoids. In fact, the video shows several power switching options, but I’m just a starting hobbyist so not sure what the best option is for my project and I’m starting to get overwhelmed. I know the solenoid requires 12V, but the following other number are also printed on it:

  • 12V DC
  • 2.5 VA
  • 200mA

Additionally, the online specs http://www.voguepc.com/upfiles/120513033202.pdf indicate it will operate with +/- 10% of rated voltage and that the power consumption is 3w.

Questions:

  1. Am I better of using a relay, NPN transistor or something else, and why?
  2. If the answer is to use the NPN transistor, what size transistors do I require on the switching power and do I need a diode on the collector side to protect against voltage buildup?
  3. If the answer is a relay, do I need to purchase relays that will active from the 3.3v the Ardunio pins will supply, or is there another option to amplify the 3.3v to operate my existing relays?

Thanks,
Kevin

The same basic circuit is used to switch relays, motors or solenoids. Your solenoids do not require much current so just about any small NPN transistor will work, for example 2N3904 or 2N2222. For anything with a coil, you need a diode to protect from “inductive kickback”, which will destroy transistors and indeed, Arduinos.

Finally, you need a resistor between the Arduino port pin and the transistor base. I would suggest 220 ohms to 1K ohms in this case. I’ve attached a representative schematic diagram showing a relay, but the solenoid connection is the same.

Relay for bulb.jpg

Thanks for the quick response. Any chance you can explain when it would be best to use a relay over an NPN transistor?

If my calculations are correct based on the video in my initial post, I would need a 866 ohm resistor so based on your suggestion, I think a 1K resistor should work.

Relays are great with 120 or 240 VAC circuits, although I would recommend a solid state relay instead of an electromechanical one.

When choosing a relay vs. transistor, here's what I think:

The device doesn't share a ground with the Arduino: relay The system has limited battery power and the load will be switched on for long periods: transistor is more efficient for low amperage loads, relay is more efficient for high amperage loads The load will be switched on and off frequently (PWM or otherwise): transistor The load is AC: relay The load doesn't tolerate voltage drop: relay The load requires high voltage, high side switching: relay

Of course, a relay usually also requires a transistor to switch the relay, which is why I usually use a pre-made relay module with all that already soldered together.

Thanks again for the quick and detailed responses. This was my first post so glad that there is a tolerance for lack of knowledge.

Cheers!

I tried hooking this up yesterday, but I added a 3.3v voltage regulator from the 12V power supply just so I could test with an LED. Within a minutes, the voltage regulator was so hot that I burned myself on it.

I did some research on the power supply that I purchased and go some more specs. It is rated at 1 amp and 32 watts from the 12V DV output. Is the high watts the problem and should I be changing to a relay because of this?

meierk: I tried hooking this up yesterday, but I added a 3.3v voltage regulator from the 12V power supply just so I could test with an LED. Within a minutes, the voltage regulator was so hot that I burned myself on it.

How many milliamps was the LED drawing and how many milliamps is your 3.3V regulator rated for?

I did some research on the power supply that I purchased and go some more specs. It is rated at 1 amp and 32 watts from the 12V DV output. Is the high watts the problem and should I be changing to a relay because of this?

"Excessive" watts in a power supply is not a problem. Devices will only pull as much as they need.

I think I need to go out and purchase a magnify glass so I can read the values on my components.

Based on the Sparkfun manual (https://www.sparkfun.com/datasheets/Components/LD1117V33.pdf), the voltage regulator outputs a max current of 800mA and the LED is probably only rated for somewhere around 20mA. However, I never actually had the LED in line , so the output of the regulator wasn't connected to anything yet. I was going to take a measurement with my multimeter before connecting the LED, but never got that far.

When I look at the page 2 on the Sparkfun PDF, it shows that the first pin is GND, however, page 14-18 shows what I though was standard on voltage regulators, which is pin 1 = IN, pin 2 = GND and pin 3 = OUT. I'm starting to wonder if I had it connected wrong. I also did not have any capacitors in place yet.

Lack of capacitors shouldn’t make it overheat, just allow a lot of voltage fluctuations. My guess is incorrect hookup.

Don’t forget a current-limiting resistor on that LED once you do get it hooked up…

I picked up a magnify glass and there was no numbers on the voltage regulator. I swapped it out with one that was number and it appears to be working properly. I'm guessing it wasn't even a voltage regulator.

Thanks for your responses.