Electronics basics: limiting resistors & optocouplers
EMHmark7
Posts: 93
Hi,
I apologize for such dummy question (before I burn something).
1) With the Propeller (or any MCU) do I need always put a resistor on the I/Os?
(I connected the Parallax 4x20 LCD transmit wire without any resistor and it works).
2) I want to use an optocoupler, maybe the 4N25 (the most simple I have seen)
Any advice on using an optocoupler?
First, on the driven side, the ICs has a transistor Base pin (beside the optical "base"). Do we need to use it?
Second, my understanding is that some % current is "transmitted" from one side to the other.
But I suppose in fact it comes from the driven side, so cannot be bigger than the driven side source.
For my project, I want to drive a camera shutter switch by shorting the connector's switch.
About 3V., 0.2mA. On the other hand, I use a QuickStart Propeller.
Thanks.
I apologize for such dummy question (before I burn something).
1) With the Propeller (or any MCU) do I need always put a resistor on the I/Os?
(I connected the Parallax 4x20 LCD transmit wire without any resistor and it works).
2) I want to use an optocoupler, maybe the 4N25 (the most simple I have seen)
Any advice on using an optocoupler?
First, on the driven side, the ICs has a transistor Base pin (beside the optical "base"). Do we need to use it?
Second, my understanding is that some % current is "transmitted" from one side to the other.
But I suppose in fact it comes from the driven side, so cannot be bigger than the driven side source.
For my project, I want to drive a camera shutter switch by shorting the connector's switch.
About 3V., 0.2mA. On the other hand, I use a QuickStart Propeller.
Thanks.
Comments
2) Most optocouplers, like the 4N25, look like LEDs to the Propeller (because that's what they are inside). Like any LED, you need a current limiting resistor to prevent damage to the optocoupler and the I/O pin. The exact value for the resistor depends on the amount of current needed for the optocoupler's LED. The 4N25's datasheet gives 10mA as a typical forward current. A 150 Ohm resistor should provide that.
The output transistor of the 4N25 is controlled by the amount of light provided by the LED (all internal to the optocoupler). The datasheet gives the typical transfer current as 50%. If you run the LED at 10mA, that means that the output transistor will provide about 5mA through it.
It's usually more reliable to use a reed relay driven by the Propeller. There are some reed relays that have a 3V coil and require less than 20mA of current to activate. These can be directly driven by a Propeller I/O pin although you need a reverse connected diode (like a 1N914 or 1N4001) across the relay coil. The relay contacts have nearly zero resistance when closed ... perfect for substituting for a pushbutton or other switch closure.
2) About optocoupler, I was more concerned by the camera side. I do not want to supply anything else than what the camera supplies itself in the remote switch connector. So, about using a 4N25, do you think I do not need to use the Base pin?
2.1) Why do you say a 150Ohm resistor should provide 10mA, if 3.3V / (10/1000A)=330 Ohms?
2.2) "typical transfer current as 50%. If you run the LED at 10mA, that means that the output transistor will provide about 5mA through it."
But if it is the driven side that provides it, it should not have a current more than that, in my case, the camera supplies .2mA, no?
Why do you say relay is more reliable? (I do not need fast stuff, I just program a delay if needed) But do you mean the optocoupler solution has its drawbacks?
Thanks for providing a nice working solution with part#. I appreciate!
But I will give a try with your suggestion of a relay. Specs say Mechanical endurance 10exp8 operations!
Using a relay such as 4N25, I suppose we need to limit current in the coil with a resistor?
The important thing is the reverse diode to stop Back EMF
The calculation is:
R = V - VLED / ILED
R = 3.3 - 1.8 / 0.010
R = 150 Ω
Just as Mike said before.
What RDL2004 showed as Vled is a combination of the voltage drop across the LED (about 1.4V) plus the typical voltage drop across the output transistor of the Propeller's output transistor (about 0.3V). 150 Ohms is a close standard value for the calculated resistance.
Or just the diode is enough?
I mean, should I also drive it with an inverter (74LS05) or I can directly use the I/O as the 3.3v source?
The relay you picked (IM01TS) draws about 3 times as much current (47mA) as the one I mentioned (17mA) and definitely more than a Propeller I/O pin is designed for (40mA). You'll need to use a switching transistor to drive it as shown in Nuts and Volts Column #6. The N & V Column is written for the 5V Stamps and you'll need to use a smaller base resistor with the Propeller, something like 220 Ohms.
Normally when using a diode to protect an external NPN transistor switch from inductive spikes we don't care about a few volts of spike getting past the diode due to its slow switching. When driving from CMOS microcontroller the input protection diodes have to be protected from over-voltage/over-current, and there is only about 0.5V of voltage swing permissable. The Prop input protection diodes may be able to take the current pulses, but its not clear from the published data what pulses they can take - the continuous current limit is 0.5mA though, so I would be very wary of 10mA pulses getting to them.
It was not clear and overloocked it in the specs sheets. When I divide Coil resistance from Rated voltage (3V) I see the current values you said.
1) But I do not catch "The diode is enough. What it does is clamp (limit) the voltage produced to 0.6V " on how it limits voltage to 0.6V.
2) And about a diode for protecting battery source before the VIN on the Quickstart board, does it need to be schottky?
3) So, about a possible overvoltage induction swing, I am not shure what protection would be for shure a good practice. (talking about the relays)
Thanks again,
Back in the project after a 2 months out of the country.
I am obviously not an expert in electronics.
I know we need to put a reversed diode parallel to a relay's coil.
I imagine that as the diode has a lower resistance than the coil, reverse current will not go through the coil but through the diode.
Q1) However, do we need to put a resistor in series with that diode in order to limit the spiking current?
Q2) I found a shottky diode: http://www.digikey.com/product-detail/en/1N5819-T/1N5819DICT-ND/190960
Current - Average Rectified (Io): 1A
I do not know the meaning of this spec (if it is a max or other meaning)
Anybody can tell me if it is a good choice for driving this 17mA relay (http://www.digikey.com/product-detail/en/IM21TS/PB1167-ND/1828439)
from a Propeller I/O?
Q3) By the way, what is the right/best way to use those prototyping boards in which the hole is large enough only for a through hole pin? (So in order to connect 2 or more things together at that node)
Thanks again,
Marc
The Schottky diode and relay you showed should work fine with a Propeller I/O pin. I've used cheap 1N914A diodes and a SPST reed relay with similar coil characteristics ... works fine.
With prototyping boards, I use two adjacent holes and bend the lead across from one hole to the other and create a solder bridge between the two
But, it is not clear if Q1) However, do we need to put a resistor in series with that diode in order to limit the spiking current?
or do we need to put the resistor between the I/O and the Coil-Diode couple ?
Thanks.
I need to make a reference voltage. What is the difference between a Potentiometer used with the 3 connectors, compared to using it with only 2 connectors?
Both will give a dfferent voltage. Does the 3-connector method have an advantage?
Thanks.
It depends on the circuit you are connecting it to. Lets say you have a 5V input reference voltage and you want to be able to adjust your output reference voltage from 0 to 5V. In that case you would use the 3 connection circuit with one end connected to ground, the other end to the +5V reference, and the output would come from the potentiometer wiper.
If you were using a 3 terminal regulator to make an adjustable regulator you would have a fixed resistor (typically 120 ohms) between the output pin and the "adj" pin, and a potentiometer between the "adj" pin and ground. That potentiometer would use the 2 connection circuit.
In the first case you are using the potentiometer to output the desired voltage. In the second case you are using the potentiometer to provide the desired resistance between the "adj" pin and ground.
(due to childhood experiments where I could turn of a device when at max resistance. Maybe it was a feature of that potentiometers or because the resistance was lowering the current just enough to stall the motor o light).
Now I see that with 2 pins, I can just lower a bit the voltage, rather than really getting full range down to zero by benefiting from the GND too.
Thanks for your reply, my question was very preschool but helped my to catch other things and modify my design.
Marc
Somebody whom knows more in that field told me that about putting tu power switch and fuse, it is normally put on + side of power source.
(Even if as I did, he knows that nobody knows what the real current is, electron or positive "holes" running in the opposite direction)
So, I am sharing the question about if it makes a difference to put it on - side of power source.
(It is not just theoric, because maybe I will have to reopen my difficult to close handheld device before I try it)
Thanks.
Most power supplies have one side (positive or negative) that is considered the ground or neutral side. The switch and fuse should always be on the other side of the supply for safety. Not critical on a low voltage supply, but essential for higher voltages. Also good practice for low voltages.
A supply that provides a positive voltage with the negative side grounded should have the switch and fuse on the positive side.
A supply that provides a negative voltage with the positive side grounded should have the switch and fuse on the negative side.
As to the electrons or holes flowing, it is really both. When an electron moves from one atom to the next one it leaves a hole behind and fills a hole in the atom it moved to. If it were possible to see this it would look like the electrons were moving in one direction while the holes were simultaneously moving in the other.
"on the other side of the supply for safety", you mean, on the other side than the ground if I catch you well.
(an explaination about why is well come for those who can put some more light on that)
But as I said, I already know the electron/hole dilemma. By the way a nice image of that that I know is a less than full shampoo bottle you flip upside down while you see an air bubble going upwards while the liquid goes down.
Thanks again,
relay with a reverse diode.
Anybody have an idea about how long I can keep the relay set without resetting it without damaging it?
Let's say I want to keep it set for 10 minutes or 1 hour or more more for keeping aperture on for shooting night sky images.
Otherwise' I would need a relay that is bi-stable. If so, what is the typical way to interface it with the propeller?
Thanks,
Marc
It has a 3V coil that dissipates only about 60mW at 3.3V. Hardly enough to do any harm.
Duane J
Marc
localroger is the go-to guy for latching relays, which make sense for long "on" times: http://forums.parallax.com/showthread.php/151333-DPDT-latching-relays-20-cents-each