This is a project I did in October 2022. I documented the design & build process mainly for myself, but when I saw the Gearing Up contest I figured it was time to upload my first project to Hackaday. I've kept the documentation mostly unaltered, so you can see how the project developed, with all the trials and tribulations that such projects have. I've added some logs about things I remember but apparently didn't write down at the time.
Requirements
- Min RPM: <500
- Max RPM: >6000
- Programmable spin speed and time
- Enclosure that catches flung liquid
- Display that shows RPM and timer
- Buttons for control
- Adjustable chuck that can fit several parts, but at least:
- 50x50mm glass square
- 105x50mm PCB (ideally with header pins sticking out on the bottom)
Inspiration
Parts
(The parts I ended up using are in bold)
Motor + ESC
Brushless motors and ESCs for drones or RC cars are cheap (€10-20 each). Most drone motors spin much faster than we need, so we should pick a slow (<2000 Kv) motor to reach the minimum RPM we're aiming for.
It would be nice if the motor had tapped holes in the rotor, then we could bolt a simple 3D printed or laser-cut piece directly to it as a chuck. A threaded shaft would also work but would probably need an adapter. A D-shaft (AKA shaft with drive flat) would be a last resort
Motor options:
- Racerstar BA2216 1250kv (€21)
- Flashhobby D2826EVO 2208 930KV (€26)
- Racerstar BR3536 950KV (€21)
- Sunnysky X2216 1250KV (€24.78)
ESC options:
- 35A BLHeli_s ESC (€14)
- Skystars Slim40A BlHeli_32 ESC (€18)
- T-Motor F35A 32bit 3-6S ESC (€28.95)
Motor + ESC options:
Speed control
There’s lots of approaches to this with varying hardware complexity and software complexity.
The old BLHeli ESC firmware had something called governor mode or closed-loop mode, where the throttle input was interpreted as a desired RPM and an internal PID kept it at that RPM. However, this firmware is quite old now and the newer versions don’t support it.
The newer BLHeli_32 supports something called bi-directional Dshost, which is a protocol that allows the ESC and the flight controller (which in our case is a microcontroller) to communicate over a single wire. When the ESC receives a (digital) throttle signal, it sends back an eRPM signal that would allow closed-loop RPM control. This is supported in newer flight controller firmware like Betaflight. But to use this on a bare microcontroller, we’d have to implement the protocol ourselves. The protocol is described nicely here, and it may be possible to use the ESP32’s RMT to implement it, but it’d have to be implemented in C because the ESP32 MicroPython firmware doesn’t support receiving signals using RMT.
There’s also some ESCs that support sending telemetry over a separate wire. The protocol seems simpler and it could maybe be implemented using UART.
Note that all BLHeli firmware also supports the old, simple 1-2ms pulse width protocol. Which protocol is used is automatically detected on power up.
Options for RPM sensors:
- Reflective sensor, e.g. QRD1114 or QRE1113 (€3.50)
- Brushless ESC RPM sensor (€5.87)
Power supply
Drone motors are designed to work with LiPo batteries, typically 2~4S (7.4~14.8V). The other electronics like the microcontroller and the display need 5V and don’t draw much current (<500mA). Perhaps it’s better to first run the motor with a bench power supply to see what the current draw is.
Some ESCs come with a built-in 5V regulator (called a BEC or UBEC). Otherwise, these are the options:
We’ll also need a power plug:
- 5.5x2.1mm DC power plug (€3.27 for 10)
Microcontroller
Any modern microcontroller like an ESP8266, ESP32, or Arduino Nano will probably work fine. There’s lots of examples floating around on how to run a brushless motor ESC with an Arduino.
Options:
- ESP32-VROOM-32 dev board (€6)
- ESP2866 dev board (€4.50)
Display
Options:
- 16x2 LCD display with integrated buttons (€4.12)
- Square OLED display (€1.79)
- Rectangular OLED display (€2.72)
Buttons
I’d like one rotary encoder with an integrated push button to control it, an emergency stop button, and a power switch.
- Rotary encoder with push button (€3.16 for 5)
- Rocker power switch (€3.12 for 10)
- 13mm plastic red push button (€4.13 for 10)
- 16mm plastic red push button (€4.12 for 10)
- 16mm brass red push button (€1.58 for 1)
- 12mm brass push button with red LED (€0.95 for 1)
Enclosure
This can be designed and 3D printed or laser-cut.
Chuck
Fancy spin coaters have a vacuum chuck, but this means getting a vacuum pump with all the associated air hoses. We’d also need to find a motor with a hole through the shaft to attach the vacuum hose to and ensure an air-tight seal with the part that has to be spin-coated. I don’t think this is affordable or necessary.
A piece of laser-cut acrylic or plywood (if it’s not warped) bolted to the motor rotor is much simpler. You can put any shape part on it by drilling holes and putting in screws in the right places to keep it centered.
Wire & connectors
You'll need some thick wire (at least 12AWG) to connect the ESC to the motor, as well as three female banana plug connectors (the brushless motor comes with 3 male banana plugs already attached). To connect everything to the ESP32, I used header pins and DuPont connectors on the ESP32 dev board and the display. The remaining wire connections I soldered on directly.