using jmri & withrottle - trainweb.org
TRANSCRIPT
Using JMRI & WiThrottle
Jonathan MinerSeacoast NMRA Meeting
October 17, 2015Updated October 31, 2015
http://www.trainweb.org/cmrc/docs/jmri_withrottle.pdfEmail: [email protected]
What is JMRI?
● JMRI is the Java Model Railroad Interface● Public Domain software – FREE!● Written in Java. Runs on Windows, Linux,
and Mac● Not tied to any single DCC system
What Can JMRI Do?
● Program Decoders● Build Control Panels● Control signals, animation, etc...● Act as a “virtual throttle”
Getting Started
● You need to have:– DCC System
– Computer
– Specific cable to connect between your DCC system and your computer
– WiFi Access Point
– Android or iOS device
Overall View
PhoneWiFi
Router
ComputerRunning
JMRIDCC
Internet
Needed during install. Optional for JMRI usage.
Basic Costs
PhoneWiFi
Router
ComputerRunning
JMRIDCC
InternetHow much have you paid for a wireless throttle from your DCC vendor?
How many visitors walk into your layout with a Smartphone?
My Layout
● 20x30 HO Scale● Six Operators
$1500 to include wireless throttles plus
receivers?
My Layout
● For $1500, I could easily purchase a computer, and WiFi Access Point
● But what if you could do it for under $100?
Raspberry Pi
● Wow... it's only $35● But, it's a quad core ARM processor aimed
at the hobbyist market● Runs Linux and Java● Widely used so you'll find lots of
documentation online.
Raspberry Pi (cont)
● Also need an SD card ($12), power supply ($8) and case ($8)
● And a WiFi adapter that can act as an Access Point ($20)
● Total hardware cost... with shipping, around $100
● Additional cost to interface with DCC command station depends on vendor.
Raspberry Pi Software
● RASPBIAN Linux● Java
– Make sure to use 1.8.x for JMRI 4.x
● JMRI● All freely down-loadable, thanks to the
Open Source Community.
Setup RASPBIAN
● Download from:● https://www.raspberrypi.org/downloads/raspbian/
● As of this writing… 20150924raspianjessie.zip● Follow directions to create micro SD card ● First task should be to update system via the Internet. Ensures you
have fixes and updates newer than the image you downloaded.– Username/Password: pi/raspberry
– sudo aptget update
– sudo aptget upgrade
– sudo reboot After downloading,
these steps take about 30 minutes.
Update Firmware
● Update the firmware– sudo rpiupdate
– sudo reboot
Takes about 5 minutes.
Setup Access Point
● See directions here:● https://learn.adafruit.com/setting-up-a-raspb
erry-pi-as-a-wifi-access-point/overview● This can be tricky, hopefully the directions
get updated for current versions.– Try the included version of hostapd first, only
follow the steps to update if that fails.
These steps can take about an
hour.
Setup Zeroconf
● Enables devices to automatically configure themselves
● Installed by default, no configuration needed.
Make sure you can connect via
WiFi before proceeding to install JMRI!
Setup JMRI
● Instructions available:– https://github.com/proffalken/JMR-Pi
● This completely sets up everything!– Username/Password: jmri/trains
● Need to select JDK-8– sudo updatealternatives config java
Takes 15 minutes or so…
depends on download speeds.
Setup RxTx Library
● JMRI-included version does not work with new RasPi-2 models
● Bug report and hints:– http://sourceforge.net/p/jmri/bugs/472/
● cd /opt/JMRI/lib/linux/armv7l
● sudo mv librxtxSerial.so librxtxSerial.so.jmri
● sudo ln s /usr/lib/jni/librxtxSerial.so
Librxtx is already
installed, just need to link to it
Setup Faceless Mode
● Set preferences via the GUI, ensure that JMRI works with your system.
● Then edit /etc/rc.local, and add:
● su jmri c “/opt/JMRI/JmriFaceless > /tmp/JmriFaceless.log” &
All on one line!
Security
● Have you ever had interference from another Club's wireless DCC system at a show?
● Like any computer and network system, security is a concern!
● Change default channels, passwords, etc.
Device Setup
● Android: EngineDriver● IOS: WiThrottle (or WiThrottle Lite)● Enable WiFi
– Connect to the network you created
● Autoconfiguration should work, or manually enter the IP Address and Port number.
Run Trains!
● Select locos by decoder address, or● Browse and select via roster entries
Real World Experience
● Can easily take my Raspberry Pi/Locobuffer to others' Digitrax layouts, and instantly add wireless capability to an operating session.
● Swap the Locobuffer for a USB/Serial cable and connect to the CMRC NCE system...
● At a show, no interference from other Clubs' wireless systems. Use a WiFi password to secure the network.
● Program on a separate machine, then use JMRI to export the roster entry, scp to the Raspberry Pi, then import with JMRI.
Real World Experience
● Once an operator learns how to use their phone, they don't need to know the brand of the DCC system
Some Downsides
● Debugging JMRI in “faceless” mode can be challenging
● Linux may not be for everyone... Windows setup should be similar.
● Changing pace of open-source development can fix some problems, cause others, documentation can be out of date.
Enable WiThrottle Server
Generic Parts List
● Newark.com– Raspberry Pi 2 B (sku: 38Y6467)
– Case (sku: 68X2067)
● AdaFruit.com– 8GB SD Card (PID: 1583, SID: 5.2.2)
– 5V 2A Power Supply (PID: 1995, SID: Pi.1)
– USB Wifi (PID: 1030, SID: 9.3.5)
No guarantees! No guarantees! Your mileage Your mileage
may vary.may vary.
NCE/Serial Parts List
● TraintekLLC.com– ESU 51952 USB/Serial (ESU-51952)
No guarantees! No guarantees! Your mileage Your mileage
may vary.may vary.
Digitrax/Loconet Parts List
● RR-CirKits.com– LocoBuffer-USB
No guarantees! No guarantees! Your mileage Your mileage
may vary.may vary.
Upgrade 4.0 to 4.0.1
● Copy software to the Raspberry Pi– scp JMRI.4.0.1r29956.tgz [email protected]:
● On the Raspberry Pi as jmri User– cd /opt
– tar czf ~/backup.tgz JMRI
– rm rf JMRI/*
– tar xzf ~/JMRI.4.0.1r29956.tgz
– Go back to the slide about RxTx library
No guarantees! No guarantees! Your mileage Your mileage
may vary.may vary.
Two Examples
● Raspberry Pi WiFi– SSID: NHML
– Password: nhmljmri
● JMRI– Address: 192.168.78.1
– Port: 12345
● Router WiFi– SSID: linksys
– Password:
● JMRI– Address: 192.168.1.100
– Port: 12345
USB - LocoBuffer
Raspberry Pi
Digitrax LocoBus
JMRI
hostap / DHCP
Wifi driver
802.11n - USB
AppleiPod / iPhone
WiThrottle
AndroidEngineDriver
Raspberry Pi working as WiFi Access Point
Depends on DCC system
USB - LocoBuffer
Raspberry Pi
Digitrax LocoBus
JMRI
Ethernet
WiFi Router
AppleiPod / iPhone
WiThrottle
AndroidEngineDriver
Raspberry Pi working with WiFi Router
Depends on DCC system
Raspberry Pi
NCE Command Station
JMRI
Raspberry Pi with NCESerial