Micro:bit Persistence-of-Vision Daisy

by techprolet in Circuits > Microcontrollers

2054 Views, 13 Favorites, 0 Comments

Micro:bit Persistence-of-Vision Daisy

micro:bit POV daisy

In this instructable we demonstrate the Persistence-of-Vision (POV) effect by exploiting a design characteristic of the BBC Micro:bit's 5x5 LED array.

The Micro:bit sports a very nice 5x5 LED array that can be used in a variety of projects to provide visual feedback such as text, smileys or other codes, as cryptic or artistic as one's imagination can get using a 5x5 array. (The LED array can also double as a light sensor, but this feature is not used in this instructable). What is not directly apparent, however, is that these LEDs are not always on: The controller chip on the micro:bit board flashes them at a high speed, so that

  • the power requirements are met (all LEDs being on all the time would draw more current than the board's specs allow)
  • dimming is possible: We can control either global or individual LED brightness in code, by setting a value from 0-9.

By employing PWM (Pulse Width Modulation), the board controls each individual LED so that it appears to be continuously on and at the desired level of brightness . This is in essence, also a Persistence-of-Vision effect: We don't see a blinking light, but a continuously lit one. The frequency at which the LEDs are blinking is somewhere around 55.8Hz, which is above the eyes' (and brain's) capacity to make out discrete flashes.

If you want to gain a more in-depth view of what goes on with the micro:bit's LED array, you can also read Matt Oppenheim's great write-up, in which he describes the results of his reverse-engineering: https://mattoppenheim.com/2019/03/06/measuring-the-bbc-microbit-led-current-draw/

We use this "feature" of the micro:bit's LED array to create another POV effect, this time based on a stroboscope: By rotating a micro:bit with a LED line continuously lit, we manage to make the flashing of the LEDs visible and, while we're at it, we create a nice (and noisy) daisy image :-). To sound even nerdier, what we accomplish in this instructable is mapping the temporal dimension (the LEDs' PWM flashing) to a spatial one (the daisy stroboscopic image).

Supplies

20210921152309_DSC_4120_2048.jpg
POV_propeller_3.png
POV_tower_4.png

For the micro:bit POV daisy project you'll need:

  • Two 3D printed components, one being the "tower" that houses the stepper motor and the other being the "propeller" that houses the rotating micro:bit. You can of course use your preferred construction method instead of a 3D printer - glued Lego bricks would be a nice alternative. I have attached the STL files for the 3D printed parts but you can also access them directly in Tinkercad here and here.
  • Two micro:bit microcontrollers, one for controlling the stepper motor and one to be mounted on the propeller (and flash its LEDs). You'll need at least one of them to be the micro:bit Go Starter Kit, which comes with a 2xAAA battery case & connector.
  • One NEMA14 stepper motor.
  • One stepper motor driver. I used a DRV8834 Low-Voltage Stepper Motor Driver Carrier from Pololu, because I wanted to power both the electronics and the stepper motor with a single 5V power source. You can also use one of the more popular (and cheaper) A4988 drivers, but then you need a separate power supply for the stepper motor (e.g. 12V).
  • One mini breadboard to stick the stepper motor driver and connect it with the motor, the micro:bit and the power source(s). If you want, you can later solder everything together - you can then transfer directly from the breadboard to an Adafruit perma proto board (thanks, Ladyada!)
  • Jumper ("dupont") cables and alligator clips, for connecting stuff together. You don't need to solder anything, unless you feel like it!
  • Double-sided adhesive tape.
  • A power source. If you use the DRV8834 low-voltage stepper motor driver, then you only need 5V to power both the stationary micro:bit (via microUSB) and the stepper motor (provided that your power source has the juice to handle it). If you use an A4988, you'll need an extra 12V power supply for the stepper motor. I used a 5V 4A power supply along with a 5.5/2.1 cable splitter, a 5.5/2.1 to microUSB adapter and an adapter from 5.5/2.1 to alligator clips. The moving micro:bit is powered by the case with the 2xAAA batteries included in the micro:bit Go Starter Kit.

The Motor Tower

motor_driver_schematic_bb_captioned.png
20210921152243_DSC_4116_2048.jpg
20210831085124_DSC_9834_2048.jpg
20210831085151_DSC_9838_2048.jpg
POV_tower_1.png
POV_tower_2.png
POV_tower_3.png

The first step is to build the motor tower, including the driver electronics and the motor itself.

Connect the DRV8834 low-voltage stepper motor driver with the first ("ground") micro:bit, your power supply and the motor, as per diagram. Thinks to consider:

  • The micro:bit need additional power from the microUSB port.
  • If you use an A4988 driver, the power supply should be 12V (or 9V or anything between 8 and 35 volt, for that matter)
  • The diagram refers to a bipolar stepper motor.
  • You don't really need to connect pin0. But if you do, you can control the direction of rotation in the script (not implemented at the moment).
  • If you check your connections and everything works as expected, you can solder the driver and the cables on a perma-proto board. This way you can also reuse everything in future projects, whenever a stepper motor is needed ;-)


When you are done with the tower electronics, you can place the motor on top of the 3D printed tower and maybe hide the board and the cables in the back of the tower. The tower is designed to be a snug fit for the motor, provided that your 3D printer prints within reasonable tolerances. You can however glue or tape the motor on the tower for this extra bit of secure feeling. What's more important is to fix the whole tower assembly on a surface - I used a double-sided tape to fix it on my table.

The Propeller

20210827072421_DSC_9798_2048.jpg
20210827072640_DSC_9821_2048.jpg
20210827072531_DSC_9804_2048.jpg
POV_propeller_2.png
POV_propeller_1.png

Things are pretty simple for the propeller part: Connect the second ("flyer") micro:bit to the battery pack provided with the micro:bit Go Starter Kit. The two AA batteries are conveniently included in the kit. Attach micro:bit + battery pack to the 3D-printed case and fix it with some double-sided tape. You may want to postpone this part until after you have programmed the micro:bit and you are ready for the first tests.

Putting Everything Together

20210921152157_DSC_4110_2048.jpg

Fix the propeller on the axis of the stepper motor. To this purpose, you can use a small M3 screw (the 3D printed propeller case has a hole for this) and you can also put some glue on top to prevent the screw from popping out during rotation.

Rotate, Baby!

20210921152606_DSC_4126_2048.jpg

It's now time to upload the scripts to the two micro:bits. I have provided the .hex files here, or you can download and modify the code from the github repo: https://github.com/techprolet/microbit_pov

Connect the power (microUSB for the "ground" micro:bit, 5V power supply for the motor power and 2xAA battery pack for the "flyer" micro:bit). Press the button B to start rotating the propeller and the button A to stop it.

Enjoy!