Page 1 of 1

Can someone explain how the master interface works?

Posted: Wed Dec 14, 2016 3:51 pm
by themba
Hi, I've been pondering the design here: http://otgw.tclcode.com/schematic.html#schematic
Just out of curiosity I'm trying to understand how exactly it works. In particular the master interface (the part communicating with the boiler) isn't entirely clear to me.
What I think I understand is the following: the gateway communicates to the boiler by setting voltage. This is done by zeners D10 (or D11 if optocoupler OK1B is active).
There is some additional voltage over R1 and Q1 but that (for reasons unknown to me) is guaranteed to be low enough for the signal to not exceed the 7V and 18V maximum voltages for transmitting a 0/1 respectively.

One of the things that confuse me is the presence of a resistor (R1) between the emitter and base of Q1. The PN junction should work as a diode and no current should ever flow though R1. At least that is how far my theoretical knowledge goes.

Another point of confusion is diode D9. I think it is there to protect the input of the optocoupler from over-voltage conditions. (i.e. it is clamped to 4.7V at most and the datasheet specifies 5V as the max so this is safe).
What I don't get is why D9 does not also clamp the output signal. Some of the time Q1 will be conducting between it's emitter and collector and the output will be clamped to 4.7V as well?

Finally I'd like to know how R1/R2/R3 have been determined.

Can someone explain if my understandings so far are correct and how Q1/R1/R2/R3/D9 fit into this story?

Many Thanks,

Re: Can someone explain how the master interface works?

Posted: Sun Dec 18, 2016 10:25 pm
by hvxl
When OK1A is not active, the voltage provided by the boiler is pulled down to a level determined by D8, Q1, D10 and D5 (or D7, Q1, D10 and D6 if the wires to the boiler are reversed). D8 and D5 (or D7 and D6) each cause a voltage drop of around 0.7V, Q1 0.6V and D10 15V. Adding all of that together results in 17V across X2.

When OK1A is active, D10 is bypassed via OK1A (0.2V) and D11 (4.3V), resulting in 6.5V across X2.

Without R1, only the base current of Q1 would run through D10. That's only a few microamps. However, a zener needs a few milliamps to be able to regulate the voltage to its advertised value. That's what R1 takes care of. As you correctly observed, the PN junction of Q1 works as a diode. A PN junction implemented in silicon causes a voltage drop of 0.6 to 0.7V. Such a voltage drop across a 330 Ohm resister means a current of around 2mA will run through the resistor, and then also through D10.

If your expectation that D9 clamps the output signal were to happen, the voltage at the emitter of Q1 would be too low for current to flow from E to B and the transistor would switch off. So the voltage at the emitter rises just enough for a small current to flow to the base. This means that Q1 is operating in its linear range and doesn't go into saturation. In that case there is some voltage across E/C of Q1.

The value for R2 is calculated such that current values representing 0 do not cause a voltage across R2 that exceeds the point where the LED in OK1B starts glowing (1.2 V) and values representing 1 do. The maximum current for a 0 is 9mA. As explained earlier, 2mA is redirected through R1, so 7mA is left. 7mA through 100 Ohm results in 0.7V. The minimum current for a 1 is 17 mA. (17mA - 2mA) * 100 Ohm = 1.5V.

The voltage across R2 won't actually exceed 1.2V. Any excess current will just go through OK1B. So, with 1.2V across R2, 12mA goes that way. The other 3mA flows through OK1B.

D9 and R3 keep the current going through OK1B in check. As the current from the collector of Q1 reaches 16mA, you get 3.5V across R3 and 1.2V across R2. Any additional current gets siphoned off through D9. That way the current through the LED of OK1B will be between 3 and 4 mA. Using a limited current range means that timing will be reasonably consistent. Allowing bigger currents through the OK1B LED could drive the phototransistor into saturation, making it slow to switch off.

I hope that clarifies things a bit for you.