Measuring the distance between me and hard things.

I wont lie, when I bought the arduino I was thinking about doing something with it and cycling, my initial idea was to make an air quality monitoring thing, to see levels of pollution on my daily commute. I also really want to make a map of “my” London, with a horizontal Thames with the bridges plotted on and then how this all relates to the places I go, as its mainly by pedalling, putting it on the bike seemed a good idea. Also, funsies.

I also wondered about making something so that a camera would be set off when a car gets too close to get its number plate so I can be a whiney bitch about it all. After getting linked to Alex Warrior’s setup I thought more about it and so I put together the arduino, adafruit datalogger with RTC and a maxbotix MaxSonar ultrasonic range finder.

However, so far it doesn’t so much measure overtaking distances as how far I am cycling to solid things, or how close solid things come to me cycling.

Then I wondered what to put it in and settled with a margarine tub and after unsuccessfully trying to tape it the rack, taped it to my saddle bottle mount rack. Then I set off on a roughly 15 mile trip. Every now and then at a red I’d check to make sure the sensor was poking out and when I got home to had me a look at the files. Weirdly, there were 90 odd files, most of which with almost no data, as a new file is created when the thing is reset this led me to believe something had gone awry.

The first file was the biggest the others being either empty or containing only one or two data points, as there were 96, I didn’t check and as they weren’t time stamped there was little context in it all so bleh. Anyway this is a graphical representation of the data recorded from that first nice file:

Where to start? Well the rangefinder worked, and the y-axis is cm. It clearly took me ages to tape it to the bike after connecting the battery. At which point all its detecting really is the bike next to mine and showing about 30cm. Then the RTC stopped, before that it was giving the date and time out by a few days, then jumped forward a hundred years then stopped altogether. Poop, maybe it was because it had been bashed about in a bag on the way to school, maybe it was because I had it set up upside down, or maybe crap soldering (it was working before, and is again now): any advice would be appreciated.

Then, very shortly after I began cycling, everything went to shit, in terms either the power was going off and on, or it was resetting as I cycled. Looking at the peaks, and how few data points were recorded (and how many files made) I reckon I got about 200m before it went haywire. Not sure why.

Anyway, good things: it worked in a mediocre fashion, and if we ignore my faff time we see this:

Which looks about right considering I rode down a short ramp to a go along a cycle lane by a queue of cars, and I was passing them and they were apparently close at quite a few being under a meter. The maximum the sensor can detect is about 6m (6.37m apparently) so the top points aren’t so much a parallel obstacle as far away things, which I’m slightly surprised by because 6m is quite far and I thought it would bounce off parked cars, but this ties into me needing to properly test the sensor.

To do:

Sort out the sketch so it prints the timestamp properly (the date isn’t really required).

Better fitting box, that’s easier to switch on and off.

Ride again to see what happens with the RTC and datalogging (maybe with the arduino the right way up)


Moar sensors D:



This entry was posted in arduino, cycling and tagged . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s