Bicycle Dashcam Mark I

I love my bike – it is a workhorse I can park anywhere, a mid-1990s hybrid. After years of limited maintenance, in the past year, I’ve had to replace a tire, cassette, all the cables, pads, grips, and shifters. I’ve also just upgraded my headlight and taillight – the improvements that have been made in bicycle lighting over the last 15 years have been incredible.

I’m using my bike more this year – my downtown office recently moved to a building with badge access indoor bicycle parking and showers, with towel service, for cyclists – what a cool perk. So, I’ve been biking to work for the first time since I started at this company in 2006, 17 km down Yonge St in Toronto, about twice a week since June.

My rides have been great. Drivers along my route leave a lot of space. But it’s hard to assess risk. The City of Toronto keeps detailed data on cyclists killed or seriously injured. There have been 11 KSIs on my route since 2008. But how do I compare that against, say, the risk of the 30 km drive to my Mississauga office? I’ve been rear-ended 3 times since 2010 commuting by car to Mississauga, but all have been at low speeds, only resulting in damage to my car – the consequences of getting hit on my bike are far more severe.

I was trying to think about what I could do beyond riding cautiously and ensuring I am visible. And, I have to say, a part of me is just always on the lookout for small, fun projects.

Envision a bicycle dashcam

Bicycle dashcams have been done before, by Cycliq and others. But I envision something difference, a bicycle dashcam that could:

  • Recognize the license plates of the cars around you. From a picture, it would look at the plates on all the cars, and then associate a plate number with the picture
  • Record the speed of the cars around you
  • Record the proximity of the cars around you
  • A driver readable display, ie: “Driver ABCD1234, your current speed is 45”. Like a mobile Toronto Watch Your Speed program sign. Would a driver allow a cyclist more space if they were aware their actions are being logged?
  • Log this data on a remote server
  • Share this data, with a group. Perhaps associate “near miss” data from many cyclists, and identify troublesome areas, or troublesome cars.

Introducing my Bicycle Dashcam, Mark I

Bicycle Dashcam Mark 1
Bicycle Dashcam Mark I

My Mark I dashcam consists of a Raspberry Pi 3 with a Pi Camera (v1.3), a battery pack, running a small Node application which takes pictures, tries to recognize license plates with OpenALPR, controlled through a phone friendly web interface.

Bicycle Dashcam Dashboard
Bicycle Dashcam Dashboard

Testing and Results So Far

On the Pi 3, it takes between 8 and 800 ms to capture a photo with the Pi Camera, and another 7-8 seconds to run the OpenALPR license plate recognition process. I haven’t looked into optimizing this, but I would be curious to see how fast this could get by adding a processor optimized for these tasks, like an Intel Neural Compute Stick.

I’ve taken my prototype on a few drives, and a 5 minute bicycle ride. I don’t know why I even tried using a Lego frame to mount the dashcam to my bike – it only held together for a few minutes of riding, and completely fell apart – I’ll have to come up with something better for bicycle testing.

In the car, over a 30 minute drive (~120 photos) in traffic, about 15 license plates are identified. OpenALPR works exceptionally well – it can pick out the plate numbers even when it would be hard for a human to do so from the same photo. The limiting factor is the Pi Camera. At a stop, the pictures are fine, and OpenALPR will recognize the plates.

Pi Camera image quality sufficient for OpenALPR when stopped
Pi Camera image quality sufficient for OpenALPR when stopped

However, as soon as the car is in motion, the image is washed out.

Photo from Pi Dashcam while car is moving.
Just a blur. Photo from Pi Dashcam while car is moving.

I have spent some time tweaking the photos taken by the Pi camera, trying out different modes. So far, I haven’t been able to get great results.

As I look to take this further, I’ll look at other Pi camera options, run further tests on my bicycle, perhaps move the project to a mobile phone app, as my phone’s camera is significantly better than the Pi’s. Also, I may explore inexpensive LED matrix screens for the driver readable display.

Source code: https://github.com/raudette/plates

What seemed like a silly idea

Throughout University, we had these Engineering Design courses, where we would go through a defined process to design something.

In my second year, my team submitted “A System for Maintaining Driver Alertness <link to pdf>“.

A System for Maintaining Driver Alertness
A System for Maintaining Driver Alertness

I’m not sure where we got the idea, and the solution we proposed was gimmicky, even at the time, but the exercise was more about design process – my team did fine. Imagine my surprise, when I was browsing for something else recently on AliExpress (and on Amazon), that some company builds and sells a device similar to our proposed design.

Commercial Driver Alertness Device
Commercial Driver Alertness Device – As Seen on Amazon

As automakers have added lane following systems and basic autopilots to their cars over the last ten years, they’ve also invested in systems that ensure drivers remain alert to supervise these systems and are ready to take over. Tesla’s systems have sensors to ensure hands remain on the steering wheel, Cadillac’s Supercruise has a camera that ensures the driver’s eyes are focused on the road ahead. What seemed like a silly idea is now a little industry…

RC Sailboat Version 2

Six years ago, I built a wifi-controlled pop bottle sailboat. Smartphone control wasn’t great, so I turned my decommissioned weather station into a remote control.

RC Pop Bottle Sailboat, V2
RC Pop Bottle Sailboat, V2

My re-used weather station project board is a homemade Arduino board, with an APC220 transceiver radio. I added two rotary potentiometers for rudder and sail control. I removed the Raspberry Pi in the boat, and connected another APC220 transceiver to the Arduino Uno that controlled the sail and rudder servos.

We drove to Downsview Park and launched the boat.

RC Sailboat Launch
RC Sailboat Launch

Control still wasn’t great:

  • Controlling the sail and the rudder is fine, but with the boat just floating on the pop bottles, the rudder has very little effect. Our boat design itself needs improvement – I think this is currently the greatest issue.
  • My transmitter and receiver code could use some optimization – as I was troubleshooting at home, my code limited updates, and was only sampling every second – controls seemed “laggy”.
  • I’m using very inexpensive TowerPro MG995 servos, which many advise against using. They were fine for playing around with interfacing, but they are slow, they seem to have a hard time holding their position, as well as not consistently reaching their programmed position.
RC Boat Halfway Across The Pond
RC Boat Halfway Across The Pond

I did write my phone number on the boat in case the boat got stuck in the middle, and someone else eventually found it. In the end, it wasn’t required. We just played with the controls as the wind carried it to the other side – probably about 100 m.

Downsview Park Test Run
Downsview Park Test Run

Maybe some time over the next 6 years, I’ll optimize the RC code, install better servos, and improve the boat design by adding a keel.