What do I need to get this optocoupler working? - Page 1
Forum section: electronics / beginners

author: Shaydzmi
author_rank: Regular Contributor
timestamp: March 10, 2021, 08:35:49 am
content: I want to use this optocoupler (U1) to drive a relay, but it seems that the input of U1 doesn't get a constant voltage when (S1) closes.My question is: Is there something missing (e.g capacitor..).Note: I can not move or remove D1 or put something across it, same thing goes with the switch and the lamp.

author: gnuarm
author_rank: Super Contributor
timestamp: March 10, 2021, 09:01:07 am
content: Nothing missing, but D1 is in the way. With D1 in the picture you will only ever get current in the direction that does not pass through the LED. So remove D1. Then the question is what is D3 doing? It looks like someone though it was a good idea to protect the LED against reverse voltage, but... D2 is already doing that with the benefit of the resistor R1 to boot. So ditch D3 as well unless I am missing something.If the original circuit had a wire in place of the red lined circuitry to start with, the lamp will be much dimmer with the diodes. Instead of the resistor limiter I'm picturing a single transistor with a resistor (much smaller than 1.5K) that will set the current through the LED and let the rest of the current bypass the LED to keep the light bulb lit at nearly full brightness. Maybe I can describe it as I don't feel like drawing it up.Remove R1. Add a resistor to the cathode leg. Connect the collector of a 2N2222 transistor to the anode of the LED, the base to the cathode of the LED and the emitter to the other end of the resistor. Set the value of the resistor by R = 0.7V / Iled. So for 5 mA use a 140 ohm resistor. Keep D2 in the circuit to bypass this entire circuit on the half of the cycle when the LED won't conduct.This circuit will work with the resistor where it is, but you would need a PNP transistor.

author: Shaydzmi
author_rank: Regular Contributor
timestamp: March 10, 2021, 12:24:01 pm
content: Thank you,I didn't understand your answer unfortunately.As I noted before, I can not take D1 out..Can you please clarify your answer to me?

author: perieanuo
author_rank: Frequent Contributor
timestamp: March 10, 2021, 01:41:11 pm
content: Quote from: Shaydzmi on March 10, 2021, 08:35:49 amwith S1 open, D2 never gets polarisedD2 anyway won't make enough voltage for opening U1 diode, you have to subtitute D2 with more diodes in series, maybe 4-5 'normal' rectifiers.if U1 is the one who activate the relay coil, you got a casuality issue, how do you apply voltage on D2 (you have no DC path to GND)

author: CJay
author_rank: Super Contributor
timestamp: March 10, 2021, 01:54:33 pm
content: Perhaps do this instead?

author: perieanuo
author_rank: Frequent Contributor
timestamp: March 10, 2021, 02:13:23 pm
content: Quote from: CJay on March 10, 2021, 01:54:33 pmyou forgot the lamp totallyand it's a big (small) resistor...anyway with relay open what's your dc path to gnd?

author: CJay
author_rank: Super Contributor
timestamp: March 10, 2021, 02:25:52 pm
content: Quote from: perieanuo on March 10, 2021, 02:13:23 pmSo what?Lamp makes little difference to the operation of the optocoupler (represented by the LED)Quote from: perieanuo on March 10, 2021, 02:13:23 pmThere is no path to ground in the original circuit with the relay open either, what's your point?

author: Shaydzmi
author_rank: Regular Contributor
timestamp: March 10, 2021, 02:33:01 pm
content: Thank you,QuoteI want U1 to operate when switch closes, not when it is open, in another words, I want to use the U1 as indicator when S1 is closed.QuoteI will supply the relay coil with an external DC.

author: Shaydzmi
author_rank: Regular Contributor
timestamp: March 10, 2021, 02:38:53 pm
content: Thank you,As I said in my first post:QuoteSo, I can not use your suggestion. And I think that the U1 will only get a half-wave anyway, and that is the problem.

author: CJay
author_rank: Super Contributor
timestamp: March 10, 2021, 03:01:54 pm
content: Ah, my bad, I missed that you couldn't put anything across D1.Put the resistor and optocoupler across the bulb instead?

author: StillTrying
author_rank: Super Contributor
timestamp: March 10, 2021, 03:56:04 pm
content: If all you've got access to is both ends of D2 it'snear enoughimpossible.

author: perieanuo
author_rank: Frequent Contributor
timestamp: March 11, 2021, 06:39:43 am
content: i'll repeat, just put 4-5 diodes series with your main rail, get 4x(0.6-0.8V) and that's your voltage for OC (of course, calculate your limiting resistor according to OC datasheet)don't tell us you can't cut the wire and add 4 diodesspice simulations other user posted don't get things done, just confirm the bad designor just take voltage from lamp like suggested, that's a second 100% working solution besides the diodes idea1 diode eans usually 0.6-0.8V, you'll never be able to power the OCseehttps://www.vishay.com/docs/81181/4n35.pdfthe forward voltage can be as high as 1.7V, that means min 3 standard diode rectifiers in series, minimum 4 with some marginI consider after 2 working propositions for your schematic, your feedback should be positive

author: gnuarm
author_rank: Super Contributor
timestamp: March 11, 2021, 07:13:04 am
content: Ok, if you have to leave D1 in the circuit remove D2 and reverse the polarity of the rest of the added circuit, D3 and the opto LED.D1 is only going to allow current in one direction. The good news is D3 is now superfluous and can be omitted. But you are going to need the circuit I described to set the current through the LED. Here is an image of the schematic. It will drop enough voltage to drive the LED plus 0.7 volts for the current set resistor, so maybe 2V total, give or take. You need to read the data sheet on the opto.The 140 ohm resistor will drive about 5 mA through the LED. Adjust according to the equation. I seem to recall the light bulb used about 50 mA, so that would require about half a mA though the BE junction of the transistor which flows through the LED, but not the resistor, so about 10% of the current in the LED. Not a significant source of error in the current setting. Mostly the error will be my assumption of 0.7 volts on the BE junction without looking at the data sheet, lol.

