Trains.com

Subscriber & Member Login

Login, or register today to interact in our online community, comment on articles, receive our newsletter, manage your account online and more!

raspberry pi and JMRI from scratch tutorial

4641 views
9 replies
1 rating 2 rating 3 rating 4 rating 5 rating
  • Member since
    January 2020
  • 61 posts
raspberry pi and JMRI from scratch tutorial
Posted by wolf10851 on Sunday, December 11, 2022 5:48 PM

I have a Christmas tree that has 5 locomotives running on it.  My girlfriend though has no interest in learning how o use an NCE throttle so I decided to setup JMRI on a raspberry PI headless so maybe she can turn the trains on a different way.  this turned into a huge project trying to get java installed trying to get JMRI to auto launch etc. After finally getting it all setup I figured I would write up a step by step tutorial on doing this.
the easiest way to install the OS is to use the Raspberry PI Imager which you can find here
https://www.raspberrypi.com/software/
once that is finished and you have the pi started the first step is to install Java.  Open terminal and type in the following codes

sudo apt update
sudo apt upgrade
sudo apt install openjdk-11-jre

that will get java installed
now you need to install JMRI.  Go to https://www.jmri.org/download/index.shtml and download the ver 5.0 linux version
when you download that double click on the file you just downloaded.  It will open the extractor..  Click on extract.  I would suggest changing the folder that it extracts to from /tmp to a location like your home location then click on extract
that will install JMRI on the PI
now came the hardest part for me trying to get panelpro to launch automatically so I could use the pi headless and make it easy for my girlfriend to get into it
Open terminal and put in the filling code
sudo nano /etc/xdg/lxsession/LXDE-pi/
autostart

this will open an editor.  go to the bottom of the code already in there and add this
@lxterminal --command="/home/PI/JMRI/PanelPro" 
(make sure you use the quotes) also make sure to use the path where you extracted JMRI to
NOW when you reboot the PI Panel Pro will automatically start up.
turn on wireless and set country code
connect to wifi signal
right click on wireless and wired network settings
under configure select wlan0 dropdown
Enter a static IP address and all other info then apply
Open panel pro if not already open and select edit>preference
connections put in your command station info and again hit save
now if you want wi throttle to start automatically
go to edit>preferences>withrottle and about halfway down check the box under "start automatically with application" then save
if you want the web server to start automatically
select web server in the left hand column then select web server on the right hand panel and check "start automatically with application" then save
there you go now you have JMRI installed on a pi that starts automatically and starts either withrottle or web server automatically

Tags: JMRI , raspberry pi , rpi
  • Member since
    September 2004
  • From: Dearborn Station
  • 24,281 posts
Posted by richhotrain on Sunday, December 11, 2022 6:16 PM

I sure hope that my girlfriend has an interest in learning how to use an NCE throttle.   Smile, Wink & Grin

Rich

 

 

Alton Junction

  • Member since
    August 2020
  • 84 posts
Posted by MrMe on Sunday, December 11, 2022 10:39 PM

There is already a pre-formatted image available for doing this. All you have to do is download it, copy it to an SD card, insert it into the Pi, and power it up. It detects which DCC system you're using and automatically configures itself. It also sets up the Pi's WiFi so you don't have to any of that, either.

Go to jmri.org and scroll down the left-hand index. It's linked at the bottom under "JMRI Setup and Installation"...

  • Member since
    December 2015
  • From: Shenandoah Valley
  • 9,094 posts
Posted by BigDaddy on Monday, December 12, 2022 7:58 PM

richhotrain
I sure hope that my girlfriend has an interest in learning how to use an NCE throttle.   Smile, Wink & Grin Rich 

I read numerous posts about problems installing JMRI, problems with ports and it's all a bridge too far for me.  I've got mostly ESU decoders, my lokprogrammer and that's good enough for me.

Henry

COB Potomac & Northern

Shenandoah Valley

Moderator
  • Member since
    June 2003
  • From: Northeast OH
  • 17,249 posts
Posted by tstage on Monday, December 12, 2022 9:44 PM

BigDaddy
I read numerous posts about problems installing JMRI, problems with ports and it's all a bridge too far for me.  I've got mostly ESU decoders, my lokprogrammer and that's good enough for me.

What you probably read, Henry, are folks who didn't follow the installation instructions on the JMRI website.  The installation is generally unique for each DCC system but straightforward.  The JMRI website is very good about spelling out what you need for each one of them - e.g. driver's, compatible Java versions, and/or hardware.

I use JMRI Decoder Pro primarily for reading & storing the decoder CV values for my locomotive roster.  Should I need to reset a locomotive's decoder to factory settings, I can reinstall ("write") the stored values into any locomotive again very easily and quickly.  Pretty handy - especially if I've spent time adjusting CVs to remap a button on my throttle, or setting up Rule 17 lighting or gyralighting.

I use Decoder Pro less so for programming but the layout of the function tabs does make locating any CV easier.  After setting up the long address with my Power Cab throttle, I generally only adjust a few CVs for each locomotive - e.g. 29, 49/50, and 61 .  I've done enough of them now that I know what CVs to enter and just do that in Programming Mode using my Power Cab.

Tom

https://tstage9.wixsite.com/nyc-modeling

Time...It marches on...without ever turning around to see if anyone is even keeping in step.

  • Member since
    August 2020
  • 84 posts
Posted by MrMe on Monday, December 12, 2022 10:21 PM

BigDaddy

 

