Issue with Using PMS7003 and ENVEA NO2 Sensor Together on ESP8266

Hello,
I’ve modified the sensor firmware to measure NO2 using ENVEA (Cairsens) sensors, but I also have a PMS7003 particle sensor. When I connect both sensors to my ESP8266 board, I cannot retrieve data from the PMS7003. When using only the PMS sensor, I get data without any issue, and the same goes for the NO2 sensor. However, I cannot get data from both sensors at the same time. It seems like the PMS readings are occurring too frequently. Could anyone help me with this issue?
Thanks in advance!

The NO2 sensor is not supported by our project at the moment. So you should be more specific in what you try to do or how you try to read the sensors.
The PMS7003 is read via UART, the NO2 sensor seems to use the same interface type. But 2 software serial interfaces may be too much for the ESP8266. We tried this with GPS sensors, this crashed the firmware after a short time in most cases.
And each of these UART interfaces needs 2 explicit pins. The sensors can’t be connected to the same pins like you can do with I2C devices.

I agree with @ricki-z.
You may use an ESP32 in order to use both UART at the same time or you should program yourself the memory usage on the uC. I have almost pulled all my hair as I tried to understand the semaphores etc. a few months ago. Default ESP32 memory usage can it out of the box. There is example of multiple sensors setups in the Aircarto project.

And which lib are you using for the ENVEA ? I am interested.
Or did you wrote yourself from the datasheet ?

Thanks for your answers
I know that the cairsens is not supported in the project, and thanks to @pjg in this topic I was able to modify the sensor firmware that works with my No2 sensor. Now when I add the PMS7003, I use the original pins (D1 and D2) and for my cairsens I use pins D5 and D6, impossible to have the PMS data but it does not crash my eps8266 and I recover that of my No2.
I have the impression that the PMS communication is too frequent, I can not manage its timing. I would like a little more explanation about the management of semaphores @pjg ?
Or some track to recover one measure then the other and so on?

https://docs.espressif.com/projects/esp8266-rtos-sdk/en/latest/get-started/index.html

It is the hell!

How comes the PMS communication is too frequent. It should be every 145s as well.
Can you publish the code ?

Hello,

Sorry for the late reply, here is my code :

https://github.com/T0abelc/Air

I tried many thing but can’t make them work together…

at first I would define only one serial interface for this sensor, not two. I think you are reading all over the same interface of the Envea sensor.
Then you need to define NO2_SERIAL_RX and NO2_SERIAL_TX in ext_def.h (look for PM_SERIAL as an example). Set them to the pins you want to use with your Envea sensor.

1 Like