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. Battery Powered Distance Sensor reports incorrect

Battery Powered Distance Sensor reports incorrect

Scheduled Pinned Locked Moved Troubleshooting
13 Posts 4 Posters 5.7k Views 1 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.
  • sonicblazeS Offline
    sonicblazeS Offline
    sonicblaze
    wrote on last edited by sonicblaze
    #1

    I have a 3AA battery pack, going through a DC-DC Step Up Boost Module to ensure 5V. This is feeding a 5V Arduino Pro Mini 5V, which feeds a HC-SR04.

    When the Arduino is powered via USB outputting ~5.2V through the FTDI, it reports distance properly. I can measure to my ceiling 8ft away and it's accurate to 2-3cm.

    When fed via the battery/step up either feeding into RAW or VCC on the Arduino, the distance reports incorrectly. It's accurate up to about 9cm, and then it just never reports anything further away.

    I've verified voltage at the Arduino via the StepUp and I'm getting 5.13. Verified voltage at the Sr04 as well from both power sources, and USB is 5.04v and StepUp is 5.13v via VCC and 4.94 via RAW.

    BulldogLowellB 1 Reply Last reply
    0
    • sonicblazeS sonicblaze

      I have a 3AA battery pack, going through a DC-DC Step Up Boost Module to ensure 5V. This is feeding a 5V Arduino Pro Mini 5V, which feeds a HC-SR04.

      When the Arduino is powered via USB outputting ~5.2V through the FTDI, it reports distance properly. I can measure to my ceiling 8ft away and it's accurate to 2-3cm.

      When fed via the battery/step up either feeding into RAW or VCC on the Arduino, the distance reports incorrectly. It's accurate up to about 9cm, and then it just never reports anything further away.

      I've verified voltage at the Arduino via the StepUp and I'm getting 5.13. Verified voltage at the Sr04 as well from both power sources, and USB is 5.04v and StepUp is 5.13v via VCC and 4.94 via RAW.

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

      @sonicblaze

      and you have caps on both the distance sensor and the radio?

      sonicblazeS 1 Reply Last reply
      0
      • BulldogLowellB BulldogLowell

        @sonicblaze

        and you have caps on both the distance sensor and the radio?

        sonicblazeS Offline
        sonicblazeS Offline
        sonicblaze
        wrote on last edited by
        #3

        @BulldogLowell I tried a cap across the SR04 and it made no difference. I never added one to my radio as I didn't have comm problems and it's going through a step-down.

        1 Reply Last reply
        0
        • BulldogLowellB Offline
          BulldogLowellB Offline
          BulldogLowell
          Contest Winner
          wrote on last edited by
          #4

          Sometimes these are referred to decoupling capacitors, Their use is intended to minimize the effects of other power consuming components on your circuit.

          it is worth a try getting caps on both. For a few cents, you rule out power (it isn't just about voltage).

          Otherwise, you can start swapping out other components. You did mention that the problem occured when you changed power supplies...

          1 Reply Last reply
          0
          • sonicblazeS Offline
            sonicblazeS Offline
            sonicblaze
            wrote on last edited by sonicblaze
            #5

            I actually just tried powering the distance sensor from my bench power supply, while the arduino was powered via battery. I still got inaccurate readings. However all the same components powered through the Arduino while powered by the FTDI via USB and it's accurate every time.

            I'm at a loss...I've got this same setup of 3AA->Booster->Arduino running temperature sensors and they are working perfect.

            1 Reply Last reply
            0
            • sonicblazeS Offline
              sonicblazeS Offline
              sonicblaze
              wrote on last edited by
              #6

              And I did check the dc-dc stepup, it's rated for 500ma, so it shouldn't be an issue of trying to draw too much current through it.

              And as for the decoupling capacitor across both radio/SR04 circuits, I figured moving the SR04 to be powered from my benchtop supply should achieve the same thing/more, since any spikes/valleys/noise introduced by the draw of the radio would be isolated away at that point.

              1 Reply Last reply
              0
              • m26872M Offline
                m26872M Offline
                m26872
                Hardware Contributor
                wrote on last edited by m26872
                #7

                So if you completely(!) remove battery and stepup, and feed both arduino and HC-SR04 with a proven bench supply, you still have the issue? And as soon as you connect the usb2serial it works?

                1 Reply Last reply
                0
                • sonicblazeS Offline
                  sonicblazeS Offline
                  sonicblaze
                  wrote on last edited by
                  #8

                  It's only incorrect when something is powered by the battery + stepup it seems.

                  Sr04 via benchtop + arduino via battery/stepup = incorrect

                  Sr04 via battery + aruino via benchtop = invorrect

                  Sr04 & arduino via battery/stepup = incorrect

                  Sr04 & arduino via benchtop OR ftdi/usb = correct

                  The only thing I can guess is the Stepup module is emitting a frequency that the SR04 is picking up as the "echo" to the "ping" it sends out on trigger.

                  m26872M 1 Reply Last reply
                  0
                  • sonicblazeS sonicblaze

                    It's only incorrect when something is powered by the battery + stepup it seems.

                    Sr04 via benchtop + arduino via battery/stepup = incorrect

                    Sr04 via battery + aruino via benchtop = invorrect

                    Sr04 & arduino via battery/stepup = incorrect

                    Sr04 & arduino via benchtop OR ftdi/usb = correct

                    The only thing I can guess is the Stepup module is emitting a frequency that the SR04 is picking up as the "echo" to the "ping" it sends out on trigger.

                    m26872M Offline
                    m26872M Offline
                    m26872
                    Hardware Contributor
                    wrote on last edited by m26872
                    #9

                    @sonicblaze said:

                    The only thing I can guess is the Stepup module is emitting a frequency that the SR04 is picking up as the "echo" to the "ping" it sends out on trigger.

                    I would suspect the same. I have bad experience from both the 5v and the 3.3V stepups. Can you try a "step-down" approach instead? Or use only battery - temporary?

                    sonicblazeS 1 Reply Last reply
                    0
                    • m26872M m26872

                      @sonicblaze said:

                      The only thing I can guess is the Stepup module is emitting a frequency that the SR04 is picking up as the "echo" to the "ping" it sends out on trigger.

                      I would suspect the same. I have bad experience from both the 5v and the 3.3V stepups. Can you try a "step-down" approach instead? Or use only battery - temporary?

                      sonicblazeS Offline
                      sonicblazeS Offline
                      sonicblaze
                      wrote on last edited by
                      #10

                      @m26872 A stepdown wouldn't work. Using a stepup on the 3AA's is to provide constant 5V, even when the batteries are almost dead.

                      m26872M 1 Reply Last reply
                      0
                      • sonicblazeS sonicblaze

                        @m26872 A stepdown wouldn't work. Using a stepup on the 3AA's is to provide constant 5V, even when the batteries are almost dead.

                        m26872M Offline
                        m26872M Offline
                        m26872
                        Hardware Contributor
                        wrote on last edited by m26872
                        #11

                        @sonicblaze Well, of course you select battery and regulator with appropriate voltage levels.
                        Edit: Since the working current of HC-SR04 is only 15mA you should be able to use the APM 5V on board regulator. Supply by connecting e.g. a 9V battery directly to RAW input pin. And then supply SR04 from VCC. Supply the radio 3.3v-stepdown from battery or VCC.

                        1 Reply Last reply
                        0
                        • sonicblazeS Offline
                          sonicblazeS Offline
                          sonicblaze
                          wrote on last edited by sonicblaze
                          #12

                          @m26872 Good call on the 9v. It reminded me I had a couple 9V battery holders sitting around. I ran it into Raw/Ground as suggested, and the ping sensor is right on the target with distances now.

                          Someone more talented than me might be able to modify the NewPing code to listen only for echos without sending out triggers, and I'd be willing to test it with the StepUp module and see if it's hearing responses without sending out pings.

                          @hek it might be worth adding a note to the Distance sensor page about StepUp's possibly interfering.

                          1 Reply Last reply
                          0
                          • daulagariD Offline
                            daulagariD Offline
                            daulagari
                            Hero Member
                            wrote on last edited by
                            #13

                            The only thing I can guess is the Stepup module is emitting a frequency that the SR04 is picking up as the "echo" to the "ping" it sends out on trigger.

                            Can you post a photo of how your setup looks like?

                            If it is really interference shielding might help.

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


                            15

                            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