Creating a pressure logger (ESP8266 NodeMCU + MicroPressure Sensor SEN-16476), I noticed serious reading interference when the MCU was running with WiFi enabled. You could see pressure spikes:
However, testing the system with WiFi off, everything is OK - just flat, a bit noisy baseline.
Forgot to mention, the plot is based on data collected directly through serial port, not via wifi. Horizonal scale: 10 div = 1s. I tested different sensor reading frequencies from 0.1Hz to 10 Hz and when WiFi is active - the problem remains the same.
Assuming you are powering the sensor from the ESP's 3.3v out, try adding a 100uF or so capacitor across the power input to the ESP and see if that helps.
Also, one way to deal with the occasional aberration is to use use a median filter (returns the median value of some number of samples...three or five or seven...).
Or try "exponential" smoothing:
smooth = A*smooth + (1-A)*reading, where A is between 0 and 1. The closer A is to 1, the stronger the smoothing effect.
Looks like you are getting spikes on Vcc, due to an inadequate power supply (sagging during WiFi current draw peaks), which are getting through to the pressure sensor.
The solution is either an adequate power supply, or add a decoupling filter on the sensor power.
Thanks @DaveEvans and @jremington. Both adding of a capacitor or using software filtering/smoothing have not solved my problem. Finally I decided to replace the ESP8266 board with an ESP32 one. It works like a charm.