element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Arduino Projects
  • Products
  • Arduino
  • Arduino Projects
  • More
  • Cancel
Arduino Projects
Blog Ultrasonic Reversing Monitor
  • Blog
  • Documents
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Arduino Projects to participate - click to join for free!
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: mcb1
  • Date Created: 7 Jan 2016 6:47 AM Date Created
  • Views 1443 views
  • Likes 11 likes
  • Comments 8 comments
  • neopixel
  • uno
  • arduino
  • ultrasonic
Related
Recommended

Ultrasonic Reversing Monitor

mcb1
mcb1
7 Jan 2016

In November I offered to use an Arduino UNO as a reversing monitor.

Arduino Uno THROWBACK THURSDAY Contest


It's a simple concept

  • Arduino
  • Ultrasonic ping sensor
  • NeoPixel LED's

 

You use the ping sensor to detect the distance and change the colour of the NeoPixel to show Green for safe, Orange for Warning and Red for Stop.image

Simple enough .... a few lines of code and its' all sorted.

 

 

What about Safety?

There are no safety issues, you just reverse until the light changes colour.

What safety, nothing will fail.

 

image

 

That's the difference between a "Fail to Safe" system and the above assumption.

 

In some cases, the person may not be aware of all the factors, and therefore they assume something.

Neopixels retain the last instruction until you send a new one, or remove the power.

If the Arduino or the data line fails for whatever reason, you have the display showing Green and it never changes.

 

The average user will just think these are lights and if you turn them off they go off.

However as the Engineer designing this system, I know better, and therefore should be designing the system to take the NeoPixels characteristics into account.

 

 

What about the Distance settings?

Having hard coded distance settings is fine, but what happens if you install it in your parents place and they want to change the trigger point.

You could reprogram it with new figures, but what happens if you don't have that capability?.

 

Having the ability to set the distance makes it much more user friendly, but it also brings some other challenges.

You need to store the setting, and read it at startup.

