# Relays

Discussion in 'General Electronics Discussion' started by Gorath, Mar 20, 2014.

1. ### Gorath

2
0
Mar 20, 2014
Hey

So today was the day my Arduino finally arrived!

My degree was computing and I did physics in high school, V=IR etc.. But there are a few things I don't understand about circuits and I was hoping someone could help me understand some basic concepts.

Currently revising my formulas for power, watts etc but my questions are about more basic things than that..

For reference I have an arduino mega 2560 - http://arduino.cc/en/Main/arduinoBoardMega2560

---------------------------------------------------------------------------

So I thought the first thing I would do is try to read the current passed between a dc pin and the ground. I connected two cables and put my multimeter between them.

Now the schematic says "DC Current per I/O Pin 40 mA" however I got ~99.0 with the switch on the multimeter at 200m (DC A) so I'm assuming thats 100mA???? How can that be the reading if the spec says 40mA?

---------------------------------------------------------------------------

The second thing I was looking at is what type of relay I would need to turn on a standard house light (the ones in the ceiling). I know the mains voltage in UK is 230V.. at 50Hz (dont know why the wave frequency helps things...) Unfortunately I could only find relays like these http://www.banggood.com/5V-4-Channe...paign=all-uk&gclid=CKnZvJiKor0CFagBwwod_6cAuQ which I believe is rated for 10A at 30V DC max. I dont know what I would need to put in place of a switch on the wall..

Again I am a total n00b atm so no idea whats going on.

----------------------------------------------------------------------------

I am really interested in learning so if there is someone kind-hearted who wouldn't mind giving me some advice that would be awesome (and there may be a virtual cookie in it for you )

2. ### BobK

7,682
1,686
Jan 5, 2010
Never try to measure current from a voltage source by putting an ammeter in series with it! This is basically creating a short circuit. The 40mA specification is the max that you can draw without damaging the chip. As you determined it can actually produce more than that, but if you did that continuously it would probably burn out the output transistors.

You need a relay that can handle 240V AC at probably 2 amps or so.

Bob

3. ### (*steve*)¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥdModerator

25,449
2,809
Jan 21, 2010
In addition to what Bob said, you will need a transistor to switch the relay. The arduino output won't be able to do it by itself.

Googling "arduino relay" will probably give you some ideas.

Note that you need a diode across the relay coil to redirect the current which continues to flow after you turn off the relay (the relay is an inductor) if you don't do that, a huge voltage spike is created and semiconductors get destroyed.

Another option is a "relay shield" or various relay boards made to work with arduinos. Those options will probably take some time to get hold of. If you get onto ebay and search for "arduino relay" you'll see the sort of thing I'm talking about.

4. ### Gorath

2
0
Mar 20, 2014

Bob:

Yea apparently 60w light bulbs take under 1A so 2A should be safe.. Also I remember in school putting the ammeter either side of a light bulb (I think..) so thanks for letting me know putting it in series is a bad idea! Does that mean putting the positive straight into the ground is a worse idea?

Last why would I want one that is 240V AC.. I thought mains was DC?

Steve:

Googled arduino relay but so far haven't found too much helpful information. Trying to brush up on my electricity knowledge atm by watching some videos.

Finally:

I watched a video on PWM earlier. Wiki says uk mains is 50Hz (as I said previously) - is that 50Hz pulses along the mains line?

I will update this when I have done some more research over the weekend.

5. ### (*steve*)¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥdModerator

25,449
2,809
Jan 21, 2010
No, definitely AC.

I'll try to answer some of the other questions later if nobody else helps you. If it looks like I've forgotten, prod me

6. ### davennModerator

13,722
1,913
Sep 5, 2009
Last why would I want one that is 240V AC.. I thought mains was DC?

You are playing with mains voltages and you dont know mains is AC ??

scarey !!
you really shouldnt be playing with that stuff unless you know what you are doing!

or at the very least well supervised

I hope you live long and prosper

cheers
Dave

25,449
2,809
Jan 21, 2010
8. ### BobK

7,682
1,686
Jan 5, 2010
The correct way to use an ammeter is to put it series with a load. If you had wanted to verify the 40mA out of an Arduino pin, the correct way would be to use a resistor, calculated to draw 40mA and put the ammeter + lead to the Arduino pin, the - lead to the resistor and the other side of the resistor to ground.

Bob

9. ### peter.rabbit

11
0
Mar 16, 2014
I agree..... that is really concerning.....
I've been circuit building for years, and have done some 240V projects, and understand what I'm doing with same, but when I can avoid it I prefer not to....
Until you sort out what you know and what you don't know - buy a 12V plugpack and a nice bright LED light fitting and experiment away. The worst you may do is kill your arduino, and not yourself.....
Good luck!