Trying to pick the correct relay for my project.

Hello! I have a few questions:

  1. How much voltage does a generic pin output? Say, for instance, I set pin 11 up as an output and turn it high, does it provide 3.5 or 5v?

  2. I need help determining what relays I need to buy.

Some explanation. I am trying to run a pump and a DC motor. Both require more voltage (from what I understand) than the Arduino is capable of producing in order to run. My solution was to use two relays. Both the motor and the pump are to have a controlled operation time. I am using the Arduino Uno for the control, here is my code if it helps:

#include "MegunoLink.h"
int relayPin = 11;
int relayPin2 = 12;

TimePlot MyPlot;
void setup()
{
  Serial.begin(9600);
  pinMode(relayPin, OUTPUT);
  pinMode(relayPin2, OUTPUT);
  Serial.println("Analog Sensor Plotter");
  
  // run pump for 5 seconds
  digitalWrite(relayPin2, HIGH);
  delay(5000);
  digitalWrite(relayPin2, LOW);
  
 //Since runL only runs for 10 seconds then the relay controlling the voltage to the motor should 
 //only run for 10 seconds.
 
 digitalWrite(relayPin, HIGH);
 runL();
 digitalWrite(relayPin, LOW);
 
}

void runL()
{
   // run sensor for 10 seconds
   for( int x = 0; x<10; x++){

      float SensorValue = analogRead(3);
      float voltage = SensorValue * (5.0 / 1023.0);
      MyPlot.SendData("My Sensor", voltage);
      delay(1000);
    
     }
}

void loop(){}

As you can see there is also a sensor reading in data. In any case, I went into radio shack to purchase some relays and quickly determined that I am not currently aware of what relay I need. Here is what I do know. One battery (the one for the motor) will be 9v. the other battery (for the pump) will be 12v. I am having trouble understanding the relay specifications.

For instance, I have a relay here in front of me and it says:

