Electronic – arduino – Sensor reading is chaotic when Arduino is powered by laptop unplugged

arduinogroundpower supplyproximity-sensorusb

I have a Sharp proximity sensor connected to my Arduino (analog input). This Arduino is connected and powered through USB by a laptop.

  • When the laptop is plugged in, everything works fine (I get
    consistent readings).

  • When the laptop is running on batteries, the values I'm reading are
    "chaotics". I mean that they vary a lot.

I also have an Arduino motor shield, which is powered by an external battery, but that's just for the motors (sensors are powered by the Arduino). The GND of the battery and of the Arduino are connected though, maybe that's causing the problem?

Or is too much power required from the USB?

Well, do you have any idea to understand that and fix it?

Additional informations:

  • Sensors reading are "smoothened" using a low pass filter (see my previous question about it).
  • (if you need some more information, that will show up here)

Best Answer

Based on the report that it works when the circuit is powered by its own battery, it really sounds like the laptop's USB VBUS supply is noisy when operating off batteries.

Maybe the VBUS comes from a badly implemented switching regulator or DC/DC converter or one with some failed components in it, that is under more stress when operating off batteries than when off the likely higher charger voltage.

It should be possible to filter this supply using both a series inductor and a cap - this will be more effective than a capacitor alone. You can even do multiple stages of such filters.

But it may be easier to just use a battery if that works for you.