- Hardware & Machines
- Driver Boards
- Solving the USB Latency Dogma for HMI/MPG: Technical Feedback Request
Solving the USB Latency Dogma for HMI/MPG: Technical Feedback Request
- bobwolf
- Offline
- Senior Member
-
- Posts: 62
- Thank you received: 22
Hi all,
I’d like to open a technical discussion about a project I’ve been working on, io_decoder, focusing on the software solution I've implemented to handle USB communication within LinuxCNC.
I am well aware that in the official LinuxCNC documentation and Wiki, USB is often described as 'the evil' (or, more formally, as 'not suitable for real-time control'). However, if one looks closely at the context of those warnings, they are strictly related to step generation and primary motion control, where microsecond-level jitter is fatal.
For HMI panels, MPGs, and secondary I/O, I believe this 'dogma' can be challenged if the HAL component is designed to manage the USB stack correctly. My goal is to allow users with complex retrofits (like those using Mesa 7i80/7i92) to offload all non-critical I/O to a single USB bus, freeing up high-speed pins and reducing the 'wiring nightmare' and EMI risks.
To test the limits of my custom HAL component, I’ve pushed it to handle real-time axis tracking via an encoder (not just simple buttons).
You can see the fluid response in this playlist:
www.youtube.com/playlist?list=PL9D_TSVxg...tA9_k6njBeVTL0IYY7Ct
In other communities, the mere mention of 'USB' triggers an immediate rejection. I’m posting here because I’d like a more nuanced, engineering-focused feedback:
1. Given that a human operator has a reaction time of ~200ms, is a stable 20ms update cycle (50Hz) really a bottleneck for MPG tracking or HMI interaction, considering it's handled by a dedicated non-blocking HAL component?
2. How can I further improve the HAL component to make the communication even more robust against bus jitter?
The project is Open Source and I'm looking for peers to discuss the driver implementation rather than the hardware itself. What do you think about the responsiveness shown in the videos?
Documentation & Wiring:
bobwolfrst.github.io/io_decoder-linuxCNC/
Best regards,
Roberto
Please Log in or Create an account to join the conversation.
- rodw
-
- Offline
- Platinum Member
-
- Posts: 11654
- Thank you received: 3924
1. You don't say anywhere how to get the boards which are very well thought out. I'd love to test it.
2. New software to go into Master branch (2.10) which will be released in a few months.... This needs to be tested on this version (I'm finalizing a how to build linuxcnc video on my @MrRodW YouTube channel
3. Reformulate (or recreate) the git repo so this can be packaged as a PR to Linuxcnc. This would give you the best chance of success with your hardware project.
4. Your business model is similar to Mesa's so having an open source driver for your hardware in the Linuxcnc distro is not really controversial.
Please Log in or Create an account to join the conversation.
- unknown
- Offline
- Platinum Member
-
- Posts: 881
- Thank you received: 319
At the end of the day one still has to make a connection from the input or output device on a control panel to the interface board.
The wiring nightmare and/or EMI issues will be a creation of the practices used by the person doing the work. In summary these issues are going to be site specific.
From memory Mesa did have a USB interface board, but is now listed as obsolete. It also supported EPP, only mentioned for completeness.
Please Log in or Create an account to join the conversation.
- NWE
- Offline
- Premium Member
-
- Posts: 94
- Thank you received: 27
+1Subject: Solving the USB Latency Dogma for HMI/MPG: Technical Feedback Request
Hi all,
I’d like to open a technical discussion about a project I’ve been working on, io_decoder, focusing on the software solution I've implemented to handle USB communication within LinuxCNC.
More hardware support for LinuxCNC.
I am very much interested in this project. I have experience with embedded mcu applications, but zero experience doing development with the USB stack. Last year I was thinking that this type of I/O via USB connection should be developed, but did not find time to start on it.
I like the mechanical format of your boards, for edge-mounting them on a DIN rail.
Ethernet is very good for EMI prone applications, however, there are plenty use cases with less EMI where USB is just fine. For example, I have LinuxCNC reading an industrial position sensor through a cheap USB to RS232 dongle going on about 10 years by now. It substitutes for an encoder, providing feedback for a relatively slow moving PID controlled axis. This is on a setworks on a lumber mill, to set board thickness. The only interference problems they've had was of a mechanical nature, when a log jams in the wrong spot and rams the $2500 USD magnetorestrictive position sensor. It gets all bent out of shape, but lasts more than 5 years.
Please Log in or Create an account to join the conversation.
- bobwolf
- Offline
- Senior Member
-
- Posts: 62
- Thank you received: 22
I'm Italian. Italians are all dramatic and exaggerated in their statements.I'm a little unconvinced how changing to USB would have an affect on the "wiring nightmare or EMI issues".
But to get serious: I imagined installing the system near the operator panel, so that all the controls are wired nearby; thus, keeping the wiring and connections clean and organized. Only the USB cable runs from the panel to the PC.
Over the past few months, I've had a lot of free time, and at first it was just a test to see if it worked... and gradually, things took shape, and I saw that there was a viable solution. I started with bit-banging from the Mesa board to control the shift registers... but I wasn't satisfied with the solution.NWE writes
Last year I was thinking that this type of I/O via USB connection should be developed, but did not find time to start on it.
To reply to rodw:
1. The project started as a personal challenge, and the ones you see in the videos are the boards with "sins of youth" that I had built after the breadboard phase. I'm planning on making some basic kits with the correct versions. For now, I have some old boards.
2. It would be a dream. But I'd like the project to be further tested by others as well.
3 See point 2. Then I'll get organized, and if it's accepted, they'll include it in some update of the new version.
4 If you compare me to Mesa, you'll make me blush... I'm a hobbyist, they're professionals.
ciao
Roberto
Please Log in or Create an account to join the conversation.
- rodw
-
- Offline
- Platinum Member
-
- Posts: 11654
- Thank you received: 3924
This would be good where a PC like an Odroid H4 was embedded in the HMI enclosure itself
Please Log in or Create an account to join the conversation.
- unknown
- Offline
- Platinum Member
-
- Posts: 881
- Thank you received: 319
The 7i73 will allow a reasonable HMI with just one cable as well. A 7i90 with SmartSerial firmware works in the same way.
Please Log in or Create an account to join the conversation.
- NWE
- Offline
- Premium Member
-
- Posts: 94
- Thank you received: 27
+1The 7i73 will allow a reasonable HMI with just one cable as well. A 7i90 with SmartSerial firmware works in the same way.
I have used 7i73 and it was really good. I will use 7i73 again whenever a project calls for it. Still, I celebrate everytime additional hardware support shows up for linuxcnc.
As I said, I had thought of doing this myself, but the fact is, I will never find the time to do everything I think of doing. I am really pleased bobwolf is doing this.
Please Log in or Create an account to join the conversation.
- bobwolf
- Offline
- Senior Member
-
- Posts: 62
- Thank you received: 22
I'm currently drafting a quick-start guide and a wiring diagram to make the testing process as smooth as possible for everyone.
I expect to release the package (firmware + documentation) this weekend.
Stay tuned!
Please Log in or Create an account to join the conversation.
- bobwolf
- Offline
- Senior Member
-
- Posts: 62
- Thank you received: 22
As promised in my last update, I’ve just released the v1.0-eval package, including the driver, the Arduino firmware, and full documentation.
I’ve set up a dedicated project page to host the quick-start guide and the wiring diagrams to make the setup as easy as possible.
What’s included in this release:
HAL Driver: The core engine to interface your USB panel with LinuxCNC.
Evaluation Firmware: Ready to be flashed on your Arduino Uno.
Technical Docs: Wiring schemes and HAL configuration examples.
You can find everything here: Project Home & Documentation: bobwolfrst.github.io/io_decoder-linuxCNC/demo_mode.en
Quick Links:
Direct Download (.zip):
github.com/bobwolfrst/io_decoder-linuxCN..._decoder_eval-v1.zip
Technical Demo: Evaluation Mode & HAL Test Video (showing the real-time response of the physical buttons and MPG in HAL).
I’ve also recorded a short technical demo showing the driver in action: you can see the real-time response of the physical buttons and MPG selector mirrored instantly in the HAL pins.
I’m really interested in your feedback regarding the setup process and the latency you experience on your machines. Let’s break the "USB dogma" together!
ciao
Roberto
Please Log in or Create an account to join the conversation.
- Hardware & Machines
- Driver Boards
- Solving the USB Latency Dogma for HMI/MPG: Technical Feedback Request