Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Troubleshooting
  3. Parking Sensor problem

Parking Sensor problem

Scheduled Pinned Locked Moved Troubleshooting
5 Posts 4 Posters 1.4k Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • mikeg291M Offline
    mikeg291M Offline
    mikeg291
    wrote on last edited by
    #1

    Just completed building the parking sensor project and interfaced it to a Vera edge via NRF2501,s and every thing works. The problem I am having is the sensor (monitoring it with serial monitor to confirm ) when a vehicle is parked it changes states ever 5 seconds from car parked to car gone . this does not occur when vehicle is actually gone . It reports correctly. I have verified connections, reloaded the sketch and now I am at a complete loss . Any suggestions .

    BulldogLowellB 1 Reply Last reply
    0
    • mfalkviddM Offline
      mfalkviddM Offline
      mfalkvidd
      Mod
      wrote on last edited by mfalkvidd
      #2

      Welcome @mikeg291 !
      Uncomment this

      //  Serial.println(fullDist);
      

      and see what the serial output look like. That should give a clue into what is happening.

      1 Reply Last reply
      0
      • mikeg291M mikeg291

        Just completed building the parking sensor project and interfaced it to a Vera edge via NRF2501,s and every thing works. The problem I am having is the sensor (monitoring it with serial monitor to confirm ) when a vehicle is parked it changes states ever 5 seconds from car parked to car gone . this does not occur when vehicle is actually gone . It reports correctly. I have verified connections, reloaded the sketch and now I am at a complete loss . Any suggestions .

        BulldogLowellB Offline
        BulldogLowellB Offline
        BulldogLowell
        Contest Winner
        wrote on last edited by BulldogLowell
        #3

        @mikeg291

        It could be that transient sound waves are reflecting/scattering around and affecting the readings. The NewPing library states that 29milliseconds should be the shortest delay between reads.

        Sound travels a little more than one foot in 1millisecond so you have an inherent delay in an empty garage; 15 feet each way, for example is about 30milliseconds from ping to read.

        So, if you insert a delay(50) after you obtain the distance you may leave enough time for all of the sound to be absorbed or reflected away.

        void loop()
        {
          unsigned long now = millis();
          
          unsigned int fullDist = (sonar.ping_median() / US_ROUNDTRIP_CM);
        //  Serial.println(fullDist);
          int displayDist = min(fullDist, MAX_DISTANCE);
          if (displayDist == 0 && skipZero<10) {
            // Try to filter zero readings
            skipZero++;
            return;
          }
          delay(50);  // try this
          // etcetera
        
        finch666F 1 Reply Last reply
        0
        • BulldogLowellB BulldogLowell

          @mikeg291

          It could be that transient sound waves are reflecting/scattering around and affecting the readings. The NewPing library states that 29milliseconds should be the shortest delay between reads.

          Sound travels a little more than one foot in 1millisecond so you have an inherent delay in an empty garage; 15 feet each way, for example is about 30milliseconds from ping to read.

          So, if you insert a delay(50) after you obtain the distance you may leave enough time for all of the sound to be absorbed or reflected away.

          void loop()
          {
            unsigned long now = millis();
            
            unsigned int fullDist = (sonar.ping_median() / US_ROUNDTRIP_CM);
          //  Serial.println(fullDist);
            int displayDist = min(fullDist, MAX_DISTANCE);
            if (displayDist == 0 && skipZero<10) {
              // Try to filter zero readings
              skipZero++;
              return;
            }
            delay(50);  // try this
            // etcetera
          
          finch666F Offline
          finch666F Offline
          finch666
          wrote on last edited by
          #4

          @BulldogLowell said:

          @mikeg291

          It could be that transient sound waves are reflecting/scattering around and affecting the readings. The NewPing library states that 29milliseconds should be the shortest delay between reads.

          Sound travels a little more than one foot in 1millisecond so you have an inherent delay in an empty garage; 15 feet each way, for example is about 30milliseconds from ping to read.

          So, if you insert a delay(50) after you obtain the distance you may leave enough time for all of the sound to be absorbed or reflected away.

          I second this. Built the sensor with a neopixel ring and the leds go berserk when I am about 3 cm away from the sensor with my hand.

          1 Reply Last reply
          0
          • mikeg291M Offline
            mikeg291M Offline
            mikeg291
            wrote on last edited by
            #5

            Problem solved Turned out to be a bad sensor and with mfalkvidd 's suggestion troubleshooting was a lot easier . Thanks

            1 Reply Last reply
            1
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            12

            Online

            11.7k

            Users

            11.2k

            Topics

            113.1k

            Posts


            Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • MySensors
            • OpenHardware.io
            • Categories
            • Recent
            • Tags
            • Popular