Skip to content

jakee417/Pi-Train-Switching

Repository files navigation

Control Lionel Switches with a Raspberry Pi Zero 2 W and Servos!

This project demonstrates how to control Lionel Train Switches from a Raspberry Pi (RPi).

Diagram

Necessary Hardware

Lionel Manual Switches

or

Lionel Remote Switches

Hardware Setup

Lionel Manual Switches

Lionel Remote Switches

System Services

Since our project relies upon the pigpiod pin factory, start this daemon:

sudo systemctl enable pigpiod

Installation

cd ~
git clone https://github.com/jakee417/Pi-Train-Switching.git
cd Pi-Train-Switching
# Now run the setup helper
./install.sh

And uninstall with,

./uninstall.sh

If this fails due to a User Service, then ensure this line,

export XDG_RUNTIME_DIR=/run/user/$(id -u)

is found in the ~/.bashrc file followed by a system reboot, sudo reboot. This error is commonly caused when developing from a ssh connection.

Viewing the Web Server

  • First, ensure the RPi and client machine (laptop, cellphone tablet, etc.) are on the same WiFi network.
  • On your client machine browse to http://raspberrypi.local:5000. If you have a custom hostname, replace rasberrypi with your custom hostname.
  • Alternatively, on the RPi you can run,
ifconfig wlan0

You should see something like this (likely with a different inet value),

wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 10.0.0.204  netmask 255.255.255.0  broadcast 10.0.0.255
        ...

Browsing to the inet field with http://10.0.0.204:5000 will also allow you to view the web server.

About

Control Lionel Train Switches with Python and Flask

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published