1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Measuring passing distance

Discussion in 'Commuting' started by PrettyboyTim, 14 Jan 2008.

  1. PrettyboyTim

    PrettyboyTim New Member

    Location:
    Brighton
    Well, I finally got around to finishing off my distance measuring device and putting it onto my bike. It's basically a ultrasonic ranging module connected up to a microprocessor which in turn drives a small LCD screen. The ultrasonic sensor is currently attached to my rear mudguard, facing right. The system takes several range samples per second and displays the closest sample taken in the last few seconds on the screen. There's some pics in a thread over in the helmet cams section, but I'll repost them here:

    The sensor:
    Sensor.jpg

    The cable winds back underneath the rack and winds around the seatpost:
    RearCabling.jpg

    None of my project boxes would fit it, so until I get something better, the circuit board and battery are currently stuffed in with my Smart headlight lead acid battery:
    Housing.jpg

    Finally, here's the display, held in place with an elastic band:
    Display.jpg

    The system isn't meant to be waterproof (you can't cover the ultrasound sensor or it won't work), but it didn't seem to mind the rain as I cycled in for its first test today.

    It worked quite well, but there's a bunch of modifications I need to make:

    • Adjust for the width of the bike - the sensor is at the centreline of the bike so I was always having to mentally adjust the value on-screen.
    • Currently it shows the distance in inches - I'd like to alter it to be feet and inches.
    • I would like to make it so that it shows the last few closest passes on the second line of the LCD - at the moment there is a temptation to look down quickly after the car has passes to see how close it was as the number only stays up for a few seconds
    • I really ought to put an on/off switch on it!
    • I should probably run it off the same lead acid battery as my front lights run off

    Anyway - I'm quite pleased with it so far! ;)
     
  2. You are not just another pretty face.

    Good idea though.
     
  3. BentMikey

    BentMikey Rider of Seolferwulf

    Location:
    South London
    Ahem, can we have proper metric measurements please? Kidding aside, that's amazing Tim! Now all you need to do is put in a clock and some sort of logging system.
     
  4. Arch

    Arch Married to Night Train

    Location:
    York, UK
    <can't resist>

    He's not even a pretty face...

    Sorry Tim, don't mean it... That is very cool!

    Now, just need to add a ticket machine that prints out little tickets with the distance to hand to the worst offenders when you catch up with them. Perhaps with a slogan on th back, something like "for every foot you give me, I assume you have an inch of penis". After a few days, I bet blokes would be giving you yards and yards....
     
  5. domtyler

    domtyler Über Member

    What you really need is a device to calculate the trajectory of upcoming cars so that you can predict the passing distance they are going to leave you, it could then flash a warning of a close overtake and you could move to compensate.

    I want this on my desk by Thursday morning please PBT.
     
  6. PrettyboyTim

    PrettyboyTim New Member

    Location:
    Brighton

    Actually, it will give the distance in centimetres if I comment out the line:

    #define USE_INCHES

    in the source code ;-)

    However, I think I'll change it from inches to feet and inches, as the units fit better the kind of distances I'm trying to measure.
     
  7. magnatom

    magnatom Guest

    Brilliant Tim! It looks good. So how close were the cars passing? As I have said before, once you've got this sorted I might try and build one myself.

    What code are you using? c or similar? How do you transfer the code to the board memory?

    ;)
     
  8. summerdays

    summerdays Cycling in the sun Staff Member

    Location:
    Bristol
    could then have one of those big red signs, on the back of the bike, that suddenly flashes on and says ... you are going to pass too close (like those speed activated signs).
     
  9. magnatom

    magnatom Guest

    No. Much better to attach it to an air-zound ;)
     
  10. PrettyboyTim

    PrettyboyTim New Member

    Location:
    Brighton
    The ironic thing is that I don't get that many cars passing me on my route ;-)

    I think the closest was around 20", adjusted for the width of my handlebars, but that was coming the other way down a narrow street.

    The prototyping board is an Arduino open-source board with an ATMega8 chip installed. The program is written in C. It's very easy to program the Arduino - there's a little free open source develoment environment which will compile your code and upload it to the board via USB. It's very easy to use. There are libraries on the Arduino website for driving LCD modules, and the sensor itself is very straightforward to get going.

    I got my Arduino from SparkFun in the US, but shipping was only about $4, IIRC. The board itself is $35, so with shipping is less than £20. The new model they sell now has an ATMega168 installed instead which has 16K of memory, rather than 8.

    I could reduce the size of my system quite a lot by creating a circuit which holds the ATMega8/ATMega168 in directly, and then just use my Arduino to program it.

    The sensor is a Devantech SRF05.
     
  11. domtyler

    domtyler Über Member

    Or a laser that would shine directly in the drivers eyes and etch "I M A To55er" onto his retinas, permanently. And then burn a hole into the engine disabling the motor.
     
  12. PrettyboyTim

    PrettyboyTim New Member

    Location:
    Brighton
    Unfortunately, that's a very difficult thing to do, as until the car gets very close almost the entire trajectory is towards you. I'm pretty sure it'd be almost impossible to do without an awful lot of sensors.

    What you might be able to do is to project a passing line on to the road beside you with a laser as vehicles approach...
     
  13. magnatom

    magnatom Guest

    Mmmm. You would need some a pretty accurate laser guidance system for that. I don't think this would be easy. However, I am sure Tim would be up to it, so hows about it Tim....:biggrin::sad:
     
  14. Arch

    Arch Married to Night Train

    Location:
    York, UK
    To be on the safe side, I suggest disabling the motor before blinding the driver, not after..:biggrin:
     
  15. gambatte

    gambatte Middle of the pack...

    Location:
    S Yorks
    only problem is, you'd program it for the nearside wheel, the drivers would assume it was the centreline....