connecting PICAXE to optoisolator

Hemi345

Senior Member
Hi all,

I bought a few of these relays and wanted confirmation on the sinking requirements when directly driven from a PICAXE:
http://www.sainsmart.com/arduino/arduino-components/relays/arduino-pro-mini.html

R4 is a 1K resistor. I should be able to connect IN2 directly to the PICAXE, right? They're going to be used for my daughter's traffic light project, so only one relay will be active at a time. The current the PICAXE would have to sink would be at most, 5mA at 5V, right?
 

Circuit

Senior Member
PICAXE can sink 5mA, but is that enough? The specification shown in the link that you gave requires 15-20mA from the PICAXE; that requires a 330r resistor rather than 1K. Where did you get the value of 1K for R4 from?
And yes, PICAXE can sink 15mA to drive the LED in the opto-coupler. See PICAXE Manual 3, page 9 for the equivalent circuit.
 

Hemi345

Senior Member
R4 is labeled on the PCB and I confirmed it's the same R4 on the schematic by following the traces. It's an SMD resistor, value "102" or 1K.



The 15-20mA figure is probably what's required to source/drive the relay thru JD-VCC?
 
Last edited:

Goeytex

Senior Member
I have worked with these and the specs are misleading. The 1K resistor will limit the Opto Emitter current to about 5ma with a Vdd of 5V, even though the specs suggest 15 -20ma. Just as important is the fact that there are 2 LED'S in series on the input (with no forward voltage specs). Mine worked fine as is with a 5V supply. However, I would get the part number from the OPTO and pull up the datasheet and confirm the transfer ratio based upon 5ma emitter current.

The bottom line here is to hook it up to the Picaxe and see what happens. I bet it works fine. If not, you can reduce the 1K resistor to 470R, assuming the OPTO can handle 10ma. But again, it should work fine as is.

EDIT: The 20ma is NOT the current drive for the relay. The relay datasheet shows a coil resistance of either 70 ohms or 55 ohms and a current rating of either 70ma or 90ma depending upon if it is a standard or "high sensitivity type". So make sure the supply/ regulator is rated to handle enough current to drive both relays and any other peripherals, plus the Picaxe.
 
Last edited:

BeanieBots

Moderator
Q3 will not need much base current so I expect it will work fine.
Rather than "just try it", try it with a further 470R or even 1k in series and see if it still works.
If it does, then 1k will be fine even on hot and/or cold days.
 

jims

Senior Member
Hemi345... I recently used 4 of these relays in a project, and they performed very reliably. My Picaxe 20m2 outputs were driving the relays through 4 ULN2803 Darlington circuits and controlling 4 x 12vdc bilge pumps (relays switched a separate 12vdc power supply to run the pumps). Ran continuously for 3 months on a control schedule where the relays/pumps were ON for 3 minutes with OFF time schedules that varied from 1 to 4 hours. Very reliable service. Never had a "glitch". Jims
 

Hemi345

Senior Member
@Goeytex, the markings on the opto are:
B1424
817C
G

The "B" doesn't look quite like a normal B, so I'm guessing that's the brand but I can't seem to find it. Based off the Vishay 817 opto, the 1K resistor should allow the opto to fully turn on. I shorted IN2 to GND and heard the relay snap and saw the LED lit. Haven't had a chance to measure current though. I'm using a 1A 5V vreg on my "Miner board", so should be okay driving one relay at a time. Thanks for the suggestions and glad to see you back on the forums.

@BB, I will try that. The traffic light will be in my shop (from +90F to -20F) so that's a good idea to test.

@jims, these exact modules? I bought mine off ebay for $1.78/ea and they look identical in every way to the Sainsmart ones above. Good to hear high reliability. You're use of them seems pretty critical. In mine, the worse thing that would happen in the event of a failure would be a collision between a scooter and a bicycle racing around my shop. :) Thus the reason for the light. haha
 

jims

Senior Member
Yes Hemi345. They're the exact same ones as shown in the photo in your entry #3 in this thread. My son bought them over a year ago. Probably from ebay also. Jims
 
Top