+ Reply to Thread
Results 1 to 17 of 17

Thread: Garage sonic ranger parking assistant

  1. #1

    Default Garage sonic ranger parking assistant

    Garage Sonic Ranger Parking Assistant
    ·
    Background
    ·
    If your garage is like mine, there is little room for a walkway in front of the garage.· Stuff gets piled up and if a car is parked too far forward, there is little passage way left.· That means when you are lugging the groceries, travel bags, camping gear or whatever, you have to dance and wiggle through the remaining space carrying a load.
    ·
    I would be nice if every car was parked such that the walkway was clear?· This project provides one solution to this problem.
    ·
    The schematic for this project is easy.· The coding is a little (but not much) more challenging, depending on the desired behavior of the device.
    ·
    General Description
    ·
    The hardware consists of a Stamp BS-2, a Devantech SRF04 ultrasonic ranging device, three LEDs, resistors, four pushbutton switches, a calculator-sized project box and a wall adapter for power.
    ·
    When a car enters the far detection range (GrnMax), the green LED is illuminated.· As the car proceeds forward, the car exits the green detection range and enters the yellow detection range (YelMax). At this point, the green LED is turned off and the yellow LED is turned on.·· Continuing forward, the car enters the red detection range (RedMax).· The yellow LED is turned off and the red LED is turned on.· The red detection range is a window of 8 inches.· Parking anywhere in this range is good.· If the car moves beyond the end of the red window closest to the sensor (RedMin), then the red LED begins blinking to indicate that the car is too close. The drawing in Attachment-1 will help clarify the green, yellow, red and red blink detection distances.
    ·
    Code
    ·
    Desired functionality
    ·
    I wanted the device to be smart enough to turn the red LED off after a car was parked. I also wanted the device not to react to people walking through an empty garage, so I needed some way to ignore readings in the yellow and red ranges if the green range had not been traversed first. I also learned through experience that it is helpful to be able to adjust the red and green detection distances without having to download a new program.·
    ·
    Note: Rather than converting timings to distance, the program uses the raw timing values received from the SRF04 for purposes of its measurements.
    ·
    Description of the program
    The program code is in Attachment-2.
    ·
    Startup
    ·
    The program initializes pins and reads stored timing values from EEPROM.· The only stored values are the red distance measurement (where you want the car to stop) and the beginning of the green detection range. It clears three switch values to false.· These switch values (one each for green, yellow and red) keep track of whether the car (or other object) has passed through green to get to yellow, through yellow to get to red and through red to get to red blink.·
    ·
    It then checks to see if any pushbutton switches are pressed.·
    ·
    If not, it drops into the main loop.
    ·
    Main Loop
    ·
    Here begins the slow pinging for an object.· As long as no object is detected, it remains in the slow pinging state, with all LEDs off.
    ·
    Once an object is detected in the green detection range, the ping rate increases, the green LED is turned on and the green switch is set to true.· As each detection zone is entered, the corresponding LED is turned on, the previous LED is turned off and the switch value is set true for the corresponding detection zone.· These switch values are used to decide if yellow or red should be displayed.· Yellow will be displayed if the GrnWasOn switch is True.· Otherwise, it is ignored.· The same is true for red.
    ·
    The main routine periodically pings and if an object is detected, tests the time returned to see if it is less than GrnMax and greater than YelMax.· If so, the green LED is turned on, the other LEDs are turned off and the GrnWasOn switch is set true.·
    ·
    If the ping time is less than YelMax and greater than Red Max, then the yellow LED is turned on, the other LEDs are turned off and the YelWasOn switch is set true.
    ·
    If the ping time is less than RedMax and greater than RedMin, then the red LED is turned on and the others are turned off.
    ·
    If the ping time is less than RedMin, the red LED is turned on for 100 mSeconds and turned off.
    ·
    A loop counter is used to count the number of times through the red zone loop.· Once this count is exceeded, the program reverts back to the slow ping state with all LEDs off and all switches set to false.
    ·
    The distance measurements are stored in EEPROM. These are the red distance measurement (ideally where you want the car to stop) and the green detection distance. The program calculates the beginning of the yellow detection distance, the beginning of the red detection distance and the beginning of the red blink detection distance at start up, according to the following computations:
    ·
    RedMin is the start of the red blink detection distance and is calculated by subtracting the red negative adjustment factor from the red measurement.
    ·
    Red Max is the start of the red detection distance and is calculated by adding the red positive adjustment factor to the red measurement.· RedMin and Red Max define a widow where the nose of the car should stop.· Inside of RedMin is the red blink range and outside of RedMax is the yellow range.
    ·
    GrnMax is the beginning of the green detection distance.· It initially defaults to about 12 feet, at or beyond the maximum range or the SRF04.
    ·
    YelMax is the beginning of the yellow detection distance and is calculated by dividing the difference between GrnMax and RedMax by 2 and adding this number to RedMax. ((GrnMax-RedMax)/2) + RedMax.· This makes the Green and Yellow zones of equal size.
    ·
    There two groups of routines that are subordinate to the main routine.· These are subroutines and terminal routines.·
    ·
    Subroutines
    ·
    GetSonar
    ·
    The first subroutine was written by Jon Williams (thank you Jon) and obtains the echo timing from the SRF04. Please refer to Jon’s “Sonic Sight” program and accompanying documentation for information regarding use of this device.
    ·
    ErrorLeds
    ·
    The second subroutine is an error display that simply toggles each LED on and off in sequence from green to yellow to red.· It performs this sequence a few times, to signify that an error has occurred.
    ·
    ShowGreenDistance
    ·
    The third subroutine displays the current value of GrnMax.· Here, the timing value is converted to distance. ··The number of feet in GrnMax is displayed by flashing the green LED once for each foot of GrnMax.· If a half foot (or greater) exists, the yellow LED is flashed once to signify this.· So, if GrnMax is set to 9 1/2 feet, the green LED will flash 9 times and the yellow LED once.· If GrnMax is set to 9 feet, then the green LED will flash 9 times and the yellow LED will not flash
    ·
    ShowRedDistance
    ·
    The fourth subroutine displays the converted value of RedMax.· To display RedMax, the red LED will flash one time per foot and the yellow LED will flash for each 1-inch fraction of a foot.· For example, to display 3 feet 8 inches, the red LED will flash 3 times and the yellow LED will flash 8 times.
    ·
    Terminal Routines
    ·
    The terminal routines are used to obtain or modify the red measurement and the beginning of the green detection distance. They are executed once and terminate with an END instruction.
    ·
    SetDistance
    ·
    This routine is used to take the initial red measurement.· To take the initial measurement, park the car where you want it to stop.· Invoke the SetDistance routine by holding the Set pushbutton down and then press and release the Reset pushbutton.
    ·
    SetDistance will obtain the time measurement for the distance from the front of the car to the sensor. This is RedMeas.· The RedPlusAdj amount is added to RedMeas to give RedMax.· The RedMinusAdj amount is subtracted from RedMeas to give RedMin.· This creates the window where the car should stop, when parked.
    ·
    These values are edited to insure that RedMax is greater than RedMin.· If so, RedMeas and the default value of GrnMax is written to EEPROM and the two distance display subroutines are called to display the respective distances.· If not, then the ErrorLeds subroutine is called to show that the adjusted red distance measurement is bad.··
    ·
    IncreaseRed
    ·
    This routine adds 3 inches to RedMin, RedMax and RedMeas (pushing the red window away from the sensor).· Red max must be at least 2 feet less than GrnMax (so a workable yellow range can be created).· If not, the ErrorLeds routine is invoked.· If ok, the new value of RedMeas is saved in EEPROM and value of RedMax is displayed on the red/yellow LEDs. Invoke the IncreaseRed routine by pressing and holding the Set and Red pushbuttons and press and release the Reset pushbutton.
    ·
    DecreaseRed
    ·
    This routine subtracts 3 inches from RedMax, RedMin and RedMeas (pulling the red window closer to the sensor). Both RedMax and RedMin must be greater than zero. If not, the ErrorLeds routine is invoked.· If ok, the new value of RedMeas is saved in EEPROM and value of RedMax is displayed on the red/yellow LEDs. Invoke the DecreaseRed routine by pressing and holding the Red pushbutton and press and release the Reset pushbutton.
    ·
    IncreaseGreen
    ·
    This routine adds 6 inches to GrnMax (pushing the green detection distance away from the sensor). If GrnMax is greater than the maximum distance allowed, the ErrorLeds routine is invoked. If ok, the new value of GrnMax is saved in EEPROM and value of GrnMax is displayed on the green/yellow LEDs. Invoke the IncreaseGreen routine by pressing and holding the Set and Green pushbuttons and press and release the Reset pushbutton.
    ·
    DecreaseGreen
    ·
    This routine subtracts 6 inches from GrnMax (pulling the green detection distance closer to the sensor). Red max must be at least 2 feet less than GrnMax (so a workable yellow range can be created).· If not, the ErrorLeds routine is invoked.· If ok, the new value of GrnMax is saved in EEPROM and value of GrnMax is displayed on the green/yellow LEDs. Invoke the DecreaseGreen routine by pressing and holding the Green pushbutton and press and release the Reset pushbutton.
    ·
    InvalidSetup
    ·
    This routine is invoked if nothing has been saved in EEPROM (zeros read from EEPROM).· The ErrorLeds routine is invoked.
    ·
    Final note
    ·
    The reason for the Increase/Decrease Red distance is so you can nudge the red detection window towards or away from the sensor.· This is handy if your initial measurement leaves the car too close to the walkway or has the car so far back that it is too close to the garage door.
    ·
    The reason for changing the green detection distance is different.· With two or more cars parked side-by-side, it is possible to get spurious echoes from adjacent cars in the garage or from “stuff” stacked along the side of the garage.· Buy shortening the green detection distance for one car stall, you can cause the device to ignore echoes from adjacent cars and other clutter in the garage, by putting them outside of the initial detection range.
    ·
    Parts List
    The Schematic is in Attachment-3.
    ·
    Part Name····················· ········Vendor· ···Vendor Part No.··· Quan ·Price··
    ·
    Stamp BS2····························· Parallax ··BS2-IC·· ···········1 ··$49.00
    SRF04 Ultrasonic Range Finder········· Parallax·· 28015··· ···········1··· 36.00
    10K Ohm Resistor 5%··················· Mouser···· 291-10K····· ·······3···· 0.24
    300 Ohm Resistor 5%··················· Mouser···· 291-330··· ·········3···· 0.24
    KingBrite green 8mm diffused LED······ Mouser···· 604-L793GD·· ·······1···· 0.30
    KingBrite yellow 8mm diffused LED····· Mouser···· 604-L793ID·· ·······1···· 0.30
    KingBrite red 8mm diffused LED········ Mouser···· 604-L793YD·· ·······1·· ··0.30
    Phihong 5V switching ext power adapt·· Mouser···· 552-PSC-15A-050S··· 1··· 14.25
    Mountain switch pushbutton switch····· Mouser···· 104-0013··········· 4···· 3.48
    Amp right angle DB-9 pcb connector···· Mouser···· 571-7478444········ 1···· 1.36
    .1uF capacitor························ Mouser···· 80-C320C104K5R····· 2···· 0.32
    PacTec plastic enclosure 3.6x5.7x1.29· Mouser···· 616-60620-510-000·· 1···· 5.49
    24-pin IC socket for Stamp············ Mouser···· 571-3902621········ 1···· 0.24
    Eagle Plastics ¼ inch PCB post········ Mouser···· 561-DMSP250········ 2···· 0.34
    Eagle Plastics threaded nylon spacer·· Mouser···· 561-MF440-37······· 4···· 1.28
    Eagle Plastics 4-40 nylon screws······ Mouser···· 561-P440.25········ 4···· 0.76
    Eagle Plastics 4-40 nylon nuts· ·······Mouser···· 561-H440··········· 4···· 0.68
    ·················································· ······················· ______
    Total·················································· ················· $115.28
    ·
    ·
    Construction details
    Photos of the finished device are in Attachments 4, 5 and 6.
    ·
    Raise the bottom of the LEDs ½ inch above the circuit board prior to soldering, so the LEDs will extend through the cover of the enclosure.· The holes in the case for the SRF04 emitter and receiver should be lightly larger than the diameter of these devices, so that the emitter does not cause sympathetic vibration of the case. I used self-adhesive Velcro tabs to affix the device to the garage wall.· I used 5 pins of a SIP snap strip soldered to the circuit board and soldered wire-wrap pins through the connection holes in the SRF04 board. These pins insert into the SIP strip and allow removal of the SRF04 without de-soldering.
    ·
    Even though the schematic shows a DB-9 serial connector for Stamp communications, I used a 4-pin Amp header on the actual circuit board.· This saves valuable space on the circuit board. I use a specially-made cable for communicating with the Stamp to/from my notebook computer.
    ·
    That’s about it.· I’ve attached the schematic, photos of the actual device as mounted in our garage, the internals of the device and the source code file.
    ·
    This was a fun and practical project and it beats having tennis balls hanging down from the ceiling. I built enough of these, so that each of the stalls in our garage has one.· We now can walk unimpeded from the farthest parked car to the entrance to the house without having to dodge car bumpers and those deformed license plate holders that snag your pant legs as you walk by.
    ·
    Regards,
    ·
    Rusty Turley
    ·
    ·
    ·
    Attached Thumbnails Attached Thumbnails Click image for larger version

