I am hoping to duplicate the function of some simple push button switches that currently reside on a 3D printer LCD control panel. After a bit of googling I thought I might be able to use ILD74 type optocouplers. At the moment with a 5V supply with a series resistor of 220 ohms I am getting about 60 ohms across the phototransistor output so not exactly a switch yet. If I take out the series resistor this drops to about 10 ohms but the current drain is then around 200mA on the LED so no good for driving by Arduino. Should I use a different method or am I doing something wrong ? Any help would be much appreciated.
Up you are over thinking the problem. A 60R resistance to ground is more than enough to give you a logic low on an input pin with the internal pull up resistors enabled.
After a bit of googling I thought I might be able to use ILD74 type optocouplers.
Did you Google your particular 3D printer? Do you have a schematic you can show us?
Although a transistor (or photo transistor) can be used to switch current and/or voltage, it isn't the same as a mechanical switch and it's not a "resistor" and you won't get accurate resistance readings with your multimeter (although if your multimeter is connected with the right polarity, you should be able to measure a change when the transistor switches).
If you want to replace a mechanical switch and you don't understand the circuit, a regular-old electro-mechanical relay is best because a relay is an electrically-operated, electrically-isolated mechanical switch. And in some cases (such as a switch-matrix) a relay is the best solution even if you do understand the circuit.
On the output-transistor side, the emitter goes to ground and the collector goes to a pull-up resistor. But, I have no idea what's inside the printer and I have no idea if it will work.
At the moment with a 5V supply with a series resistor of 220 ohms
That should work. I'm pretty sure the input side of the optocoupler is NOT the problem...
If I take out the series resistor this drops to about 10 ohms but the current drain is then around 200mA on the LED so no good for driving by Arduino.
It's also exceeding the maximum for the optocoupler's LED. And, it's a horrible design because the current is not "controlled"... It just depends on how much current you can get out of a particular ATmega chip when you stress the chip beyond it's specifications.
No schematic - cheap chinese prusa clone. The five switches I'm hoping to duplicate all have different value resistors in series 470R, 1K, 2.2K, 4.7K, 10K so I guess I should just see how it goes. What is the correct/safe resistor value I should be using to directly drive the Optocoupler from an Arduino digital output pin and or safe for the Opto ? Thanks very much people
With those resistor values, seems like it could be part of a 5-bit binary weighted DAC circuit (4-bit shown):
What is the correct/safe resistor value I should be using to directly drive the Optocoupler from an Arduino digital output pin and or safe for the Opto ?
A value of 220R is good. The problem is that an opto is not a switch in the maechanicl sense of the word and is the wrong thing to use if the circuit is like that dlloyd showed.
If you have no schematic then you have to trace what you have to know for sure if any solution will work. Otherwise it is just suck it and see.
Thanks very much for your suggestions and help. I'm sure it is indeed as dlloyd suggests as all resistors are connected to the same track. What are the options for an all electronic switch that is pretty much passive except perhaps for polarity ?
Or... could I replace the resistors completely by using some kind of VCR setup driven by PWM?
(I numbered switches from top anti-clockwise)
I think an opto could work across each switch. Need to know the polarity (which switch terminal is more positive than the other ... this would connect to the collector, the other to the emitter). Note that the opto's output can float, which is a required characteristic for switching in this type of circuit.
You mentioned the ILD74. This opto has CTR of 35% and output saturation voltage of around 0.3V. This may work, but a better performing opto would be the PS2501-1 (single) or PS2501-4 (quad). It has typical CTR of 300% and VCE(sat) of about 0.1V when IF is about 5mA and IC is about 1mA.
Could use anything from 270Ω to 470Ω in series with the opto LED and directly connect the opto transistor across the switch.
Yeah - from my limited understanding that sounds great. I impatiently rushed out to my local Maplins and the 74 was all they have ( great staff but mostly crazily overpriced ). And although it works I don't think it is close to being a good replacement for a zero ohm switch.
Thanks a million for all the help.