Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't get it to display pm values on esp32 #24

Open
BasvdVelde opened this issue Nov 9, 2020 · 3 comments
Open

Can't get it to display pm values on esp32 #24

BasvdVelde opened this issue Nov 9, 2020 · 3 comments

Comments

@BasvdVelde
Copy link

Hi,

I hope this is still active, as I would really like to use your code for my PMS5003 on the ESP32 WROOM. When uploading the basic code (after downloading the library) to my esp32 it displays thefollowing:

⸮!⸮H⸮�>⸮\x⸮K⸮$�⸮

At first I thought it had something to do with the baud rate, but this is set to 9600.

Do you have a clue what might be the issue here?

Thanks,

Bas

@mienho
Copy link

mienho commented Dec 31, 2020

Hello,
I have the similar problem with my PMS7003 on ESP8266. Only display this values all the time:
obraz

@novumsoft-projects
Copy link

This is common issue of hardware problem in hardware tty

@cydavidh
Copy link

cydavidh commented Feb 20, 2022

Don't use the RX/TX pins (pin 0 and 1 on arduino). This serial port is used for communication between your arduino/esp and computer.
Instead, use the built-in SoftwareSerial library to open another one, like this:

#include <SoftwareSerial.h>

#include "PMS.h"

SoftwareSerial pmsSerial(D8, D7);  
//SoftwareSerial(rxPin, txPin), I used D8 for RX and D7 for TX (esp8266) and connected TX on PMS5003 to D8

PMS pms(pmsSerial);
PMS::DATA data;

void setup()
{
  Serial.begin(9600);   
  pmsSerial.begin(9600);  
}

void loop()
{
  if (pms.read(data))
  {
    Serial.print("PM 1.0 (ug/m3): ");
    Serial.println(data.PM_AE_UG_1_0);

    Serial.print("PM 2.5 (ug/m3): ");
    Serial.println(data.PM_AE_UG_2_5);

    Serial.print("PM 10.0 (ug/m3): ");
    Serial.println(data.PM_AE_UG_10_0);

    Serial.println();
  }

  // Do other stuff...
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants