Parking Assisting Device

by Maxf in Circuits > Assistive Tech

95 Views, 1 Favorites, 0 Comments

Parking Assisting Device

IMG_1689.JPG
IMG_1708.JPG
IMG_1690.JPG

My family has been struggling with bumping into the garage wall while attempting to park. For this reason I made a sensor that can relay to the driver of a car using LEDs how close they are to the wall of our garage.

Supplies

Materials:

  1. Breadboard
  2. Argon
  3. 4 LEDs
  4. At least 12 wires (8 need to be around 1 - 3 ft long for LEDs and ideally solid core)
  5. 4 breakers
  6. Ultrasonic sensor(HC_SR04)
  7. Power supply and USBC to connect to argon

Tools:

  1. soldering iron and solder wire
  2. wire stripper
  3. Tape
  4. Phone to connect to Argon
  5. Computer to code inside the particle website

Setting Up Argon Wiring

Diagram.jpg

For now ignore wiring the LEDs(Orange and cream).

  1. Place the argon on the breadboard so that there are no open holes left(being the side of j1) of the Argon.
  2. Wire the Breakers(yellow) according to the diagram (the breaker farthest to the right is redundant; I just forgot to remove it for the photo).
  3. Place the sensor(purple) into the breadboard according to the diagram.
  4. Now just copy all the wiring using the diagram(Green, red and blue).

Make Extended LEDs

IMG_1689.JPG
IMG_1702.JPG

You will have to solder wire onto a standard led so that they can be seen from the seat of a car.

  1. Cut 8 equal length wires for all the LEDs. The length of wire that needs to be attached to the LEDs depends on your garage-car situation so its best to use longer than likely needed wire and experiment later. I cut my wire to a length of around 50in. Additionally it is best to use a different color wire for both the + and - side of the led(+ = long side of led and - = short side). I used red wire for the + side and black for the - side.
  2. Strip each side of all the wires about half an inch.
  3. Next solder the LEDs to the wires. I used a load bearing connection but that is not necessary.

Connect the Now Longer LEDs to the Breadboard

Diagram.jpg

Attach the LEDs(Orange and cream) to the breadboard according to the diagram.

Code

  1. Set up a particle account.
  2. Connect the Argon to your internet.
  3. Create a new app and name it.
  4. Go to the libraries tab and search for "HC_SR04".
  5. Click "Include in project" and select your project.
  6. Copy and paste the code below into your project.
  7. Now flash the code to the argon
  8. Look at the comments below to see the specific values and how to change them.


Copy code inside lines

-------------------------------------------------

#include "HC_SR04.h"


double cm = 0.0;

double inches = 0.0;


int trigPin = D5;

int echoPin = D4;


int led1 = 2;

int led2 = 3;

int led3 = 6;

int led4 = 7;

int led5 = 8;


/*

Connect an HC-SR04 Range finder as follows:

Spark  HC-SR04

GND   GND

5V   VCC

D4   Trig

D5   Voltage divider output - see below


Echo --|

    >

    < 470 ohm resistor

    >

    ------ D5 on Spark

    >

    < 470 ohm resistor

    >

GND ---|


Test it using curl like this:

curl https://api.spark.io/v1/devices/<deviceid>/cm?access_token=<accesstoken>


The default usable rangefinder is 10cm to 250cm. Outside of that range -1 is returned as the distance.


You can change this range by supplying two extra parameters to the constructor of minCM and maxCM, like this:


HC_SR04 rangefinder = HC_SR04(trigPin, echoPin, 5.0, 300.0);


*/


HC_SR04 rangefinder = HC_SR04(trigPin, echoPin);


void setup() 

{

  Serial.begin(9600);

   

  Spark.variable("cm", &cm, DOUBLE);

  Spark.variable("inches", &inches, DOUBLE);

   

  pinMode(led1, OUTPUT);

  pinMode(led2, OUTPUT);

  pinMode(led3, OUTPUT);

  pinMode(led4, OUTPUT);

  pinMode(led5, OUTPUT);

}


void loop() 

{

  cm = rangefinder.getDistanceCM();

  inches = rangefinder.getDistanceInch();

  Serial.println(inches);

  delay(150);

//If the object is to far to be detected then that equals -1 so all leds will be turned off. Don't edit this one.

  if (inches == -1)

  {

    digitalWrite(led1, LOW);

    digitalWrite(led2, LOW);

    digitalWrite(led3, LOW);

    digitalWrite(led4, LOW);

    digitalWrite(led5, LOW);

  }

  else if(inches < 11) //If detects object less then 11in then turn on all LEDS.

  {

    digitalWrite(led1, HIGH);

    digitalWrite(led2, HIGH);

    digitalWrite(led3, HIGH);

    digitalWrite(led4, HIGH);

    digitalWrite(led5, HIGH);

  }

  else if(inches < 21) //If detects object less then 21in then turn on 3 LEDS.

  {

    digitalWrite(led1, HIGH);

    digitalWrite(led2, HIGH);

    digitalWrite(led3, HIGH);

    digitalWrite(led4, HIGH);

    digitalWrite(led5, LOW);

  }

  else if(inches < 31) //If detects object less then 31in then turn on 2 LEDS.

  {

    digitalWrite(led1, HIGH);

    digitalWrite(led2, HIGH);

    digitalWrite(led3, HIGH);

    digitalWrite(led4, LOW);

    digitalWrite(led5, LOW);

  }

//If detects object less then 41in then turn on 1 LEDS. If you want to adjust when the LEDs are activated just change the value next to the "x" comment. This logic is the same for the other three if/ else if statements.

  else if(inches < 41) //x

  {

    digitalWrite(led1, HIGH);

    digitalWrite(led2, HIGH);

    digitalWrite(led3, LOW);

    digitalWrite(led4, LOW);

    digitalWrite(led5, LOW);

  }

}

-------------------------------------------------

Test

Before you set up the device in your garage test the device by moving an object closer and farther from the ultrasonic sensor. If it works then more LEDs should turn on the closer the object gets to the sensor(some objects will reflect better or worse so if the lights flicker excessively then use a more flat smooth object like cardboard to test).

Set Up in Your Garage

IMG_1686.JPG
IMG_1707.JPG
  1. tape the LEDs to the wall so that it can be seen by the driver of a car.
  2. then place the breadboard on an object so that it can sense your car. If the sensor is not stable then tape it to the object your placing it on.
  3. Drive the car up to the sensor and see if the lights turn on as intended(also have another person watching to make sure you don't drive into the wall or the device while testing).
  4. If the LEDs are not turning on properly then the device will require more adjusting. For example, as seen in the images above I had the device on the ground but it was not sensing the car properly so I put it on top of a box and the LEDs lit up perfectly.
  5. Congrats now you can park with ease.