At the very beginning, I wanted the device to rotate in one direction, so I used an infrared sensor. Later, I realized it was too heavy and couldn’t rotate smoothly. That’s how it eventually became an LED POV (persistence-of-vision) wand.

The infrared sensor can actually be replaced with a vibration switch, which makes it possible to detect motion direction more easily.

Physical demo

Front view: This is what it looks like from the front. The circuit is very simple — each LED is driven directly via GPIO. There are 16 LEDs in total, and the M61 development board is plugged directly onto the pin headers.

Powered on: I didn’t add a power switch, so the device starts running as soon as it’s powered on.

 

In action: Shake it, shake it harder… (pretty tiring)

How it works

That’s basically it. The principle is actually very simple. Using a font extraction tool, the dot-matrix data is generated first. Then, each column and each bit is read sequentially to control whether an LED is on or off.

By continuously looping this process, the POV wand effect is achieved. There’s not much more to it — simple and straightforward.

main.c

1. #include "bflb_mtimer.h"

2. #include "bflb_gpio.h"

3. #include "board.h"

4. 

5. struct bflb_device_s *gpio;

6. 

7. uint8_t data[5][32] = {

8.               {0x80,0x00,0x90,0x80,0x8C,0x80,0x84,0x84,0x84,0x46,0x84,0x49,0xF5,0x28,0x86,0x10,0x84,0x10,0x84,0x2C,0x84,0x23,0x84,0x40,0x94,0x80,0x8C,0x00,0x80,0x00,0x00,0x00},/*"安",0*/

9.               {0x00,0x01,0x80,0x00,0x60,0x00,0xF8,0xFF,0x07,0x00,0x00,0x00,0x04,0x00,0x24,0xF9,0x24,0x49,0x25,0x49,0x26,0x49,0x24,0x49,0x24,0x49,0x24,0xF9,0x04,0x00,0x00,0x00},/*"信",1*/

10.               {0x00,0x00,0x02,0x00,0x02,0x00,0xF2,0x0F,0x12,0x04,0x12,0x04,0x12,0x04,0xF2,0x0F,0x02,0x00,0x02,0x40,0x02,0x80,0xFE,0x7F,0x02,0x00,0x02,0x00,0x02,0x00,0x00,0x00},/*"可",2*/

11.               {0x24,0x08,0x24,0x06,0xA4,0x01,0xFE,0xFF,0xA3,0x00,0x22,0x01,0x00,0x04,0x22,0x04,0xCC,0x04,0x00,0x04,0x00,0x04,0xFF,0xFF,0x00,0x02,0x00,0x02,0x00,0x02,0x00,0x00},/*"科",3*/

12.               {0x10,0x04,0x10,0x44,0x10,0x82,0xFF,0x7F,0x10,0x01,0x90,0x80,0x08,0x80,0x88,0x40,0x88,0x43,0x88,0x2C,0xFF,0x10,0x88,0x28,0x88,0x46,0x88,0x81,0x08,0x80,0x00,0x00},/*"技",4*/

13.               

14.               };

15. 

16. uint8_t leds[] = {10,11,12,13,14,15,16,17,18,19,20,23,24,25,26,27};

17. 

18. 

19. void led_play(uint8_t idx, int delay){

20.     uint8_t index = 0;

21.     for(uint8_t i=0;i<16;i++){

22.         for(uint8_t n=0;n<8;n++){

23.             uint8_t d = data[idx][index];

24.             if(((d>>n) & 0x01) == 0){

25.                 bflb_gpio_reset(gpio,leds[n]);

26.                

27.             }else{

28.                 bflb_gpio_set(gpio,leds[n]);

29.                

30.             }

31.         }

32. 

33.         index++;

34.         for(uint8_t n=0;n<8;n++){

35.        ...
Read more »