Jump to content

Raspberry Pi Turnout Signals


Recommended Posts

A while ago I mentioned that I was working on a project to use a raspberry pi for some signal lights for my turnouts.

 

Long story short... I've bought a house, and the DC system isn't going to be needed anymore since I'm moving to DCC.

 

I'll put up what I had managed to do up to this point in this thread.

Attachment 1: traffic.fzz  http://www.oboe.serveftp.com/traffic.fzz  (You'll need Fritzing from http://fritzing.org to open the file)

This file has the breadboard config, and a partially completed schematic.

 

You'll notice that I've Five groups of terminals.  The really long is for connecting to the LEDs.  The 6 terminal one is connected to the frogs on my turnouts.  The 4 terminal is two lines from my power packs. The 3 terminal for power and common ground.  Finally the 2 terminal for the serial lines to the Raspberry Pi.

 

I've got 2 MPC23017 digital GPIO expanders configured here.  The Raspberry Pi didn't have enough GPIO ports for the number of LEDS I wanted to run.  So I figured I'd get two GPIO expanders and created a separate protoboard.

 

I have a number of npn transistors, these are connected to the turnout frogs and the power packs.  They figure out what the polarity is, so the signals change when the turnout is thrown or when the power pack polarity changes.

 

Attachement 2:  light1.py http://www.oboe.serveftp.com/light1.py

 

Each LED has it's own program - I figured this would make them easier to manage and debug.  The code itself I took from the Adafruit tutorial for the MPC23017, and modified the bottom bits to work the way I want it to.

It's mostly detecting current from the inputs, and adjusting the outputs.

 

I only started doing electronics last year, and it just keeps getting more and more interesting :)

Link to comment

Probably.  But I already had it, figured I should use it for something.  My wife wants to build a weather station, it'll probably end up driving that.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...