author: Shaydzmi
author_rank: Regular Contributor
timestamp: March 11, 2021, 08:03:45 pm
content: Quote from: StillTrying on March 10, 2021, 03:56:04 pmDon't say that! this doesn't go with your name!

author: Shaydzmi
author_rank: Regular Contributor
timestamp: March 11, 2021, 08:10:30 pm
content: Quote from: perieanuo on March 11, 2021, 06:39:43 amQuoteI don't think that it is a bad design, it's working on my machines tens of years.QuoteS1, lamp and resistor across it, are a standalone device, can't separate them.

author: Shaydzmi
author_rank: Regular Contributor
timestamp: March 11, 2021, 08:21:57 pm
content: Quote from: gnuarm on March 11, 2021, 07:13:04 amWould this circuit work when the lamps' current draw reaches 10 amps?

author: gnuarm
author_rank: Super Contributor
timestamp: March 12, 2021, 02:04:50 am
content: Quote from: Shaydzmi on March 11, 2021, 08:21:57 pmYes, if you use an appropriately sized transistor. But why would anyone care? Is there a plan to use this with a 10 amp light bulb instead of a 50 mA bulb? Will the power source put out 10 amps?

author: perieanuo
author_rank: Frequent Contributor
timestamp: March 12, 2021, 10:38:06 am
content: Quote from: Shaydzmi on March 11, 2021, 08:10:30 pmspice sims are working on your machines?ok....who said about separation between lamp and resistor???they have WIRES, just put in parralel on those wires OC diode+limiting resistoryou got solution proposed, I think you're not clear in your head and i'll stop here and focus on people who listen and understand what they are taught, not big-mouthif you are experienced (you said "working for years in my machines") what are you doing in begginers section and throw away good solutions from several members???just go be macho in other forums my man, here we are talking calculations, electronics and so on

author: Shaydzmi
author_rank: Regular Contributor
timestamp: March 12, 2021, 11:27:03 am
content: Thank you,Ok, I'm very sorry, please don't be mad at me, I think you didn't understand me, maybe because of my language weakness, any way, I'm still a beginner, I said that the machines are working with the same circuit foe years, and I'm not the person who made them, I'm just a learner.Please retreat from your position, and please be patient with me.Issues that you think easy for you are complicated for me.Thank you again.

author: Renate
author_rank: Super Contributor
timestamp: March 12, 2021, 11:49:47 am
content: There's a bit of information missing here.This thread is apparently a continuation or slightly different case from:https://www.eevblog.com/forum/projects/need-some-help-building-a-circuit-involving-switchs-and-relays/This is an industrial circular knitting machine.The light bulb, resistor and switch are part of a "feeder" which is a pulley unit with thread out switches on entrance and exit.As many as 100 (76 on the last example) of these feeders are all bussed together on two lines so that a broken thread on entrance or exit can be detected separately.The machine has to stop in different ways depending on which side the thread broke.The resistors are there so that the action will work even with a burnt out light bulb.So, you need a circuit that can detect 20 mA (the current through a 1.2 k bypass resistor with a burnt out bulb) but also tolerate 5 A = 76 x (50 mA bulb + 20 mA resistor, all on).The original board of the previous example used a clever circuit with a triac.The triac only turned on after a few volts so that a little shunt voltage could be detected.A thermistor tried to limit current if too many bulbs were on.The previous circuit was working on full AC. I don't know where D1 came in.Here is my reverse engineering of that PCB:

author: gnuarm
author_rank: Super Contributor
timestamp: March 12, 2021, 03:33:50 pm
content: Quote from: Shaydzmi on March 10, 2021, 02:38:53 pmCan you explain why U1 only getting a half wave current through it is a problem? You are only going to get a half wave current in U1 no matter what you do unless you use two optos in anti-parallel. That means put one in one direction and one in the other direction.Even then you will only see half wave current because of D1. Do you see that?

author: Zero999
author_rank: Super Contributor
timestamp: March 12, 2021, 06:58:26 pm
content: If you want the photocoupler to pass current for both positive and negative cycles, then use a bridge rectifier.

author: gnuarm
author_rank: Super Contributor
timestamp: March 12, 2021, 11:49:34 pm
content: Quote from: Zero999 on March 12, 2021, 06:58:26 pmWon't matter. He says he can't work around D1, so there is only flow in one direction no matter what he does with the LED in the optocoupler.

author: Brumby
author_rank: Unknown
timestamp: March 13, 2021, 06:42:17 am
content: Quote from: gnuarm on March 12, 2021, 11:49:34 pmThis was as obvious as can be - right from the very outset!

author: Zero999
author_rank: Super Contributor
timestamp: March 13, 2021, 10:36:51 am
content: Quote from: Shaydzmi on March 10, 2021, 08:35:49 amQuote from: Brumby on March 13, 2021, 06:42:17 amOh sorry, I missed the part about not moving D1. Well the only solution is to add a capacitor, to power the photocoupler, through the negative cycles.

author: Renate
author_rank: Super Contributor
timestamp: March 13, 2021, 12:46:03 pm
content: Quote from: Zero999 on March 12, 2021, 06:58:26 pmNo, then you're adding two diode drops to the burden.It's better to just use two opto couplers in parallel and do your smoothing on the photo side.I think some of you missed the part of this working on 20 mA to 5 A.If we look at using an optocoupler for a second, we need a few volts to operate it.The least drop would be using back-to-back zeners to limit the drop to say 3 V.Then a resistor to feed parallel optocouplers.Now we draw 5 A in the circuits and the zeners will have to dissipate 15 Watts!Ok, we could alter the parameters of this whole problem and say that we will only light up a maximum of 7 bulbs at a time.That would reduce that to 1.5 Watts.Face it, a directly activated optoisolator is not a great solution.Well, you could throw in a boost converter and make the drop as low as a Schottky.Ahttps://www.ti.com/product/TPS61200works to a low of 0.3 V!We could use a very small shunt resistor and use an amplifier somehow powered off the 24 V.That would work fine.Personally, I like the triac solution above.It gives the combination of softness (with the bypass resistor easily able to generate a nice voltage out of small currents)and hardness of the triac being able to carry 5 A with very low drop.