JZC-11F (part number)
005- 12 (not sure)
5VDC (Operating voltage at DC? What's operating current at DC?)
T-83 C 220/250VAC 5M (Operating: temp, voltage and current with AC source)

So as you can see I do not know what everything means. Also, I am unsure as to which pins say the 5VDC spec is referring too. Does that mean I need 5V at DC across the coil? Does the output pin even have a maximum current/voltage spec or could I in theory hook up like 120 V to that pin without frying it?

  1. I need help determining what relays I need to buy.

None - use a transistor as a switch and DO NOT PLAY WITH THE MAINS AC

How much voltage does a generic pin output?

Which board are you using - look at it's datasheet/product description!

Mark

google around for an arduino relay.
there are lots of how to sites.

google your relay part number to find the data sheet to find that it uses
Coil Rated Current 37.5mA

the Arduino CANNOT handle the power of a relay, you have to use a FET or transistor.

you put power to the relay, then put the transistor between the device and ground.
then control the transistor.

the interesting thing is that a relay is just a coil. you know, like a motor or pump!
you can control the pump with a transistor or FET.

if you want to use a relay, buy one that is on a board with transistor and all that.

not sure how tiny your pump is or how huge your battery is. but you can test by just connecting them and letting it run till it runs out of juice.

as a note, the motor coil will consume power.
the relay coil will consume power, not too much, but measurable.
the transistor will consume power, a fraction of the above
the FET will consume a tiny fraction of any of the above

Relay boards are normally used.
They have one or more relays, and the transistors/resistors/diodes to switch them.

http://www.ebay.com/itm/5V-1-2-4-8-Channel-Relay-Board-Module-for-Arduino-Raspberry-Pi-ARM-AVR-DSP-PIC-/252051910091?var=&hash=item3aaf76edcb:m:mdbiogK3bG3MfWb_sjDpLvw

Google "Arduino relay driver" if you want to use your relay.
You need at least a 1k base resistor, small NPN transistor, and kickback diode across the coil.

One, maybe two small relays can be powered from Arduino's 5volt rail.
More relays need a separate relay supply.
Leo..

Well to use Relay first you should have idea at voltage and Ampere your load is going to operate, you can get details from reading motor specs.
Like operating voltage: 12VDC
Maximum Watt: 24
then Ampere rating should be 2amp
now you select Relay which can carry this much Ampere through its coil.
Now 2nd thing how to study Relay ratings for this I'm posting an image.

Now specs of this Relay shows that it can handle maximum of 250vac with Max of 10amp current or max of 30vdc with Max of 10 amp current.
And it operates on 5vdc.
Generally arduino give s 5 vdc as output but may be it can not provide necessary amp to turn Relay on for that you can use circuit in which Relay gets on by external 5vdc supply but gets command from arduino via npn transistor which act as a switch.

vysero:
Hello! I have a few questions:

  1. How much voltage does a generic pin output? Say, for instance, I set pin 11 up as an output and turn it high, does it provide 3.5 or 5v?

  2. I need help determining what relays I need to buy.

Some explanation. I am trying to run a pump and a DC motor. Both require more voltage (from what I understand) than the Arduino is capable of producing in order to run. My solution was to use two relays. Both the motor and the pump are to have a controlled operation time. I am using the Arduino Uno for the control, here is my code if it helps:

#1) whatever your Arduino is running as power most are 5v, but some are 3.5 volt.

are you confusing volts and amps ?

if your relay is 5 volt and your arduino is 5 volt, then the arduino outputs the exact correct VOLTAGE
however, if you connect the relay directly, you would burn out that channel or worse because the relay will draw more CURRENT (AMPS) than the pin can handle.

if you think of a FET or transistor as a switch that tanks a tiny bit of power from your arduino, but switches a huge power for your pump, it would make more sense.

not that the transistor or FET connects to ground, your motor or pump connects to 5v. you use the transistor to complete the circuit.

vysero:
JZC-11F (part number)
005- 12 (not sure)
5VDC (Operating voltage at DC? What's operating current at DC?)
T-83 C 220/250VAC 5M (Operating: temp, voltage and current with AC source)

So as you can see I do not know what everything means. Also, I am unsure as to which pins say the 5VDC spec is referring too. Does that mean I need 5V at DC across the coil? Does the output pin even have a maximum current/voltage spec or could I in theory hook up like 120 V to that pin without frying it?

a relay is a device that has a coil. that coil acts like your finger on a light switch. just like your finger never touches the output power, the coil also does not touch the output power.
this is why they are isolators from the output power.
you have to power the coil.
relays show coil voltage but you have to look at the data sheet to find current.
when you have a device, put the model number in google. often it will come up.
an Arduino can control an FET with 5 volts, usually.
if the power if 5 volts and the arduino is 5 volts, all is simple.
if the power it is switch is 24 volts, then you need to switch with 24 volts, or get an FET that uses 5 volts as the base voltage. often the part number with have an L to indicate the low signal voltage.
compare with a transistor. a transistor uses a percentage of current of hfe or gain. if the hfe is 100 and your coil needs 40mA, you only need to supply 0,4ma, but we ALWAYS drive a transistor hard into saturation. most of us would drive that would 2 to 5 mA by selecting whatever resistor we have in our supplies.

If you decide that a mains-rated relay module is for you (simplest thing to install and protects your Arduino too if done right) then watch my YouTube video #18 which has loads of details of why they are good (apart, perhaps from the overall size but you didn't mention that was a constraint).

Just be careful if you are working with mains voltage, it really can kill you and that would mean one less contributor to this forum. :astonished:

Anyway, URL for the video in the signature of this post. Enjoy!

Ralph_S_Bacon:
Just be careful if you are working with mains voltage, it really can kill you and that would mean one less contributor to this forum. :astonished:

That's not the danger, there are too many contributors here anyway. The danger is that you might kill someone else.

Okay wow thanks for all the help guys. So from what I understand I should just use two transistors. This sounds fine to me. From what I understand I need only a apply a small voltage to one pin on a transistor and I can allow a large current to pass through the other two pins. This will fit into my code as a direct replacement for the relays I believe.

Right so picking the right transistor then. I assume not all transistors are created equal? I only need to push the current from a 9v and a 12v battery to the pump and the motor respectively. Will I need to lower the voltage coming out of my pins or is it okay to exceed the minimum voltage required to turn the "switch" on the transistor? I have a few transistors lying around.

Update:

Can I even use a transistor for my application? I tried messing around with a transistor and a LED. The only way I could get the LED to operate was by connecting the base to the same source as that connected to the collector. The whole reason I need a switch is to switch on and off two external sources.