Steve Todd's JMRI Raspberry Pi as an Access Point

Link to Steve Todd's Web Site

Parts for JMRI RaspberryPi

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 ($34.49). Download my free, preconfigured image to your 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 30 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 [photo].  

Below are the details of how to get your own JMRI RaspberryPi access point for EngineDriver and WiThrottle devices:


Raspberry Pi Computer and Related Equipment Needed Purchase Price
RaspberryPi 3 Model B+ Arrow $34.49
Smraza Acrylic Case w/5V 3A Power Supply, Fan & Heat Sinks Amazon Prime $14.99
SanDisk Extreme PRO microSDHC 32Gb Memory Card Plus SD Adapter Amazon Prime $17.86
HP USB 3 Button Optical Mouse Amazon Prime $12.29
Amazon Basics Wired Keyboard Amazon Prime $13.78
RELM HDMI Cord - 6 Feet High-Speed Ethernet Cable Amazon Prime $9.99
Total  (above items)    $103.40
Get an HDMI Ready TV -or- Use One you Already Have Purchase Price
Pyle 15.6-Inch 1080p LED TV,| Ultra HD  (Any HDMI Equipped TV)  Amazon Prime $119.99
One Loconet to USB Interface  (If Your DCC System Lacks This Functionality) Purchase Price
Digitrax PR4 USB to LocoNet Interface  (if no interface on current system) $69.95
RR-CirKits LB-USB LocoBuffer-USB  (if no interface on current system) $69.95
This is a Handy Optional Device to Manage Various SD Cards/USB Sticks Purchase Price
Anker 8-in-1 USB 3.0 Portable Card Reader  (optional)  Amazon Prime $10.99

Software Image

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 Server, Web Server and LoconetOverTCP (or JMRI Simple) 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 January 3, 2019), or an earlier zipped image file [here] (1.3Gb, updated April 25, 2018). NOTE: Ignore the "too large to scan" warnings and click "Download".
The image features: 

To use: From a Windows computer or Mac, download and unzip the file, then use Win32DiskImager or Etcher to write the .img file to your SD card, place the card in your RPi, connect your DCC hardware, and power the RPi on.
Contact me [here] if you have any questions, or to let me know how the image works for you.

Running Trains

Once you've assembled the hardware and installed the image, connect your RPi to your layout via your system's USB or serial connector, then 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 named "RPi-JMRI [connection name]".  (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 "", 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.

For non-Digitrax layouts, follow the above steps, but specify JMRI Simple Server (Note: this server has some limitations).

Optional Features

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 for command line, and WinSCP or Windows file sharing [screenshot] for 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. You can also upload your roster files using the JMRI Web Server's Roster page [screenshot].

For more advanced modifications to your RPi-JMRI image, see [this page].

Software Details

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 the June 2018 RaspberryPi Raspbian Stretch image, which includes Java 8.  
Installed hostapd, dnsmasq and samba using "sudo apt-get install hostapd dnsmasq samba
Set static address for wlan0 in /etc/dhcpcd.conf (to and disabled wpa_supplicant for wlan0
Set matching address range  in /etc/dnsmasq.conf ( -
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 "sudo 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"

Connect to the RPi using TightVNC Viewer or similar. Using the RPi's browser, download the desired Linux version of JMRI from, 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 the User Files location to /home/pi/JMRI_UserFiles. Set up connections as needed, saving profiles for several popular hardware connections: PR3, LocoBuffer-USB, NCE Serial, NCE USB, SPROG, EasyDCC Serial, MERG USB, MRC Prodigy or DCC++. Each has a unique "railroad name", which is shown as the Discovered Server name, this is useful for verifying your connection.

To provide external access to the JMRI log files, ran 
ln -s /home/pi/.jmri/log/ /home/pi/JMRI_UserFiles/log
Log can now be accessed as "http://RPi-JMRI.local:12080/prefs/log/session.log" from any connected browser.

To load PanelPro at desktop startup, I ran:
mkdir /home/pi/.config/autostart
ln -s /home/pi/Desktop/PanelPro_autoIdentify.desktop /home/pi/.config/autostart/PanelPro_autoIdentify.desktop 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

To minimize the size of downloadable image, I do a bit of cleanup and set all unused space to zeroes. This helps (a lot) with the compression. Here's my cleanup script



updated January 8, 2019