Hi Forum Members,
Everything is hooked up and running fine except one thing: the sensor data is all zeroes on my serial monitor. FWIW this is my first exposure to Arduino, and I'm trying to learn as I go.
At this point, it's all very basic. The Uno is hooked up to the sensor with just 4 wires, sensor to Arduino, 5v to 5V, ground to ground, tx to rx (pin 0), and rx to tx (pin 1).
I installed the Arduino IDE, added the PMS library, and uploaded the simplest possible code. Here is it:
#include "PMS.h"
PMS pms(Serial);
PMS::DATA data;
void setup()
{
Serial.begin(9600); // GPIO1, GPIO3 (TX/RX pin on ESP-12E Development Board)
//Serial1.begin(9600); // GPIO2 (D4 pin on ESP-12E Development Board)
}
void loop()
{
//if (pms.read(data)) {
Serial.print("ok");
Serial.println();
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();
}
The purpose of the commented if statement was to determine if Arduino was reading the data. It wasn't. The sketch outputs the lines but the readings are all zero, in other words no data, even with some smoke.
Now I'm reading that the problem may related to 5v vs 3.3v logic. Apparently, the sensor runs at 3.3.
Based on what I could find so far, I'm stuck with a few questions.
- Is that the most likely problem?
- Is the best solution a logic level converter?
- Did I probably damage my sensor?
Any help is greatly appreciated!
Vince
9 posts - 3 participants