author: fcb
author_rank: Super Contributor
timestamp: March 13, 2021, 03:05:48 pm
content: Use a small transformer across the diode 'D2'.Adjust the 0.37V bias voltage to suit. The capacitor across the transistor is to provide an on-time longer than 1 cycle.

author: Shaydzmi
author_rank: Regular Contributor
timestamp: March 13, 2021, 06:45:31 pm
content: Quote from: Renate on March 12, 2021, 11:49:47 amHello Mr Renate!It's a pleasure to see you here, after the long discussion in teh other thread.. Thank you.QuoteYou know, it's been almost a year since I began that thread, and I didn't figure out what's happening in that circuit you mentioned, nor I found a way to do what I wanted to do, maybe because of the time limitations, or simply because I'm a stupid guy, anyway, I love electronics no matter what happens.QuoteThis is another circuit from another brand, I've tried to imitate it, and I failed at the end, every thing worked well, except the optocoupler, it works, but on off on off quickly, it can't keep relay on steadily.This is the original circuit:QuoteI didn't understand how it works, I'll keep trying to understand it.

author: gnuarm
author_rank: Super Contributor
timestamp: March 13, 2021, 09:55:44 pm
content: If you have external power for the other side of the opto isolator, why can't you use a hall effect sensor to sense the current without inserting anything in the line? 50 mA is not so low that it can't be detected and I don't think anything bad happens when they are overloaded with 5 or 10 amps of current. You just need a spot where you can put the sensor next to the conductor.

author: Renate
author_rank: Super Contributor
timestamp: March 14, 2021, 01:25:15 am
content: Quote from: Shaydzmi on March 13, 2021, 06:45:31 pmThe optoisolator on this is pulsing at line rate, that little capacitor there does not do much filtering.The filtering is on the other side (the phototransistor side) of the optocoupler.Is the relay "chattering" (switching on and off almost in a buzz)?Or is it more random on and off?Is the little LED in the drawing bright and steady?

author: gnuarm
author_rank: Super Contributor
timestamp: March 14, 2021, 04:52:57 am
content: In the most recent drawing I'm starting to think the F6A component is not a diode. If it is a diode there is simply no way this circuit could work. If it is not a diode then there is at least a chance the circuit will work and the rest of the design starts to make sense.The U1520 is a 200V, 15 amp diode dropping up to 0.9V at 5 amps. In the other direction the current flows through the resistor, LED and opto device at a low current of about 14 mA. The current is in pulses at the AC frequency.That all makes perfect sense. It is the assumption that the F6A device is a diode that makes no sense.If the 50/60 Hz pulsing of the opto is a problem some filtering needs to be added. As Renate says the 10 nF capacitor (0.010 uF) is doing nothing. Not just because it is small, but because the 1N4007 diode effectively shorts it when the current is in the other direction. That diode can be removed as it is doing nothing of use. The U1520 prevents a reverse voltage from harming the LED and opto by limiting the opto reverse voltage to 1V.I think this diagram has the 1N4007 diode connected wrong. For the capacitor to be of any value the diode needs to be in series with the opto circuit between the anode of the U1520 and the junction of the capacitor and the opto pointing the same direction as the opto LED. However, if I did the math right, to stabilize the opto current enough to keep it lit during the half cycle there is no current requires 700 uF! That's what it takes to maintain 14 mA for 10 ms with a 0.2V droop.Yes, this can be filtered much more easily on the other side of the opto in a high impedance circuit feeding an op amp or better, a comparator. Heck, even a digital input will suffice. A 10K pullup and a 10 uF cap should do it. Or a larger resistor and a smaller cap, 100k and 1 uF.All this depends on there being no D1 diode (the F6A component) that only allows current to flow in one direction... the wrong one.One thing I don't get is why that diode would be there in the first place. That would stop half the current flow making the light bulbs light up at half the brightness. Why would anyone do that? I would also point out that most light bulbs can be replaced with LED equivalents that use a fraction of the current and last much, much longer greatly lowering the current through the U1520.

author: Shaydzmi
author_rank: Regular Contributor
timestamp: March 14, 2021, 06:40:12 am
content: Quote from: StillTrying on March 13, 2021, 10:00:49 amThat's interesting, I'll try it after buying a reed relay.

author: Shaydzmi
author_rank: Regular Contributor
timestamp: March 14, 2021, 06:43:23 am
content: Quote from: fcb on March 13, 2021, 03:05:48 pmIt worth trying, thank you.

author: Shaydzmi
author_rank: Regular Contributor
timestamp: March 14, 2021, 06:45:57 am
content: Quote from: gnuarm on March 13, 2021, 09:55:44 pmI'll try this when I give up the other optocoupler solution.

author: Shaydzmi
author_rank: Regular Contributor
timestamp: March 14, 2021, 06:54:47 am
content: QuoteThe optocoupler and the led in the original circuit are working perfectly fine.But in my imitation when I inserted D2 between D1 and the feeders, the LED looks good, but the relay I connected in optocoupler output is switching on and off in a buzz.

author: Shaydzmi
author_rank: Regular Contributor
timestamp: March 14, 2021, 07:15:49 am
content: QuoteNo, this drawing is not mentioned in my first post, because it is a part of the original PCB, it's across D1, that is why I said I can't work around it.F6A Is a fuse 6amps.QuoteI don't think so, it's purpose is to force current in half cycle to go through the LED and the optocoupler.QuoteAll machines of different brands that I inspected are using a power diode like the drawing, with a slightly different circuit, some using an NPN, others PNP transistors etc..

