Sunday, October 26, 2014

Anyone for Some Pi

As mentioned, our Raspberry Pi setup worked well at the recent model train show. In fact it ran well all weekend. We sort of expected that, as we have after all been using JMRI software for about 2-3 years now to wirelessly control trains. This show we just happened to cutover to using a Raspberry Pi instead of a clunky old laptop computer.


To help with running a Raspberry Pi (R-Pi) setup, you need a way to turn it off at the end of the day, and as usual there are any number of ways of doing it. The R-Pi doesn’t actually come with a button that says “Power Off”, and as with all computers, you need to shut them down correctly so that they always work for you when you turn them back on. We also don’t have a keyboard and mouse attached, as we are running in a minimal setup and hence running “headless”.

One way is of course to use an application on your phone or tablet to remote control into the R-Pi such as something like “Putty” so that you can SSH into the R-Pi to then issue a command to shut down. I have found one such app for Android devices called “ConnectBot”. I find it works quite well. If using this app, you would connect into your R-Pi and then issue a command such as “sudo shutdown –h now” to turn off the R-Pi at the end of the day. You’d then wait about 3 minutes after doing this and then turn off all the power switches.

But the best way so far we have found (Peter A in the club, pat yourself on the back) is to use an app called “SSH Button” for Android devices. 

This allows you to setup a series of commands in advance, on your Android device. Each command sequence also has the username and password embedded in it so that all you have to do is press the “button” on you Android device to make it happen. See this picture of my cheap Android phone I bought to drive trains with. Here we see 3 “buttons” I have setup so far. I can shut down the HO guys Raspberry Pi, also the N scale one as well as rebooting the N scale one. The command I used to shut down the R-Pi is of course the same as above – “sudo shutdown –h now”. But now I just press the button, wait 5 seconds and you get a small message back saying “ok” and the R-Pi starts to shut itself down – voila. Here is a screenshot of my phone with some buttons setup already:


By the way, while we are talking about Pi, the HO bunch now have a Raspberry Pi. I have finalise its setup and it has been trialled on a number of Wednesdays and Saturdays and of course functions well on the new permanent HO layout. I just now need to build a small wood shelf under the NCE DCC system to position the components for their final home and write the instructions on turning it on and turning it off.

On the subject of turning on and off, maybe for the club we might purchase a simple phone to use as a shutdown device with the above “SSH Button” app, for all the club Raspberry Pi’s. I did try the other day to use the club computer in the office, but with all the steel walls everywhere, there was bugger all wireless reception in there and hence I couldn’t connect to the layouts Raspberry Pi. The future will see.

Now on the topic of Pi, spotted the other day by Peter A in the club, was a new version of the app called “Engine Driver” for use on Android devices. For anyone familiar with driving trains by using your phone and the JMRI software, Engine Drive is what sits on your phone and allows you to drive your train(s).

The latest version was just released on the 22nd October and has a great new feature. Well, here are the updates anyway:

Adjusted speed step handling to restore proper AUTO speed behaviour
New pref to stop locos when phone goes off hook
New pref to hide speed slider, making a button-only throttle

The great new feature is the third one. So here is what you do – first download and install this latest version. Next you go into the preferences side of things for this app and tick the new feature called “Hide Speed Slider” – here, I’ll show you:


What this does is make it so you only get the left and right hand speed adjustment arrows and no slider in between. I am always adjusting too far or fast, so this allows me to ONLY adjust in smaller increments. These increments, by the way, are adjustable as per normal in the preferences area. So now I have better control of the loco and am much less likely to stuff it up with my big fat fingers.

The next photo shows the new look on the right and the old look on the left – so as our friend Aleksandr says - simples!


Wednesday, September 24, 2014

No wonder Microsoft has more installations of its operating system around the world.

No wonder Microsoft has more installations of its operating system around the world.

