Last week, our main goal was to actually get the Purple Air and Raspberry Pi on the same network, and communicating with each other so we could get the sensor data in real-time. After a lot of work, we were able to connect the two, but we are still stuck on obtaining meaningful data from our sensors.
Both the Purple Air and the Raspberry Pi have the ability to broadcast their own networks for any device to connect to. Based on the guides we were reading, we needed to connect the Purple Air onto the Raspberry Pi’s wifi network. However, we were stuck on this for half a week trying to get the two to talk this way. We spent half a week alone on setting up the ad-hoc wifi network capabilities of the Raspberry Pi, while simultaneously connecting to the internet via ethernet.
Frustrated, we reached out to the author of a online project on Github, who had worked with the Purple Air before, and an affiliate of the University of Michigan. He told us that we needed to work the other way around, and connect the Pi to the Purple Air instead. Once we followed the steps he outlined for us, we were able to connect the two devices together fairly quickly.
However, as we learned, the Purple Air reads data every second, but only outputs its data every 80 seconds in an aggregated manner. This is far too slow for our application, as bikes can generally get very far in 80 seconds. We know technically, the underlying sensor, the PMS5003 Laser Particle Counter, is able to output data every second, and currently we are just working on actually obtaining this data.
To solve this, we are trying two different approaches. The first is to directly modify the firmware that the Purple Air runs on, which is what Nic is currently working on. The second approach is to bypass the Purple Air completely, and attempt to talk to the underlying sensor, the PMS5003, which is what I am working on. Both Nic and I have been making progress and facing challenges while trying to obtain the mystical 1-second data output.
The PMS5003 uses a wifi chip called the ESP8266, which runs Arduino code to connect the sensor to the broadcasting capability of the Purple Air. Because I don’t have any Ardunio experience specifically, I was playing around with the Ardunio IDE and trying things to immerse myself in this new technology. I tried uploading a simple script to one of our two Purple Airs, and it overwrote everything on the Purple Air, meaning that all the functionality was lost.
Fortunately, we were able to get in contact with the support team of the Purple Air, and they gave us a binary file containing the firmware for the Purple Air. From this, we can re-flash the Purple Air to get going again. Nic has been working on modifying this file we were given, and change the format of the output, so when we re-flash the sensor, it no longer aggregates the data. In the meantime, I found a very relevant project on Github designed for the PMS5003, and I am working on getting that setup.
Tonight, we visited Civic Hack Night, run by the awesome Code for Atlanta organization, and they graciously allowed us to present our projects to the greater community! We were able to connect with some very talented members of the tech community in Atlanta, and work together to solve the issues our project has been facing recently. Code for Atlanta runs Civic Hack nights twice a month, and you should definitely check them out if you are in the area.