author: gnuarm
author_rank: Super Contributor
timestamp: March 14, 2021, 10:32:31 am
content: Quote from: Shaydzmi on March 14, 2021, 07:15:49 amI don't understand a lot of what you say. When you are talking about technical things it is good to not use the pronouns like "it" unless it is very, very clear just what "it" is. I don't know what you are saying here because I'm not sure what you mean by "it".QuoteYeah, but it doesn't force anything. A diode blocks current flow in one direction. In this case someone might have thought it was a good idea to prevent the LED and opto from seeing the full 24V. So it is not uncommon to have a diode in the opposite polarity across them to by pass the current when it is not the polarity the LED will conduct. In this case the U1520 is already doing that. So the 1N4007 is redundant.QuoteOk, so is the U1520 the same as D1 in the original diagram? What is the diagram of the machine circuit before you make any mods? What parts of that diagram do you have access to for connecting wires, etc?I'm sorry, but I don't really understand what you are starting with or what the limitations are. What I do know is this is a simple problem to solve once the issues are understood. This sort of circuit can be designed easier than falling off a log. The problem is getting all the facts and requirements presented in a clear manner.

author: StillTrying
author_rank: Super Contributor
timestamp: March 14, 2021, 12:28:10 pm
content: I agree with gnuarm, unless you know exactly what's already there and want's needed to do you'll be going around in circles forever.Simulating something very similar to the last diagram in Reply #28.....Green:Is the ouput of the opto, LOW = ON, it sinks ~1.5mA through the 3k3.Blue:If I increase C1 from 0.01uF up to 10uF it stays charged enough to keep the LED/opto turned ON all cycle.Orange& White: Is the current throught the 1k5/LED/opto with C1 = 0,01uF and 10uF.YellowandMagenta:Is the bulb current with C1 = 0.01uF and 10uF.YMMV

author: Shaydzmi
author_rank: Regular Contributor
timestamp: March 14, 2021, 02:21:57 pm
content: Thank you..Ok, I'll try to put you in the picture:This is the entire board:The highlighted erea is the part that I want to add to it, this is a closer look :D1 in my first post is u1520, the resistor, capacitor, opto and led across it (D1) are original, I can't remove them or add to them.What I want to do is to add a similar circuit (diode, diode, resistor cap, opto, led) in series with the original one (D1) . When I did try, the problem happened on the opto, it keeps on-off.I have access to the AC feeding the D1, and the wire going to the switch, but I can't work around D1, because it my interfere with the already working circuit, I don't know, you can tell me if not.

author: Renate
author_rank: Super Contributor
timestamp: March 14, 2021, 03:42:35 pm
content: Quote from: Shaydzmi on March 14, 2021, 06:54:47 amWell, you're confusing us all.The original circuit works fine, yes?So what are you trying to do?If you want to have another output of alarm just for yourself you should take it off the board somewhere else than at the optocoupler.There is no reasons to try to put in your own optocoupler.That will just interfere with the original circuit.Besides, you should leave the original board a original as possible.As I said, there is filtering after the optocoupler.That's the capacitors and the 4093 CMOS quad NAND Schmitt trigger.Can't you use the relay (that is already there) output?

author: Shaydzmi
author_rank: Regular Contributor
timestamp: March 14, 2021, 08:21:38 pm
content: Quote from: Renate on March 14, 2021, 03:42:35 pmYes.QuoteI'm trying to do what you have already understood, to make different stopping time for each broken yarn position. plus two different common lamps alarm.QuoteThere is a reason, the relays that are stopping the machine are very late, I can turn on and off the switch on the feeder quickly, I can see the led beside the optocoupler is on, but the machine keeps running. I want the machine to stop immediately even when the switch of the feeder closes for a brief period of time.QuoteThis is another reason, I don't want to touch the board, all what I want to do is putting some circuit around the half-wave AC going to the MPF.QuoteI don't want to enter to this area.QuoteAs I said it's very late.A slight whisper in your ears:Can't I get help without asking why? If what I want to do is not essential to me, I will not waste my time and your time on this give-and-take.Thank you all..

author: floobydust
author_rank: Super Contributor
timestamp: March 14, 2021, 08:38:18 pm
content: Are the existing timers calibrated/adjusted? Trimpots T1-T5 could set debounce times for the switches, I assume the switches are normally chattering depending on thread tension. You can follow the PCB traces from the opto on D13 to see which trimpot it is. The timers are after the LED so you would not see that delay, if you manually moved a switch open/closed.I think the existing TL504A opto-coupler is monitoring loopvoltageon the -ve 1/2 cycle, so there is more going on at the switches and lamps than we know of.Orizio has to monitor so many switches, with local status lamps- that to reduce power they went 1/2 wave. There are two MUR1520 in the picture, so either the machine has two current-loops or a single one possibly using the 1/2 wave AC to monitor two banks (switches loop current) using the +ve and -ve sine-wave portion separately. I have seen DI's multiplexed this way.A picture of the PC board back side would help to follow the traces.Just an observation, but U1 (TO-220 top edge) looks like it has seen very hot days, C3 might get damaged from that as well. I would check the IC and trimpot T6 is working (set properly). The board might need repair or at least a heatsink added. This could also affect the delay times if the voltage regulator has failed.Board is SIGMDF024 for Orizio circular knitting machine.

author: Shaydzmi
author_rank: Regular Contributor
timestamp: March 14, 2021, 08:39:28 pm
content: Quote from: StillTrying on March 14, 2021, 12:28:10 pmWhat is on reply #28 is fine and doing its job, what I need to do is putting a similar circuit between D1 and the bulb, is that clear? I hope so.

author: Shaydzmi
author_rank: Regular Contributor
timestamp: March 14, 2021, 09:06:57 pm
content: Quote from: floobydust on March 14, 2021, 08:38:18 pmYes, Thank you..QuoteOne MUR1520 is for yarn input, the other is for the output.QuoteQuoteI didn't notice that, I'll check it, thank you.QuoteThat's right.