I went to Jaycar the other day and bought another wifi dongle to use on the Raspberry Pi for JMRI and Wireless control of trains. I had setup my test beast happily and it worked, so I was now onto building up a setup for the clubs' N scale exhibition layout. The dongle is the same make/model etc - almost…

On my old Microsoft XP laptop, you just insert the dongle, insert the CD, run the installer and it all works – simple – easy - wonderful – even Jon Arbuckle could do it!

And of course the new dongle just doesn’t want to work on the Raspberry-Pi, does it. The old dongle is based on a Realtek RTL8188EUS chip and this new one that is now sold by Jaycar is based on the Realtek RTL8188EU chip. You’d think it would be the same driver wouldn’t you – nope.

I have found a few helpful websites out there, but gee whiz, slap my arse and call me Sally, is it a roundabout way to do things. It appears every single version of Raspian has a different driver for this chip and you have to find the damn thing first. But of course if you ever figure out how to do it, next time you patch the operating system with an update – you’ll need to go find a new driver for the wifi dongle and install that one.

ARRRRGGGGGGGGGGGGGGHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH

So I have stuffed all the R-Pi parts into a box and placed it into the corner for now – the box has now been designated the Too Hard Basket. I'll go look at it in another few days I reckon.

Wednesday, August 13, 2014

Another Slice of Pi

Today being a public holiday in Brisbane, I took off early from home and headed out to the club to play trains. Well, actually, to play with some Pi.

I took down my carton of Raspberry Pi components and NCE bits and such, to setup a small test track for a bit of a show and tell for a couple of blokes who are also now going to play with their own Raspberry Pi's. So once at the club, I dragged over a table and sprawled all my parts across it - it was still very crowded! But I was able to quickly cable it all up, go get a couple of cups of strong coffee, and get the Raspberry Pi up and running with my Raspberry Pi model B+, Powered USB Hub and such. I of course already had it set for Faceless mode and once turned on we were all able to hook our phones into the Pi and drive my N scale California Zephyr loco 9910 up and down the length of test track.

So next step was to burn a copy of the Micro SD Card for one of the fellas, let's call him Bob shall we, to take home and play. I had also collected together some other files for Bob such as the Noobs 1.3.9 download, VNC, PUTTY and such. It'll save him a few minutes here and there looking for those files on the net.

So we then plugged his R-Pi with this new Micro SD card installed in it, into all my kit and fired it up. It of course worked fine and loco 9910 went up and down the track again. OK, so now we connected a monitor into the Pi so we could do some editing. Reason why - because Bob had an old Wireless Router kicking around and wanted to see if we could get it to be our Access Point. I had all these thoughts of needing to go find some drivers for this gadget and editing files and such. But of course we had it all plugged together and whilst I got ready to edit some files, Bob was able to just hook into the whole thing from his iPhone and drive 9910 up and down the track!  No edits or anything required!!

So another cuppa and a think. Yes of course...  The Wireless Router was a pretty much standard unit (TP-LINK 54Mbps Wireless Router, Model No: TL-WR340G v 4) and connected to the R-Pi with an ethernet cable.  The Pi wasn't required to drive a USB wireless dongle and also act as a DHCP and DNS server etc. By default the Wireless Router does all of that. It had previously been setup to act as the Access Point for a windows based laptop. The IP Address, and DHCP was already setup on the device itself.


So the TP-LINK wireless router gave the Pi an IP Address and the JMRI was able to talk out via this device. Funny enough, no changes were made in the Pi at all. When we looked at it again and rebooted, we were able to see a few errors during boot-up that could be attributed to the USB Wireless dongle being missing, but that was it. So that was an easy config! So Bob was happy and sent home with a working JMRI and Raspberry Pi setup.

So a pile of gas bagging with the fellas at the club and some lunch and more talking and such, then it was time to head home, crack a beer and sit outside and read the local rags and some online news. Another beer, some YouTube videos on model trains, a snack and then it was time to go inside, turn on the boob-tube have a ½hr snooze ready in time for the news at 5.

