2
\$\begingroup\$

So I wanted to play around with relays and clearly got it wrong even before I got started. I wanted to control a 12 Volt fan - thinking that it would have a capacity of 12 V to control.. But now I know that it takes 12 V input and can control upto 250VAC...

I have ordered some new 5 Volt relays, but want to know how I can use the 12V relay with an arduino _____________? (bear in mind that I'm a newbie)

This is the relay module I bought: enter image description here


UPDATE

Thank you all so much for finding your time to help me out, I really appreciate it! First now I found the time to try out your suggestion.

@jippie comment:

..(or Vin on Arduino if you are feeding it from a 12V supply)

got me think about what I really wanted. I wanted to use the 12V power supply to also feed the arduino (hehe..) - but posting the question I needed to know the anwser to whether an "under"-powered arduino could control a 12V relay.

But first validate that the relay is actually working! So found a 12 V adapter and connected it to a breadboard.

12V adapter Then connected it to the relay by NC and COM relay connections Compiled the Blink code example and hooked it up using Vin, GND and D13 Relay working with 12 V I then hooked my Arduino to a 9V battery and tried the 5V output Not working relay with 5V Unfortunately this did not work..

@Madmanguruman and @Kurt thank you both for your answers - I'm just too newbie to figure out all the things you were talking about.


UPDATE 2

Forgot one more possible combination Relay not working

This kinda brings me down to these options with my relay:

  • Control something that requires more than 12 Volts, but power the arduino with 12 Volts
  • Use it to control DC gear motors without using and H-bridge and diode (kinda expensive)
  • Use the NC (Normally Closed) and NO (Normally Open) logic to do something neat

All this got me thinking.. If I need to power my Arduino with 12 Volts to control a 12 Volts device - why don't I just connect my device directly to my Arduino ____?

As mentioned many times: I'm a newbie and just want to learn electronics mostly by Learning-by-doing - but without putting myself at risk and breaking things (like my Arduino)

But why would this not work:

schematic

simulate this circuit – Schematic created using CircuitLab

EDIT:

Controlling 12v DC motorfan with arduino

Firstly, even if a motor or pump or fan (anything with coils inside) is 3V or 5V, do NOT power it directly from the Arduino pins as the Arduino pins can only supply a maximum of 40mA. As per my previous article on Arduino pins, they are not designed to drive a DC motor or coils.


UPDATE 3

Using 9V and Vin also worked :) Using 9V and Vin

So guess the answer is:

  • Yes, but I have to use >= 9V (perhaps lower, but not 5V) and the Vin.
\$\endgroup\$
  • \$\begingroup\$ Side question: The case your arduino is in, where did you get that? \$\endgroup\$ – Passerby Apr 13 '13 at 18:02
  • \$\begingroup\$ Congrats on getting it to work. You should maybe look into learning about some hardware components like transistors. That is my big complaint about arduino - it gets people to play, but they mostly just copy what other people have done, never learning anything on their own or actually understanding how anything works. \$\endgroup\$ – Kurt E. Clothier Apr 13 '13 at 19:46
  • \$\begingroup\$ @Passerby I laser cut out myself and bend so it looked like flames. Do you want to buy one? \$\endgroup\$ – Norfeldt Apr 13 '13 at 20:20
  • \$\begingroup\$ @KurtE.Clothier I got the Arduino so I could play - that's what I like about it. This is one of my hobbies - learning electronics by playing around. Sure I will be copying a lot of tutorials, but that will allow me to combine it all into awesome projects once I get the hang of it. \$\endgroup\$ – Norfeldt Apr 13 '13 at 20:21
  • \$\begingroup\$ Right, that's kind of what I meant - it encourages people to "play" but most of the people who use it never go beyond blinking a few lights because they never try to learn anything else about electronics, and the ones that do are still just copying other people's work to get some larger scale project to work without knowing a thing about what is going on. I'd don't have a problem with Arduino when it comes to learning and encouraging, I just wish people would learn something for themselves to expand upon the tutorials not just copy them. Often times there are much better ways to do something. \$\endgroup\$ – Kurt E. Clothier Apr 13 '13 at 23:06