author: gnuarm
author_rank: Super Contributor
timestamp: March 14, 2021, 10:34:32 pm
content: Quote from: Shaydzmi on March 14, 2021, 02:21:57 pmOk, this is clear to me now. I understand why you had both D1 and a second diode in your original drawing. I think adding another huge heat sink for the diode is not essentialifyou can tap into the existing circuit (which you are reluctant to do and I understand that).The point is the current path around D1 is not lighting the bulbs so you can insert more LEDs or optos which will only drop an extra volt without affecting the circuit.To do that requires you to open that circuit at some point which you seem willing to do since you had done this in your original design, just not at the right place. You can open the circuit that runs to the existing opto on either side or even on the other side of the LED. Add your opto in series in the same polarity and you should be in business. The 1.5K resistor is controlling the current so you should not see a noticeable impact. The 1.2V drop on the opto should be pretty invisible with the 33Vpeak the circuit is dealing with.Is that clear or do I need to draw a schematic?BTW, I still don't see what the small diode is for. The D1 diode limits the voltage in the direction the opto and LED might be damaged by reverse voltage. So there will be very little current flowing in the small diode even when forward biased. If you want to be very, very cautious, you can add a diode in anti-parallel with your opto to make sure it is not subjected to excessive reverse voltage, but with D1 being in parallel with the whole thing I don't see how the extra diode can be doing anything useful.So instead of tapping into the main path of 10 amps, just tap into the path of current going through the opto and LED.

author: gnuarm
author_rank: Super Contributor
timestamp: March 14, 2021, 10:48:36 pm
content: Quote from: Shaydzmi on March 14, 2021, 08:21:38 pmSometimes you seem to talk in code. I don't know what MPF means. You say you don't want to touch the board, but your original drawing in this thread "touched" the board, no? Or was that in the connection to the board? Ah, I think that is it.In that case I would recommend you consider my transistor based design or duplicate the design as you have done. My understanding is you can't get this duplicate design to work, but I'm still not clear why. You say the output is irregular, but I'm not sure what you mean by this. As everyone has mentioned the opto will output a half duty cycle square wave which needs to be filtered. I don't know if I ever heard the answer to whether this is what you are talking about or something else.QuoteI don't know what "entering to this area" means. Do you mean it is too complicated for you to construct?QuoteActually, no. If you want us to offerUSEFULadvice, we need to understand what the options are. Otherwise, why would you ask us to help?The only problem with inserting a new diode/opto circuit in line with the existing circuits is that it will drop more voltage to the lamps and burn power. Otherwise it should work fine. Can you explain more clearly what it is doing and what it is not doing?I'm at least happy that I understand what you are doing now.

author: gnuarm
author_rank: Super Contributor
timestamp: March 14, 2021, 10:55:36 pm
content: Quote from: Shaydzmi on March 14, 2021, 08:39:28 pmThis is an example of poor communications. What he means is he has two pieces of equipment connected by a cable, no? He wants to sense the current flowing in the cable and not modify any of the equipment.I think a hall effect sensor would be so simple. Or a ferrite toroid core could be used to couple to sense the current. That would be just as isolated as the opto and not even need to tap into the circuit, just slip the toroid over one of the wires or if there are two wires pass them through in opposite directions to kill common mode signals.Is there anything at a board level on the hobbyist market that would do this? I know there are hall effect sensors.

author: StillTrying
author_rank: Super Contributor
timestamp: March 14, 2021, 11:48:36 pm
content: Quote from: Shaydzmi on March 14, 2021, 08:39:28 pmI can easily move the 1N4007 and 1k5 in the simulation to match your Reply#28, it does what we'd expect, the opto is ON during the 24VAC's negative cycle, plots below.In operation the 1N4007 and 0.01uF don't do anything, there's no change if I disconnect them, perhaps they are just some voltage spike protection for the LED and opto, opto isolator LEDs can easily be damaged.QuoteInstead ofbetween, could thesimilar circuitalso bein parallel across the same diode, because on the negative half cycle of the 24VAC there's about -18V and 50mA avalible there, more than enough to power both paralleled opto circuits.Or something else...

author: gnuarm
author_rank: Super Contributor
timestamp: March 15, 2021, 04:05:20 am
content: Quote from: StillTrying on March 14, 2021, 11:48:36 pmIn your simulation, can you plot the current and voltage on the diode and cap? If they are doing nothing there will be very little current flow. This small diode can't be protecting anything because the big diode is already doing that. In the one direction the circuit can't see much more than a volt (I'm assuming even that high because nearly any diode will be in it's linear region at 10 amps). When the current flows the other way to pass through the opto it doesn't need voltage protection, it needs current limiting which is what the resistor does.Diodes have a recovery time when the voltage reverses it takes an instant to clear the junction of carriers and stop conducting. But that would not cause an over voltage, just the opposite it shorts in the reverse direction for a few nanoseconds. I'd like to see what current is flowing in those two appendix parts.QuoteI get what he wants now. Anything other than between the machine with the diode and the machine(s) with the switch(s) and lamp(s) is inaccessible. He has duplicated the circuit and put it inline by interrupting the connecting cable at some point, likely where it attaches to the machine with the diode. It should work fine, but it doesn't and he isn't able to provide enough info to debug it.It seems like these sorts of discussions frequently turn out this way. Advisors feel too little info is provided. The requestor feels it is not important to answer those questions. I've been there myself. I've learned to ignore the side issues as much as possible and try to focus on the real issue. But if you don't give the advisors enough info to know the problem they can't help.I've been looking for an education in motor controllers. Several people are telling me to use a linear amp instead of trying to create a class D amp from a motor controller. At some point I relent and give them the gnarly details of why the available amps aren't suitable. I did finally get enough clarity to get a design done. Well, at least I think it is done.

author: Renate
author_rank: Super Contributor
timestamp: March 15, 2021, 09:58:51 am
content: You can't duplicate the original circuit and insert it into alarm line.You'll be stealing half the voltage, the current will be halved and it will work unreliably.You say that your relay is chattering.I've already said that you don't have the filtering that the original circuit has and needs to convert the half wave to a steady signal.You haven't even shown us a relay on your diagram so we have no idea how you are driving it.Fix a problem where the problem is.Do you have another machine of the same model that operates differently?Do you have the manual for this machine?Have you asked the manufacturer?How fast do you expect the machine to stop (in seconds, in fraction of rotation)?Does the broken needle detector stop it faster? Fast enough?As pointed out earlier, T1-T5 are delay settings. Are they correct?You've got tons of LEDs on tha board.Using the convenient leg of the big diodes as a test point, connect a 1k resistor to ground.How fast does the initial LED (one of the three right near the diodes) go on?How fast does a relay click and its LED light up?Is the main drive VFD? Does it have special braking?Is there a separate electrically activated mechanical brake on the central drive?

