ESP32/S2/S3 LinuxCNC Controller (6 axis hardware step gen), USB plug-and-play

23 Feb 2024 23:12 - 23 Feb 2024 23:29 #294138 by wez
Hey all,
I’m trying to gauge how much interest there is for a new open-sourced motion controller for LinuxCNC based on the low cost and abundant ESP32/S2/S3 series of wireless MCUs.

Posting in General to hopefully gauge maximum reach – mods I hope this is ok given the potential benefit to LinuxCNC?

Goal is to have an ecosystem that doesn't have to rely on closed source commercial only control boards.

The firmware will run on any of the respective MCUs and shouldn’t require complex firmware build environments. Allowing users to get up and running quickly.

Medium term intention will be to offer custom boards with all relevant IO and fully featured for multiple machine types – Mills, Lathes, Pick and Place, Robotics & Automation.

Nothing prevents you from designing your own board and using the firmware however!

I’m aware of other projects that use FPGAs but component sourcing and setup can be complex for most users.
Known working features and capabilities:
  1. Full open-source firmware based on Arduino libraries allowing for any developer to customise as easy as possible if needed (most cases shouldn’t warrant it
  2. Must be reliable and thoroughly tested
  3. 200khz total step pulse frequency generation in hardware for up-to 6 axes (4 on the ESP32-S2)
  4. Low latency, low jitter, near real-time communications to LinuxCNC with error handling to ensure the host is aware of any problems with the controller/machine
  5. High frequency pulse counting for encoder feedback (multi-axis), spindles, lathes – rigid tapping etc
  6. Analog inputs
  7. PWM outputs
  8. Lots of native IO: ESP32-S3 – would have 15 GPIOs available on a 6 axis machine. Use of I2C GPIO expanders allow this to expand to approx. 50+ on a custom board design
  9. Native Ethernet support (RMII) on the ESP32 and USB networking on the ESP32-S2/S3 series. True plug-and-play controller (working)
  10. Easy to use command line interface to support config and monitoring
  11. Web interface for IO, peripheral and motor configuration. Responsive, mobile compatible. Additional tool to export config json to create LinuxCNC config templates for fast initial machine setup.
  12. Low latency and high-speed wireless point-to-point peripheral connectivity. Another ESP32(Sx) can easily connect directly to the controller with ability to communicate with the LinuxCNC host. Probes, MPGs, wireless VFD PWM/Modbus controllers
  13. Wireless station mode (client) or connect to existing access point to be able to perform seamless firmware updates and can be used to connect phone/tablet directly to view machine status with low latency (app dev future scope)
  14. Firmware update management either via local flashing or automated secure web pulling

Potential future ideas:
 Based on inter-MCU ESP-NOW functionality 1ms for 1 byte with no TCP overhead or WiFi conf management random latencies, much like NRF wireless protocol used in game controllers. Has security.
  1. Wireless battery operated LinuxCNC user interface using 7” high resolution capacitive touch screen connecting directly to the controller. A highly flexible and customisable user interface with core LinuxCNC UI features. 100ms latency data streaming
  2. Wireless reliable GPIO/PWM expanders – e.g Pick and Place machines feeders which ideally want to be remotely controlled. Pneumatic or electric solenoids etc. Controller can pause a job if wireless connection to any critical controllers is lost (not occurred yet in testing but would be subject to environment)
  3. Wireless measurement/instrument tools integrated into LinuxCNC e.g. calipers, micrometers, touch probes – almost anything you like!
  4. Wireless tool changer controller?
  • Integrate vendor specific drives into controller (likely different firmware releases)

What does the community think about this?
Last edit: 23 Feb 2024 23:29 by wez.
The following user(s) said Thank You: tommylight, aparecido, hairy, Mecanix

Please Log in or Create an account to join the conversation.

23 Feb 2024 23:18 - 23 Feb 2024 23:29 #294141 by wez
Well... the formatting of that hasn't gone well. Editing it makes it worse! 
Last edit: 23 Feb 2024 23:29 by wez.

Please Log in or Create an account to join the conversation.

24 Feb 2024 00:05 #294145 by cornholio
Re the FPGA comments:
Sourcing the boards used is as easy as going on AliExpress.
Setting up the build environment is pretty easy for the Lattice boards. Even easier for Spartan 6 based boards.

IMHO where some of these projects aren’t up to scratch is the motion controller to machine interface. This seems to be left up to the end user. Which can put the expense up to almost the cost of an “off the shelf” solution. This I can speak from experience with my own endeavours when using MachineKit and a beagle bone black. As well as using firmware with a Spartan 6 dev board.

I’m not knocking any new projects but just voicing some of the things I’ve experienced. I’ve not delved into using an Ethernet interface due to complexity of PCB design and writing of the driver required on the FPGA side.
Now a comment on these projects as a whole. It would be nice to see those developing these projects strive towards a common Linuxcnc driver. It appears every project has their own particular driver required. Mayhaps something similar to the Mesa solution, the hostmot2 driver does the “software tasks” and then the other modules talk to the hardware. A very simplistic and not I’d imagine totally accurate description.

Please Log in or Create an account to join the conversation.

24 Feb 2024 00:19 #294147 by tommylight
I have 2 of ESP32 on this desk right now, one attached to this PC, plenty more in the shop and today got delivery of 2 of ESP8266, so yes i am interested and will gladly test even on machines.
No S2/S3 yet.
The following user(s) said Thank You: wez

Please Log in or Create an account to join the conversation.

24 Feb 2024 01:00 #294154 by wez
Thanks for the feedback. Yea I'm aware of the ease to source FPGS boards. They're great and amazing but pin mapping, firmware compilation and souring the right binaries for a specific hardware isn't straightforward for some.

I'm only striving for something that's completely seamless, easy to setup, reliable, feature rich and is readily available for a low cost overall.

Simple flash of firmware, config either via CLI or WebUI (or host driven like hostmo2) regardless of board type.

I think I mentioned about the setup in my original post - the driver and hal config will be mostly automated based on templates with clear documentation supporting customisation.

Which kind-of aligns re LinuxCNC driver, I think having a common driver is a good idea too and I'd like to see such a thing but can't be sure if gaining buy in from other projects would happen? Suppose could be a case of build it and others will adopt?

Re ethernet - the S2/S3 supports USB, I understand your comments are relating to Ethernet + FPGA and board design. USB hardware design is much simpler and uses less IO than RMII/SPI.
S2/S3 modules can be bought if wanted to go custom route.

Or could use an existing abundant COTS S2/S3 module with USB already on it, design a carrier for any IO you like avoiding any USB hardware design aspects. IIRC there's over 16 "modules" for the S3 and 10 for the S2.

Pre-built, tested boards will be available once the firmware and features are refined.
The following user(s) said Thank You: aparecido, hairy, cekaa

Please Log in or Create an account to join the conversation.

24 Feb 2024 01:15 #294156 by wez
Thanks tommylight. The S2/S3 USB ethernet support is something you may be interested in bench testing, will be released soon. The ease of USB with no IP config is quite nice.

Video proof of multi-axis step gen pulse trains on a scope and produce iperf latency/jitter results is on the to do list. I have the latest data just need to present it nicely.

Running an ESP32 on a machine here and it's performed surprisingly well, no board restarts at all and no steps lost. Once issue #15 in my repo is solved it should be near perfect
The following user(s) said Thank You: tommylight, aparecido

Please Log in or Create an account to join the conversation.

24 Feb 2024 01:58 #294163 by cornholio
Actually starting with the Mesa sources, modifying the pin mapping, defining the modules you want and then building the firmware I’ve found to be far easier than any other platform, be it STM, esp32 or anything else. I will give that the Mesa code base is also more mature.
I have looked into the various projects around, added a few bits of code here and there.

I reckon if you set up a build environment for the Spartan 6 family and had a go at building a bog standard project for a Mesa card you’d see how insanely easy it is.

Like I said before the biggest letdown in some of these projects is the electrical interface from the motion controller to the machine. A robust yet simple design for getting the logic levels of the main micro controller to 12/24 volts of machine controls is needed. I would also suggest, going against modern trends, is to stick to through hole components where possible, for ease of assembly. Even tho I have years of experience in smd soldering I still tend to stick to through hole for ease of soldering and obtaining the parts from my local electronics shops. I suppose living Down Under affects this as well as either we have to wait at least 10 days for delivery, even tho Element 14 and RS have local warehouses, or spend a decent amount at Digikey or the like.
It’s sounds like Tommy may have similar experiences in his neck of the woods.

All in all its great seeing what others are doing.

Another suggestion for you Wizards of Code, getting a simple code base for Smart Serial on one of the more popular controllers would be fantastic. I’ve looked at the STMBL code but it goes over my head then out in one ear and out the other.
The following user(s) said Thank You: wez

Please Log in or Create an account to join the conversation.

24 Feb 2024 04:17 #294172 by wez
  • ESP32-S2 (Single Core!)
  • USB Networking (No Ethernet)
  • Waveshare Pico S2 module
  • Raspberry PI 4
  • 4 Axis
  • High speed test
The following user(s) said Thank You: aparecido, hairy, Mecanix

Please Log in or Create an account to join the conversation.

24 Feb 2024 06:21 #294179 by Mecanix
Impressive. Be mindful that we've received an email last week about the delivery of pre-sale ESP32-P4. We should get our hands on that badboy anytime in march. No specifics about the global rollout of the device however expect this to be a month or two after the engineering samples are out.

If you are serious about maintaining a community espressif solution for Linuxcnc, I would put your project on hold until then. P4 brings quite a bit of hardware parallel IO capabilities and packs a significant punch if compared to the S2 or dual-core S3.

All in all fascinating and looking promising judging from your video, thanks for sharing.
The following user(s) said Thank You: wez

Please Log in or Create an account to join the conversation.

24 Feb 2024 11:59 #294201 by cornholio
With the USB interface can you still do threading and other ops that need spindle sync ?

Please Log in or Create an account to join the conversation.

Time to create page: 0.099 seconds
Powered by Kunena Forum