Voting resources, early voting, and poll worker information - VOTE. ... Adafruit is open and shipping.
0

PM25_Test.ino "Could not Read from AQI"
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

PM25_Test.ino "Could not Read from AQI"

by jhefler on Sat Aug 29, 2020 5:10 pm

I am using the PM25_Test.ino sketch from the Adafruit_PM25AQI.h library example folder modified only as shown in the use notes to use the Software Serial port on pins 2,3. The AQI is connected to an Arduino Uno connected exactly as shown in the sketch (PS - I did connect AQI Vcc to Arduino +5V!).

Upon upload, the console output shows the AQI sensor starting up ("PM25 Found!") and will display a few AQI readings, then starts displaying a bunch of "Could not Read from AQI" messages. After a random number of these messages, it displays a few AQI readings, then goes back to "Could not read..." and the behavior repeats.
If I reset the Arduino, the behavior repeats, with different numbers of AQI readings and "Could not Find" messages. It seems to restart more or less immediately, but eventually fails to read.

I tried different time delays with no change in behavior so I backed out those changes. I also tried different Software Serial port pins (4, 5), so I don't think the Arduino is failing.

I measured +4.87 volts at the AQI Vcc pin. Is the AQI fussy about Vcc?
Could there be a voltage level mismatch between the Arduino and the AQI signal levels?
Does the Software Serial Rx pin need a pullup?

Do you have any trouble shooting suggestions or is it possible I have a lazy AQI?

Thanks

jhefler
 
Posts: 8
Joined: Tue Aug 25, 2020 11:29 am

Re: PM25_Test.ino "Could not Read from AQI"

by mganucheau on Sun Sep 13, 2020 2:56 pm

I'm also having this problem with my PM25AQI.
Does anyone have advice on how to debug?

mganucheau
 
Posts: 2
Joined: Thu Oct 22, 2009 3:17 am

Re: PM25_Test.ino "Could not Read from AQI"

by jhefler on Mon Sep 14, 2020 11:56 am

What sort of trouble are you having?
Are you using PM25_test .ino from the Adafruit_PM25AQI.h library example folder?
Have you modified the code other than to match your interface (i.e., I2C, hardware serial, or software serial?

Assuming
you are having the same "Could not read from AQI" issue I described

jhefler
 
Posts: 8
Joined: Tue Aug 25, 2020 11:29 am

Re: PM25_Test.ino "Could not Read from AQI"

by jhefler on Mon Sep 14, 2020 11:56 am

Are you using PM25_test .ino from the Adafruit_PM25AQI.h library example folder?
Have you modified the code other than to match your interface (i.e., I2C, hardware serial, or software serial?

Assuming
1. You are having the same "Could not read from AQI" issue I described in my post
2. You are using the software serial interface and have modified the code only as described in the notes for that interface

Try changing delay(1000) in line 72 from 1000 to 500.

There appears to be a timing issue between the aqi.read(&data) processing and the display processing in the void loop(). The aqi.read(&data) reads data until it detects the first character in its buffer is the start byte 0x42. If the first buffer character is not 0x42, it returns "false". This causes the "Could not read from AQI" message to be displayed.
Most of the time, this isn't an error. It just means aqi.read(&data) didn't find what it was looking for.

If the display processing loop waits too long between read requests (i.e., delay(1000)), it appears to cause aqi.read(&data) to generate checksum errors rather than simply not finding the start byte. It may y take a randomly long time to get a successful read, as I observed in my post. This may be a problem only with software serial, not I2C or hardware serial AQI sensors; I don't know, my Arduino UNO has to use software serial. I changed delay(1000) at line 72 to delay(500) and it works.

The "could not read" and "successful read" messages are confusing because they are part of normal processing and are not errors once the timing conflict is resolved. A successful read is obvious because AQI data is displayed as soon as valid date is received.

I would appreciate feedback from adafruit regarding my observations.

Credit:
https://how2electronics.com/interfacing ... r-arduino/

jhefler
 
Posts: 8
Joined: Tue Aug 25, 2020 11:29 am

Re: PM25_Test.ino "Could not Read from AQI"

by mganucheau on Mon Sep 14, 2020 8:58 pm

I ended up putting tasmota on my arduino. It was very easy to get things setup.

Thanks!

mganucheau
 
Posts: 2
Joined: Thu Oct 22, 2009 3:17 am

Please be positive and constructive with your questions and comments.