Odd Software for Odd Jobs

Bike Sonar

Hi! This is my first attempt at a blog, so bear with me!

The easiest way I find of learning something new is to have an idea of something you want to create and then go about implement it, learning the pitfalls and how to solve them. I've never been any good at just reading a book and then creating some software.

So where I live in Australia, the government is introducing new laws this year regarding safe passing distances for cars & bicycles. Simply, allow a 1m gap. It's obviously not something you need to get out a ruler and measure but rather to get the mindset that pedestrians are a lot easier to kill than cyclist, and cyclists are a lot easier to kill than motorists. So just think and be courteous to other road users, regardless of their means of transport … no one person owns the road or has any greater rights.

Anyway, this gave me an idea to implement a simple little sonar for my bike. Essentially it's just a 'rear parking sensor' for a bike! The idea is if a car gets too close then an audible warning can be given to the cyclist. It also has a display so that the actual distance can be captured by a video camera, like the Cycliq Fly6.

Maybe this will be of interest to someone else. Like I said, it's pretty simple. And there's no doubt similar things already out there - this was just something so I could practise going from initial idea to prototype and then refine.

Step one. Get all the parts and put it together on a breadboard for testing to see if it'll actually work.

I used the following:

  • Adafruit USB-Boarduino
  • HR-SC04 ultrasonic sensor
  • four-digit seven-segment LED display (labelled "CPS02841AR", common cathode)
  • Maxim MAX7219 LED display driver (plus 68kΩ resistor, 10μF electrolytic and 100nF ceramic capacitors)
  • Freetronics piezo buzzer

First step was just wiring it all up. Here is the result:

Pasted Graphic

Next step is to write the code for the Arduino to run it all and test.