Next time I'll need to figure out how to setup the Raspberry Pi with our 5 amp NCE system at the club (Powerhouse Pro 5) via a serial cable - see you then.

Thursday, July 24, 2014

Let's Get Current



OK - I know I shouldn't have, but I just had to. The new Raspberry Pi is out - the Model B+. So I ordered one a few days back and it arrived today. It won't go astray as I plan to have two units on my own layout - one will drive wireless control of the layout and the other will be for programming locos at the workbench.



The Model B+ is the higher-spec variant of the Raspberry Pi. It replaced the original Model B in July 2014. Compared to the Model B it has:

  1. More GPIO. The GPIO header has grown to 40 pins, while retaining the same pinout for the first 26 pins as the Model B.
  2. More USB. There are now 4 USB 2.0 ports, compared to 2 on the Model B, and better hotplug and overcurrent behaviour.
  3. Micro SD. The old friction-fit SD card socket has been replaced with a much nicer push-push micro SD version.
  4. Lower power consumption. By replacing linear regulators with switching ones we’ve reduced power consumption by between 0.5W and 1W.
  5. Better audio. The audio circuit incorporates a dedicated low-noise power supply.
  6. Neater form factor. They’ve aligned the USB connectors with the board edge, moved composite video onto the 3.5mm jack, and added four squarely-placed mounting holes.
Anyway so it arrived and as soon as I had pushed some food into my face after work, I pulled the package out and plugged in all of the cables on my table and inserted a MicroSD card I already had imaged with my Raspian "June 2014" and JMRI "3.8".


As expected it all just worked fine. So the next trick and test I wanted to see was to not use the powered USB hub. So I pulled the hub out and inserted the Wireless Adapter into the R-Pi itself.

Power was switched on and it all fired up and again I was able to drive a train. Happy happy, joy joy.

So this now leads me to the next test I must do once I can get some time at the club - that is to hook the setup into the N Scale Exhibition layout and test how far away I can get and it still work. Also to see how many can drive at the same time too.


Maybe it will all be a ripper and the new Pi has enough power to drive the adapter and hence cost and size of the setup will be lower for connecting to the layout. Now I can't wait till next club day for me!

Sunday, July 20, 2014

It's Alive...it's Alive!!

My lounge room now echos to the sounds of my HO scale Burlington Northern EMD SD9. And it also looks funny that whilst this loco is moving in one direction there is an N scale Canadian National EMD SD40-2 passing in the opposite direction.

Yes - it is all alive!


I have finally nutted out, with help of course, how to get the Raspberry Pi to run in Facelesss mode and fire up the latest JMRI software which is version 3.8 and to act as an Access Point. This will now allow us at the club to start planning our implementation on our N scale exhibition layout and also our HO club room layout.


So continuing on from my last post, we start at step 22. This is where we had the JMRI running in normal mode and were able to control locos. But it still required manual intervention to start up the JMRI.



22. Once finished, exit the app on the smartphone / tablet and turnoff the device’s wifi connection if required.

Close down the WiThrottle Server by going to WiThrottle on the menu bar of the WiThrottle window and click on Stop Server.

Close down JMRI by going to File on the menu bar of the DecoderPro window and click Quit.
Exit/Logout the desktop GUI of your Raspberry Pi.
Close down the Pi if required:

sudo shutdown –h now

If you don’t intend to have the R-Pi Access Point permanently connected to the Internet (probably only required temporarily for software updates), disconnect the Ethernet cable from the R-Pi.

Bundle up your R-Pi, USB powered hub, and power sources. Position them as you wish on your layout.

Remember this order of start-up:

Turn on your DCC system/s interfaces/systems first
Turn on powered hub
Turn on computer monitor (if required)
Turn on the R-Pi

23. Now it is time to turn our attention to getting our R-Pi to run in Faceless mode. This way we do not need a keyboard, monitor or mouse to run it as our Access Point and WiThrottle. So in this configuration it will be great for our exhibition layouts.

