# Issue with Using PMS7003 and ENVEA NO2 Sensor Together on ESP8266

**URL:** https://forum.sensor.community/t/issue-with-using-pms7003-and-envea-no2-sensor-together-on-esp8266/4287
**Category:** Uncategorized
**Created:** [January 22, 2025, 2:34pm UTC](https://forum.sensor.community/t/issue-with-using-pms7003-and-envea-no2-sensor-together-on-esp8266/4287 "2025-01-22T14:34:15Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![Bazinga](https://forum.sensor.community/letter_avatar_proxy/v4/letter/b/34f0e0/32.png) [@Bazinga](https://forum.sensor.community/u/Bazinga)
#### Post date: [January 22, 2025, 2:34pm UTC](https://forum.sensor.community/t/issue-with-using-pms7003-and-envea-no2-sensor-together-on-esp8266/4287/1 "2025-01-22T14:34:15Z")

</div>

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!

---

<div class="post-metadata">

### Author: ![ricki-z](https://forum.sensor.community/user_avatar/forum.sensor.community/ricki-z/32/215_2.png) [@ricki-z](https://forum.sensor.community/u/ricki-z)
#### Post date: [January 22, 2025, 9:30pm UTC](https://forum.sensor.community/t/issue-with-using-pms7003-and-envea-no2-sensor-together-on-esp8266/4287/2 "2025-01-22T21:30:17Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![pjg](https://forum.sensor.community/user_avatar/forum.sensor.community/pjg/32/194_2.png) [@pjg](https://forum.sensor.community/u/pjg)
#### Post date: [January 22, 2025, 9:36pm UTC](https://forum.sensor.community/t/issue-with-using-pms7003-and-envea-no2-sensor-together-on-esp8266/4287/3 "2025-01-22T21:36:15Z")

</div>

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.

> **[GitHub - aircarto/ModuleAir\_V2.1: Software for the esp32 running inside the air...](https://github.com/aircarto/ModuleAir_V2.1)**
>
> Software for the esp32 running inside the air quality sensor ModuleAir.

---

<div class="post-metadata">

### Author: ![pjg](https://forum.sensor.community/user_avatar/forum.sensor.community/pjg/32/194_2.png) [@pjg](https://forum.sensor.community/u/pjg)
#### Post date: [January 22, 2025, 9:42pm UTC](https://forum.sensor.community/t/issue-with-using-pms7003-and-envea-no2-sensor-together-on-esp8266/4287/4 "2025-01-22T21:42:17Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Bazinga](https://forum.sensor.community/letter_avatar_proxy/v4/letter/b/34f0e0/32.png) [@Bazinga](https://forum.sensor.community/u/Bazinga)
#### Post date: [January 23, 2025, 9:31am UTC](https://forum.sensor.community/t/issue-with-using-pms7003-and-envea-no2-sensor-together-on-esp8266/4287/5 "2025-01-23T09:31:12Z")

</div>

Thanks for your answers  
I know that the cairsens is not supported in the project, and thanks to @pjg in this [topic](https://forum.sensor.community/t/supported-no2-sensors/2648/12) 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?

---

<div class="post-metadata">

### Author: ![pjg](https://forum.sensor.community/user_avatar/forum.sensor.community/pjg/32/194_2.png) [@pjg](https://forum.sensor.community/u/pjg)
#### Post date: [January 23, 2025, 10:35am UTC](https://forum.sensor.community/t/issue-with-using-pms7003-and-envea-no2-sensor-together-on-esp8266/4287/6 "2025-01-23T10:35:23Z")

</div>

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

> **[RTOS Basics: Getting Started with Microcontrollers - Latest Open Tech From Seeed](https://www.seeedstudio.com/blog/2021/04/26/rtos-basics-getting-started-with-microcontrollers/?srsltid=AfmBOoo-YnKqt3u-i3qXZbClH6LtX0xC2RxOLSOiX4t4WywpSsx0o3Pr)**
>
> Are you new to RTOS development? Get started with RTOS basics and why they're an essential part of developing applications for your microcontrollers!

It is the hell!

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

---

<div class="post-metadata">

### Author: ![Bazinga](https://forum.sensor.community/letter_avatar_proxy/v4/letter/b/34f0e0/32.png) [@Bazinga](https://forum.sensor.community/u/Bazinga)
#### Post date: [January 30, 2025, 4:59pm UTC](https://forum.sensor.community/t/issue-with-using-pms7003-and-envea-no2-sensor-together-on-esp8266/4287/7 "2025-01-30T16:59:46Z")

</div>

Hello,

Sorry for the late reply, here is my code :

[https://github.com/T0abelc/Air](https://github.com/T0abelc/Air)

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

---

<div class="post-metadata">

### Author: ![ricki-z](https://forum.sensor.community/user_avatar/forum.sensor.community/ricki-z/32/215_2.png) [@ricki-z](https://forum.sensor.community/u/ricki-z)
#### Post date: [February 2, 2025, 6:23pm UTC](https://forum.sensor.community/t/issue-with-using-pms7003-and-envea-no2-sensor-together-on-esp8266/4287/8 "2025-02-02T18:23:26Z")

</div>

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.
