0

Learn Project using PMSA003I Air Quality
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Learn Project using PMSA003I Air Quality

by robboz4 on Sun Feb 21, 2021 9:26 pm

I made the project according to the learn guide (https://learn.adafruit.com/air-quality- ... silo-house) that was posted. Currently I have it the unit indoors as I make sure it's functioning. However, after about 24 -36 hours it will stop loading to the dashboard. Here is the fault indication:

RGD Led flashes yellow
Blue
Yellow for 6 pulses
Blue for 6 pulses.

And repeats. Pressing the reset button on the feather fixes it or power cycling. Can some one help deduce this error condition and supply any fixes to keep it running 24x7? If I l have the unit outside I will be limited to power cycling as I don't want to be unscrewing the lid every time to reset the device.

Also how do you get the longitude and latitude values to be passed into the dashboard? The example code doesn't work and that line has to be removed to make the code run.
In a previous example using the same code the values are passed in as single quotes:

# Set up location metadata from secrets.py file
location_metadata = (secrets["latitude"], secrets["longitude"], secrets["elevation"]) <-- https://learn.adafruit.com/air-quality- ... silo-house
# from other article : location_metadata = (secrets['latitude'], secrets['longitude'], secrets['elevation']) <---https://learn.adafruit.com/diy-air-quality-monitor
# notice the single quote

I have had a chance to try that I was hoping someone could validate which is the correct syntax.

Apart fro the above two items the project was excellent and the device os reporting humid, temperature and air quality pretty consistently. It's interesting to watch the air quality go down as we cook dinner or burn log s in the fire place!

So any help with the above two items would be appreciated.
Attachments
Screen Shot 2021-02-21 at 5.25.31 PM.png
Screen Shot 2021-02-21 at 5.25.31 PM.png (58.83 KiB) Viewed 165 times

robboz4
 
Posts: 57
Joined: Tue Nov 20, 2012 7:01 pm

Re: Learn Project using PMSA003I Air Quality

by adafruit_support_carter on Mon Feb 22, 2021 8:01 pm

See if you can use this to help decode the RGB flash sequence:
https://learn.adafruit.com/welcome-to-c ... 2978455-20
But being able to attach to the serial output and see the full text of the error message would be much easier, if that is possible.

In Python, you can use either single or double quotes for strings. So those two examples are essentially equivalent.

adafruit_support_carter
 
Posts: 18893
Joined: Tue Nov 29, 2016 2:45 pm

Re: Learn Project using PMSA003I Air Quality

by robboz4 on Tue Feb 23, 2021 2:15 pm

HI!


I'll connect the device to a laptop running Mu to see if I can capture the serial console output on failure.

With regards to the code issue, there is usually a difference between the value in a single quote and a double quote variable. I'll change the quotes and test it again. But if the quotes don't matter then why does the line fail? Could it be how the values are stored in the secrets file. Here's my entries:

'latitude': 'REMOVED', # https://www.latlong.net/
'longitude': 'REMOVED',
'elevation': '192'
}

I'm not the only one to see this issue as that's how I discovered you had to comment the line out to make the project run. It was reported in another thread in the forum. I haven't found a solution posted for the issue.

Thanks
Last edited by adafruit_support_carter on Tue Feb 23, 2021 2:24 pm, edited 1 time in total.
Reason: removed lat/lon location

robboz4
 
Posts: 57
Joined: Tue Nov 20, 2012 7:01 pm

Re: Learn Project using PMSA003I Air Quality

by adafruit_support_carter on Tue Feb 23, 2021 2:26 pm

But if the quotes don't matter then why does the line fail?

What error are you getting here?

adafruit_support_carter
 
Posts: 18893
Joined: Tue Nov 29, 2016 2:45 pm

Re: Learn Project using PMSA003I Air Quality

by robboz4 on Tue Feb 23, 2021 2:43 pm

Heres the error:

AQI: 0
Category: Good
Sampling environmental sensor...
Temperature: 76.9 F
Humidity: 25.3 %
Publishing to Adafruit IO...
Traceback (most recent call last):
File "code.py", line 198, in <module>
File "code.py", line 189, in <module>
File "adafruit_io/adafruit_io.py", line 579, in send_data
File "adafruit_io/adafruit_io.py", line 496, in _create_data
TypeError: tuple indices must be integers, not str

and this thread is where I found the workaround:



IoT Air Quality Sensor with Adafruit IO Example Not working

by mdede on 24 Nov 2020 01:24

And line "189: io.send_data(feed_aqi["key"], str(aqi), location_metadata)" the "location_metadata" variable was causing my error. I removed it and everything works. Again I have no idea how the original project ever worked unless the wrong example code was uploaded.


Thanks

robboz4
 
Posts: 57
Joined: Tue Nov 20, 2012 7:01 pm

Re: Learn Project using PMSA003I Air Quality

by adafruit_support_carter on Tue Feb 23, 2021 3:02 pm

Thanks. That helps. It's not related to the single vs. double quotes. It looks like the IO library expects a dictionary to be used for the metadata and instead a tuple is being passed in.

Looks like maybe a bug in the code, so I'll pass this on.

adafruit_support_carter
 
Posts: 18893
Joined: Tue Nov 29, 2016 2:45 pm

Re: Learn Project using PMSA003I Air Quality

by robboz4 on Tue Feb 23, 2021 7:29 pm

OK thanks! Let me know what they find and if we have to load a new library.

I'll try to capture the output when it fails or hangs. Could take a few days.

robboz4
 
Posts: 57
Joined: Tue Nov 20, 2012 7:01 pm

Re: Learn Project using PMSA003I Air Quality

by robboz4 on Sun Feb 28, 2021 2:08 pm

I had the projected connected to a laptop to collect the serial console output. It seems that it gets stuck in the getting time loop.
After 1 hour this weekend it would try to get time after posting results. It would issue
"Time Fetched OK,"

but not give a number like normal... just repeats the message. Occasionally I did see a retry in getting time, but never one when it stuck in this loop. So I don't know whether this is the real issue or a new one this weekend. Looking at the code it seems to get the time from a library call over the network, so perhaps the time server was having issues this weekend.


Any news on the library fix for the longitude, latitude issue?


Cheers

robboz4
 
Posts: 57
Joined: Tue Nov 20, 2012 7:01 pm

Re: Learn Project using PMSA003I Air Quality

by adafruit_support_carter on Mon Mar 01, 2021 1:21 pm

Any news on the library fix for the longitude, latitude issue?


It's working it's way through:
https://github.com/adafruit/Adafruit_Ci ... IO/pull/64
I think the library maintainer was also going to respond here when things were done and done.

adafruit_support_carter
 
Posts: 18893
Joined: Tue Nov 29, 2016 2:45 pm

Re: Learn Project using PMSA003I Air Quality

by brubell on Mon Mar 01, 2021 1:37 pm

Hi, we've updated the Adafruit IO CircuitPython library and the library's code.

Please download the latest version of the Adafruit IO CircuitPython library:
https://github.com/adafruit/Adafruit_Ci ... O/releases


Then, replace the code.py on your CIRCUITPY drive with the updated code:
https://github.com/adafruit/Adafruit_Le ... ty/code.py

Let me know if this works for you!

brubell
 
Posts: 1256
Joined: Fri Jul 17, 2015 10:33 pm

Re: Learn Project using PMSA003I Air Quality

by robboz4 on Tue Mar 02, 2021 1:27 am

Sorry nothing seems to work now. There is a LED is solid green. No output on the serial port except:
code.py output

If i Use ctrl-C I get this:

Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.
code.py output:
Traceback (most recent call last):
File "code.py", line 36, in <module>
File "adafruit_esp32spi/adafruit_esp32spi.py", line 159, in __init__
File "adafruit_esp32spi/adafruit_esp32spi.py", line 174, in reset
KeyboardInterrupt:


I also had to comment out this line as per the serial aport:

Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.
code.py output:
Traceback (most recent call last):
File "code.py", line 13, in <module>
ImportError: no module named 'adafruit_bme280'

I added a simple print ("starting...") on line 155 and that did not print on the serial port...

I did get this on the serial port:

Failed to connect, retrying
('No such ssid', b'Club-Robbo')
soft reboot

But that is the ssid of my network and is in the secrets file and has't changed. And the password is the correct in the secrets file.

Everything else only network seems to be OK.

robboz4
 
Posts: 57
Joined: Tue Nov 20, 2012 7:01 pm

Re: Learn Project using PMSA003I Air Quality

by adafruit_support_carter on Tue Mar 02, 2021 11:20 am

This:
Code: Select all | TOGGLE FULL SIZE
Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.
code.py output:
Traceback (most recent call last):
File "code.py", line 13, in <module>
ImportError: no module named 'adafruit_bme280'

would mean you don't have a copy of the BME280 library in your CIRCUITPY/lib folder.

But you are showing multiple error messages.

This:
Failed to connect, retrying
('No such ssid', b'Club-Robbo')
soft reboot

means it can't find your network SSID.

If you back up and try a simple Internet connect test:
https://learn.adafruit.com/air-quality- ... et-connect
does that at least work?

adafruit_support_carter
 
Posts: 18893
Joined: Tue Nov 29, 2016 2:45 pm

Re: Learn Project using PMSA003I Air Quality

by robboz4 on Tue Mar 02, 2021 5:12 pm

I loaded the wi-fi test code back in and it does find the wifi and report it must be working. However, the console output only shows up if I close the serial console (in Mu editor) and reopen it... It used to stream with out those steps. I waited over 3 minutes from the "ESP32 SPI webclient test" message before doin gate open/close steps. This seems a bit strange.

I'm using Mu 1.0.0 on an iMac (sw 10.13.6)

Device info from Mu:

2021-03-02 13:08:50,974 - mu.modes.base:217(find_device) INFO: Found device on port: cu.usbmodemFD131
2021-03-02 13:08:50,974 - mu.modes.base:218(find_device) INFO: Serial number: DED86E895364933502020233241310FF

It looks like the serial output is waiting for a handshake or is hanging on a library call. It didn't used to do this the I first built the device. Could there be some lower level code on the feather that has got corrupted?

robboz4
 
Posts: 57
Joined: Tue Nov 20, 2012 7:01 pm

Re: Learn Project using PMSA003I Air Quality

by adafruit_support_carter on Tue Mar 02, 2021 8:21 pm

Not really sure what could cause that. So also maybe back up to some very simple print("hello") code tests to sanity check the basic Mu setup, serial window output, etc.

adafruit_support_carter
 
Posts: 18893
Joined: Tue Nov 29, 2016 2:45 pm

Re: Learn Project using PMSA003I Air Quality

by robboz4 on Wed Mar 03, 2021 3:15 pm

Sorry for the delay.

1) The serial port hiccup seems to be intermittent and is probably a MAC thing. It's now working fine on wifi test and main code. I can get wifi test to hang up if I have the circuitpy icon open on the desktop. Not everytime!

2) New library and code loaded and running. But the dashboard is not updating the map widget with my values. It's still defaulting to New York area. Temperature and humidity are updating and I assume air quality will start as well.

In summary no crash with the new code, but no map widget update.


Thanks

robboz4
 
Posts: 57
Joined: Tue Nov 20, 2012 7:01 pm

Please be positive and constructive with your questions and comments.