author: StillTrying
author_rank: Super Contributor
timestamp: March 15, 2021, 02:47:30 pm
content: Quote from: gnuarm on March 15, 2021, 04:05:20 amYellowis the voltage across the 1N4007 and 0.01u,greenandblueare the currents through them, white's are 0 markers.

author: Shaydzmi
author_rank: Regular Contributor
timestamp: March 15, 2021, 07:42:33 pm
content: Quote from: gnuarm on March 14, 2021, 10:34:32 pmSchematic is always welcomed.QuoteMPF stands for Madness of Perfect Foolishness! Or this:https://www.memminger-iro.de/en/fournisseure/mpf-p.phpQuoteYes.QuoteOk, I'm happy too, that you are still following this thread.QuoteOk, there is a language barrier..QuoteCan you explain this to me please?

author: gnuarm
author_rank: Super Contributor
timestamp: March 15, 2021, 07:55:51 pm
content: Quote from: Renate on March 15, 2021, 09:58:51 amThat's not quite right. Yes, inserting another resistor will cut the current in half. But the circuit can be simplified to a diode and the opto with or without the LED. The resistor in the original circuit limits the current in both circuits since they are in series.The measurements StillTrying took show that the 1N4007 and the capacitor are doing nothing useful. The tiny cap draws a bit of current when the AC cross zero and the polarity changes. The current through this diode is 180 uA peak corresponding to 0.27 V across the resistor. So the 1N4007 has some low voltage, perhaps as low as 0.5 V and so the big diode has about 0.77 V, but this is just a simulation. Still, I can't see how the 1N4007 diode in particular is doing anything useful. If removed the reverse voltage on the LED/opto reaches the voltage on the big diode, still well within the rating on them. I think the original designer was being overly cautious.Still, the extra diode and cap do nothing to harm the circuit. Adding an additional circuit in line will operate fine if the resistor is removed or at least cut in size. Heck, even with a second 1.5 K resistor in the circuit the current though the optos will be 7 mA which should be above the required current. These optos work with a current ratio of current into the LED and current out of the transistor. You can do a lot with even just a mA on the isolated side. Add a 10 K load resistor and you get a 10 V swing.

author: Shaydzmi
author_rank: Regular Contributor
timestamp: March 15, 2021, 08:11:07 pm
content: Am I supposed to answer all this questions? or you are shooting all these questions on me in the goal of me announcing surrender?Quote from: Renate on March 15, 2021, 09:58:51 amQuoteWhere is the problem? other than to optocoupler?QuoteNo.QuoteYes, but they don't mention electronics part.QuoteThey don't answer.QuoteFrom max speed (53Hz) to 0Hz in seconds:Yarn out broken: 0.5sYarn in broken: 1sNeedle broken: 0.8sNormal stop: 1.5sQuoteNow, no difference.QuoteYes.QuoteI don't think that all this questions are related to my request, there is a lot of things I can't explain, because if I begin, the questions will not get to an end.anyway:The initial LED goes on immediately, The relay has little delay, I must keep it like that, because there are something related to it needs a very short delay.QuoteVFD has its braking resistor.QuoteNo.

author: gnuarm
author_rank: Super Contributor
timestamp: March 15, 2021, 08:41:16 pm
content: Quote from: Shaydzmi on March 15, 2021, 07:42:33 pmThat post was talking about tapping into the existing board which I now understand you do not want to do. So mox nix.QuoteSo it is some of the machinery. Got it. .QuoteI've lost the context of this comment...QuoteBut you did not explain what the present problem is. You have said it isn't working, but we need more information on what it is doing right and wrong.QuoteI'm not talking about the language barrier. I mean we are used to talking technical and generally know what info to provide to solve a problem. You tend to use general terms and vague descriptions. The meaning of "it" depends on context and should be avoided if possible. A failure needs to be described well enough that someone can understand what you are seeing without being there.QuoteThis is not really different from a transformer approach someone suggested some time back. He recommended an audio transformer, possibly in parallel with a diode and in series with a cap. I don't completely understand that circuit, but a toroid is what is used in what we call GFCI in the US but I think it is RCD elsewhere (of course, the US seems to never be aligned with the rest of the global community). They sense a difference in current of just a very few mA while the line passes many amps.https://www.electricalengineeringtoolbox.com/2016/01/how-residual-current-device-rcd-works.htmlSuch a circuit (tailored for your use of course) could detect the current flow in the wire without any electrical connection at all. The wires would need to pass through the toroid, possibly loop around a few times, each of pair in opposite direction. A sense wire also loops around the toroid multiple times and is amplified/detected to drive your relay.Here is a hall effect chip that produces an output voltage proportional to the current.https://cdn.sparkfun.com/assets/d/0/0/5/e/ACS723-Datasheet.pdfThe most sensitive version provides 400 mV/A so would require an amplifier and comparator and filter to drive the relay. Even if this particular chip isn't optimal for you, the point is a hall effect sensor can do this job as well as an opto and eliminate the complications of interfering with the original equipment.I expect there are board level products or even box level products to sense current in an AC conductor. My furnace has one to turn on the humidifier whenever the fan is on. It's a small module that has a sensor the fan wire runs through. I doubt it will detect 50 mA, but that is not unreasonable for such a unit to exist. The wire can be looped multiple times to increase the sensitivity. It just requires looking.

