Southern California
Offline
Sr. Member
Karma: 5
Posts: 466
I like blinky lights
|
 |
« on: January 04, 2010, 02:36:23 am » |
I'm building an Arduino-compatible circuit that flashes some lights for an hour then turns itself off. I built the power circuit copying the Arduino AA Undershield schematic and all works well, like this:
1. User presses momentary switch which connects the batteries to the power circuit 2. The ATMega328 boots and pulls a pin high 3. This pin completes a 5V relay circuit
The relay's switch is in series with the momentary switch, so once the chip's booted it stays on.
After 1 hour the code pulls the pin low, which breaks the relay, which kills power to the circuit.
As I said all is working, but I'm a programmer by trade and am new to hardware. Is there a more efficient way to do this? I tried using an optoisolator but couldn't get it to work, but I may have easily been doing it wrong.
Thanks in advance for any help.
|
|
|
|
|
Logged
|
|
|
|
|
Copenhagen / Denmark
Offline
Edison Member
Karma: 5
Posts: 2338
Do it !
|
 |
« Reply #1 on: January 04, 2010, 03:21:23 am » |
How did you connect the optoisolator ?
Did you use a current limiting resistor for the LED in the optoisolator ?
How much current are the lights drawing ?
|
|
|
|
|
Logged
|
|
|
|
|
Manchester (England England)
Offline
Brattain Member
Karma: 276
Posts: 25482
Solder is electric glue
|
 |
« Reply #2 on: January 04, 2010, 03:22:04 am » |
The output current from an opto isolator is limited to a few mA, if you want more then you will have to have a transistor at the receive end. There is not enough current for an opto to directly control a relay.
|
|
|
|
|
Logged
|
|
|
|
|
Southern California
Offline
Sr. Member
Karma: 5
Posts: 466
I like blinky lights
|
 |
« Reply #3 on: January 04, 2010, 01:18:20 pm » |
It looks like the LEDs will draw about 500ma when all are on, but most of the time they blink so it's closer to 150 - 200.
I did put a resistor between the Arduino and the Optoisolator but didn't think about putting a transistor on the other side, to increase the amount of current the optoisolator can switch. I will look into that.
Thanks for the help,
Chris
|
|
|
|
|
Logged
|
|
|
|
|
Manchester (England England)
Offline
Brattain Member
Karma: 276
Posts: 25482
Solder is electric glue
|
 |
« Reply #4 on: January 05, 2010, 04:47:55 am » |
but most of the time they blink so it's closer to 150 - 200 Yes but be aware when designing things it needs to be able to handle the peak current as if they were all on at once. The fact they are on an on / off duty cycle only helps with the power (heat) dissipation. good luck
|
|
|
|
|
Logged
|
|
|
|
|
Southern California
Offline
Sr. Member
Karma: 5
Posts: 466
I like blinky lights
|
 |
« Reply #5 on: January 05, 2010, 10:44:06 am » |
Good point, thanks Mike.
Chris
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Full Member
Karma: 0
Posts: 177
Arduino rocks
|
 |
« Reply #6 on: January 05, 2010, 07:40:44 pm » |
There is a schematic on the Playgroundwith a relay driven by a transistor triggered by an optoisolator 
|
|
|
|
|
Logged
|
|
|
|
|
Southern California
Offline
Sr. Member
Karma: 5
Posts: 466
I like blinky lights
|
 |
« Reply #7 on: January 05, 2010, 09:13:12 pm » |
Hi thanks for the example but for this application I didn't need a high powered relay -- I have a 5v one that works directly off a digital pin.
I was looking to see if using an optoisolator + transistor instead a relay reduced power consumption enough to make running the system of AA batteries viable, but I think the draw from 96 LEDs means I'm stuck with a wall wart or D cells.
Thanks,
Chris
|
|
|
|
|
Logged
|
|
|
|
|
Manchester (England England)
Offline
Brattain Member
Karma: 276
Posts: 25482
Solder is electric glue
|
 |
« Reply #8 on: January 06, 2010, 04:41:23 am » |
I have a 5v one that works directly off a digital pin. Are you saying that you are driving a relay directly from the output pin of an arduino? That is surprising if you find a relay that pulls in at less than 40mA? If so what is the maker and part number?
|
|
|
|
|
Logged
|
|
|
|
|
Offline
God Member
Karma: 3
Posts: 985
Arduino rocks
|
 |
« Reply #9 on: January 06, 2010, 05:24:21 am » |
The small 5V Omron relays (e.g. type G5V) have a coil resistace of approximately 175 Ohm's. Also I've seen Tyco electronics offer small relays (OMR series) with a coil resistance of 250 Ohm's. That is surprising if you find a relay that pulls in at less than 40mA? Are you thinking that the inrush current may be damaging to the Arduino over time when interfacing to the above relays directly?
|
|
|
|
|
Logged
|
|
|
|
|
Manchester (England England)
Offline
Brattain Member
Karma: 276
Posts: 25482
Solder is electric glue
|
 |
« Reply #10 on: January 06, 2010, 06:22:30 am » |
Well 175R gives you a current of 28mA so that should be OK, however you do need a diode across it or you will damage the output pin with revers voltage. Are you thinking that the inrush current may be damaging to the Arduino Inrush current concerns only really applies to capacitors and motors. A relay is an inductor and when you first apply apply a voltage to it there is a delay as the current increases. That is the inrush current starts off at zero and ramps up to the full value given by the resistance of the coil. You might think a motor is an inductor but in that case the inrush current ramps up to the stall current, before the motor starts turning. Once going a DC motors take less current due to the constant change in direction of current in the rotor.
|
|
|
|
|
Logged
|
|
|
|
|
|
|
Manchester (England England)
Offline
Brattain Member
Karma: 276
Posts: 25482
Solder is electric glue
|
 |
« Reply #12 on: January 06, 2010, 11:49:46 am » |
Yes that relay looks OK for direct drive from an arduino. Things to note:- 1) You do order the one whose order code ends in 10 or 50 as that has the diode option. 2) This means the relay coil must be wired the right way round. If it is the wrong way round you will effectively short the output through the protection diode. 3) The contacts can only handle a small power 10W.
It is OK to post any relevant link on this forum.
|
|
|
|
|
Logged
|
|
|
|
|
Southern California
Offline
Sr. Member
Karma: 5
Posts: 466
I like blinky lights
|
 |
« Reply #13 on: January 06, 2010, 12:31:01 pm » |
Thanks again for your help Mike.
Chris
|
|
|
|
|
Logged
|
|
|
|
|
|