Society of Robots - Robot Forum
Electronics => Electronics => Topic started by: Kerry on November 08, 2009, 08:22:00 PM
-
Hello,
I want to create a circuit to go in-between my AVR ISP mkII and whatever AVR-containing circuit I want to program such that the programmer is isolated from the circuit and the MCU. I've created the attached schematic, but I'm unsure how to finish it (or if what I've got so far is correct). These are my thoughts:
These pins are for data going in the direction Programmer -> MCU
RST (pin 5)
MOSI (pin 4)
SCK (pin 3)
EDIT: Correct pin#s
MISO (pin 1) is for data going MCU -> Programmer
GND and VTG are for reference and don't actually need to be coupled.
I assumed this was going to be pretty basic - if the signal on the input side of the isolator is at +5V relative to the input side ground, the output should be 5V above the output side ground. If the input signal is at 0V, the output side should follow. The schematic shows four pull-down resistors so the output from the optoisolators is at 0V, unless the optoisolator output is high, then it pulls the signal high. The collector is always at VCC (or VTG, +5V).
I'm getting stuck on what to do with the negative side of the LEDs (circles in red). My first guess was just to ground them, and my second guess was that they needed to be grounded through a resistor (not sure why I thought that would help), but some quick tests on a breadboard showed that I was unable to get the output side to react as I intended, regardless of my connection to that pin. So... am I completely missing the boat on this one, or am I close?
Note: I'm actually using 4N27 isolators, not 4N25's - it's the same datasheet, so I believe the functionality is the same. The CAD software I'm using has a 4N25 but no 4N27, so that's what I show in the schematic.
Thanks for the help!
-Kerry
-
Rather than edit my first post - here's an update:
Turns out the optoisolator I was using was fried - I swapped it out and it's behaving as I expected. I'm using a resistor between the negative LED lead and ground (and afraid to try anything different in case this fried the first one). I also removed the pull-down resistor from the 4N27 pin 6 (the emitter) and I'm getting high and low output as expected, even without the pull-down resistor. I realize this could just be coincidence, but I'm doubting the necessity of the pull-down resistor on the emitter now. Thoughts on this?
Datasheet for the 4N27: http://www.vishay.com/docs/83725/4n25.pdf (http://www.vishay.com/docs/83725/4n25.pdf)
Thanks!
-Kerry
-
Hi,
You need a resistor in series with each LED. It doesn't matter on which side of the LED it is placed.
Assuming 5V logic and 1.5V for the LED, a resistor of 3.5/0.01 = 350 use 330 Ohm.
Whether your logic can drive 10mA is quite another matter though.
-
Is 10 mA a typical value for an LED? The datasheet shows the LED current going as low as 0.5 mA, although I don't see a recommended value called out anywhere. I suppose I could try a 3k3 Ohm resistor to drop the current down to something more reasonable for logic? Is my approach reasonable? I feel like I'm guessing...
Thanks for the help!
-Kerry
-
Yes, 10-20mA is normal for an led.
-
Hi,
Is 10 mA a typical value for an LED? The datasheet shows the LED current going as low as 0.5 mA, although I don't see a recommended value called out anywhere.
We're looking at a specific LED here, namely the one in the 4N27.
The DC Current Transfer Ratio for this (IR) LED is 30% (typ), 10% (min).
That means, that for 10mA in, you can draw 3mA (typ), 1mA (min).
For 0.5mA the values would be 150µA and 50µA respectively.
I don't know what currents you need out of the 4N27, but a potential 50µA is probably less than what you need.
You shouldn't go over 10mA though.
I suppose I could try a 3k3 Ohm resistor to drop the current down to something more reasonable for logic? Is my approach reasonable? I feel like I'm guessing...
You could use a transistor like BC337 or 2N2222 to drive each LED, or... You could connect it up directly.