Page History: Vehicle Reversing Assistant
Compare Page Revisions
Page Revision: 2018/04/12 16:44
The following is a tiny trinket to provide the retro-fit your vehicle with reversing sensors (or fix a crappy Chinese kit) using 40KHz ultra-sound sensor modules available off ebay etc. for about £5. Be careful with buying these - there are two versions that I can find. One has a trigger and output pin so you can get a reading when you want it, the other type has a serial output that is free-running. The code below works with the former. The latter type presents a problem because despite claims of anti-jamming, all these modules suffer from picking up ultrasound pulses from neighbouring modules and will provide false readings. To illustrate, consider that you are some distance from an object and a pulse is initiated. A neighbouring module also sends a pulse shortly after but it "hears" the return from the first module - it can't tell this is not the reflection of its pulse and now calculates a much shorter distance than reality. OK this is fail safe but it makes for a lot of false readings and generally results in a useless system - you have to be able to control the when the pulses are sent and wait for any return. If the modules are free-running, it's mayhem.
There is a wayt ot tell these modules apart... if you apply power and the LED flickers constantly, it is free-running. These are fine for solitary use and give a serial output with the direct reading of the distance. If the LED gives a single flash, it is waiting to be triggered and these are the ones you can use in groups. It is a blunt instrument but these tend to have a blue PCB while the free-running ones have a green PCB. Here are pictures of teh two types - note there is also a differernce int he built-in microcontroller. You will have to source the appropriate modules.
My particular situation has three sensors. The trigger and outputs of each sensor need to be connected to appropriate pins of your MicroMite.
The code works by measureing all three sensors and then choosing the shortest distance. This is then compared to the timer and if the timer is greater then a beep is issued and the timer set to zero. The closer the object, the faster the beeps. There is a lock-up zone of 400mm - any closer than this and the sounder emits a continuous tone. This has the nice effect that the value for the timer changes in real time and any changes are reflected by the rapidity of the beeps fairly quickly.