I want to build something that displays an image over a (push)bike wheel whilst the bike is in motion.
I know these exist: for example Ladyada used to sell a kit based on this Instructable: http://www.instructables.com/id/SpokePOV%3A-LED-Bike-Wheel-Images/
But what’s more fun: building it from scratch or buying a kit? And which way will I learn more? For me, the answer is the former, so here we go. This post is the baseline plan, along with some calculations. Because they already exist, there shouldn’t be a problem with the overall concept, just as long as I get it right…
Oh, and I’m a systems engineer, so I approach things from a top down aspect, and tend to define required functionality to help me decide on the build/test flow. Top level functionality has already been decided (“display images on a bike wheel”), so it’s time to come up with a first iteration. Ideally, this would then flow back to define more requirements, but at some point my hands get itchy and I want to build something…
First: pick the architecture. As I have a PICkit programmer, and a bunch of PICs lying around, I pick the PIC. A load of LEDs are required, so I’ll use a shift register to drive all the LEDs. And a timing signal needs to come from somewhere: a magnet on the bike fork sensed by a hall effect sensor will complete the package.
Basic diagram is then as shown:
Low level functions of this circuit are:
- Respond to magnet
- Light LEDs in addressable manner
Higher level function of this circuit is:
- Display an image based on magnet based switching.
I’ll add another, not defined by the circuit
- Go into sleep mode after 5 minutes of no magnet based switching
- Wake from sleep mode on a magnet based switching event.
These last two mean that it can be left on a bike, and there is no power switch, and you can never forget to turn it on.
Note that this is very simple; the image will be hardcoded into the PIC.
Each function has to be tested, so this leads to three demo/breadboards/tests
- Hall Effect switch response to magnet. The PIC need not be present for this.
- Hall Effect switch response to magnet. “Read” by PIC, lights an LED. (No Shift Register required for this). Should also demonstrate sleep (ie low power consumption mode) of PIC.
- LEDs controlled by PIC via shift register. Should be representative of final model
- Full up demo with test pattern.
This is going to be mounted on a 700C sheel, ie diameter ~700mm (Yes, I know the actual diameter is a little bigger for a MTB). So the circumference is pi times that, = 2.2m. Let’s use two speeds, 10mph and 30 mph (as people go downhill on bikes as well!). 10mph = 16 km in 3600s = 4.4m/s. (30mph = 13.2m/s). So at 10mph, with a 2.2m circumference wheel, need to update the entire image in 500ms. At 30mph, this drops to 166ms.
Lets assume ~24 LEDs (3 shift registers). Seperated by 10.16mm (which form 5mm LEDs might be a bit too far apart, but would work for 8mm nicely), 24 LEDs covers 243.8mm. This gives a bit of space at both ends of the radius for the hub.
Lets assume that there’s a gap for another 8 LEDs where the hub is, so really it’s a going to sweep out a circle inside a square 64 by 64 LEDs. Convert to angular space, and we need to split into 32×4 = 128 seperate angles. ie every 360/128 degrees will have a different pattern displayed on the LED. 166ms / 128 = 1.29ms, which corresponds to 780 Hz. As PICs can run upto 2MHz, there will be plently of instruction cycles to figure out which pattern to display and shift them out along the shift register.
Next step is to start some breadboarding, as well as thinking about the code architecture. That’s for another post…