I have a sensor connected to a Raspberry Pi 3 and I see some variations of the signals which is not expected. These variations seems to be due to the supply voltage 5 V from the Raspberry Pi.

The 5 V signal has both high frequency oscillations (between about 4.9 - 5 V), and a long term drift (over hours I see it slowly dropping). Does anyone have any idea about what is causing it and how to solve it?

The sensor has two voltage outputs connected to a ADC. The ADC is connected to the 5 V PWR, to ground and to SCL/SDA of Raspberry Pi

  • 1
    What is the specification of your power supply?
    – CoderMike
    Aug 7, 2018 at 7:08

1 Answer 1


The subject of ADC error is both wide and deep. Engineers have built careers on studying, quantifying, measuring and resolving ADC error. If you "Google" terms such as adc error analysis, or adc error correction, you'll find enough highly technical and/or scholarly information to keep you occupied for quite some time - for example. But the bottom line is that power supplies can make a huge difference in ADC performance.

The description you gave of your PS sounds like a recipe for poor measurements. All switching power supplies will produce some noise, and HF oscillations "come with the territory" as the laws of physics dictate that the "off-then-on" nature of the supply will propagate to the output as oscillations. These oscillations are not necessarily problematic as long as they are not "too large"; "too large" being relative to the accuracy required. What is "too large" for your case may be determined by reading the data sheet for the ADC chip you're using; you should refer to that for your power supply specifications. One potential cure for taming the oscillations is a high quality, low ESR capacitor (tantalum, for example) that is placed as close as possible to your ADC circuitry.

Your comment about long-term drift ("over hours I see it slowly dropping") is what seems to be the strongest indicator that you have a sub-standard power supply. Again, some drift is normal and expected, but I get the idea that yours may be greater than that. I know of no easy way to correct drift in a power supply - except to replace it!

If your supply is one that you bought for your RPi, there is a decent chance it's not very good quality. And as mentioned, the only real solution here is to buy a better quality supply. For this, you may have to venture outside the "Raspberry Pi marketplace".

Hope this helps. Don't hesitate to ask additional questions, or post a Comment if something is unclear. Also, you may wish to consider adding a schematic to your question if you need more specific answers.

  • Thank you. Yes, as you said it is a "poor" setup. I have been generic in the description on purpose. I can say you were right, the problem is the power supplied by r.pi that is not constant. I also notices a drop of voltage when opening an excel sheet. Problem solved with an external power supply.
    – Giovanni
    Aug 8, 2018 at 8:23
  • Very good, I think you're on the right track. Oh - one other thing: If you've not done so, please read the site tour.
    – Seamus
    Aug 8, 2018 at 13:55

Your Answer

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

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