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. My Project
  3. Parking Sensor

Parking Sensor

Scheduled Pinned Locked Moved My Project
74 Posts 28 Posters 45.0k Views 18 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.
  • L leothlon

    This is looking great!
    But i'm not seeing any "sleeping" is there anyway to have this using the external interrupts on the arduino so it can be running on battery?
    ( sorry if i'm mistaken, i'm new to arduino :D )

    korttomaK Offline
    korttomaK Offline
    korttoma
    Hero Member
    wrote on last edited by
    #33

    @leothlon that LED ring would burn through your batteries quite fast.

    • Tomas
    L 1 Reply Last reply
    0
    • korttomaK korttoma

      @leothlon that LED ring would burn through your batteries quite fast.

      L Offline
      L Offline
      leothlon
      wrote on last edited by
      #34

      @korttoma
      Even if it's only active for about 3-4minutes per day?
      The problem is i got no way of getting power to where i want to place it.
      And also if i did it would have to be something like 230V to usb adapter.
      And plugging one of those in outside seems like a fire hazzard (even indoors they are known to start fires).

      What if i hook it up to a small solar panel to charge the batteries?

      Otherwise i guess i'll just have to stick with the old tennisball on a string method :D

      korttomaK 1 Reply Last reply
      0
      • L leothlon

        @korttoma
        Even if it's only active for about 3-4minutes per day?
        The problem is i got no way of getting power to where i want to place it.
        And also if i did it would have to be something like 230V to usb adapter.
        And plugging one of those in outside seems like a fire hazzard (even indoors they are known to start fires).

        What if i hook it up to a small solar panel to charge the batteries?

        Otherwise i guess i'll just have to stick with the old tennisball on a string method :D

        korttomaK Offline
        korttomaK Offline
        korttoma
        Hero Member
        wrote on last edited by
        #35

        @leothlon I'm not saying it can not be done but according to the datasheet the LED chip can consume up to 20mA ( http://www.adafruit.com/datasheets/WS2812.pdf ). So with 24 of them you will be looking at almost 500mA for just the LEDs.

        http://ncalculators.com/electrical/battery-life-calculator.htm

        btw, there is another thread about safe AC DC transformers here

        • Tomas
        Dan S.D 1 Reply Last reply
        0
        • korttomaK korttoma

          @leothlon I'm not saying it can not be done but according to the datasheet the LED chip can consume up to 20mA ( http://www.adafruit.com/datasheets/WS2812.pdf ). So with 24 of them you will be looking at almost 500mA for just the LEDs.

          http://ncalculators.com/electrical/battery-life-calculator.htm

          btw, there is another thread about safe AC DC transformers here

          Dan S.D Offline
          Dan S.D Offline
          Dan S.
          Hero Member
          wrote on last edited by
          #36

          @korttoma The online documentation I read said:

          "The pin labeled PWR +5V is the power input pin, and should be connected to a suitable power supply. An input voltage of 5 V is used to power the ring, and each LED on the ring can draw up to 50 mA at 5 V when outputting white at full brightness. That means the ring could draw up to a maximum of around 1.2 A."

          Although Hek's code does not operate all the pixels at full white brightness, I decided to play extra safe and use a 2A supply.

          korttomaK 1 Reply Last reply
          0
          • Dan S.D Dan S.

            @korttoma The online documentation I read said:

            "The pin labeled PWR +5V is the power input pin, and should be connected to a suitable power supply. An input voltage of 5 V is used to power the ring, and each LED on the ring can draw up to 50 mA at 5 V when outputting white at full brightness. That means the ring could draw up to a maximum of around 1.2 A."

            Although Hek's code does not operate all the pixels at full white brightness, I decided to play extra safe and use a 2A supply.

            korttomaK Offline
            korttomaK Offline
            korttoma
            Hero Member
            wrote on last edited by
            #37

            @Dan-S. Yeah I'm sure thats true. Please post a link to the documentation if you can find it. Anyhow I guess we can agree that running this device on batteries would be difficult.

            • Tomas
            Dan S.D L 2 Replies Last reply
            0
            • korttomaK korttoma

              @Dan-S. Yeah I'm sure thats true. Please post a link to the documentation if you can find it. Anyhow I guess we can agree that running this device on batteries would be difficult.

              Dan S.D Offline
              Dan S.D Offline
              Dan S.
              Hero Member
              wrote on last edited by
              #38

              @korttoma link text

              1 Reply Last reply
              0
              • korttomaK korttoma

                @Dan-S. Yeah I'm sure thats true. Please post a link to the documentation if you can find it. Anyhow I guess we can agree that running this device on batteries would be difficult.

                L Offline
                L Offline
                leothlon
                wrote on last edited by
                #39

                @korttoma
                Yea from my calculations i would need to change batteries about once a month.
                And with the amount of sun here in sweden i don't think solar charger would help much sadly.

                1 Reply Last reply
                0
                • hekH Offline
                  hekH Offline
                  hek
                  Admin
                  wrote on last edited by
                  #40

                  But isn't the distance sensor rather power hungry as well?

                  The dist-sensor but be awake all the time taking measurements (which needs to be interpreted by the MCU).. so sleep mode is not an option on this.

                  BulldogLowellB 1 Reply Last reply
                  1
                  • hekH hek

                    But isn't the distance sensor rather power hungry as well?

                    The dist-sensor but be awake all the time taking measurements (which needs to be interpreted by the MCU).. so sleep mode is not an option on this.

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

                    @hek said:

                    But isn't the distance sensor rather power hungry as well?

                    You could wake it with a reed switch attached to the garage door...

                    door open, sense and display until steady state and go to sleep on a timeout or door closed interrupt

                    TD22057T 1 Reply Last reply
                    0
                    • BulldogLowellB BulldogLowell

                      @hek said:

                      But isn't the distance sensor rather power hungry as well?

                      You could wake it with a reed switch attached to the garage door...

                      door open, sense and display until steady state and go to sleep on a timeout or door closed interrupt

                      TD22057T Offline
                      TD22057T Offline
                      TD22057
                      Hardware Contributor
                      wrote on last edited by
                      #42

                      @BulldogLowell said:

                      You could wake it with a reed switch attached to the garage door...

                      door open, sense and display until steady state and go to sleep on a timeout or door closed interrupt

                      I like that idea. I was planning on having garage door sensors tied in with this anyway. FYI here is a link to the ultrasonic module docs which list 15mA as the current draw.

                      1 Reply Last reply
                      0
                      • rvendrameR Offline
                        rvendrameR Offline
                        rvendrame
                        Hero Member
                        wrote on last edited by
                        #43

                        Just to add my two cents, as I have a window nearby, I'm planning to run my parking sensor with a solar battery bank, like this one.

                        http://www.dx.com/p/solar-powered-13800mah-external-battery-charger-power-source-bank-silver-white-281953#.Ve8ICLTOmNM

                        I'm waiting for the ring now. It is the last piece missing ;-)

                        Home Assistant / Vera Plus UI7
                        ESP8266 GW + mySensors 2.3.2
                        Alexa / Google Home

                        1 Reply Last reply
                        0
                        • M Offline
                          M Offline
                          msebbe
                          wrote on last edited by
                          #44

                          This was fun to build :)

                          However, my HC-SR04 is making a high pitch sound when distance is close and a more static sound when distance is further. I have tried with 3 different modules and 2 different Nanos and 2 different power sources. Is this normal?

                          SparkmanS BulldogLowellB hekH 3 Replies Last reply
                          0
                          • M msebbe

                            This was fun to build :)

                            However, my HC-SR04 is making a high pitch sound when distance is close and a more static sound when distance is further. I have tried with 3 different modules and 2 different Nanos and 2 different power sources. Is this normal?

                            SparkmanS Offline
                            SparkmanS Offline
                            Sparkman
                            Hero Member
                            wrote on last edited by
                            #45

                            @msebbe It's normal for a :dog: or a bat. :laughing: Either you have really good hearing, or there's something wrong with your HC-SR04. The ultrasound is supposed to be well above human hearing range (40 KHz). My HC-SR04 is quiet and I don't hear any sound from it.

                            M 1 Reply Last reply
                            0
                            • M msebbe

                              This was fun to build :)

                              However, my HC-SR04 is making a high pitch sound when distance is close and a more static sound when distance is further. I have tried with 3 different modules and 2 different Nanos and 2 different power sources. Is this normal?

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

                              @msebbe

                              building on @Sparkman , perhaps it is some kind of resonance... something attached with a natural frequency that is excited by the vibrations of the speaker.

                              1 Reply Last reply
                              0
                              • M msebbe

                                This was fun to build :)

                                However, my HC-SR04 is making a high pitch sound when distance is close and a more static sound when distance is further. I have tried with 3 different modules and 2 different Nanos and 2 different power sources. Is this normal?

                                hekH Offline
                                hekH Offline
                                hek
                                Admin
                                wrote on last edited by
                                #47

                                @msebbe

                                I could hear mine as well when being close to it.

                                1 Reply Last reply
                                0
                                • SparkmanS Sparkman

                                  @msebbe It's normal for a :dog: or a bat. :laughing: Either you have really good hearing, or there's something wrong with your HC-SR04. The ultrasound is supposed to be well above human hearing range (40 KHz). My HC-SR04 is quiet and I don't hear any sound from it.

                                  M Offline
                                  M Offline
                                  msebbe
                                  wrote on last edited by
                                  #48

                                  @Sparkman

                                  It is correct that I have really good hearing.. But if I use the distance sensor sketch the HC-SR04 is not making any sound at all, first now with this sketch I hear it. Could it have something to do with the LED-strip I got from china?

                                  1 Reply Last reply
                                  0
                                  • Dan S.D Offline
                                    Dan S.D Offline
                                    Dan S.
                                    Hero Member
                                    wrote on last edited by
                                    #49

                                    Was checking out operation of parking sensor after changing MAX_Distance to 200 from original 100--wanted earlier start from wall. Also changed the Panic distance to 60--more space from wall during testing. Noticed that the led ring did not start from 1 pixel and increase from there as the distance closed. It started at 7 lit pixels. Examined the formula for newLightPixels and made a change which corrected this.

                                    The current newLightPixels formula is:

                                    int newLightPixels = NUMPIXELS - (NUMPIXELS*(displayDist-PANIC_DISTANCE)/MAX_DISTANCE);

                                    The portion of the newLightPixels formula (displayDist-PANIC_DISTANCE)/MAX_DISTANCE) is intended to map the interval between PANIC_DISTANCE and MAX_DISTANCE to the interval (0,1). In other words, when you are at the PANIC_DISTANCE it should calculate to 0 and when you are at MAX_DISTANCE it should calculate to 1, advancing linearly between the two values as the distance closes and vice versa. Clearly when a displayDist = PANIC_DISTANCE, the numerator of the division of the formula calculates to 0. However when displayDist = MAX_DISTANCE, it does not calculate to 1.

                                    In order to correct this I changed the portion of the formula to:
                                    (displayDist-PANIC_DISTANCE)/(MAX_DISTANCE-PANIC_DISTANCE))
                                    Note the only difference is subtracting the PANIC_DISTANCE from the MAX_DISTANCE in the denominator. Now when the displayDist = MAX_DISTANCE, the formula returns the value 1. So the proposed new newLightPixels formula is:

                                    int newLightPixels = NUMPIXELS - (NUMPIXELS*(displayDist-PANIC_DISTANCE)/(MAX_DISTANCE-PANIC_DISTANCE));

                                    I tested it both by plugging values into the formula and in operation of the Parking Sensor. Now the leds climb smoothly from 0 as you enter the MAX_DISTANCE zone. rather than starting at some number other than 1 (7 in my case).

                                    1 Reply Last reply
                                    1
                                    • Lawrence HelmL Offline
                                      Lawrence HelmL Offline
                                      Lawrence Helm
                                      wrote on last edited by
                                      #50

                                      Cool, I had this happen as well, so great fix! Now all I need it to do is talk to domoticz, not picking it up yet... :)

                                      1 Reply Last reply
                                      0
                                      • Dan S.D Offline
                                        Dan S.D Offline
                                        Dan S.
                                        Hero Member
                                        wrote on last edited by
                                        #51

                                        Have one more proposed change to parking sensor code. Noticed that even when I was standing still there seemed to be quite a few changes in number of leds lit. In checking the internet, learned that variability of distance readings was particularly a problem for those using the sensor in robots. The preferred solution seemed to be taking the median of several readings.
                                        See:
                                        http://blog.microcentertech.com/2013/05/minipingbot-construction.html

                                        Fortunately, the Newping library has a built in function to address this issue by taking the median of several readings (default = 5). So I modified the code as follows:

                                        // int fullDist = sonar.ping_cm(); original code
                                        unsigned int fullDist = (sonar.ping_median() / US_ROUNDTRIP_CM);
                                        // Get average distance for 5 pings, convert to cm
                                        // US_ROUNDTRIP_CM = distance sound travels in cm/sec

                                        As a result, the jumping around of the number of leds appears to have decreased significantly and the response is much more stable. Hope this helps others.

                                        M 1 Reply Last reply
                                        3
                                        • Dan S.D Dan S.

                                          Have one more proposed change to parking sensor code. Noticed that even when I was standing still there seemed to be quite a few changes in number of leds lit. In checking the internet, learned that variability of distance readings was particularly a problem for those using the sensor in robots. The preferred solution seemed to be taking the median of several readings.
                                          See:
                                          http://blog.microcentertech.com/2013/05/minipingbot-construction.html

                                          Fortunately, the Newping library has a built in function to address this issue by taking the median of several readings (default = 5). So I modified the code as follows:

                                          // int fullDist = sonar.ping_cm(); original code
                                          unsigned int fullDist = (sonar.ping_median() / US_ROUNDTRIP_CM);
                                          // Get average distance for 5 pings, convert to cm
                                          // US_ROUNDTRIP_CM = distance sound travels in cm/sec

                                          As a result, the jumping around of the number of leds appears to have decreased significantly and the response is much more stable. Hope this helps others.

                                          M Offline
                                          M Offline
                                          msebbe
                                          wrote on last edited by msebbe
                                          #52

                                          @Dan-S. Thanks for your investigation! I made the changes and it seems to work well!

                                          About the high pitch sound I mentioned earlier; I changed NEO_KHZ400.

                                          Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, NEO_PIN, NEO_GRB + NEO_KHZ400);
                                          

                                          to

                                          NEO_KHZ800
                                          

                                          This removed the annoying high pitch sound :D

                                          Dan S.D 1 Reply Last reply
                                          1
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          6

                                          Online

                                          11.7k

                                          Users

                                          11.2k

                                          Topics

                                          113.0k

                                          Posts


                                          Copyright 2019 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