project
The future
Stuff I'd like to do for Version 2:
- Raise the I2C frequency. It's not that I need a higher I2C frequency - it's just embarassing seeing every other device doing a standard 400kHz, and mine piddling along at 8kHz :-)
- Dynamic control over the PWM frequency. This implies a whole new command format as well, but I expected that for any updates.
- Support I2C reads. This isn't necessary at the moment - but it's generally a nice thing to do. It'd also be nice to support less common I2C commands such as slow starts and long addresses.
- Add more channels. More motors is more better!
Controller software
For those that just want the firmware download, we have:
- i2cpwm.asm (the main PIC assembly file)
- i2cpwm.hex (compiled HEX image)
- i2cpwm.zip (project files and testbenches)
Theory
There are two main tasks to be performed by the software: talking to the I2C bus, and setting the H-bridge outputs. The outputs need to be updated on a set schedule, so the PIC's timer is used to regulate it. The I2C bus is polled, and the PIC has no direct hardware support. This is why the maximum frequency is so low compared with I2C-native devices.
I2C-based H-bridge controller with PWM
During development of my Sumo robot, I ran into some problems around controlling the H-bridges:
- If you're going to use PWM, the PWM signals on each input of the H-bridge need to be synchronised (phase-coherent), and there's no such guarantee when using an AVR to drive them. If they're not phase-coherent, the H-bridge will get hot and not drive the motor properly.
- I wanted to use braking on the H-bridge, which means I need independent control of all four H-bridge inputs. The ATMega32 that I was using has four PWM channels - more than most microcontrollers - but still only enough to run a single H-bridge.
Building a Sumo robot (summary)
Robot Sumo is a competition based on the idea of robots shoving each other out of a ring. It's (nominally) non-destructive, unlike BattleBots and the like. The robots are autonomous, so there's a much greater emphasis on sensors and on-board intelligence.
I'm documenting my Sumo robot build as I go. This is my first robot. I am nominally trained as a software engineer, but I've done a lot of personal study on the electrical side of things as well. My mechanical skills are pretty poor. So I'll be constructing the electronics from scratch and going for a lot of prefab mechanicals where possible.
Performance
I'm pretty happy with how the light worked out. I got through the 24 hour race, and that was my original aim. It ran happily for four night laps with about 50 minutes of use per lap. I charged the batteries and slept for a few hours, then ran it for another two laps. I had no problems at all, despite two crashes in the night. Even the lenses stayed firmly attached.
I made a mid-race adjustment: a piece of cardboard taped to the top of the head unit. It stops the light from the side of the lenses from messing up my night vision.
My main dissatisfaction with the light is in the lens quality. For what was nominally a six-degree lens, the beam was very loose. To compare this, I photographed each light pointing at my bedroom wall with the same exposure time:
The charger
The charger uses a MAX713 fast-charge controller. Maxim IC were awesome and sent me two free samples. I promptly blew one up.
The charger is based on the reference design for the MAX713. The same design will work for between one and 16 cells if you modify the PGM pin straps. The MAX712 is preferred for NiMH cells - it'll cut off the charge a bit earlier and stop the cells heating up so much. The MAX713 cuts off the charge a little later than is preferred for NiMH cells.
Battery and regulator
The bottle contains both the battery pack and the regulator board. It provides a safe environment for the batteries and regulator without weighing too much.
The regulator board sits on a layer of bubble wrap. The battery sits on top of another layer of bubble wrap on top of this. The battery is at the top, so it can be removed easily (theoretically!) for charging or replacement.
The bottle is a 'White Stuff Bottle' from ProBikeKit. It's a bit too tall for this application; the battery sits right at the top and makes it top-heavy. I've had no problems with it coming loose, however.
Head unit
The head unit is constructed around a small diecast aluminium case. The power socket and brightness switch are mounted on the sides. The LEDs are bolted to the back surface and use the case as a heatsink. The wiring is contained within the case and can be weather-sealed, although I didn't bother. With the exception of the lenses (see below), the whole assembly is extremely robust.
The case that I chose measures 51x51x32mm - just big enough to fit the LEDs on the back. Larger cases are excessively heavy - this one was about 60 grams.
High-power LED mountain bike light
In preparation for the 2006 Sydney 24 Hour, I wanted new mountain bike lights. Last year's light was a 20W halogen globe and two packs of ten AA cells. This was nice and bright, but the battery packs got rather hot and only lasted about 40 minutes each.
This year, I raced solo. Recharging two battery packs per lap wouldn't cut it. My plan was to spend about an hour per lap - each lap was 10km - and sleep for an hour or two when I charged the batteries. So I was aiming for 3-4 hours battery life at about the same brightness as a the 20W halogen.
The new system weighs 715 grams and lasts for about four hours at 9 watts of output. Charging the batteries takes under two hours.
Ultimate Luxeon K2 bike lights (in progress)
So after my recent set of mountain bike lights, I decided that I was ready to build what would be my be-all, end-all set of bike lights. These would be it. The Ultimate.
After the mountain bike lights, I wanted lighter, brighter, and longer battery life. I wanted to be able to use them for long road rides - so they can't use a bottle cage. I wanted to be able to commute without having to charge the battery every night. I wanted even more power for mountain bike riding and scaring pedestrians. I wanted lighter weight, so I could use them for fast group rides.
There are a number of bike light projects on this website:
|