To begin with you will first need to set WiThrottle to autostart when JMRI starts up. So startup DecoderPro as before.

Now under ‘Edit’ on the menu bar, select ‘Preferences’
Select Start Up
Under the ‘Actions’ tab, click the Add Action button and set Start WiThrottle Server on the drop down list to automatically start at Start up.
Click Save
When asked, restart the application for the changes to take effect.

Once done, close down DecoderPro. So from now on, whenever you start up the DecoderPro, the WiThrottle will also start up.

24. Next we need to make DecoderPro itself start up by itself whenever the R-Pi is turned on. First part is to create a profile for this. So turn your R-Pi on and log into it.

The older versions of JMRI used a slightly different method to setup what is called Faceless mode. Under version 3.8 we get to play with the new “profile” files a tad. Now first up we need to setup a profile for use with our Faceless mode.

Now under Edit on the menu bar, select Preferences, then select Config Files.
Click on New and give your new profile a name. I used MyFacelessMode as my name.
Now the Status of your new profile should show as “Active profile on restart”.
So hit Save and restart the JMRI. It should restart and be sitting at the Connections page of Preferences.
So add the details into this profile, the same as before:

So I selected NCE as the System Manufacturer.
Next I selected NCE USB as the System Connection.
Next select /dev/ttyUSB0 in the Serial port dropdown menu under the Settings section.
My USB version I set to V6.x.x as that is what I have.
My system I selected as PowerCAB.

Also select Start Up, then the ‘Actions’ tab, then click the Add Action button and set Start WiThrottle Server on the drop down list to automatically start at Start up.

Now if you want a fixed port number for you WiThrottle, then in the WiThrottle section look at the Network option. Tick the box and give it a 5 digit number (make it below 65000 or there abouts).

Click Save and restart JMRI when asked to.

At this point you could test a train to make sure you have it right or just trust you are following the instructions correctly.

25. Now shutdown the JMRI for the next step where we make the configuration file for the autostart. At a command prompt on you R-Pi, make a new file:

sudo cp /home/pi/.jmri/DecoderProConfig2.properties /home/pi/.jmri/JmriFacelessConfig3.properties

Now let’s edit this new file and make it autostart:

sudo nano /home/pi/.jmri/JmriFacelessConfig3.properties

Now change the line:

<entry key="autoStart">false</entry>

To now be:

<entry key="autoStart">true</entry>

Now save and exit the file.

26. Finally we will edit the R-Pi’s start up file to start JMRI at boot time. So at the command prompt we will edit the startup file:

sudo nano /etc/rc.local

Add the following line so it is the second last line. Copy it exactly, as if you haven’t already guessed, Linux, of which Raspbian is a version, is case sensitive when you type. So a capital letter is different in a command than a lower case letter and so on. And the ampersand at the end of the line means something too.

sudo –u pi /home/pi/JMRI/JmriFaceless &

The last line of course will therefore be “exit 0”.
Now save and exit the file.

You can now reboot your R-Pi and JMRI should now start up as will the WiThrottle. I’ll now be able to connect this one to the club exhibition layout so we can use our tablets and phones to drive our trains at our next show.

27. If at any time you wish to cancel the JMRI Faceless mode then:

Power off the R-Pi (pull out the power lead)
Connect up the computer screen and keyboard
Reconnect the power
Login to the R-Pi and at the command prompt type:

killall java

You can then comment out the execution of JmriFaceless from the startup script if you are intending to work on JMRI, etc. So at the prompt:

                sudo nano /etc/rc.local

Now just put a hash in front the second last line. It should then look like:

sudo -u pi /home/pi/JMRI/JmriFaceless &


Save the file and exit.

So you are now up and running with a Raspberry Pi for remote controlling of you locos. For shutting down I plan on just pulling the power plug. It can't damage the components at all, but in the long term it might corrupt the SD card. So you can always make a backup copy onto another SD card and carry a spare. You can reburn the failed one when you get near your desktop computer. Of course you need to take a copy first - that you do with something like the "Win32DiskImager" which is free on the internet.