author: Renate
author_rank: Super Contributor
timestamp: March 15, 2021, 09:00:35 pm
content: So, here we are at 50 posts and you have not stated what the problem is yet."I want to stick this circuit inside this other circuit" is not a statement of the problem.Quote from: gnuarm on March 15, 2021, 07:55:51 pmYes, of course you can change the resistor values, but why are we even getting bogged downon the completely needless project of inserting yet another current sensor in something that has a perfectly fine current sensor in it?Quote from: Shaydzmi on March 15, 2021, 08:11:07 pmSo, please state the problem in a way that we can understand it.Are the stop speeds not being met and you want to fix a machine that is not performing to spec?Are you trying to change the specifications of a machine that is currently performing to spec?

author: gnuarm
author_rank: Super Contributor
timestamp: March 15, 2021, 09:22:03 pm
content: Here is a homebrew transformer current detector.http://jimlaurwilliams.org/wordpress/?p=3292I would not advise using the transformer-less power supply any more than I want to use one of the $2 phone chargers on eBay.This design detected 500 mA while you are detecting 50 mA. The core needs to not be saturated with the full 5 amps or 10 amps or whatever the spec is.There have got to be off the shelf products for this, but my google fu is not always so good.

author: Shaydzmi
author_rank: Regular Contributor
timestamp: March 15, 2021, 10:06:29 pm
content: Quote from: Renate on March 15, 2021, 09:00:35 pmAs I mentioned before, if we continue to dig into these details, we won't be able to fix the circuit.It doesn't matter what does the machine do and doesn't do, or I'm trying to change specifications, or even destroy my mchine, all this has no thing to do with my little optocoupler need to work perfectly.When I fix this circuit, I'll ask you for your help to do other things when I need help..Thank you.

author: Shaydzmi
author_rank: Regular Contributor
timestamp: March 15, 2021, 10:14:25 pm
content: Quote from: gnuarm on March 15, 2021, 09:22:03 pmThank you Gnuarm, currently I am trying to find out what is wrong with my circuit involving optocoupler, why optocoupler doesn't work even if I put a big capacitor across its input.. If I can't fix it, I'll try the current sensor method.

author: gnuarm
author_rank: Super Contributor
timestamp: March 15, 2021, 11:14:44 pm
content: Quote from: Shaydzmi on March 15, 2021, 10:14:25 pmI know, but you have not given us any info to work with on helping to get your circuit working. I don't even understand what it is doing or not doing. Do you have an oscilloscope? Can you post pictures of the waveforms at various points in the circuit?BTW, have you removed the resistor from your circuit yet? You should do that since it is cutting the current in half to both units.Yes, a summary review of the existing circuit, your addition and an indication of what is happening would be useful. If you post hand drawn schematics, please make them legible. I could not read the numbers on the other one you posted.

author: StillTrying
author_rank: Super Contributor
timestamp: March 16, 2021, 01:28:25 pm
content: Quote from: gnuarm on March 15, 2021, 07:55:51 pmYes a seccond detector in series with the bulb halves the peak of 16mA through the LED/opto to 8mA but they both still work with the opto output only sinking 2mA in the simulation.In the 1 detector verses 2 in series detector plots below I've reduced one of the 1k5 to 100R which restores most of the current through the optos in the 2 series version.I don't know what the OP's opto output drives.(or anything else really)

author: Shaydzmi
author_rank: Regular Contributor
timestamp: March 19, 2021, 12:40:03 pm
content: Now, maybe it is a good idea to try to build a circuit in parallel with the D1, and get rid of the rest.What is the purpose of this circuit?The purpose of this new circuit is to detect whether S1 is closed or not.The current drawn by the bulb could be as low as 30mA to 6amps.What is your suggestions?If there are a missing information, please ask me..

author: StillTrying
author_rank: Super Contributor
timestamp: March 19, 2021, 05:43:48 pm
content: The purpose of this new circuit is to detect whether S1 is closed or not.The current drawn by the bulb could be as low as 30mA to 6amps.If I change to current through the bulb between peaks of 7A and peaks 32mA which is just the 1k, the 2 in series version still works in the simulation.If there are a missing information, please ask me..What do you want the output of the opto to drive, I've just got it sinking 2mA through a pull up resitor in the simulation.

author: gnuarm
author_rank: Super Contributor
timestamp: March 19, 2021, 06:05:50 pm
content: What do you mean by "in parallel with D1"? Do you mean literally in parallel? I'm thinking you mean in the line between the switch and the equipment with D1 in it because you have previously indicated you don't want to attach to the internal circuits of a machine. Or has that changed now?If you want to attach a circuit in parallel with the D1 diode literally, you can copy the circuit that is already there. It will pass another 15 mA of current to the amount passing around D1 through the existing optos. The 1.5 K resistors will assure the current is split between the two circuits evenly. The current won't be exactly 15 mA in each one because the change in voltage on the bulb, but it will be close.How is the 30 mA measured?

author: Shaydzmi
author_rank: Regular Contributor
timestamp: March 19, 2021, 06:25:44 pm
content: QuoteIt works in your simulation, didn't work in my practical circuit.I didn't understand this:QuoteQuoteI want the opto to drive a relay 12 or 24v.

author: Shaydzmi
author_rank: Regular Contributor
timestamp: March 19, 2021, 06:45:44 pm
content: QuoteI mean in parallel literally, before, I thought if I put in parallel I have to take wires for the new circuit components, by soldering wires to the existing components on the board. But now I found out that there is connector before D1 and another after D1, so I can safely use them without changing the board look, as long as this new circuit doesn't affect the existing one's work.QuoteCan't you suggest a better and simple circuit from you knowledge? Because you have criticized the existing circuit.QuoteBecause I see it written on some bulbs.

author: gnuarm
author_rank: Super Contributor
timestamp: March 19, 2021, 07:31:25 pm
content: Quote from: Shaydzmi on March 19, 2021, 06:25:44 pmSo why can't you make it work? I can assure you that unless there are things going on you have not told us about it will work. Did you ever put an oscilloscope on the output of the opto? Or even a volt meter?

