I have no idea where to connect the A and B Pins on the MP503 sensor. Can someone please help me with this. Also I'm using an arduino nano 33 iot board.
Datasheet: https://robu.in/wp-content/uploads/2021/03/Winsen-Air-Quality-Detection-Module.pdf
The outputs are slow PWM (period 1 second) that you can read with pulseIn()
Note the 5 minute warm-up time - I presume readings taken before 5 mins are spurious or at least less accurate than after 5 mins. I think you are meant to read pin A, as B is reserved for factory (perhaps its the uncalibrated output used at the factory to program calibration?)
Thank you for the reply. Yes, according to the Datasheet it does seem that the B port is not meant to be connected. I just tried the PulseIn approach you suggested, but I didn't receive any changes in the output it just keeps on printing zeros.
This the code I used in ArduinoIDE:
int Pin = 3; //D3 pin
unsigned long pulseWidth;
void setup() {
Serial.begin(9600);
pinMode(Pin, INPUT);
}
void loop() {
pulseWidth = pulseIn(Pin, HIGH);
Serial.print("O/P: ");
Serial.println(pulseWidth);
delay(1000);
}
But I just tried testing it with A0 pin without using pulseIn and was able to obtain somewhat of an output i believe.
The code I used for that is:
const int sensorPin = A0;
void setup() {
Serial.begin(9600);
}
void loop() {
int sensorValue = analogRead(sensorPin);
Serial.print("Sensor Value: ");
Serial.println(sensorValue);
delay(1000);
}
Output I got with this code:
Sensor Value: 8
Sensor Value: 9
Sensor Value: 10
Sensor Value: 8
Sensor Value: 6
Sensor Value: 15
Sensor Value: 9
Sensor Value: 9
Sensor Value: 1023
Sensor Value: 1023
Sensor Value: 1023
It just jumps to 1023 whenever any kind of VOC is detected no matter what amount. Is this how it is supposed to work.
Thank you for the reply. I did try that, But the outputs received made no sense whatsoever.
The MP503 is a resistive sensor, its value changes depending on the gases (and quantities thereof) detected (see datasheet).
The ZP07-MP503 module adds a comparator that switches outputs A and B based on 4 preset thresholds.
Pollution class A output B output Air quality
-------------------------------------------------------------
0 LOW LOW Clear
1 LOW HIGH Slight pollution
2 HIGH LOW Middle pollution
3 HIGH HIGH Heavy pollution
Then you must read it with 2 digital inputs.
Remember that you must let the sensor preheat for at least 3 minutes (from power on) before taking readings.
MP503 datasheet (478,1 KB)
ZP07-MP503 User's manual (226,9 KB)
Thank you, I'll try this out. I saw this datasheet but the one from the site from where I ordered the sensor had a different datasheet so I thought that the sensors might be different.
I just tried it out and It does work. Thank you very much for the help, really appreciate you spending your valuable time. Hope you have a great day
Sorry, I hadn't seen the data sheet attached in #1.
Hi,
I see that you were able to make it work ! Which parts of your code have you modified to the read on the channel B ? Would you matter to share your code ?
Thanks !
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.