In the summer months, I really enjoy riding a bike along some of the flatter roads and trails around my small Vermont town. But sharing some of those roads with cars can be a dicey proposition. There’s one dirt road in particular, where no matter how often I scan my mirror or sneak a look over my shoulder, it seems that sooner or later I get surprised by a car zipping by.
I’ve often imagined fitting an ultrasonic sensor to the bike to warn me of incoming traffic, but most of those have a range of less than 10 meters, which is worse than even my mediocre human senses. A lidar—similar to a radar system, but with laser pulses instead of radio waves—would have the longer range I need, but lidars have traditionally been too expensive for my biking needs.
This changed last year when startup PulsedLight, of Bend, Ore., announced Lidar-lite, a crowdfunded lidar detector less than half the size of a deck of cards, with a range of up to 40 meters and an accuracy of plus or minus 2.5 centimeters, all for US $89.
When the package arrived, my first step was to make a set of labels for the lidar’s four signal wires, as for some reason PulsedLight ended up with a color-coding scheme consisting of black, black, black, and black. I plugged the little thing into an Arduino microcontroller, ran the example software provided online, and darned if I didn’t see a stream of distance measurements running back to my PC over the Arduino USB connection. Pretty quickly I moved on to attaching a board with four alphanumeric LED displays to the Arduino. Once I’d done the programming, I had myself a handy little pocket range finder. (FYI, the cavernous basement of the nearest maker space to me is about 45 meters long.)
The next step was to build something that could fit on the back of a bicycle and wouldn’t be shaken apart. That was a little more difficult, but luckily, in addition to putting manuals, data sheets, and sample Arduino code on the Web, the folks at PulsedLight also make available a 3-D model of the Lidar-lite’s case. An hour or so with Openscad, my 3-D design tool of choice, plus a few hours at the 3-D printer, yielded an outer shell. Into the shell I was able to fit the Lidar-lite, the microcontroller, and a little strip of Neopixel RGB LEDs that act as a warning display, with room for a uniform 6-millimeter layer of padding. (Of course, my first shell design didn’t fit on the back of the bike, but a few more iterations fixed that.) The bike mount built into the shell is tilted to point a few degrees upward and to the left, so that as the lidar beam diverges with distance it will be more likely to impinge upon approaching cars rather than just road surface and shrubbery.
One thing I hadn’t really considered when I first started designing the shell was power consumption issues. A USB port was fine for powering the breadboard system, but of course the real version needed to run off a battery. I have a bunch of nifty DC-DC converters that will make 5 volts from any power source that can provide 1 to 4 V. I also found a really nice Openscad library that let me incorporate a holder for two AA batteries into my shell design. But, in addition to the 27 milliamperes my microcontroller draws while running, the Lidar-lite module draws an average of 100 mA while in use (and this can spike to 200 mA). Plus, the warning LEDs can draw up to 500 mA. Unfortunately my DC-DC converters have a hard current limit of 200 mA.
So, after sketching out a few designs with two or three DC converters in parallel, I ditched the elegant, power-efficient AA battery approach for one using a two-cell rechargeable lithium battery that provides 7.4 V. A 7805-style linear voltage regulator gets the voltage down to 5 V, by throwing away roughly a third of the energy that goes through it. Conveniently enough though, the new lithium battery is almost exactly the same volume as a couple of AAs.
Does it work? I haven‘t been run over yet. But time will tell. The first time I saw the LED blips that indicated a sedan approaching from 35 meters behind me, I was very nearly too fascinated by the display to remember to get out of the way. I also need to fabricate a new case so that I can adjust the lidar angle (the current aim point misses cars that pull slightly to the left to pass me, which is probably not a safety problem but still unnerving). And while I’m at it, something that I don’t have to disassemble completely when I want to recharge the battery would be nice.
The range is a little shorter than I would like, especially around blind curves, and my code has a tendency toward false alarms that I could reduce at the cost of slightly slower response. But those shortcomings are probably a good thing, since I should be looking behind me on a regular basis anyway, rather than relying on a hacked-together gadget as a first line of safety.
This article originally appeared in print as “An Early-Warning System for Your Bike.”
About the Author
In Paul Wallich’s previous Hands On columns for IEEE Spectrum, he described how to build a kid-tracking drone and how to automate your home without rewiring it. For this issue, he created a laser system for his bicycle that warns of cars coming from behind. “The biggest thing I learned was the importance of packaging. Getting the mounting brackets right, fitting the available space in a solid enclosure, even a practical on-off switch turned out to be much more work than the device itself,” says Wallich.