1. Magnet sensor: hall effect switch
2. Neodymium magnets from Amazon x 40 (39 excess)
"These magnets are perfect for sticking receipts, tasks, papers or instructions on a magnetic board or hanging kids art work or family photos on the fridge."
Poundland £1 USB battery
Probably can do better
Lasts about an hour
+ level convertor + buttons + screw terminals
import board
import adafruit_dotstar as dotstar
dots = dotstar.DotStar(board.SCK, board.MOSI, 24,
brightness=0.5, auto_write=False,
baudrate=1000000)
# theoretically up to 8000000 haha
dots[3] = (255,0,0) # red
dots[4] = (0,255,0) # green
dots[5] = (0,0,255) # blue
dots.show() # slow
import gpiozero
magnet = gpiozero.Button(27) # pin 27
magnet_start = time.time()
last_magnet_start = magnet_start - 1
def set_magnet_edge():
global magnet_start
global last_magnet_start
last_magnet_start = magnet_start
magnet_start = time.time()
magnet.when_pressed = set_magnet_edge
last_duration = last_magnet_start - magnet_start now = time.time() time_since_magnet = now - magnet_start pos = time_since_magnet / last_duration # approx 0 .. 1
loop as fast as possible:
update LEDs with latest pattern
4 different pattern/sections:
Radius: 0.5m / 20", Circumference: 1.6m
LED update: 120Hz
| Speed | Rot/sec | angular pixels | note |
|---|---|---|---|
| 5km/h | 0.9 | 137 | walking pace |
| 17km/h | 3 | 40 | fast ride in London |
In practice, 120 updates/sec. But...
... => 10x angular pixels (vs 120 updates/sec)
Get a 5x7 font.
render letters
Attempt at NHS logo
To slow to render. Hard to photo.