Demo
I filmed this at my desk, first calibrating it over 10 cm of a ruler and then measuring three lengths along the same ruler.
Try it
This copy of the ruler runs the same logic as the firmware and starts on its calibration screen. Drag the Unit Scroll along the ruler to roll it with the wheel pressed down, which counts, or click the ruler to lift it and set it down somewhere else, which doesn’t. Tapping the screen saves a calibration or zeroes the reading, and holding it for a second starts a new calibration.
Calibrating: 0 steps so far. Roll exactly 10 centimetres with the wheel pressed, then release.
A calibration that isn’t exactly 10 cm throws every reading off by the same amount, here as on the real ruler.
How to use it
The AtomS3R’s whole screen is its button, so the ruler has only two controls: the scroll wheel, which you press down while you roll it, and the screen, which you tap or hold.
Measure
You press the wheel down and roll it forward, and the distance counts only while the wheel stays pressed, with the Unit Scroll’s LED glowing green and the reading turning green too. Releasing the wheel stops the count, and rolling backwards while it is pressed takes distance off again.
Tapping the screen sets the reading back to zero, and holding it for about a second starts a new calibration.
Calibrate
The first time it starts, and whenever you ask it to, the ruler measures 10 cm to learn how far the wheel travels per step. You press the wheel and roll it exactly 10 cm along a real ruler, then release it and tap the screen to save the number of steps it counted.
Pressing the wheel again keeps adding to the same roll, and holding the screen starts it over. The calibration stays in flash, so it survives a power cut, and the direction you rolled it in becomes forward.
How fine it measures
The wheel only has so many steps in a turn, so the ruler measures in steps rather than smoothly. Mine counted 49 steps for 10 cm, which makes each step about 2 mm, and the screen shows the exact step length under every reading so you know how much to trust the last digit.
How it works
The Unit Scroll has its own small chip that counts the wheel’s steps and reads its button, and the AtomS3R asks it for both over I2C through the Grove port a hundred times a second. Each read returns the steps since the last one, and they only count toward the distance while the wheel is pressed.
I kept the ruler’s logic, which is the calibration and the distance maths, in one file with no hardware code in it, so eleven unit tests check it on a computer before it goes onto the device. If the Unit Scroll comes unplugged the screen says so, and it picks the unit back up as soon as it is plugged in again.
Hardware
- AtomS3Rruns the ruler on its ESP32-S3, and its 0.85-inch screen is also its button.
- Atomic Battery Baseholds the battery, so the ruler needs no cable.
- Unit Scrollis the wheel you roll, with a push button and an RGB LED, and it plugs into the AtomS3R’s Grove port.

Setting one up
Stack the AtomS3R on the Atomic Battery Base and plug the Unit Scroll into the AtomS3R’s Grove port.
Open Flashdeck in Chrome or Edge, choose Scroll Wheel Ruler, plug the AtomS3R in over USB-C and press Install, which flashes the firmware straight from the browser.
It starts on the calibration screen, so press the wheel and roll it exactly 10 cm along a ruler, then release it and tap the screen to save.
The GitHub repository has the firmware’s code, its unit tests and a download of the firmware image for flashing with esptool instead.
The AtomS3R on this page is rendered from M5Stack’s own model in M5_Hardware (MIT licence, copyright M5Stack), and its screens are drawn from the firmware’s own layout.





