I really like the idea of Web Ground Control and I absolutely think something like that is the future. I would like to start designing a controller specifically to work with Web Ground Control.
CNCs using stepper motors are VERY sensitive to timing because the motors require precise and high frequency pulses to move. A closed loop system like ours should be a lot more forgiving about timing (especially if the processor is much faster than the motors) so I think we may be able to get rid of the Arduino entirely and control the motors directly from something like a Raspberry Pi. It’s still a theory, but I’m interested in playing around with it more.
My first thought is to use the Raspberry Pi Zero W which gives us a good amount of processing power, SPI, and wifi/bluetooth in a small package. The SD card is a pro and a con. I like that it easy to replace the software completely with a new SD card, but also it adds cost and I am a little bit worried about dust getting in there. The need to solder on headers is also not ideal, but workable.
Something like the Raspberry Pi compute is built for that type of thing, but it doesn’t include WiFi and is not easy to reprogram for the end user (and being hackable is important).
Does anyone have any other suggestions for little cheap wifi boards which could run a little web server and some PID loops?
Edit: On the other end of the spectrum something like the Air602 for $1.90 is designed to be soldered directly to a PCB. The cons are that it doesn’t have the huge support community that the Pi does, and with 1Mb of storage we aren’t going to be having any fancy pictures in there.
When people come to us looking to move to a production with a PI (which used to be tough to get wholesale, but that’s becoming less of an issue) we would recommend redesigning around a Beagle Board. There is a vendor making these as a SIC, but that would be overkill here.
Well, that would certain solve the settings sync issue with webcontrol. One of my concerns, and I don’t know the answer and I think you alluded to it, is whether the RPi is able to manage all the user interface requests as well as maintain the motors. I don’t know what’s required timing wise, but some of the user interface functions of webcontrol (particularly the sending a complex piece of the gcode to the client) can bog down the RPi. Maybe it can be optimized to handle it.
Are you thinking this is a way to eliminate the custom motor controller shield and allow other ones to be used?
I’m very much not into the hardware aspect (I like working with my databases, dangit).
It would be interesting to have all the smarts in a single box, though. What about the UDOO boards that are like a combination of an RPi and Arduino. We’d still need the extra board for controlling the motors, though.
I would go with a regular pi, or with a Beagle Bone Black, the extra cost is
minimal, and it’s really good to be able to dedicate a processor core to the
real-time stuff and have others available to deal with the network and other
Using a Pi is a common way to go, using a BBB gives you the real-time processors
on-board so that it can do real time work.
I am very interested in the possibility of using absolute encoders on the motor
outputs that you can read via serial, what would pretty much eliminate real-time
the difference between the 8MHz arduino and the 1500 MHz cores on the pi can
also make up for a lot of ‘real time error’
another direction to consider would be something like the ESP32, dual 240MHz
cores with wifi, so you could have one core managing the machine and another
doing the webserver.
Overall, I think going with the pi would be the best long-term option as the
work done there can basically be used on any linux-based machine in the future.
This is why using a Pi3 or Pi4 would be better than a Pi0. the bigger ones have
4 cores, so one can get bogged down while another is still free to manage the
hardware (there are software complications with having multiple
processes/threads and communicating between them, but that’s reasonably well
understood territory, even if it is something people struggle with a fair bit.
My thought it that if you are trying to avoid a custom built motor controller, then I think it’s worth pursuing. If a custom motor controller is still planned then I don’t really see the advantage of doing so since the Arduino (or whatever) is relatively cheap component to add in.
But I have thought about creating a motor controller with an embedded microcontroller that is strictly running the PID loop. The rpi would do all the gcode processing and just send set points to the controller over serial and the controller would be responsible for the pwm/encoder processing and reporting error. Doing it this way, you could implement a traditional two motor maslow with one board and a four motor maslow with two boards.
I agree with David. At $35 the Pi3 or Pi4 is not a material cost compared to the consumables that are involved in regular CNC work.
You’ll get all the GPIO pins on board and benefit from a large and robust ecosystem for hardware and software. Also daily overlooked is the long availability timeline. The Pi foundation is committed to multi year supply because people are building products around them.
Also the pi4 has two HDMI outputs so you could have both the current software as well as a new dashboard or visualization screen if desired.
Also the pi4 has multiple ram options at 1g, 2g or 4g. Not sure how much ram is needed but allowing for say 2g minimum leaves the door wide open for innovation by the community.
I agree with having a multi core system and dedicating a ore for the UI and others for motor controllers. I came from a professional video background where we were processing dozens of live HD video streams for broadcast and we did exactly this as the timing requirements are low ms with extreme consistency. We were using Intel CPUs but same idea.
Also the extra pins on the PI can be used for controlling relays for dust extraction or the auto zeroing sensor etc that others have shown here.
If you are concerned about the SD card you could always PXE boot the pi from a host PC. And run in RAM. We did both. Firmware was on a flash device. It loads to a ram disk and executed from there. So the flash was for storage and mostly read only except some critical logs. For a subsystem we had it PXE boot from the main host and run from ram. That way we would provide the 24/7/365 required. Also the system find very fast when everything is in RAM. If 1G would do them spec a 2G board and boot from SD in to RAM. Helps improving timing and removes disk IO bottleneck risk.
We did a stacked set of images. When running in RAM you can overwrite what is below you. So we had Kernel at the bottom then a base OS image then an OS app image and then our custom apps. So this way you can have the base OS extremely stable and constant and update just the OS app layer or your custom layer on top. Loading the new image just requires a reboot once downloaded.
Also you can apt-Get install things love for temporary use and they vanish on reboot. For gcode file storage if you want to keep it local that could be on the SD. By minimizing writes to just gcode and some basic logs life expectancy of the flash should be many years.
Another thought with the SD card is that it would provide a really easy way to initially distribute the software. Installing an image on the SD card seems like a pretty straightforward process, though I’ve only done it once with a rPi, and that a while ago.
If we were to use the Raspberry Pi compute anyone who wanted to modify the software would need one of these adapters which seems like a hassle.
This seems like very exciting option to me. Great recommendation. I am going to read up more on these. This seems like a good solution which would basically replace the Arduino Mega with something else comparable and modern.
Thanks for the recommendations everyone! I will keep reading up on all of these and I’ll post my progress when I make any.
If we are looking at ESP32 boards and the like does MicroPython or CircuitPython (AdaFruit branch of MicroPython) come into play?
I am not familiar with either, but seems to be a trend in micro-controller development. You can program the supported boards without the Arduino IDE and with native USB, they show up as a drive letter on your PC when connected, and their is no longer a need to compile code and push it over a serial link.
possible, but I would be a bit surprised. The firmware is already written in C
and while these are far more powerful than an Arduino, I’d rather use that power
to drive the machine than to drive the python interpreter