Pretty similar to what is described here I have the strange problem that my sensor readings are affected by the type of power supply I use.

Whenever I connect my D1 mini through USB with laptop everything works fine. The readings make sense and are quite accurate. But as soon as I disconnect it from the laptop and use a USB power supply (I tested different ones) the readings do not make sense anymore.

I also tried to apply the sketch to a NodeMCU board. The results are the same. So I assume it has something to do with either the sensor or the ESP 12E.

Any suggestions?

  • 1
    How are you powering the sensor?
    – Majenko
    Jul 20, 2020 at 7:39
  • The sensor is powered by the 3.3V output of the Wemos/NodeMCU Board. But I also tested it with the 5V output. Always with the same results.
    – Kai
    Jul 20, 2020 at 12:29
  • I'll bet your laptop's charger has 3 prongs that plug into the wall, but your USB power supplies only have 2 prongs. If so, try grounding to earth.
    – dandavis
    Jul 21, 2020 at 4:19
  • Easier said than done in this case :) But I'll try. Sounds like a good idea.
    – Kai
    Jul 21, 2020 at 6:41

1 Answer 1


Try a different supply or computer, it sounds like that one has a lot of ripple and or noise on it. Not all USB power supplies are clean and some do not have much filtering.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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