๐Ÿ’ฌ Parking Sensor

  • Admin

    This thread contains comments for the article "Parking Sensor" posted on MySensors.org.

  • I am going to abuse this use case to handle the 'toilet occupied' events because it is a well known challenge of presence detection


  • i think HC-SR04 is a bad sensor for parking . this sensor can not detect distance If there is some angle.

  • Now after hundreds of tests I can only confirm that HC-SR04 isn't really a sensor to rely on.
    Yes it shows something and it is somehow correlated with reality but... the deviations are so big!
    In my case it shows stable results if you point it onto a wall... if you put a book, hand or try to dance in front of it... so unreliable measures! I even tried to apply statistical methods to filter outfitters silly errors etc... too bad!

  • I've had some success with this but not using the HC-SR04. As others have commented this sensor is rubbish at anything except detecting a good flat surface like a wall for example.

    I instead used the Sharp GP2Y0A02YK0F. You have to re-write some of the code to use this as it just provides a sense voltage you have to convert in to a distance. There is lots of useful information on the comments section here https://www.sparkfun.com/products/8958. Which is where I managed to come up with the function below.

    int pingSharpSensor(){

    int voltageLevel;
    int sum = 0;
    int averageReading;

    for(int i=1; i<10; i++){
    voltageLevel = analogRead(distancePin);

    float v = (averageReading/1023.0)*5;

    int cm = int(61.681 * pow(v,-1.133));


    Serial.print("Distance ");

    return cm;


  • Hey David,
    Could you share the working code (with the SHARP sensor integrated) with us?

  • Cool project! I like the LED ring. But not near as cool as a traffic signal. Just sayin'.

Log in to reply

Suggested Topics

  • 176
  • 133
  • 32
  • 88
  • 161
  • 68
  • 258
  • 37