Easy Installation of JMRI on a Raspberry Pi

Discussion in 'DCC Control' started by paul_l, Apr 6, 2021 at 10:32 AM.

  1. paul_l

    paul_l Staff Member Administrator

    Messages:
    7,793
    Likes Received:
    3,537
    Joined:
    Dec 5, 2015
    Easy Installation of JMRI on a Raspberry Pi



    Following on from recent discussion threads regarding DCC and JMRI, I thought I’d start a thread on a simple and cheap dedicated solution.



    I cannot take any credit for this, but is a link to the JMRI site, followed by work done by Steve Todd to produce a preconfigured image for download and install.



    What do we need ?



    An internet connection to download the JMRI / Raspberry Pi image.

    Application to write the image to a Micro SD card

    Raspberry Pi Model B version 3, 4 or 400. It will run on a version 2 but is too slow to be usable.

    Micro SD card (8GB or greater).

    A DCC command station on the compatibility list with a cable or interface to connect to a USB port (Locobuffer-USB, PR3, SPROG, LENZ USB, NCE Serial, NCE USB, DCC++, EasyDCC Serial, MERG USB, MRC Prodigy)



    Is that all ? he says.



    First off a trip to the JMRI site.

    Actually we can go directly to Steve Todds own site, but the JMRI site has documentation and help.

    https://www.jmri.org/

    upload_2021-4-6_10-29-14.png


    Click on the download link highlighted above

    upload_2021-4-6_10-29-45.png


    Click on the Raspberry Pi OS on Raspberry Pi link in the left hand list.

    upload_2021-4-6_10-30-37.png

    Now click on the link for the Pre-Built image circled above (or you could build your own version by following the Installation steps below on the page – thought not)



    This will take us to Steve Todds web page, or just click the link

    https://mstevetodd.com/rpi

    upload_2021-4-6_10-31-2.png


    In the Software Image paragraph select the latest image ( I selected the 1.7GB zip image), and download the image to your PC – for ease I placed it on my desktop.

    upload_2021-4-6_10-31-26.png


    Right click on the file and select extract



    This will give you the image file

    upload_2021-4-6_10-31-50.png


    Next we need to get an application to write the image to an Micro SD card.

    That will be on the next post ........


    Paul
     

    Attached Files:

  2. paul_l

    paul_l Staff Member Administrator

    Messages:
    7,793
    Likes Received:
    3,537
    Joined:
    Dec 5, 2015
    The application I used is Balena Etcher, a free application available for Windows , MACs and Linux systems.

    https://www.balena.io/etcher/

    upload_2021-4-6_10-36-58.png


    Click the download button, then run the install application.



    Insert the Micro SD card in to the PC – you will probably need to use a Micro SD to SD card adapter, to insert the card in to a SD Card reader.



    Run Balena Etcher

    upload_2021-4-6_10-37-56.png


    Click on the Flash from file button and select image file you downloaded

    upload_2021-4-6_10-38-23.png


    Now select the target – this is the drive letter of the Micro SD card you inserted

    upload_2021-4-6_10-39-3.png


    Note above the card I used is a 16GB card with two partitions F:\ and H:\, click in the the box to the left to select it

    upload_2021-4-6_10-39-27.png


    Then click select

    upload_2021-4-6_10-40-2.png


    Then click on Flash! – it will now apply the image to the card – all existing data will be erased from the card. At the end of the process, Windows will offer to format the card – cancel this.



    You now have a Raspberry Pi / JMRI configured card for the Raspberry Pi.
     
  3. paul_l

    paul_l Staff Member Administrator

    Messages:
    7,793
    Likes Received:
    3,537
    Joined:
    Dec 5, 2015
    Phew ...... congratulations to those that have survived this far.


    So we have a prepared boot image for the Raspberry Pi



    Now we’ll set up the test system.



    The DCC system I will use is the NCE PowerPro combined Command Station and 5A booster unit.



    The unit is effectively two separate units shoe horned in to the one box, as demonstrated by the cable connecting Command Station on the right hand side to the Booster on the left hand side of the box.

    Connections



    The unit requires a 16VAC or 28VDC max – I’m using a 20VDC Laptop power supply. I have removed to propriety laptop connector and replaced it with a Deans connector, extra insulation provided by hot glue – not pretty, and will be replaced by some form of moulded cover.




    For the programming side of things the track connection is not required from the Booster.

    However a connection is required from the Program track output of the Command Station



    The power out put from the Programming Track is limited to 1A, and is limitation for a lot of more Traditional DCC systems – OK for programming standard decoders, but can have issues with some sound decoders. The NCE PowerCab has a distinct advantage being able to provide 1.5A to 2A to the programming track. – it was designed after sound decoders hit the market.

    We also have a RS232 serial connection between the Command station and the Raspberry Pi, the the form of a USB to Serial Cable.

    I have also connected the Power Pro handset into the Cab Bus using the curly cable. Although for programming via JMRI this is also not required.

    Almost there ...........
     
  4. paul_l

    paul_l Staff Member Administrator

    Messages:
    7,793
    Likes Received:
    3,537
    Joined:
    Dec 5, 2015
    I will be using a Raspberry Pi 3 model B, and a Pi 400 (combined Pi 4 (4GB) and keyboard) as the test subjects.

    Raspberry Pi 3 Model B

    I have installed this in a case and is approximately 90 x 70 x 25 mm in size


    It has a Micro USB port for a power supply connection (5V 2A), HDMI port for Video out, and Audio out


    At the business end

    Ethernet port (10/100/1000) and 4 x USB 2 ports


    and the oppsite end has the Micro SD card slot



    I connected a wireless keyboard and mouse, ethernet cable and the USB end of my USB to Serial cable (the other end is connected to the NCE Power Pro).



    Then switch on - I had powered up the command station first


    We now have a working JMRI system, the JMRI - PI auto detected my NCE system, and should do for most systems.

    For the Rasberry Pi 400 system I just removed the Micro SD card from the Pi 3 and inserted into the Pi 400


    I did need to change power supplies as the Pi 4 requires 3A, and uses a Micro HDMI video connection

    The Pi 4 is faster than the Pi 3, and for the cost of and O gauge wagon I will probably treat Viccy Road to its own Pi 4 4GB unit

    [​IMG]

    Currently £54 + case.

    Paul
     
    steve likes this.
  5. Colin_W

    Colin_W Full Member

    Messages:
    204
    Likes Received:
    74
    Joined:
    Nov 19, 2016
    Excellent start Paul, I have a 3B under my main board hooked up to DCC++. I will eventually use the JMRI image but at the moment the 3B is running as a wireless host so I can VNC into into it remotely from my laptop. It means it has it's own network so if I did (unlikely ) take it anywhere else then I can log into into it and run JMRI. If I drop the image onto it then it will mean many hours of graft and head scratching to set it up again. Looking forward to following this one.
    Col
     
  6. paul_l

    paul_l Staff Member Administrator

    Messages:
    7,793
    Likes Received:
    3,537
    Joined:
    Dec 5, 2015
    Hi Colin

    You are going to love this build,
    By default it sets up two networks - the wired port is DHCP to allow it to connect to local network. The wireless port is setup to 192.168.6.1, and to act as a hotspot (details within the Software section of Steve Todds web page), if you set your phone (or other wifi throttles) in the 192.168.6.50 to 99 range then you can use the WiThrottle aplication - also startsup by default.
    VNC is also setup by default, so you can remote logon to the Raspberry Pi from any PC on your network (with a VNC viewer application running).

    The 3B runs the version really well, the 4B even smoother.

    DCC++ is supposed to be recognised automatically, but if it doesn't spot it first time, there is a Port dectection app on the desktop, run it and it found my NCE system.

    It's worth just imaging up a spare SD card to give it a go. You can copy your existing roster and panel files over to the new card after boot up.

    Paul
     
  7. gormo

    gormo Staff Member Administrator

    Messages:
    4,365
    Likes Received:
    1,629
    Joined:
    Dec 5, 2015
    :whatever::confused:..........:avatar::avatar::avatar:
    Holy circuit boards Paul.......this is quite a topic......:thumbs::thumbs::thumbs::thumbs::thumbs:
    :tophat:Gormo
     
    Colin_W likes this.
  8. Colin_W

    Colin_W Full Member

    Messages:
    204
    Likes Received:
    74
    Joined:
    Nov 19, 2016
    My IP is 192.168.4.1 and I suspect works the same. but at the moment I have to turn on WiThrottle and Run up JMRI. This sounds much easier and once I have finished messing around I think I will go ahead and drop it in. I like the idea of the VNC firing up on auto. One minor query :lol: if you disconnect the DCHP does the wireless still work as an independent host? The way I'm setup I don't need the DCHP from a main router, the 3B supplies the network. For instance I have my main BT Network but I also have a separate network called RailwayPi which I log into with VNC and Engine Driver. I could effectively turn off my BT system and the Pi will provide the complete wireless network to run my layout. If that makes sense ? Pull the ethernet cable from the Pi and see if you have a wireless network on 192.168.6.1 that you can log onto out of interest.

    Col
     
  9. Colin_W

    Colin_W Full Member

    Messages:
    204
    Likes Received:
    74
    Joined:
    Nov 19, 2016
    Hi Gormo, remember he started this :facepalm: :avatar:
     
  10. paul_l

    paul_l Staff Member Administrator

    Messages:
    7,793
    Likes Received:
    3,537
    Joined:
    Dec 5, 2015
    Tempted yet Gormo :avatar:

    Colin, it runs as two seperate networks - it's own wifi network 192.168.6.xxx for the wi throttles, and the wired ethernet port for the Pi to connect to your network (the Pi gets the ip address from your routers DHCP server) - not needed to run the layout, but is the network you will VNC on to the Pi.
    I'm not sure if the Pi acts as a DHCP server for the Wifi network. I'd also point out that the Pi's wifi is not too strong so on bigger systems may be better to use a wifi access point or an old wifi router (I use a 2nd hand BT Wifi access point I picked up for a couiple of quid, but will give the Pi's wifi ago when I re-assemble Viccy Road).

    You can change the wifi address settings by editing the following to what you want - taken from Steve Todd's web page.

    Set static address for wlan0 in /etc/dhcpcd.conf (to 192.168.6.1) and disabled wpa_supplicant for wlan0
    Set matching address range in /etc/dnsmasq.conf (192.168.6.50 - 192.168.6.99)


    Paul
     
  11. Colin_W

    Colin_W Full Member

    Messages:
    204
    Likes Received:
    74
    Joined:
    Nov 19, 2016
    I'll have a look tomorrow and see what the Pi Range is. I set mine up using this method
    https://www.raspberrypi.org/documentation/configuration/wireless/access-point-routed.md
    If you scroll down to the "Setup the network router" section you will see the Pi can be used in complete isolation as a wireless network.
    I agree with you though it may be better to use an old router if the signal is weak. Having said that the laptop can log directly into the Pi and VNC straight in. I only have a small area to work in 20 x 8 feet but always have a strong signal. Also I have an ethernet cable into the shed and can still access the Net if I plug this into the PI. If I 'was' to use an old router it just seems like another thing to go wrong :) in a shed where many things go wrong and somehow it always seems to be my fault :facepalm:.:avatar::avatar::avatar:
    Col

    P.s I even have the same Pi case as you :giggle:
     
  12. gormo

    gormo Staff Member Administrator

    Messages:
    4,365
    Likes Received:
    1,629
    Joined:
    Dec 5, 2015
    Nope.........:faint:
    :tophat:Gormo
     
  13. gormo

    gormo Staff Member Administrator

    Messages:
    4,365
    Likes Received:
    1,629
    Joined:
    Dec 5, 2015
    Yes I know.......he`s always doing this high tech, extremely intellectual stuff that us mere mortals can only look at and fry our brains........:facepalm:
    Give me a good old 3/8" ring spanner any day and a hammer and I`ll fix most things..........I raided Toto`s tool box.....that`s all that was in there......:avatar::avatar::avatar::avatar:....Oh nearly forgot....there was a bacon sarny in the tool box too.........looked like it had been there a while...:scratchchin:
    :thumbs::tophat:Gormo
     
  14. paul_l

    paul_l Staff Member Administrator

    Messages:
    7,793
    Likes Received:
    3,537
    Joined:
    Dec 5, 2015
    I doubt that, probably bait on a mouse trap to stop anybody pinching his favourate hammer :avatar:

    DCC loco control is a bit like the change that happened when feedback controllers first arrived on the scene, it's a big improvement but takes a while to catch on, and in DCC's case requires conversion of the loco's, more expensive but can be done, and with the correct settings on the decoder a DCC fitted loco will work on DC. By the way something, I disable on my loco's as it can cause other issues.

    Just because you control your loco's via DCC doesn't mean you have to control your layout using DCC, like wise a DC controlled layout, can use DCC to control points, signals etc. etc.

    Rule 1 applies - It's your layout, you do it your way - bearing in mind that my way is right tho' :avatar:

    Paul
     
  15. Colin_W

    Colin_W Full Member

    Messages:
    204
    Likes Received:
    74
    Joined:
    Nov 19, 2016
    Over the next few days I'll drop the JMRI image onto an SD and give this a go.
    Did a rough range check on the Pi wireless today still had about 40% signal at 15 Meters outside the shed :thumbup: .

    Col
     
  16. paul_l

    paul_l Staff Member Administrator

    Messages:
    7,793
    Likes Received:
    3,537
    Joined:
    Dec 5, 2015
    Hopefully, it will be sufficient for exhibitions, as if everyone installs high powered AP's all we'll do bleed over each other. It may be worth changing the IP address from the default range Steve Todd has set if you intend to take it to an exhibition.

    Good luck and enjoy

    Paul
     
  17. Colin_W

    Colin_W Full Member

    Messages:
    204
    Likes Received:
    74
    Joined:
    Nov 19, 2016
    You too mate.

    Col
     
  18. gormo

    gormo Staff Member Administrator

    Messages:
    4,365
    Likes Received:
    1,629
    Joined:
    Dec 5, 2015
    Yes I know your way is the right way Paul..........:facepalm::avatar::avatar::avatar::avatar:
    By the time I change over though.....it will be to the new system.
    :whatever::drums::drums::drums::tophat:Gormo
     
  19. paul_l

    paul_l Staff Member Administrator

    Messages:
    7,793
    Likes Received:
    3,537
    Joined:
    Dec 5, 2015
    But that'll give you time to plan your next upgrade :worship: - clockwork mechanisms - very enviromentally freindly :avatar:

    Paul
     
    steve likes this.

Share This Page