I read numerous posts about problems installing JMRI, problems with ports and it's all a bridge too far for me.  I've got mostly ESU decoders, my lokprogrammer and that's good enough for me.

 
Henry,
 
I've used JMRI for roughly 20 years now, and have regularly followed the JMRI list for that long, so I have a bit of history with both the software and the issues folks report.
 
As Tom mentioned, the folks who don't, won't, or can't follow the installation instructions are the ones who have installation issues. I also follow the JMRI developers list, and LOTS of effort is expended there making sure it's easy for beginners to use.
 
I don't have a LokProgrammer, but if I'm not mistaken, it is USB-attached and uses a COM port, doesn't it? If so, what's the difference between that and a COM port for a DCC interface device?
 
I'm glad that you're happy with your LokProgrammer, but I use JMRI for more than just decoder programming. I also don't limit myself to one brand of decoder, so even for decoder programming I need flexibility.
 
JMRI provides me that decoder flexibility, and those additional functions as well: PanelPro for layout control, and OperationsPro for, well, all aspects of Operations (Manifests, switchlists, scheduling, etc). The LokProgrammer simply can't do that.
  • Member since
    August 2003
  • From: Canada
  • 1,284 posts
Posted by wickman on Wednesday, December 21, 2022 11:47 AM

I find this incredibly interesting, now after researching all that you have described and learning the Raspberry Pi headless is simply no monitor, which raspberry pi should I be looking to acquire to do this project?

thanks

Lynn

wolf10851

I have a Christmas tree that has 5 locomotives running on it.  My girlfriend though has no interest in learning how o use an NCE throttle so I decided to setup JMRI on a raspberry PI headless so maybe she can turn the trains on a different way.  this turned into a huge project trying to get java installed trying to get JMRI to auto launch etc. After finally getting it all setup I figured I would write up a step by step tutorial on doing this.
the easiest way to install the OS is to use the Raspberry PI Imager which you can find here
https://www.raspberrypi.com/software/
once that is finished and you have the pi started the first step is to install Java.  Open terminal and type in the following codes

sudo apt update
sudo apt upgrade
sudo apt install openjdk-11-jre


that will get java installed
now you need to install JMRI.  Go to https://www.jmri.org/download/index.shtml and download the ver 5.0 linux version
when you download that double click on the file you just downloaded.  It will open the extractor..  Click on extract.  I would suggest changing the folder that it extracts to from /tmp to a location like your home location then click on extract
that will install JMRI on the PI
now came the hardest part for me trying to get panelpro to launch automatically so I could use the pi headless and make it easy for my girlfriend to get into it
Open terminal and put in the filling code

sudo nano /etc/xdg/lxsession/LXDE-pi/
autostart


this will open an editor.  go to the bottom of the code already in there and add this

@lxterminal --command="/home/PI/JMRI/PanelPro" 

(make sure you use the quotes) also make sure to use the path where you extracted JMRI to

NOW when you reboot the PI Panel Pro will automatically start up.
turn on wireless and set country code
connect to wifi signal
right click on wireless and wired network settings
under configure select wlan0 dropdown
Enter a static IP address and all other info then apply
Open panel pro if not already open and select edit>preference
connections put in your command station info and again hit save
now if you want wi throttle to start automatically
go to edit>preferences>withrottle and about halfway down check the box under "start automatically with application" then save
if you want the web server to start automatically
select web server in the left hand column then select web server on the right hand panel and check "start automatically with application" then save
there you go now you have JMRI installed on a pi that starts automatically and starts either withrottle or web server automatically

 

 

  • Member since
    August 2020
  • 84 posts
Posted by MrMe on Wednesday, December 21, 2022 7:25 PM

wickman

I find this incredibly interesting, now after researching all that you have described and learning the Raspberry Pi headless is simply no monitor, which raspberry pi should I be looking to acquire to do this project?

thanks

Lynn

 
Lynn,
 
The instructions on the JMRI web site I linked to above refer to a model 2B, and a quick perusal of jmriusers on groups.io shows folks have used 4B's, so the pre-formatted version (simpler to get up and running) should work on anything in that range. 
  • Member since
    August 2003
  • From: Canada
  • 1,284 posts
Posted by wickman on Wednesday, December 21, 2022 9:39 PM

MrMe

thankyou 

Lynn

 

 
wickman

I find this incredibly interesting, now after researching all that you have described and learning the Raspberry Pi headless is simply no monitor, which raspberry pi should I be looking to acquire to do this project?

thanks

Lynn

 

 

 
Lynn,
 
The instructions on the JMRI web site I linked to above refer to a model 2B, and a quick perusal of jmriusers on groups.io shows folks have used 4B's, so the pre-formatted version (simpler to get up and running) should work on anything in that range. 
 

  • Member since
    March 2020
  • 12 posts
Posted by FlightRisk on Wednesday, December 28, 2022 11:21 AM

They could do a better job of promoting this, but the "Steve Todd Image" is what most people have been using for the last several years if they are using a Pi. Steve is also part of the DCC-EX team so there are DCC-EX enhancements. All the software you would want is on that image and it automatically creates an Access Point to connect wirelessly to. You can change that to connect to your own network router.

https://mstevetodd.com/rpi

Subscriber & Member Login

Login, or register today to interact in our online community, comment on articles, receive our newsletter, manage your account online and more!

Users Online

There are no community member online

Search the Community

ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT
Model Railroader Newsletter See all
Sign up for our FREE e-newsletter and get model railroad news in your inbox!