Trolley Software
Click to expand
The software has basically 3 parts: Drivers, Configuration, and Program. The drivers are all of the software packages which are needed in order for the program to work. The configuration is what you'll need to change in order to let the program know how your environment is setup. And, of course, the program is the core software component that drives the train based on the configuration.
Basic Instructions:
Drivers: Please install all of the drivers listed on this page: [click here]
Clone the trolley program from GitHub: [click here]
Configuration:
First, setup the bin folder on your Raspberry Pi:
$ mkdir ~/binNext, copy the scripts from the GitHub repo "/scripts" folder to ~/bin
$ cd [trolley1 repo]/scripts
$ cp * ~/binNext, setup your environment using the commands shown below. In the scripts folder, you'll see a file named "env.pitrain.sh". What you need to do is copy this to env.$MYHOST.sh, where $MYHOST is the host name or ip address of your RPi.
$ MYHOST=`hostname -s`
$ cp env.pitrain.com env.$MYHOST.sh
$ vi env.$MYHOST.sh
Next, edit the new file and set the values to match how you wired up your system.
Program: The program can be compiled and published in one step using the publish.sh, but if you're just wanting to compile locally to flush out syntax issues or something, then you can use make.
Compiling without publishing:
$ make clean && makePublishing will recompile the source and then copy the binary to the target location (hostname:~/bin). Creating ssh keys will allow this process to occur without needing to type in passwords. The program was designed to allow you to use one beefy RPi to do the editing/compiling on while using a less powerful RPi for the train controller, but it can all be done on a a single RPi. The publish.sh takes one argument which can be either the hostname of the target pi (or ip address) or the userid@hostname. Examples:
$ ./publish pi@192.168.1.35
or
$ ./publish localhost
Publishing only copies the streecar binary.
Note that as of 2/20/2023, the streetcar program does not control the OE pin on the txs0108e or the OE pin on the pca9685. You can leave the OE pin on the pca9685 disconnected if you want to, but the OE pin on the txs0108e must be either connected to 3.3v or connected as shown in the circuit diagram and then preset to high before executing the streetcar binary.