Skip to content

iotitan/train-signal-controller

Repository files navigation

Train Signal Controller

Directory Structure:

  • ./3d: 3D printable models to replace existing (e.g. better suited) or missing parts.
  • ./arduino: Per-signal Arduino software that reads signals from the train signal web API.
  • ./assets: Images used for the project.
  • ./LocalTrainCTC: [OUT OF DATE] An Android phone app to send state change commands to the signal.
  • ./photos: Before/after photos of specific signals.
  • ./TrainSignalApi: A Java servlet application that runs on the server. This software is responsible for both serving the web API and listening for connections from the SignalConsumer.
    • This can be built using Apache Ant with Ivy using the build.xml file in this directory. The generated .war file can be found in the "out" directory.
  • ./web: A simple web application to interact with the signal. This interface is preferred over the Android app.

Architecture:

The TrainSignalApi is always listening for connections from the SignalConsumer. If the connection is interrupted, the SignalConsumer will attempt to establish a new connection. The server is only capable of hosting a single connection to a signal, so when a new connection is requested (due to interruption or otherwise), the existing connection will be dropped to host the new one. The SignalConsumer has a delay of 2.5 seconds after receiving a command before processing the next, giving it time to physically change.

API:

TrainSignalApi/api?color=COLOR&lamp=LAMPSTATE

  • COLOR: One of the following:

    • r: Change the signal to red.
    • y: Change the signal to yellow.
    • g: Change the signal to green.
  • LAMPSTATE: One of the following:

    • 0: Turn the lamp off.
    • b: Blink the lamp (this needs to be implemented in hardware).
    • 1: Turn the lamp on.

Hardware:

  • Arduino UNO: The microcontroller that lives in the train signal.
  • Arduino ethernet shield: Used to receive commands from the network.
  • Power supply: 12V and at least 3A depending on number of lamps.
  • Relay board: Used to switch larger power supply.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published