By coincidence I’ve been looking at using a Raspberry Pico for this. Both the pico and Micro:bit are based on ARM M0 Cortex, except the pico has two and they’re both at least as twice as fast as the micro:bit. Might matter because MicroPython (which both platforms run) is rather slow, and Python might struggle to produce pulses fast enough to get decent RPM out of a rotary table.
Prodded by the late John Stevenson, who hated nested menus, I wrote an alternative to Gary Liming’s Arduino effort: Gary used a combined 5 button/LCD IO module, whereas I use a 4×4 keypad, and separate LCD display. My version also has some extra features like backlash correction, undo/rewind, and remote control. Performance is similar. Intended to be an MEW article, but I thought World of Ward and Gary got there first.
The keypad eliminates nested menus by allowing numbers to be typed in directly, and simply by having more buttons. I decoded my keypad thus, using A for Angle, B for Bump, ie ‘Jog’, C for continuous, and D for division steps.
I think 4 or 5 have been built, most recently by Peter Cook of this parish, who spotted a couple of bugs and suggested an improvement. Looking at the code to confirm Peter was right, he was, reminded me I’d intended to revisit the code with a view to driving the table faster. At the moment the Arduino drives a 90:1 HV6 reasonably, but I’d like it to be faster.
Motor speed is limited by how fast the microcontroller can send pulses to the controller, and is throttled in my implementation by how long it takes a 16MHz Arduino to loop through the control logic. Written in C so adequately performant, but my design does motor control by “bit banging” in software, which is slow. I hoped to use one of the Arduino’s built-in hardware counter/timers to send a stream of ‘n’ steps on demand, which would be much faster but turns out the Arduino family doesn’t support that.
Same problem with the Micro:bit. Python will make it easy to implement the control logic, but Python may not be fast enough on a 64MHz M0 to bit bang a stepper motor as quickly as needed.
The reason I’m looking at the pico is because it includes a Programmable Input Output peripheral/ The PIO contains 8 individual state machines each specialising in high-speed IO, making it very easy to send ‘n’ pluses. Freed of responsibility for pulsing. MicroPython on a pico should be plenty fast enough for everything else.
I’m not sure about the Micro:bit. As far as I can tell from the datasheet pulses would have to be “bit banged” by the software just as I’ve done on an Arduino, making the table’s RPM uncomfortably slow. Confident it will work, but not that a microbit will be adequately fleet of foot. Will a high-level, semi-compiled, user-friendly, garbage collecting Python program on a 64Mhz processor keep up with a fast. efficient compiled C program on a 16Mhz processor? I suspect it won’t, because Python trades performance for fast development, whereas C delivers fast efficient executables that take much longer to write.
Adequate performance is relative though – even a downright sluggish electronic rotary table should outperform a human twirling a handle carefully, and the computer won’t lose concentration and make silly mistakes. Indexing non-trivial angles with a rotary table manually is hard work, whereas a computer is a doddle.
For what it’s worth as an overview, the micro:bit targets learners, not a bad thing but the board comes stacked with goodies not needed for a rotary table. Arduino is aimed at makers and the boards are robust rather than powerful, so not ideal either! Arduino users are required to learn C/C++, albeit in user-friendly form, which some find too steep. The pico is aimed at power-makers, either writing code in no-holds-barred C, or friendly but chug-along MicroPython. Although the pico has a friendly aspect, it’s not as cuddly as a micro:bit. On the other hand, the pico runs rings round the micro:bit if brute performance is needed, but it’s a shade harder to learn, much more so if C is used. They can all drive a rotary table, but in theory I think the Micro:bit will turn it slowly. perhaps too slowly, unless recoded in C, much harder than Python or Scratch.
The way to find out is to prototype the software and measure how fast a Micropython microcontroller outputs pulses. If a micro:bit gets anywhere near the speed of an Arduino, I’d say that was ‘close enough’.
Dave