Name:	Garage.jpg‎
Views:	827
Size:	15.0 KB
ID:	36933   Click image for larger version

Name:	SonicSchematic.jpg‎
Views:	955
Size:	184.8 KB
ID:	36934   Click image for larger version

Name:	DSCF0005.JPG‎
Views:	975
Size:	286.0 KB
ID:	36936   Click image for larger version

Name:	DSCF0006.JPG‎
Views:	977
Size:	280.6 KB
ID:	36937  
    Attached Files Attached Files
    Last edited by ForumTools; 10-01-2010 at 03:00 AM. Reason: Forum Migration

  2. #2

    Default

    Very cool. I was thinking about such a project the other day. I was considering a digital readout at eye-level, and the sonar sensor at license plate level.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas, TX· USA
    Last edited by ForumTools; 10-01-2010 at 03:00 AM. Reason: Forum Migration

  3. #3

    Default

    Something similar was in nuts and volts...no?

    Great idea nonetheless!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·

    Steve
    http://members.rogers.com/steve.brady
    "Inside each and every one of us is our one, true authentic swing. Something we was born with. Something that's ours and ours alone. Something that can't be learned... something that's got to be remembered."
    Last edited by ForumTools; 10-01-2010 at 03:00 AM. Reason: Forum Migration

  4. #4

    Default

    This is so cool, the "Background" description describes
    my garage to the tee.· I can't tell you·how many times that my family and I have danced around the car hoping not to scratch it.· Two thumbs up for this project!

    Dave


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Dave Andreae

    Tech Support
    dandreae@parallax.com
    www.parallax.com



    Post Edited (Dave Andreae (Parallax)) : 4/27/2005 2:58:18 PM GMT
    Last edited by ForumTools; 10-01-2010 at 03:00 AM. Reason: Forum Migration

  5. #5

    Default

    ·You can save some money if you purchase one of Parallax's BS2 OEM kits for this project.
    They currently have them on sale for $30.00. ·I recently bought two of them for "stock".· It's hard
    to beat the price!
    Last edited by ForumTools; 10-01-2010 at 03:00 AM. Reason: Forum Migration

  6. #6

    Default

    Great project.

    I have been looking for something like this to illistrate to my wife why I am doing this microcontroller thing!
    Last edited by ForumTools; 10-01-2010 at 03:00 AM. Reason: Forum Migration

  7. #7

    Default

    That is a nice looking board where did you have that made.· I like the fact that it has the part printing on it.

    Kevin


    Post Edited (Kevin B Slater) : 4/28/2005 3:16:00 AM GMT
    Last edited by ForumTools; 10-01-2010 at 03:00 AM. Reason: Forum Migration

  8. #8

    Default

    Hi Kevin.

    I made the board.· I use the technique described here

    http://www.pulsar.gs/1_PCB/a_Pages/1_Menu/Overview.html

    I use the direct etch method described on this site.· It's pretty reliable.· I've done boards up to 6x9, single and double sided.

    You have to have some type of layout tool/software to produce the artwork.· Then you need transfer paper to run thru a laser printer.· Then the image can be transferred to the copper-clad board·using a laminator.

    You can read the details on the web site.

    Hope this helps,

    RTurley
    Last edited by ForumTools; 10-01-2010 at 03:00 AM. Reason: Forum Migration

  9. #9

    Default

    Very nice project. Just ordered an OEM BS2 and plan to make one using a PING I purchased already instead of the SRF04. If I use 4 AA instead of AC power any idea how long·they will last?·Getting to the nearest AC power would be more·of a problem for where I want to use it.
    Last edited by ForumTools; 10-01-2010 at 03:00 AM. Reason: Forum Migration

  10. #10

    Default

    RTurley,

    · Thanks, that is a great site!

    Kevin




    Post Edited (Kevin B Slater) : 4/29/2005 2:38:03 AM GMT
    Last edited by ForumTools; 10-01-2010 at 03:00 AM. Reason: Forum Migration

  11. #11

    Default

    The Ping (actaully, any sonic rangefinder) requires a bit of energy when it transmits, so you may want to use an additional trigger (perhaps light level) before you start pinging.· Even then, you'll want to have a bit of space (a second or two) between pings to converve battery power.· Then, when you detect the car is not moving any longer, you can shut down.·

    Wade Smith said...

    Very nice project. Just ordered an OEM BS2 and plan to make one using a PING I purchased already instead of the SRF04. If I use 4 AA instead of AC power any idea how long·they will last?·Getting to the nearest AC power would be more·of a problem for where I want to use it.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas, TX· USA
    Last edited by ForumTools; 10-01-2010 at 03:00 AM. Reason: Forum Migration

  12. #12
    sam_sam_sam's Avatar
    Location
    Propeller Proto Board........> Sunny Jacksonville FL
    Posts
    2,150
    Blog Entries
    2

    Default

    ·"···········THESE GUYS HAVE GONE MAD "····················
    ···················"·THEY NEED HELP BAD"
    ······It has been moved to is garage open or closed
    ····

    Post Edited (sam_sam_sam) : 6/16/2005 11:49:09 PM GMT
    Last edited by ForumTools; 10-01-2010 at 03:00 AM. Reason: Forum Migration

  13. #13

    Default

    This is a great project; however, I was wondering what would be the best mounting height for such a device? I have a car and a SUV which share same parking spot. If I place the sensor lower, it will not detect the SUV being present and vice versa.

    Thanks
    Last edited by ForumTools; 10-01-2010 at 03:00 AM. Reason: Forum Migration

  14. #14

    Default

    llomll,

    See this similar....Errr... Almost identical thread posted 2 years later.

    RTurley get's the credit for original design in the forum.

    http://forums.parallax.com/showthread.php?p=636791

    llomll,

    In answer to your question ... I have a 2002 Jeep Grand Cherokee ... My sensor is located about·30 inches from the ground.
    This places the sensor "looking" right into the center of the grill on the car.


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe

    IC Layout Engineer
    Parallax, Inc.

    Post Edited (Beau Schwabe (Parallax)) : 1/30/2008 5:49:46 AM GMT
    Last edited by ForumTools; 10-01-2010 at 03:00 AM. Reason: Forum Migration

  15. #15
    Parallax Engineering

    Chris Savage's Avatar
    Location
    Rocklin, CA
    Posts
    12,581
    Blog Entries
    8

    Default

    We’ve got ours aimed at the license plate, since it is the flattest section on the front of the car. The entire rest of the nose (2007 Hyundai Elantra) is all curves and doesn’t reflect well. And yes, credit should be given to RTurley for the first posted project doing this. In fact, if I didn’t give credit on my project page I will post that now.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    Last edited by ForumTools; 10-01-2010 at 03:00 AM. Reason: Forum Migration

  16. #16

    Default

    broken link http://www.pulsar.gs/1_PCB/a_Pages/1_Menu/Overview.html

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    When the blue smoke comes out of a Basic Stamp... You know that you did something wrong... -- Matthew
    Last edited by ForumTools; 10-01-2010 at 03:00 AM. Reason: Forum Migration

  17. #17

    Default

    Matthew Burmeister,

    Try this... (A little URL hacking)

    http://www.pulsarprofx.com/PCB/a_Pages/1_Menu/overview.html



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe

    IC Layout Engineer
    Parallax, Inc.
    Last edited by ForumTools; 10-01-2010 at 03:00 AM. Reason: Forum Migration

+ Reply to Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts