ESP32 sensors interfering

Hey all,

I decided to configre an ESP32 as an air quality monitoring device.
So i hooked up an SDS011 particulate sensor (every 5 minutes) and a senseair S8 (LP) CO2 sensor (every minute) over UART. Both sensors show up and report data. All seems well. Then when i wanted to do a manual calibration of the senseair S8 i noticed that the data looks strange. There seems to be a spike in CO2 levels spot-on every 5 minutes.
This seemed too artifical to be true. And then i realized the SDS011 measures every 5 minutes. I disconnected the air-refreshment fan of the SDS011 (Which spins up for every measurement), and low and behold the 5 minute spike is gone.

It is clear that the activation of the fan of the particulate sensor is causing abberant readings from the CO2 sensor.

At first i was running the ESP32 from a Li-ion USB powerbank. So i figured perhaps the power draw of the ESP + the two sensors may cause a voltage drop or EMF or something, throwing the CO2 sensor readings off. So i proceeded to put a fat electrolytic capacitor (2200uF) between 5V and ground. Unfortunately, this didnt seem to help.

Does anybody have any other suggestions to avoid this issue?

Kind regards,
Nevermore

The 5 minute spike is clearly visible in the red squared area.

For good measure i unplugged the sensor fan again from the blue mark. (Not the whole sensor)
There still seems to be some “instability”. But not nearly as noticeable as with the fan plugged in.

Is your project in a box of some description?

I am curious if this “instability” is electrical or airflow related.

I have a SenseairS8 in the same box as a PMSA003i which has a fan that runs all the time. No spikes here. But it stands to reason that the fan could indeed cause EMI just as much as it could re-circulate the air so you are not reading the same stale air without the fan.

The ESP32 is on a breadboard with the sensors connected using dupont wires in the open (Both outdoors while equilibrating or indoors). So if there is any airflow around the sensor causing interference it should be much more random.

I wanted to build it in a single case, but to be sure i wanted to know that everything was working. For example, i discovered i cant get the SDS011 UART interface to work on GPIO 1+3. But using UART on another set of pins (18+19) that is logically mapped to the UART bus works fine.

Perhaps if i make the SDS011 fan run continuously (By setting a measure interval below 1 minute) i wouldnt see these “spikes” in the CO2 readings. But then it will make a small amount of noise and wear out the sensor faster. So i’d like to avoid this option if possible.

Edit:
I kept the fan disconnected and powered the project though a USB charger (2A 5V), then at some point i switched over to the power bank (5V, at least 1A) and moved the project about a little (the red line), and later i switched back to the USB charger (blue line).

It appears that disturbing the project caused a pretty big offset (red line) while the data still presents the earlier described “instability”, indicating that the fan aggravates the issue, but is not the sole cause. After later switching back to the USB power supply the offset remained (showing that the data offset is not a cause of the battery). Moreover, the “instability” is significantly reduced.

Another thing that this dataset shows is that the intensity of the instability varies over time (Between the red and blue line).

So, overall i am at a loss as to what may be causing this effect.
I wouldn’t expect power draw to be an issue (unless perhaps the breadboard and/or dupont wires are of very poor quality? Causing a poor connection and perhaps choking the CO2 sensor?). Both sensors are directly connected to the 5V rail and thus no extra voltage regulator is involved. (TTL = 3.3V)
I think the UART protocol is a digital bit stream, and with short lengths of wire i wouldnt expect it to be very sensitive to RF interference. And i wouldnt expect poor connections altering reading values, id rather expect it to output complete garbage in that case.

This being the case then airflow is ruled out.

My own experience when I accidentally powered my SenseairS8 on 3.3V and the readings were sky-high gives credence to the theory that voltage drop being the prime suspect. The fact that the large cap didn’t improve this is odd.

I suppose that brings us to the following ideas to confirm the voltage drop theory;

  • try a different power supply with both sensors attached
  • try a second power supply with different sensors on different PSU’s using a shared ground
  • try a different ESP

I tried two more things, disconnected the particulate sensor alltogether, no issues at all. Tried again with the cap again, seemed to help this time somehow. Then i removed it, problem came back, added cap back, problem remained for some reason.

Decided to only connect VCC and GND of the particulate sensor (not TX and RX) and the problem was still there. I commented out the code of the particulate sensor (Including delcaring the UART interface for it) and the problem is still there.

This reinforces the idea that this is caused by a voltage drop and will proceed to test with yet another 5V supply.

Hello,
that will not fix your problem, but you could choose readout measurement intervals for both sensors that are prime numbers. For example: 107 and 179s. Of course, the duration of the measurements would also have an effect, but you get the idea. This way, the number of events when both sensors are on simultaneously may be reduced.

Mario.

I did consider this. But to me it seems more like a dirty workaround rather than to actually fix the underlying problem (which you also mentioned).

I also tested other 5V supplies now, but no difference.

However, since the capacitor experiments weren’t completely reproducible, i am thinking it might just be bad wiring. Perhaps soldering with proper wires instead of using a breadboard might fix the issues?

Moreover, its not actually only interfering during the instant of measurement, but during a certain period (I noticed that when i decreased the measuring interval of the CO2 sensor). So it overestimates CO2 concentrations for a while, not only the single measurement at the same time as the particulate sensor. And once it starts it takes a little while to recover back to baseline (correct) CO2 measurements.

So the proposed workaround would likely be relatively ineffective.

Have you ever found a solution.

Looks like I am suffering the same issue and it looks more and more like power supply is the issue. The S8 seems to need a very stable power supply. But why doesn’t the vendor make any node to that and how does everybody else have such perfect power supplies?

See my case: High periodic spikes from Senseair S8 CO2 sensor (and lower from one MHZ-19)