I am starting to make my own N scale layout, which will eventually have trains running on Beeton Decoders, but before trains can move, communication packets fly, or even a status LED turn on, I need power, and controlled power at that.
Most layouts use mechanical switches to enable the systems built into the layout, but as I am already going to have a Raspberry Pi built into the layout to communicate with the trains, I may as well have full control within it as well. This will help bring model railroading to the modern era by having Python control the entire layout centrally, through the pi, rather than many individual switches, buttons, or other mechanical systems with a mess of wires below to do the same work.
With the use of an I2C bus, I can control relays that enable and disable the power to the layout, controlled by Python, and even have sectioned power, so for example, as the artificial sun sets over the horizon, the streetlights can click on.
Let's walk through the components that make this all possible:
TCA9554DB: The I2C to 8 IO expander. I chose this as I wanted 8 relays, 8 power channels of control, and easily expandable on the I2C bus. With changing the address of the chip, I could technically have up to 64 individually addressable power feeds. Even better, it is supported by Python with preexisting libraries already! I don't have to write it!
ULN2803CDWR: The logic amplifier. The 3.3V that I2C runs on is not enough to turn on relays, so these chips take the 3.3V logic level voltage, and sink current to enable relays, operating as switches on the load side of the relay coil. Think of them like a starter motor in a car, little power turns motor, which turns the big engine over.
Relays: These relays are the standard relays rated for 120V 10A at a minimum. They are ubiquitous, and you definitely interacted with them before. Anything that goes click when you turn it on-that's a relay.
Fuse holders: I designed this system to split power, and it eventually will become a smart breaker box under the layout, so I put fuses in it so I don't have to scatter fuses across the layout. They use standard 5mm by 20mm fuses. I hate crawling around under tables upside down, so collecting them all together in one spot is great for ease of access, testing and operation.
Removable connectors: I hate unscrewing wires upside down and the only thing worse than that is trying to screw wires in. These terminals allow for removal of the cable without unscrewing or desoldering, and just press-fit into their holders. Now I can pop the cable out, modify it at eye level, and then put it back in. Also works as a great way to confirm the channel I am working on is dead, as just unplugging it is a pretty definitive way to know.
The board is not cheap, due to the relays, fuses and connectors, but it is worth it. As of now, there is nothing on the market capable of doing this task. Until someone else builds one, I'll keep making what I need, and sharing it.
Comments
Log in to add a comment.