Wednesday, July 16, 2014

Consistency has been Achieved

OK, so I have been buggering around with my Raspberry Pi over the last few weeks. I have now been able to time after time follow these here destructions and get a working JMRI out of it and control my trains on track connected to my NCE PowerCAB.

There is only one more step alluding me, and that is how to get the R-Pi to autostart JMRI and thereby allowing me to run "faceless".

But these instructions so far as I have gotten, may be of help to those out there wanting to put the latest version of JMRI 3.8 onto their Raspberry Pi. (the hardware is as per my previous post):

1. Purchase your bits and pieces. Here are the parts I purchased to use for myself and this project:

2. Next I pulled down a small piece of software to format the SD Card I will use with this Raspberry Pi. The software is called “SD Formatter 4.0 for SD/SDHC/SDXC” and is available from:


So I followed the relevant instructions as per their website and formatted my SD Card.

3. Obtain the latest Operating System for the Raspberry Pi. You can get it from:


For my current build, the download I used was “NOOBS version 1.3.9”. This will get me the “Raspbian Debian Wheezy” Operating System that was release on 20 June 2014.

4. Follow the instructions to get the NOOBS copied to your SD Card and the to install the Operating System on your Pi:


5. Make a few minor configuration changes like:

            Password for your Pi
Locale:  select “en_AU.UTF-8”  and deselect the default “en_GB.UTF-8”
Timezone: I selected “Australia”, then “Brisbane”
Keyboard Layout
SSH
Name you want to give your Pi

6. Reboot the Pi and login to it. The default user is “pi” with a password of “raspberry”

7. I ensured I had my Ethernet cable plugged into the Pi and connected up to my hub/switch and router to my home internet feed. This way my Pi got an IP address and was able to connect to the internet to get all the software needed to continue with this build.

8. Check that the system is all up to date with its software. So issue the following command at the prompt. The prompt is that blue coloured dollar sign “$” on your screen. So here is the command:

                sudo apt-get update

9. Now to install the remote control software so you can get into your Raspberry Pi from your desktop computer, because as we know that has the most comfortable chair in the house and a nice big screen. But if you want, you really don’t need the remote software. So if you do, here we go. We want to install “TightVNCServer”. So type in the following command at the prompt:

sudo apt-get install tightvncserver

Once it has completed its install, you can start it up (note, there is a space before the colon):

vncserver :1

You will be asked to give it a password. Please note it only accepts a maximum of 8 characters. If asked for a read only password say no to it.

10. Install a VNC Client on your desktop PC. There are many, but I used the one from RealVNC at:


11. You can now connect remotely to your Raspberry Pi (let’s start shortening the name to R-Pi shall we) and be comfortable. As an example, my R-Pi when connected to my Ethernet at home, grabbed an IP Address of 102.18.4.14 . Hence to connect via VNC to it from my desktop PC, I just fired up the RealVNC software and put this IP Address in for the remote connection I was going to (ie the R-Pi) as well as adding in a colon and a one at the end ie -    102.18.4.14:1

To find out your IP Address, at the prompt on you R-Pi, just type in:

ifconfig

This is part of what gets spat out. The important bits we want are the four numbers after the “inet:addr” in the section of “eth0”:

eth0    Link encap:Ethernet  HWaddr b8:27:eb:30:de:32 
                       inet addr:102.18.4.14  Bcast:102.18.4.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:804 errors:0 dropped:0 overruns:0 frame:0
          TX packets:943 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:42747 (41.7 KiB)  TX bytes:220723 (215.5 KiB)


The following 2 steps would seem out of order, but it has a reason – it saves typing because you can do the second step much easier this way – trust me.

12. One problem I had with the TightVNC was that copy/paste between my Raspberry Pi and Desktop PC did not work. So I found a solution here:


