Automotive link uses single wire
In the automotive industry, in which the goal is to produce cars with simpler, lighter wiring looms, any interface that uses just one wire instead of two offers a distinct advantage. The circuit in Figure 1 implements a bidirectional link using a single wire, with the car's chassis or ground conductor providing a negative return path. The microcontroller communicates with the driver of the car by illuminating LED1. The driver communicates by operating switch S1. Detecting the switch closure requires no current sensing: The circuit simply exploits the fact that the forward voltage drop of a properly biased LED is usually two or three times the VBE of a bipolar transistor. Q1, LED2, and Q2 form a semiprecision current source. Q3 in the receiver path detects the switch closure. When the microcontroller's TX pin goes high, Q2 illuminates LED2 and biases Q1 on. Q1 sources a constant current to LED1 via R2 and D1.
LED2 constitutes an inexpensive but effective voltage reference, which imposes a constant voltage across current-setting resistor R1. Provided that you choose R3's value to suit Q2's base drive, you can set the current in LED2 and the voltage across it to fairly precise and constant values. For example, with R3=430Ω, the current in LED2 is approximately 10 mA with 5V at Q2's base (TX high). If you use a device such as the HLMP-1000 for LED2, its forward voltage remains constant at approximately 1.6V, putting approximately 0.9V across R1. The resulting 20 mA or so flowing in Q1 provides adequate brightness for LED1 and remains acceptably constant with changes in VB or temperature.
With S1 open, R6 biases Q3 on, pulling the receiver pin, RX, low. RX remains low, regardless of whether LED1 is on. When the switch closes, the values for R4 and R6 ensure that Q3's base pulls down to approximately 150 mV (with VS=5V), thereby turning off Q3 and allowing RX to go high. As long as the switch remains closed, RX stays high, whatever the state of the TX pin. Powering the current source directly from the car's battery voltage, VB, rather than from the microcontroller's supply, not only relieves the burden on the low-voltage regulator, but also ensures that LED1 receives proper bias, even with a very low value for VS. Thus, provided that R3, R4, and R6 have appropriate values, the circuit functions with VS as low as 3V or even lower. A further advantage is that you can replace LED1 with several LEDs connected in series. With VB=12V, the current source has adequate compliance to drive four or five LEDs.
R2 is a nonessential component, but it reduces the power consumption in Q1. D1 provides positive overvoltage protection for the current source, and voltage-suppressor D2 can protect against the harmful transients that systems often encounter in the harsh automotive environment. C2 with R4 provides a degree of noise filtering and has negligible effect on the switching of Q3. You may need C1 and R5 to roll off Q2's frequency response to avoid the possibility of high-frequency oscillation. The transistor types are not critical; most devices with respectable current gain and adequate power rating are satisfactory. LED2 provides a triple function. As well as acting as a voltage reference for the current source, it also provides local indication of the external LED status by illuminating in synchronism with LED1. Additionally, it provides open-circuit (broken-wire) indication by turning off completely (even when TX is high) if the connection between D1 and the external LED breaks—a feature that may be useful for troubleshooting purposes. In the event of a broken wire, little collector current flows in Q1, and its base-emitter junction shunts LED2; provided that R1 is much smaller than R3, the shunt steals LED2's bias current, thereby turning it off. Although the circuit was developed for an automotive product, you could easily adapt it for use in other applications in which a simple user interface must operate on a single line.