Battery Powered Distance Sensor reports incorrect



  • 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.


  • Contest Winner

    @sonicblaze

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



  • @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.


  • Contest Winner

    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...



  • 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.



  • 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.


  • Hardware Contributor

    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?



  • 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.


  • Hardware Contributor

    @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?



  • @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.


  • Hardware Contributor

    @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.



  • @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.


  • Hero Member

    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.


Log in to reply
 

Suggested Topics

  • 3
  • 2
  • 3
  • 2
  • 15
  • 2

0
Online

11.2k
Users

11.1k
Topics

112.5k
Posts