JMRI on Raspberry Pi

I have finalized my DCC system. As previously mentioned I have built a DCC++ Base Station per the instructions found on the DCC++ YouTube site and other resources on the web. On my blog I have lots of links and how to’s for that. To run DCC++ you either have to use the software that was developed for it or use JMRI. I chose JMRI. Instead of running it on my lap top I wanted a dedicated computer for it so I invested in a Raspberry Pi. A Pi, is a very small credit card sized board designed to run a version of Linux. No worries, no Linux knowledge is needed. Steve Todd has it all done for you and a visit to his site will get you what you need to set it up.

https://mstevetodd.com/jmri-raspberrypi-access-point

I went another way. I wanted to document the procedure start to finish for my own pleasure and so I started with a brand new installation of the Raspbian Operating System. Below I will detail that procedure out. It got complicated because the latest OS is a little different than previous versions and the procedure to change it to an Access Point is different. I have shown step by step what I have done for anyone wanting to repeat my process.

I began by downloading the latest version of NOOBS (New Out Of the Box Software) for the Raspberry Pi. (12/9/17) this file contains the latest version of the Raspian operating system for the Pi. I am using a Raspberry Pi 3 mounted in a plastic case.

Once downloaded, NOOBS was loaded on the micro SD card and the simple instructions were followed from https://www.raspberrypi.org/learning/software-guide/ This provided me with a fresh, clean install of the operating system.

With the operating system installed, I installed JMRI following the instructions as found at: http://jmri.org/install/Raspbian.shtml

  • Setup JMRI to connect to my DCC++ Base Station
  • Copied Roster from PC to JMRI with USB stick.
    • Exported Roster on PC
    • Imported Roster on Pi
  • Renamed from MyJMRIRailroad to West Haven Industrial via Edit/Preferences/Railroad Name
  • Run DecoderPro at Startup
    • In a terminal open the session autostart file:
      sudo nano /home/pi/.config/lxsession/LXDE-pi/autostart
    • Add the following line, with the path to the location where you installed DecoderPro:
      @/home/pi/JMRI/DecoderPro
    • Save the file and quit the editor.
  • Set WiThrottle Server to open at startup via Edit/Preferences/Start Up/Start WiThrottle Server
  • Set JMRI to turn on track power at startup via Edit/Preferences/Start Up/Power Button
  • Setup VNC to allow remote access and control
  • Setup Pi as Access Point
    • NOTE: Raspbian Stretch works differently than most of the tutorials on the internet… Follow instructions below:
    • Download and install DNS and AP software packages:
      sudo apt-get install dnsmasq hostapd
    • Edit the dhcpcd.conf file:
      sudo nano /etc/dhcpcd.conf
      add the following:
      interface wlan0
      static ip_address=192.168.6.1/24
      static routers=192.168.6.1
      static domain_name_servers=8.8.8.8denyinterfaces wlan0
    • Edit dnsmasq.conf file:
      sudo nano /etc/dnsmasq.conf
      interface=wlan0
      domain-needed
      bogus-priv
      dhcp-range=192.168.4.8,192.168.4.250,12h
      dhcp-option=252,”\n”
    • Edit /etc/hostapd/hostapd.conf
      sudo nano /etc/hostapd/hostapd.conf
      interface=wlan0
      driver=nl80211
      ssid=westhaven
      hw_mode=g
      channel=6
      ieee80211n=1
      wmm_enabled=1
      macaddr_acl=0
      auth_algs=3
      ignore_broadcast_ssid=0
      wpa=3
      wpa_key_mgmt=WPA-PSK
      wpa_passphrase=xxxxxxxx
      wpa_pairwise=TKIP
      rsn_pairwise=CCMP
      eap_reauth_period=360000000
    • Edit /etc/default/hostapd
      sudo nano /etc/default/hostapd
      DAEMON_CONF=”/etc/hostapd/hostapd.conf”
    • Start the services:
      sudo service hostapd start
      sudo service dnsmasq start
    • Reboot the Pi
  • You can now access the westhaven network via WiThrottle  and VNC

Again, none of this is necessary as the image from Steve Todd does ALL the configuration for you. This is just for the DIY crowd using the latest version of the Pi OS.

With everything up and running, I wanted to try attaching my MERG Booster to the system. This was an easy thing to do. Track output of the DCC++ to the DCC IN on the booster. Power up the Pi and the DCC++ Base Station, then power up the booster. I was running trains in 5 minutes. See my comments on the MERG Booster for more information.

Now I have a complete 5Amp DCC system and it cost me less than $200 Canadian. The booster with power supply worked out to $62. The DCC++ Base Station was less than $20 and the rest is the Pi, memory card and its associated power supply. I bought a kit but the individual components are available cheaper.

One thought on “JMRI on Raspberry Pi

  1. My experience using Steve Todd’s excellent JMRI image for Raspberry Pi was that I still needed to do the following step to get everything working as it should:
    Set JMRI to turn on track power at startup via Edit/Preferences/Start Up/Power Button

    Thankfully I found the solution to my problem on your site!

    Liked by 1 person

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s