1

my Problem is, that I get random values from my ultra sonic sensor if my arduino is connected to any external power supply (vin port 30) on my arduino nano.

If I power up from the laptop usb port, I get consistent values.

I have tested 3 different power supplies between 7-17V and up to 2000mA. I have tested this on 2 different nano boards. Also tested with an extra 2000uF capacitor between vin and gnd

pls help if you got an idea :)

  • What voltage are you reading on a +5 pin? (Ie "pin 27" in your 30-pin numbering scheme, or pin 6 on the ICSP header.) Also, what model of ultrasonic sensor do you have, and which sketch is running? And do some other sketches seem to work ok with external power? – James Waldby - jwpat7 Nov 1 '15 at 23:43
  • I got the HC-SR04 Ultrasonic Sensor and the basic demo code. I found the solution see below. Thanks for your comment anyway :) – Cracker0dks Nov 1 '15 at 23:59
3

So i tried to used a stable 5V input on the 5V input pin and got the same more or less random values (jumping all around... especially on targets more than 1m away)

So I changed form newPing lib (http://forum.arduino.cc/index.php?topic=37712.0) to Ultrasonic lib (http://forum.arduino.cc/index.php?topic=37712.0).

Now the values are correct on each power supply and even more accurate on high distance than with newPing on USB power supply.

Don't know whats broken with the newPing v1.7 lib -.- but this works!

0

Glad the library helped.

I think perhaps the problem had to do with reference voltages.

If you are using two supplies, you need to make sure they are grounded together very well.

One library could stand the different voltages and the other couldn't.

But the key to using two power supplies for anything is to make sure they are grounded together.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.