Hello!
I am a student using Arduino for the first time, so I am not very good with it. Apologies for the stupid questions in advance
I have been trying to use the Honeywell IH-PMC-002 particle sensor to analyze smoke machine/hazer smoke particles with Arduino for a school project. However, for some reason i am not receiving any output from the RX/TX ports. The sensor uses UART, but it is also possible to use L2C.
Here is the data sheet for the sensor
Honeywell IH-PMC-002 sensor data sheet
I have tried many variations of the code, but here is one of them:
#include <SoftwareSerial.h>
SoftwareSerial mySerial(10, 11); // RX, TX
const int sensorProtocolPin = 3; // Control pin for selecting UART mode, connect to digital pin 2
void setup() {
Serial.begin(1200);
mySerial.begin(1200); // Software Serial for sensor communication, set to 1200 baud
pinMode(sensorProtocolPin, OUTPUT);
// Set pin 2 (sensorProtocolPin) to HIGH for UART protocol
digitalWrite(sensorProtocolPin, HIGH);
// Initialize the sensor
delay(1000); // Allow time for the sensor to start
}
void loop() {
// Start measurement
sendCommand(0x11);
// Wait for the sensor to complete the measurement
delay(5000); // Adjust this delay based on your sensor's documentation
// Stop measurement
sendCommand(0x10);
delay(5000);
// Request PM2.5 measurement
sendCommand(0x00);
// Wait for the sensor to respond
delay(1000);
// Read and print the response
while (Serial.available() > 0) {
int pm25 = mySerial.read(); // Read the PM2.5 measurement
Serial.print("PM2.5 Measurement: ");
Serial.println(pm25);
}
// Wait before making the next request
delay(5000);
}
void sendCommand(byte command) {
mySerial.write(command);
}
When I run the code with the sensor connected, there is no output at all. Is there something stupid in the code that could be messing up the output?
I also tried to use the PWM output pin to analyse the data, but I didn't really understand how it works. With the PulseIn command I got some output, but it made no sense at all.
Here is the code I tried to use to get the PWM values:
#define pwmpin 1
int pwmvalue;
void setup () {
Serial.begin(1200);
pinMode(pwmpin, INPUT);
}
void loop(){
pwmvalue = pulseIn (pwmpin, HIGH);
Serial.println (pwmvalue);
}
I would really appreciate any help regarding the situation, as I am kinda lost with this myself.