using jmri & withrottle - trainweb.org

33
Using JMRI & WiThrottle Jonathan Miner Seacoast NMRA Meeting October 17, 2015 Updated October 31, 2015 http://www.trainweb.org/cmrc/docs/jmri_withrottle.pdf Email: [email protected]

Upload: others

Post on 02-Jan-2022

7 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Using JMRI & WiThrottle - TrainWeb.org

Using JMRI & WiThrottle

Jonathan MinerSeacoast NMRA Meeting

October 17, 2015Updated October 31, 2015

http://www.trainweb.org/cmrc/docs/jmri_withrottle.pdfEmail: [email protected]

Page 2: Using JMRI & WiThrottle - TrainWeb.org

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

Page 3: Using JMRI & WiThrottle - TrainWeb.org

What Can JMRI Do?

● Program Decoders● Build Control Panels● Control signals, animation, etc...● Act as a “virtual throttle”

Page 4: Using JMRI & WiThrottle - TrainWeb.org

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

Page 5: Using JMRI & WiThrottle - TrainWeb.org

Overall View

PhoneWiFi

Router

ComputerRunning

JMRIDCC

Internet

Needed during install. Optional for JMRI usage.

Page 6: Using JMRI & WiThrottle - TrainWeb.org

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?

Page 7: Using JMRI & WiThrottle - TrainWeb.org

My Layout

● 20x30 HO Scale● Six Operators

$1500 to include wireless throttles plus

receivers?

Page 8: Using JMRI & WiThrottle - TrainWeb.org

My Layout

● For $1500, I could easily purchase a computer, and WiFi Access Point

● But what if you could do it for under $100?

Page 9: Using JMRI & WiThrottle - TrainWeb.org

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.

Page 10: Using JMRI & WiThrottle - TrainWeb.org

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.

Page 11: Using JMRI & WiThrottle - TrainWeb.org

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.

Page 12: Using JMRI & WiThrottle - TrainWeb.org

Setup RASPBIAN

● Download from:● https://www.raspberrypi.org/downloads/raspbian/

● As of this writing… 2015­09­24­raspian­jessie.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 apt­get update

– sudo apt­get upgrade

– sudo reboot After downloading,

these steps take about 30 minutes.

Page 13: Using JMRI & WiThrottle - TrainWeb.org

Update Firmware

● Update the firmware– sudo rpi­update

– sudo reboot

Takes about 5 minutes.

Page 14: Using JMRI & WiThrottle - TrainWeb.org

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.

Page 15: Using JMRI & WiThrottle - TrainWeb.org

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!

Page 16: Using JMRI & WiThrottle - TrainWeb.org

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 update­alternatives ­­config java

Takes 15 minutes or so…

depends on download speeds.

Page 17: Using JMRI & WiThrottle - TrainWeb.org

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

Page 18: Using JMRI & WiThrottle - TrainWeb.org

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!

Page 19: Using JMRI & WiThrottle - TrainWeb.org

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.

Page 20: Using JMRI & WiThrottle - TrainWeb.org

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.

Page 21: Using JMRI & WiThrottle - TrainWeb.org

Run Trains!

● Select locos by decoder address, or● Browse and select via roster entries

Page 22: Using JMRI & WiThrottle - TrainWeb.org

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.

Page 23: Using JMRI & WiThrottle - TrainWeb.org

Real World Experience

● Once an operator learns how to use their phone, they don't need to know the brand of the DCC system

Page 24: Using JMRI & WiThrottle - TrainWeb.org

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.

Page 25: Using JMRI & WiThrottle - TrainWeb.org

Enable WiThrottle Server

Page 26: Using JMRI & WiThrottle - TrainWeb.org

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.

Page 27: Using JMRI & WiThrottle - TrainWeb.org

NCE/Serial Parts List

● TraintekLLC.com– ESU 51952 USB/Serial (ESU-51952)

No guarantees! No guarantees! Your mileage Your mileage

may vary.may vary.

Page 28: Using JMRI & WiThrottle - TrainWeb.org

Digitrax/Loconet Parts List

● RR-CirKits.com– LocoBuffer-USB

No guarantees! No guarantees! Your mileage Your mileage

may vary.may vary.

Page 29: Using JMRI & WiThrottle - TrainWeb.org

Upgrade 4.0 to 4.0.1

● Copy software to the Raspberry Pi– scp JMRI.4.0.1­r29956.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.1­r29956.tgz

– Go back to the slide about RxTx library

No guarantees! No guarantees! Your mileage Your mileage

may vary.may vary.

Page 30: Using JMRI & WiThrottle - TrainWeb.org

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

Page 31: Using JMRI & WiThrottle - TrainWeb.org

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

Page 32: Using JMRI & WiThrottle - TrainWeb.org

USB - LocoBuffer

Raspberry Pi

Digitrax LocoBus

JMRI

Ethernet

WiFi Router

AppleiPod / iPhone

WiThrottle

AndroidEngineDriver

Raspberry Pi working with WiFi Router

Depends on DCC system

Page 33: Using JMRI & WiThrottle - TrainWeb.org

Raspberry Pi

NCE Command Station

JMRI

Raspberry Pi with NCESerial