Find all your DIY electronics in the MakerShed. 3D Printing, Kits, Arduino, Raspberry Pi, Books & more!

sevenSegPing600.jpg

I built this ultrasonic tape measure today using an Arduino Duemilanove, a PING))) sensor, and a 7-Segment Shield. I’ll post a video this week showing it in action.

I’ve got a project in the works that’ll require distance sensing and display. I wrote some code that samples the distance from the PING))) sensor to nearest object ten times, displays the average value in inches on the 7-Segment display, and calls that “normal”, turning the big RGB LED green. When objects move in front of it, the new values are displayed and the LED turns red or blue to correlate to closer or farther. In my upcoming project, victims who see the LED turn red will regret it!

Here’s a great post Marc de Vinck did on using the PING))) sensor with an Arduino.

In the Maker Shed:

pingUTMb.jpg
PING))) sensor

sevenUTMb.jpg
7-Segment Shield


Related

Comments

  1. Chris Spurgeon says:

    Nice. I really love the PING ultrasound sensor…pretty inexpensive, easy to wire up, and I love how it looks like a face.

    Suppose you wanted to do something with a longer range…something in the 10 to 30 foot range? What would be a good sensor for that?

  2. John Park says:

    Hey Chris, good question, I haven’t tested the maximum range on this one yet, but the data sheet says about 3 yards. For something much farther I’d consider going electro-mechanical and use a fishing reel and a optical rotary encoder.

  3. bigla25 says:

    Do you have the code available for this project? This is really cool. Thanks!

    1. John Park says:

      Yes, and thanks! I’ll clean up my code and make it available when I write up the project as a step-by-step tutorial. Not sure of the timing of that, but shouldn’t be too long.

  4. Theron says:

    I’m a physics teacher, and this looks like an excellent project for having the kids build their own sonic rangers for gathering data on position, velocity, and acceleration. Does this setup have the capability to report an output to a computer and/or report a new data point at timed intervals?

    1. John Park says:

      Hi Theron, that sounds great, you’d better do it and then tell us all about it!

      You can definitely get data from the Arduino over USB for logging and graphing the data, or even doing real-time visualization. Simplest way to view the data is through Serial.print statements sent to Arduino’s serial monitor. My current code samples distance every half second and prints to the 7-segment display and the serial monitor.

      For actual logging and more interesting displays, check out the Processing language. http://www.processing.org for more info, and here’s a good tutorial: http://arduino.cc/en/Tutorial/Graph . (Arduino sort of grew out Processing as the physical computing side of things.)

      You can add more sensors as your class’s needs grow, too, such as digital compasses, accelerometers, etc. One thing the 7-Segment shield has that I’m not using is a temperature sensor. I still haven’t figured out why they combined four 7-segments, one RGB LED, and a temp sensor! Maybe there was a kegerator project brewing?

      I look forward to hearing of your physics class’s progress with this, and please let us know if we can help with anything.

  5. Anonymous says:

    John, This is exactly what I need to enable my wife to park close to the right hand door opening. Would enclose it in a weather proof container. Could you please send me the code you wrote to make this function?  This newbie would appreciate it. You load the dcode from a pc via usb or one of the usb varieties?
    Thanks
    Albert
    agf3rd@att.net

  6. Anonymous says:

    Mark,
    Is it possible to get a copy of this code?  

    Thanks

In the Maker Shed