author: gnuarm
author_rank: Super Contributor
timestamp: March 19, 2021, 07:32:52 pm
content: I don't recall seeing a schematic of anything beyond the opto. Do you have a complete drawing of the circuit you built and attached and how it was attached?

author: Shaydzmi
author_rank: Regular Contributor
timestamp: March 19, 2021, 08:12:17 pm
content: QuoteI don't know, that's why I began this thread.QuoteReally? I tried, no success, the relay in the opto output keep stuttering.QuoteNo, I don't have one, I'm just a beginner.Quoteyes, in diode mode, it doesn't give me any readings, I tried a relay coil in series with the opto, The relay keeps on/off...QuoteYes, I'll give you a schematic later.

author: Renate
author_rank: Super Contributor
timestamp: March 19, 2021, 08:31:41 pm
content: Quote from: Shaydzmi on March 19, 2021, 08:12:17 pmTake your time, we're only SEVENTY POSTS into this already.

author: Shaydzmi
author_rank: Regular Contributor
timestamp: March 20, 2021, 12:32:33 pm
content: This is The schematic that didn't work:

author: Renate
author_rank: Super Contributor
timestamp: March 20, 2021, 04:13:47 pm
content: Quote from: Renate on March 15, 2021, 09:58:51 amQuote from: Renate on March 15, 2021, 09:58:51 amMany people have said these same things multiple times.Your circuit is not the same circuit as what they made.They definitely don't drive a relay directly off an optoisolator.First of all, there is the CTR (current transfer ratio) which is the ratio of current out to current in of an optocoupler.Since as usual we don't even know WHAT optocoupler you are using we can only guess at that.The little current that goes into the optocoupler LED will only cause a little current to flow in the optocoupler transistor.Quote from: Renate on March 15, 2021, 09:58:51 amBut I repeat myself.So, to literally answer the question "What do I need to get this optocoupler working?"A few resistors, a capacitor, a CD4093B and a ULN2803A.Now, we could talk you through on how to build this circuit.But, as I said, you've already got a controller board with the correct current detector and a ton of relays for output.As you won't say what you are doing or where your relay contacts go to or why you can't use the outputs of the controller board I'll just have to bow out.

author: Shaydzmi
author_rank: Regular Contributor
timestamp: March 20, 2021, 05:17:13 pm
content: QuoteOh no, please don't do this! I'm learning from your answers a lot..QuoteTon of relays, yes, but there is only one common relay for controlling the ins and outs of the yarn, the rest are controlling other things like oil, air, heat, gates, lamps etc.The other thing is that I want to understand how things work, and do my own circuit.QuoteSorry, no need to guess, it isPC817https://global.sharp/products/device/lineup/data/pdf/datasheet/PC817XxNSZ1B_e.pdfQuoteDo you have a suggestion of a circuit that can do the job? forgot about my optocoupler.

author: gnuarm
author_rank: Super Contributor
timestamp: March 20, 2021, 06:47:56 pm
content: Quote from: Shaydzmi on March 19, 2021, 08:12:17 pmIf the relay is buzzing at the frequency of your power line then your problem is the effectively rectified signal pulsing. But if the relay is "stuttering" more erratically the problem is that you are trying to drive the relay coil with the opto directly which won't work. You need a transistor in between to provide the current needed to switch the relay.To properly drive the relay requires knowing the details of the driving voltage and the relay coil resistance and/or current specs, but this web page has a number of suitable driving circuits. I would use the "N-channel MOSFET Relay Switch Circuit" about half way down the page with a 2N7002 FET.https://www.electronics-tutorials.ws/blog/relay-switch-circuit.htmlThis configuration requires the least knowledge of the relay and power to make it work. The output has to be below the VDSS rating of the FET, some 60V in the data sheet I'm looking at (different makers are different) and the coil current has to be below about 100 mA again depending on the specific brand of 2N7002 you use. Also, do not connect the gate directly to the 24VAC at any point. The ±30 volt gate to source rating is a bit too low for this. What is your V+?Connect the opto between the resistor input and the V+ connection provided it is not too high a voltage for the opto ratings. The relay can be connected to a different power source than the opto if needed. Be sure to use the diode across the relay to discharge the relay current when switching off. Add a 3.3 uF cap between gate and ground to filter the 50/60 Hz and you should be in business. The cap can be as large at 10 uF, but that will limit how quickly the FET will turn on, not that 10 or 20 ms will matter to you.The diode can be nearly anything, a 1N400x will be very adequate.QuoteFor AC work you are going to need one. Hard to do stuff like this without seeing what "stuttering" means on the scope.QuoteDiode mode means measuring conductivity which is not what you want to measure voltages or currents.QuoteYes, I saw that. If you put your "new circuit" across D1 without D3, it will work fine as well. The circuit does steal about a volt from the voltage source. Two volts from the two circuits in series still should not be a problem.Same with wiring in parallel. Then you split the current with about 15 mA through each opto, so it should work fine.Does the original circuit drive a relay? Can you tap off that circuit after the opto? What does the original circuit do to smooth the 50/60 Hz? That might give you some insight to this design.

author: StillTrying
author_rank: Super Contributor
timestamp: March 20, 2021, 07:45:34 pm
content: I think a transistor to drive the relay is the only way.Redis the current through the opto's LED,greenis the current through the relay's coil.

author: gnuarm
author_rank: Super Contributor
timestamp: March 20, 2021, 08:54:50 pm
content: I don't recommend a bipolar transistor because it is a bit more work to make sure the details are right. The design above may work fine, but I can't tell without knowing the current required by the relay. The base has to pass an amount of current defined by the relay current and the beta of the transistor which varies with the collector current, dropping off at higher values of current.The 2N7002 simply requires adequate voltage on the gate which controls the drain current. Enough voltage gives enough current. With the high input impedance of the FET the voltage swing is defined simply by the ratio of resistance or if the opto is the current limiting factor, then the transfer ratio.Because the bipolar transistor is current controlled in nature the relay current is ultimately limited by the current at the input of the opto. With the FET there is no limitation. The opto simply needs to drive the resistors chosen by the designer.