So you pull down and install “autocutsel”:

sudo apt-get install autocutsel

Then you need to open this file /home/pi/.vnc/xstartup and edit it. So at the command prompt type this:

nano /home/pi/.vnc/xstartup

By the way, nano is a small editor that is in your Pi by default.

The edit is to insert this line   autocutsel -fork   into the existing file and thereby give a file that looks like the following:

#!/bin/sh
xrdb $HOME/.Xresources
xsetroot -solid grey
autocutsel -fork
#x-terminal-emulator -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
#x-window-manager &
# Fix to make GNOME work
export XKL_XMODMAP_DISABLE=1
/etc/X11/Xsession

So save the file and with a reboot of your Pi, the copy and paste will now work with your VNC.

13. We now need to make sure the TightVNC starts up automatically each time the Pi starts up. I tried a number of recommended ways, but ended up following the “Adding Tightvnc to the startup“ section of this one which worked fine for me:


So here we go – go to the command prompt (that little blue dollar sign) and we will make a new file to autostart the TightVNC. So start typing:

cd /etc/init.d
                sudo nano tightvncserver

Add all these lines into this file we have just created and opened up:

#!/bin/sh
### BEGIN INIT INFO
# Provides:          tightvncserver
# Required-Start:    $local_fs
# Required-Stop:     $local_fs
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start/stop tightvncserver
### END INIT INFO
# More details see:
# http://www.penguintutor.com/linux/tightvnc
### Customize this entry
# Set the USER variable to the name of the user to start tightvncserver under
export USER='pi'
### End customization required
eval cd ~$USER
case "$1" in
  start)
    su $USER -c '/usr/bin/tightvncserver :1'
    echo "Starting TightVNC server for $USER "
    ;;
  stop)
    pkill Xtightvnc
    echo "Tightvncserver stopped"
    ;;
  *)
    echo "Usage: /etc/init.d/tightvncserver {start|stop}"
    exit 1
    ;;
esac
exit 0

Now to set the file up to run. Type the following at the command prompt:

sudo chown root:root /etc/init.d/tightvncserver
sudo chmod 755 /etc/init.d/tightvncserver
sudo update-rc.d tightvncserver defaults

Reboot the Pi and voila, the TightVNC has now started.

14. Let us now install and configure the software to turn our Raspberry Pi into a wireless Access Point. Depending on the Wireless Dongle you have purchased, these steps may change. But for the one I have used (the Nano 150 from Jaycar), the best method was to follow one I found on the internet. This instruction set suits all dongles that have the Realtek 8188CUS chipset in them:


So here are the key strokes to follow at the command prompt:

wget https://github.com/jenssegers/RTL8188-hostapd/archive/v1.1.tar.gz
tar -zxvf v1.1.tar.gz
cd RTL8188-hostapd-1.1/hostapd
sudo make

After a while, you should be given control back to the terminal. So then do these instructions:

sudo make install

So now we have the “hostapd” program installed – this is part of our Wireless Access Point. Now we need this program to also autostart every time we boot up the Raspberry Pi. So type this at the command prompt:

sudo ln -s /etc/init.d/hostapd /etc/rc2.d/S02hostapd
sudo update-rc.d hostapd enable

This is the output that will come too your screen – don’t worry about the two warnings:

update-rc.d: using dependency based boot sequencing
insserv: warning: current start runlevel(s) (2) of script `hostapd' overrides LSB defaults (2 3 4 5).
insserv: warning: current stop runlevel(s) (empty) of script `hostapd' overrides LSB defaults (0 1 6).

This should ensure that the “hostapd” application starts after a reboot.

15. Now we will install “dnsmasq” to use as the DHCP Server:

sudo apt-get install dnsmasq

16. Now you have to configure the “/etc/network/interfaces” file. So let’s edit:

sudo nano /etc/network/interfaces

Comment out the line “allow-hotplug wlan0” ie put a “#” in front of the line so it looks like:

