Get free access to our online edition!

From the Q&A

With TJ Byers


RR Roundhouse Controller

Question:

I need a circuit that will display a number on a seven-segment LCD between 0 and 9. The number represents which track on my HO scale train roundhouse has power to it. As I turn a single pole 10-position rotary switch, I want the LCD to indicate which track is live. The track runs on AC power and the voltage varies from 0 to about 13 volts.

Greg Harris


Answer:

At first I thought of adding a digital pulse atop the AC that would indicate the active track. But then I remembered DCC (Digital Command Control). DCC allows more than one locomotive to share the same track — each with different speeds - and it uses digital pulses. Which means there could be a conflict. I know your setup doesn't have DCC — but someday you might want it. So the only solution I can see is to use the rotary switch to activate relays — relays that activate the selected track — and decode the hot track from the voltage applied to the relay coil (Figure 6).

The design requires a 10-to-4 encoder (for the rotary switch), an inverter, and a BCD-to-seven-segment decoder. Whew, that's a mouthful of digi-talk. It means, we connect each relay to a separate input of a 10-to-4 encoder — which changes it to a BCD code. The 74HCT147 performs the decimal-to-BCD translation. From here, a seven-segment LCD driver — a 74HC4543 — displays a number that represents the active track.

Unfortunately, the logic is backwards for the 74HC4543 inputs — so an inverter is needed. I decided on a hex 4049 because it allows me to generate a square wave (via the two leftover gates) that's needed for the LCD display. As for the  relays, make sure they can handle the voltage and amps you need to feed the roundhouse. I don't think a reverse diode (1N4001) across the relay coil is needed — the input of the 74HCT147 is diode protected — but it might be a good idea to include one anyway.


Comments