4
\$\begingroup\$

I'll leave the long talks to the other answerers. If the exact module you bought is the one on the picture then:

Connect:

  • GND to GND on Arduino
  • Vcc to 12V (or Vin on Arduino if you are feeding it from a 12V supply)

At this moment I would verify the voltage on pin IN, this should be near 0V with respect to GND, if it is higher than 5V stop here. If it is near 0V, the last step is to connect:

  • IN to the digital output pin you conotrol on Arduino.

So my answer is: If memory serves me right, my answer is: yes you can drive this type of module from Arduino.

\$\endgroup\$
  • \$\begingroup\$ hmm pretty much the same answer as Madmanguruman already gave, didn't see that before. \$\endgroup\$ – jippie Apr 8 '13 at 6:47
5
\$\begingroup\$

This board is designed to work with 5V logic level control, according to the link you provided. I couldn't find a spec sheet so the following is speculative: you supply +12V and ground to the VCC and GND pins, and use a logic level signal on the IN pin to switch the relay on and off via Q1 and the optoisolator.

So, if the logic level signal can control Q1, your relay may actually work as-is. Changing the relay itself may not help if Q1 can't deal with 3.3V gate drive. (Q1 is marked 'J3Y', so it may be an NPN transistor known as 'S8050'. A logic-level MOSFET like a 2N7002 may work better in this application. Again, pure speculation without a spec sheet.)

There's nothing inherently wrong with your relay as far as controlling a fan goes. Overkill, sure, but it will do the job just fine and will scale up to allow you to play with bigger stuff as your confidence grows.

\$\endgroup\$
3
\$\begingroup\$

First off, a common automotive relay would work plenty fine, unless you are trying to switch power for a high voltage device or you really wanted that opto-coupler in there.

In any case, take a look at this simple circuit: Relay Control

Because a logic Level MOSFET is used, the transistor only needs a small voltage at the gate to fully turn it ON. When the signal from the microcontroller is HI, it will turn the FET ON, connecting the relay to ground and powering the fan or other devices. When the MCU pin is a LO signal, Q1 will turn off. If the MCU is disconnected or the pin is in some unknown state (hi-Z, for example) the resistor R1 will pull the gate LO to turn the transistor off. either way, when Q1 turns off, the relay will also disconnect the power to the fan.

This circuit could be similarly made with BJT transistors; I just prefer FETs. The only thing to consider here is that the transistor must be able to sink at least as much current as the relay coil uses when the relay is switched on.

\$\endgroup\$
0
\$\begingroup\$

You tried powering the relay from a 12v power supply and it worked, but when you tried a 5v supply, it did not.

Try connecting the Relay's VCC to the Arduino's VIN, which would be the 9v. The relay requires 75% of the nominal voltage to "Pickup". 12v * 0.75 = 9v. That's the bare minimum that is needed for the relay to activate. So your 9v battery might not be enough, but a fresh one should.

Once it's activated, the relay will consume about 25~30mA, and should, according to the datasheet, stay on until the VCC goes down to about 10% of the nominal, which is 1.2V.

AND you could simply power the arduino from the 12V power supply in the first place, instead of the low capacity 9v battery.

\$\endgroup\$
0
\$\begingroup\$

This is because even I had the same problem. So all u need is a high voltage (12v) transistor and the other parts : arduino, 12v adapter and relay. Now connect the vcc of relay to 12v adapter. Now connect the one end of the transister (refer to data sheet) to 12 adapter connect the middle pin of transistor to one of the pwm pin of arduino . Program the arduino to be high on the pwm. Connects the last end of the transistor to the relay 12 v signal pin and you are good to go When the pwm pin is high the 12v flows through from the transistor to the last pin and here is how you control 12v relay with 5v pwm arduino

Thanks Swaton

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.