# allow-hotplug wlan0

Add the following lines to setup the IP addressing. Now this can be all sorts of addresses, I’ll give an example here:

#Setup the device with an static IP
iface wlan0 inet static
# Static IP Address
address 100.0.0.1
# Network mask
netmask 255.255.255.0

Comment out the line with “wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf”
Comment out the “iface default inet dhcp” line
Save the file and exit the editor.

17. Now to edit the /etc/hostapd/hostapd.conf file:

sudo nano /etc/hostapd/hostapd.conf

Edit it replace it with the following lines. You just need to pick your own passphrase and ssid:

# Basic configuration
interface=wlan0
ssid=MyWFiName
channel=1
#bridge=br0

# WPA and WPA2 configuration
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=2
# passphrase has to be 8-63 characters in length
wpa_passphrase=MYSPECIALPASSWORD
wpa_key_mgmt=WPA-PSK
wpa_pairwise=CCMP
rsn_pairwise=CCMP

# Hardware configuration
driver=rtl871xdrv
ieee80211n=1
hw_mode=g
device_name=RTL8192CU
manufacturer=Realtek


18. Next we edit the file to configure the DNS mask. So edit:

sudo nano /etc/dnsmasq.conf

Now add the following two lines to the very bottom of the file:

interface=wlan0
dhcp-range=100.0.0.2,100.0.0.5,255.255.255.0,12h

18. So now that the Raspberry Pi is acting as a proper Access Point for us, it is time to turn our thoughts to installing the JMRI. So let’s start typing on the little blue dollar sign of our Pi.

First let’s check that the Pi is up to date:

sudo apt-get update

Download JMRI 3.8, which is the most current at the time of writing this article:

sudo tar -zxvf JMRI.3.8-r26527.tgz

19. Now to start JMRI and configure it. Now connect your DCC system interface (in my case an NCE USB adapter and my PowerCAB) to the USB Hub before starting up JMRI. Fire up a desktop environment:

cd /home/pi
startx

Open File Manager and go to the directory  /home/pi/JMRI

Start JMRI by clicking on the DecoderPro (not DecoderPro3) start up file. This will take a while for the first time it starts.
When asked, use “Execute” and don’t use “Execute in a Terminal”.

Once the JMRI has started, change some preferences. These are found under Edit then Preferences in the menu bar of JMRI.

Once this Preferences window is displayed, enter the Connection information of your DCC system you wish JMRI to connect to, making sure you have connected your DCC system’s USB interface first to the USB hub. So I selected NCE PowerCAB.

Next select /dev/ttyUSB0 in the Serial port dropdown menu.
Save your settings and restart JMRI when asked to.

20. Once JMRI appears to be responding, activate the JMRI ‘WiThrottle’ (wifi) server. Do this by going to the menu bar and selecting Tools, then Throttle, then Start WiThrottle Server.

If this worked it should advise the static IP Address of the Pi (e.g. 100.0.0.1) with a random port number (e.g. 49876) in a new window. Eg 100.0.0.1:49876

21. To test connectivity, grab your smartphone or tablet and connect to the WiFi that your Raspberry Pi has been set to advertise. In this document we used MyWFiName and we used a password of MYSPECIALPASSWORD.

Let’s assume you have already gone and installed the Engine Driver app on your Android or WiThrottle app on your iPhone. If JMRI is working correctly, you should see the IP address and port of the JMRI ‘WiThrottle’ server on your app. So connect to it.

If this worked, the JMRI ‘WiThrottle ’server’ window on the Raspberry Pi should list the relevant smartphone / tablet device name (configured in the app) connecting to JMRI.

If connected to a layout, try acquiring a train and running the engine remotely.

-------------------------------------------------------------------------------------------------

By the way - I see there is a new Raspberry Pi available. It is called a Model B+. Same processor and memory, but a smaller form factor and a few other changes like now it uses a MicroSD card and has 4 USB ports and more GPIO pins.