Many model railroaders would benefit from using smartphones as Throttles, but most are not computer experts, and may be intimidated by the setup required. To lower this bar, I've preconfigured everything needed to get started, and provide the software free of charge.
First, start with the tiny RaspberryPi computer ($35). Download my preconfigured image to the SD card. Then simply turn on main power, and the RPi will start up and load JMRI, scanning for your layout hardware connection. It will also start up a dedicated wireless network from the RPi. Within 60 seconds, you can connect your phone(s) or pad(s) to the RPi's Wifi and start running trains! The RPi needs no screen, keyboard or mouse, so it can stay nicely out of the way under the layout, or in your electronics box.
Below are the details of how to get your own JMRI RPi access point for Withrottle devices:
|RaspberryPi Model 3||Newark|
|5V 2.5A Power Supply w/ MicroUSB Cable||NewEgg|
|8Gb MicroSD memory card||NewEgg|
|RPi Case with Lid
I have created an image file which contains all software and config needed to autostart JMRI PanelPro on the RPi, as an access point, with Withrottle, Web Server and LoconetOverTCP server included. Also included is remote access to the RPi via ssh (command line) and to the RPi "desktop" via VNCServer (at port ::5900)
Download the zipped image file [here] (1.3Gb, updated April 25, 2018).
The image features:
- AutoIdentify of attached hardware (Locobuffer-USB, PR3, SPROG, LENZ USB, NCE Serial, NCE USB, DCC++)
- Autostart of PanelPro with WiThrottle and Web Server.
- Access to GUI desktop via attached monitor or remotely via VNC client
- Creates network access point for device connection, or can be plugged into existing network
- Support for defining GPIO Pins as JMRI Sensors and Turnouts
- Latest Raspbian Stretch image
- Secure file access via SCP or Windows file share. You can also upload roster files and icons via the JMRI web server.
To use: Downloaded and unzip the file, then use Win32DiskImager or Etcher to write the .img file to your SD card. Alternative for Mac described [here].
Contact me [here] if you have any questions, or to let me know how the image works for you.
Once you've assembled the hardware and installed the image, connect your RPi to your layout via PR3, LocoBuffer-USB, NCE Serial, NCE USB, LENZ USB, SPROG or DCC++, and plug in the RPi's power adapter. You should see some LEDs on the RPi begin to blink, and shortly, using your wifi-capable phone, you'll see a WiFi network named "RPi-JMRI". Select it and enter "rpI-jmri" when prompted for the key (note that 3rd character is a capital "eye"). Open EngineDriver on your phone, and you should have an available connection under Discovered Servers called "RPi-JMRI". (Similar with WiThrottle on iPhone). Enter loco address and run trains!
Remote copy of JMRI
JMRI provides some excellent tools for "sharing" a physical connection to your layout. One of these is the LoconetOverTCP server (Digitrax-only). To use this, connect a separate computer to the RPi-JMRI wifi network. Start JMRI, and in Connections, specify Digitrax, LocoNetOverTCP LbServer. Enter the RPI's address "192.168.6.1", Save and restart. When JMRI comes up, you will be running a full copy of JMRI, with full-screen access to decoder programming, panels, etc.
The RPi is always at "RPi-JMRI.local" and running Vncserver, so you can use TightVNC Client to access the desktop (use address RPi-JMRI.local::5900). Via the desktop, you can easily change and save settings in JMRI PanelPro. Double-click the "Disable AutoIdentify" if you'd like your RPi to always use the last profile.
You can also use remote access tools like Putty and WinSCP for command line and file access, for tasks such as copying your roster and panel files over to the RPi. (user is "pi", all passwords are "rpI-jmri", 3rd char is a capital "eye"). Put these files in the /home/pi/JMRI_UserFiles folder.
Note: the following section is for information only, and is not needed to use the RPi-JMRI image. It describes the steps I have already taken in the image provided.
Started with a standard RaspberryPi Raspbian Stretch image, which includes Java 8.
Installed hostapd, dnsmasq and avahi-daemon using "sudo apt-get install hostapd dnsmasq avahi-daemon samba"
Set static address for wlan0 in /etc/network/interfaces (to 192.168.6.1) Leave eth0 using dhcp.
Set matching address range in /etc/dnsmasq.conf (192.168.6.50 - 192.168.6.99)
Configure hostapd in /etc/hostapd/hostapd.conf with SSID name and password.
Set hostname and password using "sudo raspi-config".
The name is broadcast as "RPi-JMRI.local". This can be useful to identify the RPi on a wired network, handy for troubleshooting wifi problems.
Set up samba share to JMRI_UserFiles folder in /etc/samba/smb.conf, run "smbpasswd -a pi" and set the samba password. This provides access from windows explorer as "\\RPi-JMRI", and also causes wins to resolve that name to an ip address.
Set the vnc password using "sudo vncpasswd -system"
To provide external access to the session.log file, I added a soft link in JMRI_UserFiles "ln -s /home/vnc/.jmri/log/ log". This can now be accessed as "http://RPi-JMRI.local:12080/prefs/log/session.log" from any connected browser.
Connect to the RPi using TightVNC Viewer or similar. Using the RPi's browser, download the desired Linux version of JMRI from JMRI.org, and extract it to /home/pi/JMRI on the RPi. Start a terminal session, and run ~/JMRI/PanelPro. Set WiThrottle to autostart on port 12090 (default), and the JMRI Web Server to autostart on port 12080 (default). Set up connections as needed, saving profiles for several popular hardware connections: PR3, LocoBuffer-USB, NCE Serial, NCE USB, SPROG or DCC++.
To load PanelPro at desktop startup, I ran:
ln -s /home/pi/Desktop/PanelPro_autoIdentify.desktop /home/pi/.config/autostart/PanelPro_autoIdentify.desktop
PanelPro_autoIdentify.sh is a shell script which attempts to open PanelPro with the correct profile, based on identifying the attached hardware. To bypass this and have PanelPro always start with your last profile, double-click the desktop icon "Disable AutoIdentify".
To enable use of the RaspberryPi's GPIO pins [details here], I appended the following line to /home/pi/.profile:
and added the following value to /home/pi/.jmri/jmri.conf