Keyboard Shortcuts
Likes
- Jmriusers
- Messages
Search
Re: How do I hook up a bar code reader to JMRI
¿ªÔÆÌåÓýNick
like most things inside JMRI there are at least half a dozen ways of getting to the end.? Ken's suggested scripts method is one.? ?
I prefer to do processing either in LogixNG or outside of JMRI (hence suggesting python) as I find it quicker/easier to change things "on the fly", rather than staring at a JMRI script wondering "why did that not work".? ?
Sticking with stuff that might work straight out of JMRI.? There's some USB stuff (labelled as deprecated because the library underlying it isn't supported, so caution over it as it may stop working with an update, and doesn't work on new processor Macs
already) which shows reading serial input to a Memory Variable.? If you've got that far, then LogixNG could monitor the memory variable for change, and write a new Reporter message with the report value taken from the memory variable.??
MQTT doesn't need wireless, nor do you need to spend any money.? ?MQTT is purely a data transfer mechanism, and will work on a single machine (with a sort of network connection internally in the machine from the machine to itself).? Or, will work over
a wired, or wireless network.? ? If heading that way, you'll need:?
a)? MQTT Broker (server) software, typically that's "Mosquitto" because it's well documented and free.?
b) Something to take your current serial input and publish it on the broker on a path that will be collected by JMRI.? That's a python script (or any other language you're comfortable with running on your existing computer .? c)? JMRI connection to the MQTT broker (in preferences).? Its fine to have multiple connections in preferences.?
And that's it.? ??
Yes, MQTT is often used for devices connected via WiFi, but that's just one thing that can be done with it.??
- Nigel
------ Original Message ------
From "Nick Brownsberger via groups.io" <nbrownsbe@...>
Date 05/05/2025 21:42:23
Subject Re: [jmriusers] How do I hook up a bar code reader to JMRI
|
Re: JMRI won't pickup cars with trains
#operationspro
On Mon, May 5, 2025 at 04:53 PM, Craig wrote:
I tried changing the number of cars (moves) at each location on my train so it matches up.? the build report lists cars at out of service.? The program won't add a car to a train that is out of service.? All of your coal cars are listed as being out of service.? You can select all of the cars and use the tool "Set Cars" to change the status of your coal cars.? More in the help links:
?
?
?
Dan
? |
Re: How do I hook up a bar code reader to JMRI
¿ªÔÆÌåÓýThat¡¯s why I said a script that opens the port for reading. JMRI proper doesn¡¯t even know about it. You just have to code to open the device name. For Windows, that¡¯s a COM something. For Mac or Linux, that¡¯s going to be a /dev/ something. That script will figure out what to do with that four digit code. But since that code is running inside of JMRI, it knows all the tables of things in JMRI. ? -Ken Cameron, Member JMRI Dev Team
? ? |
Re: JMRI won't pickup cars with trains
#operationspro
I tried changing the number of cars (moves) at each location on my train so it matches up.? the build report lists cars at out of service.? The train still doesn't put any cars on the train.? What Things do I need to set in locations, routes, and trains that might be effecting this. Craig Drenkow 1306 Parkview Dr. Norfolk, NE? 68701 402-649-5498
On Saturday, May 3, 2025 at 10:13:14 PM CDT, Dan Boudreau via groups.io <daboudreau@...> wrote:
Craig,
?
From your build report in normal mode, we can see at the coal mine, the train's route does says to pull 50 cars Eastbound, followed by another 5 cars "moves" Westbound.? At the main yard, you asked the program to set out "0" cars.? So we now know why no cars were assigned to the train.? You need to increase the number of set outs at the main yard to 55, if that's the number of cars your really want delivered.
?
Dan
?
4r4 Location (Coal Mine) Eastbound requests 50 pick ups, maximum train length 1,000 feet
4r7 Location (Coal Mine) Westbound requests 5 moves, maximum train length 1,000 feet 4r5 Location (main yard) Westbound requests 0 set outs ?
|
Re: How do I hook up a bar code reader to JMRI
Nigel, Ken,
?
My device only connects to a USB port on my Mac. When it reads a bar code it sends a 4-digit code, i.e. 0123, followed by <enter>. If I have a spreadsheet open, when the code is read it fills the active cell with the 4-digit code and moves down to the next cell (in my Excel spreadsheets, using the enter keys moves to the next cell down). I can read as many bar codes as I want, moving down the spreadsheet each time.
?
I just haven't found a way for it to read into something in PanelPro that I can take action on.
?
Also, for the reason just mentioned, I don't think MQTT will work since its not a wireless device. And it sounds like I need to buy a piece of hardware to implement MQTT.
?
Thanks for continuing to help.
?
Nick |
Re: How do I hook up a bar code reader to JMRI
¿ªÔÆÌåÓýNick, ? JMRI only looks for certain types of names for the devices that it shows you. On some systems you can add what amounts to a search key for finding other devices to offer. But even if the device name is offered, the system connection will limit what it does with it. Unless the device you had sends a matching message format to something the system connection knows, it won¡¯t go anywhere. ? -Ken Cameron, Member JMRI Dev Team
? ? |
Re: How do I hook up a bar code reader to JMRI
¿ªÔÆÌåÓýNick, ? My rough thought is that you write a script that opens the device. Look at the FileLogging.py for an example of opening a file/device. The script would then handle the input stream and make reporters or whatever you want done with it. ? ? -Ken Cameron, Member JMRI Dev Team
? ? |
Re: How do I hook up a bar code reader to JMRI
Nigel,
?
I tried reading directly into a Jython program using the input command. (I didn't exactly use that command, but the safer command the name of which I can't remember right now.) But I couldn't get that to work either. I think what you suggested earlier regarding MQTT might be a better approach. I'll look into that tonight.
?
Any ideas why I can't see the USB connection when adding a Reporter.
?
Or, could I use the RFID input connection to read from a bar code reader to an IDtag?
?
Nick |
Re: Xnet Message queue not being send to layout
#lenz
#xpressnet
No worries as long as we progress it is already awesome! Unfortunately I won't be able to test your las release on the layout for the next two weeks as I am in that city anymore. Sorry for that and thanks for your efforts. ?I will sure keep you posted as soon as I can.
?
Regarding the Error I guess around "
2025-05-04T11:06:00,124 lenz.XNetThrottle DEBUG - set Speed to: 0.0 Current step mode is: 28 SS [Speeder : X73500 (DCC 7)]
2025-05-04T11:06:00,124 lenz.XNetThrottle DEBUG - queuing add to message queue [Speeder : X73500 (DCC 7)]
2025-05-04T11:06:00,401 lenz.XNetThrottle DEBUG - added message to queue, now containing 28, state 2 [AWT-EventQueue-0]
2025-05-04T11:06:07,435 automat.AbstractAutomaton ERROR - Stop with currentThread null! [AWT-EventQueue-0]
I did not notice it but I guess it as to do with the way I handle a back and forth transit of a little .
?
Best |
Re: Manifests: Why print all at once before an Op Session?
#operationspro
Clarence,
?
That is it exactly!
?
If the crews are using JMRI's "Conductor" feature/screen (on their phones or tablets or tablets supplied by the RR host), then no traffic manager is needed, because:
?
1. The train crews are updating the work done (including even setouts or pickups missed) in real time.
2. The next crew just signs in to the Conductor page for the next train.
3. The Yardmaster also has a screen that they can update in real time (what's in the yard, what's yet to do).? If /as new trains are generated, JMRI can update the Yardmaster's printed switchlist, and also the screen.
?
From Operations, click the "Trains" menu, then press "switchlists" near the bottom.? See example below:
?
?
?
Now you CAN choose to print all switch lists immediately, or to print them in "Real Time".? I use Real Time.? ?
?
The conductor screen will advance the trains' locations so new trains can be built.?
On my KCS layout (thanks Ken for your mention!) I do have a live dispatcher.? I'm using a (FREE!) JMRI add-on authored by Rodney Black known as "CATS" see .? That has a feature that "automatically "moves" the train(s) within JMRI's Ops Pro as the train symbols move across the layout on the dispatch screen.? That removes some of the work/ bookkeeping required and obviates the need for operators to use the Conductor screen (though to be fair the use of conductor is more accurate since it can account for missed work and other things only the local train crew would know about).
?
Whether the trains are "moved" within JMRI via linkage to a Dispatcher panel, by train crews using the Conductor screen, or via an external host or traffic manager, there is still another step needed: to cause JMRI to generate new manifests/switchlists for any train(s) dependent on the movements of another train.? This can be done manually (a traffic manager/host builds the train when needed via clicking the Build button for that train, OR, automatically by JMRI using the "Edit" button in JMRI which will bring up another menu which has a "Scripts" option - click that to get the below:
?
?
As you can see, you can then run scripts to do things like build another train as the train (a) is built; (b) is moved (to another location on the layout) or (c) after it terminates.
?
Many people use these features to generate manifests as needed, providing the functionality many associated with car cards/waybills.
?
Steve Davis
KCS Heavener Sub
?
?
|
Re: Coding with Packet Analyzer
Thanks, Bob. That would be a way. Seems overkill though, with so much code already in place to support the device! To my non-JMRI mind, it seems it should be no more than a tiny extension to what's already there. Then again, what do I know? ? But thanks for the suggestion. Wouter On Mon, 5 May 2025, 18:28 Bob Jacobsen via , <rgj1927=[email protected]> wrote: I think you could write a script that directlty accesses a serial port to get the raw data from the Packet Analyzer. This script could be a staring point: |
Re: Coding with Packet Analyzer
I think you could write a script that directlty accesses a serial port to get the raw data from the Packet Analyzer. This script could be a staring point:
jython/serialinput/SerialPortDevice.py Bob On May 5, 2025, at 1:06?PM, whmvd via groups.io <vandoornw@...> wrote: ¡ª Bob Jacobsen rgj1927@... |
Re: How do I hook up a bar code reader to JMRI
¿ªÔÆÌåÓýSo, in principle...? ?you could write something in Python (or similar) which takes the readings, and then "publishes" a message to MQTT.? ? If that message were to a path such as "../mylayout/reporters/reporter01" and contained the text
value "123AB123" (or whatever your barcode said),? then you're just about home and done as JMRI can subscribe to those messages and will treat them as reporter messages.
Question is how much of a learning curve are the two key steps:? (a) installing a MQTT broker, and (b) code-writing to get the above to work.??
?
- Nigel
------ Original Message ------
From "Nick Brownsberger via groups.io" <nbrownsbe@...>
Date 05/05/2025 18:19:05
Subject Re: [jmriusers] How do I hook up a bar code reader to JMRI
|
Re: Coding with Packet Analyzer
An interface to obtain just the texts (I'd assume a listener interface triggering its clients on the equivalent of what is a complete line in the output window) would absolutely do me. Parsing and discarding would not be a problem. But again: I'm not the OP. It's just that he mentioned a feature I've on a few occasions talked about and asked for myself, so if there's a bandwagon emerging, count me as having jumped on. Wouter On Mon, 5 May 2025, 12:58 Ken Cameron via , <kcameron=[email protected]> wrote:
|
Re: How do I hook up a bar code reader to JMRI
NIck, What reader hardware are you using? Dave Sand ----- Original message ----- From: "Nick Brownsberger via groups.io" <nbrownsbe=[email protected]> Subject: [jmriusers] How do I hook up a bar code reader to JMRI Date: Monday, May 05, 2025 10:07 AM I want to use a barcode reader to identify cars on my layout, but I can't find a way to read the code into JMRI. I've reviewed other bar code topics from this group in the past but none answered my question. ? One way I've tried is to use a Reporter. I'm using an iMac running macOS Monterey. When I connect the bar code reader to the USB port, I can see it in the Mac system report and in JMRI>PanelPro>Debug> USB devices. However, when I try to create the Reporter using 'others' as the system manufacturer and (Direct Drive (Serial) not available), the USB port does not show in the serial port drop down. I can't get past this problem. ? Another way I've tried is to use a Memory Variable. I can read the bar code into the value field if my cursor is in that field. But I don't known how to select that field without a cursor. I don't need to identify a port, as the bar code reader just acts like a keyboard, entering a 4-digit number and <enter>. I've never tried manipulating JMRI windows and am not sure how to activate a particular field in one. ? I'm creating Jython script to accept the bar code using the waitChange command (for the Reporter) and then process it. But as I said I'm stuck trying to get the bar code inside JMRI. The Reporter track is preferred, I think, since I will be using two bar code readers eventually and I can have two reporters attached to two different connection ports. I don't know how I would do this using a Memory Variable. ? Can someone help me out? ? Thanks, Nick |
Re: How do I hook up a bar code reader to JMRI
¿ªÔÆÌåÓýMy approach would be to look at two routes and decide the easier one:?
a)? use an existing serial device for reporter type, and make the bar-code reader's output fit the format expected from that device.? ??
b)? take the bar code reader's output, and feed that to an MQTT broker (eg. Mosquitto, which could run on your iMac).? ?Then use the MQTT connections inside JMRI to read the data from the MQTT broker.? ?If the data are not yet in "reporter
form", there are methods within LogixNG which could help translate things.??
- Nigel
------ Original Message ------
From "Nick Brownsberger via groups.io" <nbrownsbe@...>
Date 05/05/2025 16:07:12
Subject [jmriusers] How do I hook up a bar code reader to JMRI
|
Re: NCE ProCab- Light-it as signal decoder - Simultaneous commands
#nce
Lou, Signal mast logic (SML) has some delays when setting a cascade of signal mast changes. Here is an example using NCE simulation with "DCC Signal Head" decoders. ?The signal masts use the "Signal Head Controlled Mast" driver to combine one or more heads to make a mast. Here is the NCE Command Monitor output. 09:56:32.651: [AD 00 66 04 00]?? Accessory 102 Reverse direction (OFF) 09:56:32.900: [AD 00 6A 05 00]?? Signal 106 Aspect 0 :: Right-AU 09:56:32.907: [AD 00 6C 05 00]?? Signal 108 Aspect 0 :: Right-B 09:56:33.151: [AD 00 70 05 01]?? Signal 112 Aspect 1 :: Inter-RL 09:56:33.158: [AD 00 66 05 01]?? Signal 102 Aspect 1 :: Left-AU 09:56:33.405: [AD 00 6B 05 01]?? Signal 107 Aspect 1 :: Right-AL 09:56:33.414: [AD 00 6D 05 02]?? Signal 109 Aspect 2 :: Right-C 09:56:33.667: [AD 00 70 05 02]?? Signal 112 Aspect 2 :: Inter-RL Maybe the SML delays would take care of the lost message problem. Dave Sand ----- Original message ----- From: "louis.dirosso via groups.io" <louis.dirosso=[email protected]> Subject: Re: [jmriusers] NCE ProCab- Light-it as signal decoder - Simultaneous commands #nce Date: Monday, May 05, 2025 10:51 AM For what it¡¯s worth, I should have listened to Dick (RRCircuit founder) and went LCC from the get go. Like you, I tried to keep everything in house with NCE figuring it would be easier and it made sense¡ until I tried it.? The beauty of the signalman is you can use them on LCC or DCC. For now, I use them on DCC, but if I ever do a significant wiring project or layout reconstruction I will convert to LCC.? Also, I upgraded my DCC power. I use a NCE 5amp booster / command station as a base.l, but all my accessory decoders (switch-it, signalman, turn out power, lights etc) are run off a dedicated 5amp booster from Tam Valley. I¡¯ve heard this cleans up the DCC bus when sending complicated and multiple signal commands. ? My layout is divided into 3 power districts using the NCE booster and 2 other Tam Valley boosters. All my signals are controlled with my own Logix. Everything runs Automatic Block unless I check a ¡°CTC¡± box on my panel, in which case all signal logix looks for a sensor to be clicked to release each signal. Once you release a signal, the ABS allows it to change to whatever aspect it need be, all while looking at the next signal (which is red until released), similar to real life CTC systems. ? Lou -- Modeling Conrail¡¯s Boston Line in HO |
Re: NCE ProCab- Light-it as signal decoder - Simultaneous commands
#nce
¿ªÔÆÌåÓý?I have observed some signals driven by Light-its step through changes in aspects before settling on the correct aspect. Not knowing how the Light-its and signal commands work, is its possible the changing commands are not buffered in the light-it so it misses out on the last correct command? I strictly use SML so no extra delays are introduced by Logix(NG). I have lessened errors by increasing the number of repeated signal head commands to 5-6 for each signal.? I assume the repeats are sequential rather than interspersed with other commands. Is there a way for JMRI to space out the commands or re-issue a refresh set of commands to assure a match to the LE signals, sort of like loco commands? I know if repetitive would create a lot of command bus traffic.? John ?Bauchiero -?NCE PH-Pro & PowerCab, Pi4, DCC-EX - JMRI 5.11.5 - Java 17.0.12
|