0
Offline
Newbie
Karma: 0
Posts: 10
|
 |
« on: January 28, 2007, 07:47:38 pm » |
Hi everyone
Beware, I'm a newbie.
I can't find any tutorials on how to control a simple relay from the Arduino. I've got LED's blinking and input running, but getting control of my 9V relay seems difficult.
Thanks Carl Emil
|
|
|
|
|
Logged
|
|
|
|
|
|
|
 |
« Reply #1 on: January 28, 2007, 11:19:54 pm » |
as far as I know, ther is no complete tutorial yet, but here is the schematic, which is posted in the Playground: http://www.arduino.cc/playground/uploads/Learning/relays.pdfYou can use the same code as you would use for driving an LED. Instead of connecting an LED and to the Arduino, you would connect the resistor and GND, as shown in the diagram.
|
|
|
|
« Last Edit: January 28, 2007, 11:24:13 pm by Daniel »
|
Logged
|
|
|
|
|
0
Offline
Jr. Member
Karma: 0
Posts: 75
|
 |
« Reply #2 on: March 01, 2007, 10:59:03 pm » |
hi,
this diagram is great, thanks. i think it's shown me that i was trying to do this the wrong way. i was assuming that you could control the relay directly as if it were an LED or something, which seems to sort of work. can anyone tell me what the transistor and rectifier actually do?
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Newbie
Karma: 0
Posts: 10
|
 |
« Reply #3 on: March 02, 2007, 01:09:00 am » |
Uph! I forgot to return to this thread. Thanks for the diagram, it's all I need =) Carl Emil
|
|
|
|
|
Logged
|
|
|
|
|
|
|
 |
« Reply #4 on: March 02, 2007, 01:37:38 am » |
hi,
this diagram is great, thanks. i think it's shown me that i was trying to do this the wrong way. i was assuming that you could control the relay directly as if it were an LED or something, which seems to sort of work. can anyone tell me what the transistor and rectifier actually do?
the Arduino can source about 20 millimaps of current through a pin.. a relay typically takes 100-300ma. So the transistor is there to amplify the signal from the Arduino to the current level required by the relay. Try googling "transistor amplifier theory", or "NPN Switch" if you want to know more. D
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Jr. Member
Karma: 0
Posts: 75
|
 |
« Reply #5 on: March 02, 2007, 08:08:15 am » |
Thanks a lot. That's a huge help. I know it's not your job to explain electronics 101 to me, and I really appreciate it.
|
|
|
|
|
Logged
|
|
|
|
|
|
|
 |
« Reply #6 on: March 02, 2007, 12:25:12 pm » |
hey
no sweat. Try getting a copy of the ARRL Handbook, it has terrific explanations of basic electronic theory. D
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Newbie
Karma: 0
Posts: 20
Arduino rocks
|
 |
« Reply #7 on: January 08, 2009, 12:59:48 pm » |
I wish there was a step-by-step picture walkthrough for retards. I can't seem to get this circuit to work... and i'm afraid i'm building it wrong. I've somehow managed to burn out three transistors now, and i can't tell what i'm doing wrong.
I feel retarded, if it's any consolation.
|
|
|
|
|
Logged
|
|
|
|
|
Bristol, UK
Offline
Edison Member
Karma: 0
Posts: 1197
Exhibitor at UK Maker Faire
|
 |
« Reply #8 on: January 08, 2009, 02:31:22 pm » |
Could you say a bit more about how you're building the circuit? What transistor, what relay, what voltages? I'm just trying to get to the bottom of why it's not working for you, 'cos I'd really like to hear that it's working!
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Newbie
Karma: 0
Posts: 20
Arduino rocks
|
 |
« Reply #9 on: January 08, 2009, 03:04:14 pm » |
Well, I duplicated someone else's design exactly. I'm a programmer really and this particular project is way out of my territory. ] This is my relay: http://pewa.panasonic.com/pcsd/product/pwr/pdf/mech_eng_jtn.pdfRight now I just want to see if it works in the first place. I think I might have a dead one. I connected the two close pin to ground and 5V. I set an old meter to ohms and it spikes over to 0 when you touch those two terminals, so they are definitely the coil. I small tick can be felt when you connect it to the 5V. So I assume the circuit is closed on the other side no? Apparently, wrong. the same setting on that meter doesn't spike when touching the other two, ever. Basically, I can't get my relay to close a circuit period. I also tried plugging it up to 3 AA's... wish I had a 9V sitting around. Grrr, I wish I was 200 miles away at my state college, because I could probably ask anyone there to explain it and have a 50/50 chance of them working it out for me  Tomorrow or whenever I find a camera i'll just take a picture of it, it's embarrassingly simple.. so it should work... But I think tomorrow i'll try a new relay too. I didn't think relays ever got stuck open
|
|
|
|
|
Logged
|
|
|
|
|
STOCKHOLM
Offline
Newbie
Karma: 0
Posts: 31
Arduino rocks
|
 |
« Reply #10 on: January 08, 2009, 04:10:13 pm » |
Well, This is a simple fault searching method, sorry if it is to basic. 1 Locate the article number on the relay - confirm that it ends with 5V DC
2 Locate the coil terminals on the relay 3 Measure the coil resistance - according to your data sheet shall it be 31ohms +/- 10% 4 connect the power supply to the realy and confirm that it clicks 5 if it does not click - reverse the power supply and try again. 6 Here would I normally give up and get another relay If you are really serious can you measure the current through the coil. Another option is to increase the realy voltage.
It is very possible that the relay contacts can have been welded together if you got this as a surplus relay. Then should you also get a new one
Magnus
|
|
|
|
|
Logged
|
|
|
|
|
|
|
0
Offline
Newbie
Karma: 0
Posts: 20
Arduino rocks
|
 |
« Reply #12 on: January 15, 2009, 08:03:07 pm » |
I do have a 12v DC relay here that I know is good, but... no 5v. How would I switch it>? How CAN I switch it? I have not been able to get any of these relays to "click"
|
|
|
|
|
Logged
|
|
|
|
|
Bristol, UK
Offline
Edison Member
Karma: 0
Posts: 1197
Exhibitor at UK Maker Faire
|
 |
« Reply #13 on: January 15, 2009, 08:23:58 pm » |
I have not been able to get any of these relays to "click" You've tried multiple relays? And none of them will "click"? Hmmm... Makes me wonder if something else is wrong, like trouble with your power source. Or even a dud piece of wire somewhere that's making all your tests fail! You should be able to take a battery, some wires, and a relay, and get a small but audible "click" when you connect power to the coil. You may see a small spark when you disconnect the battery, too. Can you describe your setup for us, a little more clearly?
|
|
|
|
|
Logged
|
|
|
|
|
|
|
|