There needs to be a warning if there is no settings read (because they aren't stored or corrupted)

The method of setting the distance needs to be considered, and made user friendly.

 

 

I'm pinging all the time

Pinging constantly is fine, but why wear out the transducer while the car is either not there, or is parked for two weeks.

Since it is ultrasonic is there an effect on animals?

Perhaps this might be great to persuade mice and other rodents to vacate the place, but I'm concerned if domestic pets are troubled by it.

image

 

I decided that after 10 seconds of the detecting the same distance, we can reduce the ping rate.

We can drop the ping rate down to once every second, we reduce the wear, but allows for any movement to be detected.

 

We really need to know when the car is returning and the distance is getting less.

Since these can work from 4.5m (14 feet), the first few seconds are likely to be well within the safe distance.

 

 

 

Blank the display

Having the Neopixel stuck on the last distance colour is fine, except it simply wears them out and is not necessary.

It would be much more useful to blank the display while it is in 'sleep' mode.

 

We still ping every second, and if the distance changes then unblank the display.

 

I thought that 60 secs is adequate time to decide the car is staying put, and this becomes the sleep time.

 

 

 

How do I know it's working?

Having a 'heartbeat' is necessary to provide user confidence that its working.

 

 

I elected to make one LED White and cycle it around at a 1 sec rate.

While the display is blank, the same will work, or I could leave it blank and maybe flash the onboard LED.

 

 

For the error warning, I elected to flash half the ring RED, with the rest blank. This alternates at a 1 second (1Hz) rate.

ie the first half is RED while the second half is blank and then it swaps to first half blank, second half Red.

It becomes very obvious something isn't right.

 

 

 

What does this all mean?

What it means is that this device performs the same function ie detects a distance and changes colour.

We have added :-

  • Allow the user to change settings.
  • Provide confirmation it is working.
  • Warn if there is an error.
  • Reduce the wear by reducing the ON time of some parts.
  • Reduce the ultrasonic pollution created by the pinger.

 

 

The hardware remains the same, but the code has grown exponentially.

It might not be the most efficient code (I have stated before I'm not a software programmer), but it includes plenty of comments for anyone to follow.

That helps me later when I think why the .... did I do that, or What was I thinking?

 

It also means the quick simple task has morph'ed into a much longer project, and has consumed far too much time.

 

 

My Advice

If you get into these projects, you need to think of the things that could go wrong and deal with them.

Your time is spent planning how to do xyz, coding it, and working out a means to test it.

 

We've made comments before about Engineering is 90% planning and 10% doing, and this is no different.

The end result is a much better product, that is much safer and more user friendly.

 

 

Part Two

I'm still completing the final parts of the code.

There have been some other distractions (inc silly season) and I want do some more testing on the code.

I have found a suitable enclosure but I need to live test it before I fit it to the enclosure.

 

The Ping sensor uses a Tx and Rx ultrasonic transducer to send out a burst of high frequency audio.

This causes ringing of the transducer and can cause the mounting hardware to resonate which may give false readings.

I've been finding that doing this work in a confined room results in lots of echo, and therefore my "same distance' measurement isn't the same.

 

I've also had some issue with the IDE and the colourisation of keywords, that threw me off for a few days.

 

It's got to the stage where I can start actually testing it, and testing the hardware before fitting it into an enclosure ensures you can determine where the problem is, if it doesn't work as expected.


Hopefully soon I can do part 2 and include the code, and some more details of the project.

edit Part 2 is here http://www.element14.com/community/groups/arduino/blog/2016/01/16/ultrasonic-reversing-monitor-part2

Mark

  • Sign in to reply

Top Comments

  • stevemann
    stevemann over 9 years ago in reply to mcb1 +3
    Traffic Light Tree is a public sculpture in London, England, created by the French sculptor Pierre Vivant following a competition run by the Public Art Commissions Agency.
  • mcb1
    mcb1 over 9 years ago in reply to DAB +1
    Where did you take the picture of all the traffic lights? I have to admit I stole it from the internet. I should have put the siurce of each picture but I had downloaded them earlier and forgot ...…
  • DAB
    DAB over 9 years ago in reply to mcb1 +1
    With that many lights, I doubt anyone would notice a bulb out. DAB
  • Former Member
    Former Member over 9 years ago in reply to mcb1

    a good rule of thumb is:

    you can make things foolproof BUT you will never make them idiot proof

    like the idea of the sensor tho

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • mcb1
    mcb1 over 9 years ago in reply to twenty9

    Let's say you want to really sell your "Ultrasonic Reversing Monitor". Then you have to think about all the safety stuff.

    Agreed.

     

    I use a golf-ball which is hanging from the roof. When it touches the car, I have to stop

    And if you sold it and the string broke then same situation ....

     

    There is never an idiot proof solution as there will always be a better idiot come along.

     

    Very interesting insight into code bloat,

    Thanks

    Mark

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • twenty9
    twenty9 over 9 years ago

    You asked about safety and gave an gave some interesting and easy-to-understand answers.

    I am a software engineer in automotive industry for a big German company.

    15 years ago our software fit into a 16-bit microcontroller (clocked at 16 MHz) with 32 kB of FLASH. Nowadays we use 32 bit microcontrollers with clock speed of 120 MHz and up to 3 MB of FLASH. Although there are a few improvements, the main functionality - i.e. what the driver of a car with our system really sees - is basically the same.

    What was the cause for this increase of codesize and performance needs?

    1) Standards: First, the car manufactures required standardized (and increased) communication protocols, which only become active when your car is in repair-shop, then they requested an OSEK-operating system, (which really nobody sees). Nowadays AUTOSAR is a standard, which specifies operating system,  standard layers of drivers in basic software, and the communication between software components.

    2) Safety: IEC 61508 'Functional Safety of Electrical/Electronic/Programmable Electronic Safety-related Systems' and its more automotive-specific successor ISO 26262 'Road vehicles – Functional safety' specify, what you have to consider, when you develop electronic systems, which might lead to accidents, injuries or death when something breaks does not work as intended.

    Example: One cell of FLASH-memory looses its contents (some electrons diffuse faster as expected). This might lead to a pointer to a wrong address. So the part of software, which normally supervises some temperature sensor, writes in a variable, which causes full-throttle. Think what might happen, if your car accelerates on its own without any reason in any driving situation...

    Solution: You have to execute a checksum check on the contents of your FLASH-memory. But what happens, if the checksum check itself is influenced by the corrupted memory contents?

     

    I am not against standards and safety. But it costs...

    And sometimes people forget to think on their own. (I very much like the sign "This machine has no brain - use your own")

    And all the safety-concerns restrain progress. Let's say you want to really sell your "Ultrasonic Reversing Monitor". Then you have to think about all the safety stuff. Even when you install it for free in your neighor's garage, he might no longer be your friend after he has crashed his car...

     

    In my garage I use a golf-ball which is hanging from the roof. When it touches the car, I have to stop.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • stevemann
    stevemann over 9 years ago in reply to mcb1

    Traffic Light Tree is a public sculpture in London, England, created by the French sculptor Pierre Vivant following a competition run by the Public Art Commissions Agency.

    • Cancel
    • Vote Up +3 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • gadget.iom
    gadget.iom over 9 years ago in reply to mcb1

    mcb1 wrote:

    I was wondering how you change the lamps???

    I think I would attack that particular problem with a vehicle mounted boom.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
>
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube