Week 8: Conclusion

I’m glad to say that at the end of the Digital Technology Summer Fellowship I’ve achieved what I had initially set out to do and more. At the start of the program, I wasn’t too sure about how I was going to approach my project at all since I had never built any kind of device before and had very little knowledge about hardware. All I knew was that I wanted to make an air quality sensor and have the information display on an LCD, I had no idea how to do any of that though. Thankfully as the weeks went on, I was able to build up my knowledge on building my air quality sensor with the help of Eric, Josh, and the internet.

Each week provided me with a new challenge; whether it be learning the Arduino, creating a case, configuring the sensors, attempting to connect to WiFi, etc. The work never became too hectic for me though because there was always enough time to figure out the kinks and try different solutions. Also, I think I’ve really upped my google searching skills due to this experience since I was scouring the internet anytime I reached an obstacle in my project.

The early weeks of the project were very smooth for me because I just had to build off the previous thing I’d learned. For example, I first learned the basics of the Arduino, then I learned how to program each sensor onto it, and then I learned how to program the LCD onto it. I only hit real obstacles once I tried to add WiFi to my device. Things became more stressful because I had to keep switching boards which left everything up in the air. I’m glad I was able to get everything working at the end with the nano. Building the cases and using the printers was also a bit tricky because I’d never designed something that would become a real object before but I really enjoyed the process.

Practicing our presentations every week was also a really good aspect of our 8 weeks. It gave us a chance to understand our own projects better and to build our public speaking skills. Our final presentations went over very smoothly thanks to all of the practicing we did. I enjoyed sharing my project with everyone who came to the talk. Overall, DTSF has been a great learning experience for me and I’ve had a lot of fun. Thanks Eric and Josh!

Week 7: Putting it all together

I started the week by establishing a WiFi connection between the nano and the Arduino cloud platform. Using the cloud I can add all my code to the online editor, enter the WiFi information and I will be able to display all of the readings from the sensors online. I had a lot of issues establishing the WiFi connection because the create agent application has to be active for a connection to be established. Last week I was having issues with the data that the CO2 and VOC sensor was giving, I was able to fix this by editing the code a little.

Three of the sensors added to the dashboard.

Then I got the dust sensor to work properly after adding the resistors that shift its voltage. After that I focused on slowly integrating each sensor into the online code. Each time I added a sensor I had to re-establish the WiFi connection. The whole process took some time but I was able to get all of the sensors to send data to the dashboard. I added extra widgets to the dashboard so that the sensor data looked neat and readable.

Editing the dashboard.

After I had everything running properly, I focused on making the final case print for my device. I took new measurements and created something new from scratch. I then sent it to the printer, chose new filaments, and made sure that the prints were coming out properly. When I got the prints back I realized that the LCD did not fit perfectly into the area that was designed for it so I adjusted the design and sent it to the printer. 

LCD doesn’t fit properly on the case.

Once the new print for the top of the case was ready I secured the LCD onto it using a drill. Then I connected the device back on to WiFi to make sure it was all still working properly. Sometimes the wires get shifted which can cause a lot of problems. It wasn’t connecting to the cloud so I had to remove everything from the nano, delete the device from the cloud, re-upload it, and then reconnect all of the wires, then it was working properly again.

Final case.
Final dashboard.

Week 6: Some Big Challenges

On Tuesday, I started my day by creating a backup case design that would fit the arduino mega. Just in case I could not get the sensors to read properly from the nano, I’d have a case that fits the mega. I sent that to the printer and it began printing. Then I got a new temp/humidity sensor. I programmed all of the sensors and the lcd to the mega to see if they all still work properly and they all did except for the ozone sensor which was broken. Then I went to check up on my prints and noticed that they were not coming out right. One of the filament rolls had a knot in it which was preventing the printing and the other printer was not leveled so it was also malfunctioning. After some help from Josh, the printers were functioning again. Then I hooked up some mq sensors to the nano to see what the analog read functions would show for them. I also hooked up the dust sensor to compare. The same thing that happened last week happened this time: the mq sensor showed a reasonable number but the dust sensor’s reading was very low. When I hooked it up to the mega however, the dust sensor’s readings were a lot more reasonable. 

On Wednesday, I got my new cases and tried to fit everything into place only to realize that I had more work to do with them because the LCD did not fit properly and the Arduino was getting a little stuck. Shifting my focus, I reprogrammed the dust sensor onto the Mega again to see what results it would give, in the process I accidentally switched two of the wires and the sensor started heating up. After fixing the wiring and running the code, the sensor readings became substantially low on the Mega. I wired it up to the nano and it wasn’t reading anything at all. The dust sensor stopped working. I focused on creating a new design and sending it to be printed. Afterwards, I realized that one of the power supplies was sending a very high voltage compared to what it was supposed to send. This cleared up why the sensor reading on the nano may have been inaccurate. Some voltage level shifters were ordered so that the right amount of power could be sent to the nano.

On Thursday, I worked on setting up the Arduino IOT cloud so that the data from the sensors could be displayed online. This proved to be quite difficult because no matter what I tried I could not connect to the WiFi. The other option I had was to send the data to my own website. This also proved to be difficult because there were not many examples online where people had sent data from an arduino to their own website so I had nothing to guide me. I was able to connect to my server but the WiFi network would immediately block it. I kept alternating between my two options to see if I could get either to work. I also explored other IOT cloud platforms I could try to send my data to like Blynk and Thingspeak but they were even more complicated than my current choices. Also I programmed an LCD that doesn’t require I2C onto the nano, I added a potentiometer on to so that I could adjust the contrast and I made it display Co2 and VOC readings.

Later in the week I worked more on connecting the nano to the cloud. The issue I was having was that the school’s WiFi was an open network but the cloud was only accepting networks that had a password. After a great deal of trial and error and much google searching I was able to create communication between the nano and the cloud. All I had to do was put quotation marks where the code said PASS[] and delete and rejoin the nano onto the cloud platform. I was able to control an LED using an on and off switch on the dashboard of the IOT cloud platform. Then I added the CO2 and VOC sensor to the nano to see if it could show up on the dashboard as well. I had to rejoin the device again, I think each time I add something new I have to delete the device and add it again to the cloud. I was able to get results from the sensor but for some reason the CO2 reading shows the number 65535 sometimes rather than the real reading. I googled and found out it was the raw base reading of the sensor but I was unsure why it was showing up.

Week 5: Trying Different Boards

On Monday, I was working with the ESP32 board because I was not able to establish an internet connection with the WiFi chip in the previous week. I tried to get the pm2.5 sensor to work with the esp32. I attempted to calibrate the sensor with a different library, change the variables, etc. but the serial monitor only read unreliable values, then I stopped with the pm2.5 sensor and tried to calibrate the mq7 sensor and when I ran the code, the serial monitor showed nothing. I focused back on programming the wifi chip even though it was not working last week. I was able to retrieve the ip and mac address that would be needed to send the data from the Arduino to a web server. I spent the rest of the day researching the esp8266 module, trying to figure out how I could configure it so that it could successfully send Arduino data to a web server. I think that the information I had looked at in previous weeks was about how to program the chip as a board, I was not using the chip as my main board, just as a module which is why I had to dig deeper in my research. I looked through a bunch of different tutorials. I also tried out all of the AT commands on the chip. I decided that once I get the wifi and password, I would try to see if I could establish a connection.

Serial port failing to establish connection on the ESP32.

On Tuesday, I kept working on configuring the esp8266 wifi chip as a wifi shield for the Arduino mega. I looked through a lot of tutorials on how to do this. I tried out many examples in many different libraries to see if any would be compatible with the wifi chip. I could get the esp8266’s AT commands to work in the serial monitor but I could not establish a wifi connection. various issues popped up with each example i tried, sometimes the port malfunctioned, sometimes the code wouldn’t run fully, sometimes a library was missing. Also a pin from the VOC/co2 sensor got stuck in the Arduino mega so I had to unsolder that pin from the sensor and solder on a new one, in the process I changed out all of the pins and put in new ones. I programmed the sensors onto an Arduino uno to see if they could all function on something smaller since we were considering buying an Arduino Nano to program the sensors on to. I got all of the sensors onto the board but I found that there may be a power issue with the uno because some sensor readings were unreliable.

On Wednesday, I focused my attention on building another case for my device. Since I was considering changing the board, I needed a more fitting design. I used tinkerCad to make my new designs and sent them to the 3D printers. Later in the day, I tested out various sensors on the uno. I had a bunch of different chemicals and I observed which ones the sensors were more receptive of. I also had two CO2 sensors hooked up at the same time and monitored if they would both relay the same readings.

On Thursday, the new boards arrived, there was an Arduino MKR 1010 and an Arduino Nano 33 IOT. I started with the MKR 1010 because it was easier to see the input locations on it. I quickly realized that it only had 1 ground pin and so far during my project I’d been using at least 2-3 ground pins because that was the only way that I could power all of my sensors. There also was only 1 set of SDA & SCL pins which was also an issue because the VOC/CO2 sensor and the LCD both require those inputs to function. Despite these issues I tried to hook up my sensors to the board and most of them worked properly. The ones that did not work properly on this board were the temp/humidity sensors (which was broken) and the dust sensor. One positive thing about the board was that I was able to successfully connect to the internet with it. However, I could not create a server because it turns out that the school does not allow for independent servers to be created on their WiFi. This meant that I had to create a website on the Gettysburg sites page. I created a website using WordPress and tried to add the domain to the Arduino IDE so that I could send my data there but I was not able to because the SSL of the website was HTTP not HTTPS. 

On Friday, I ditched the MKR 1010 and tried to program on the Nano. The good thing about the Nano was that it had two grounds which meant that I would not have a power issue with any of my sensors. The not so good things were that it also had only 1 set of SDA & SCL input pins and the dust sensor was not cooperating on this board. I tried to get to the bottom of the dust sensor issue. The sensor readings were extremely low on both the Nano and the MKR 1010, and they were completely normal on the Uno and the Mega. The difference between the boards is that the Uno and Mega are 8-bit microcontrollers while the Nano and MKR 1010 are 32-bit microcontrollers. So maybe there was a difference in the way that the new boards were computing the data from the sensor. I tried a basic potentiometer sketch on the nano to see what analog values it would show and it showed the same thing that an Uno or Mega would. However, when I connected the dust sensor to the board the same way that I had connected the potentiometer, it showed the extremely low readings again. So I assume there is a communication error between the two devices but I am unsure how to solve it. 

Different sensors hooked up to the Nano.

Week 4: WiFi Issues

On Monday, I was still working on better understanding the ESP2866 WiFi chip. I tried to combine the code for the chip and the code for the sensors so that a wifi connection could be established through the device. This proved to be difficult because the tutorials I was following were very unclear. It was hard to configure the code that sends Arduino data to a server and the code that allows all of the sensors to function together. I also started and finished a redesign for my case after taking more careful measurements. This took me most of the day because I took apart each component to get more accurate measurements.

A more accurate case design.

On Tuesday, I sent my new design to the 3D printer and made sure that they were being printed correctly. I also kept trying to get the wifi chip to cooperate with the Arduino. When I followed the online wiring diagrams and tried the AT commands on the serial monitor, nothing came up, though in days before when I had followed different diagrams, some information was showing up on the monitor. I also readjusted the prints because they were not sticking to the bed on the 3D printer. Lastly, I did research on the ESP32 micro controller which would be a more efficient alternative to the Arduino and the WiFi chip since it has a WiFi chip on it already. I installed the board + libraries for the ESP32.

A case being printed.

On Wednesday, I got my new redesigns from the printer. The Arduino fit well but the breadboard holders needed to be a little bigger. Also, I was still doing more research into the ESP32 because I decided it would be the new board that I would configure all the sensors to. Lastly, I started another redesign of my case.

The Arduino fits into the case but the breadboard does not.

On Thursday, I soldered pins to the ESP32 and joined it to a breadboard. I added all of the sensors to the breadboard with the ESP32, it wasn’t turning on and I figured out this was because certain pins cannot be inserted into certain locations. After reworking, the ESP32 turned on and I started to configure the sensor code so that it would work with the ESP32. Also, I had a lot of libraries downloaded for the ESP32 and they conflicted with each other. I sifted through them to decide which ones were necessary. I added all of the sensor code following a template from a tutorial. When I tried to run the code it did not compile because of issues with the libraries and the board.

On Friday, since I hadn’t gotten anywhere with the ESP32 board, I went back to basics to figure out how the board works. I conducted more simple examples rather than trying to configure all of the sensor code. I powered an LED with the board and ran other simple pieces of code on the board. Then I tried to configure the dust sensor on the board and I was able to hook everything up so that the code ran without any errors, however, the results from the sensor showing up on the serial monitor were not stable or correct. I am not sure why this is happening.

Week 3: Making Some Adjustments

On Monday, I decided that I needed three breadboards so that the power would be distributed well between the sensors and the LCD. I was having trouble setting up a common ground between the Arduino and the second breadboard. Whenever the pins of the sensors were connected to the second breadboard the results are either inaccurate or all over the place. Even the first breadboard didn’t seem to be on the same ground as the Arduino, but I realized that this was a power issue after running one of the sensors by itself. After readjusting the wiring, a common ground was set up between the breadboards and the Arduino. I also did some soldering on the LCD though when I connected it to the Arduino, it was turning on but nothing was being displayed. Lastly, I researched how to send the data from the Arduino to a web server.

The three breadboards, all the sensors, the Arduino, and the LCD which is not displaying anything.

On Tuesday, I was still trying to figure out how to make the LCD show information. I looked online through different solutions but nothing I was trying was working, I even tried to adjust the contrast of the LCD but nothing changed. In the afternoon, we did our design thinking workshop.

On Wednesday, I did more soldering on the LCD. This time, I soldered all of the pins very carefully and when I connected it to the LCD it started displaying information. I adjusted the code so that the LCD was displaying the correct information given by each sensor. There were a few issues with some of the data being displayed because some numbers from previous readings would remain but with some tweaks to the code this issue was fixed. I also got to work creating an initial design for the case of my device.

The LCD displaying data from the sensors.

On Thursday, I spent a lot of time trying to program a WiFi chip to the Arduino. The WiFi chip is what will enable data to be sent from the device to a web server. There were several different examples online of how to effectively program the chip. I combined information from various tutorials to make the WiFi chip function with the Arduino. It was quite difficult because the chip does not have any labels for its pins so I kept getting mixed up about where to connect which pin. I also spent some time testing different sensors. I used Isopropyl alcohol to test the VOC sensor and a candle to test the CO2 sensor. 

The CO2 and VOC concentrations spiking when directly exposed to the candle.

On Friday I spent my time developing the prototypes I had created earlier for the case of my device. It took me a while to design the cases because many different ideas were floating in my head about what the device should look like. By the end of the day, one of my case prototypes was being printed by the 3D printer.

Week 2: Picking up the pace

I started the week by programming an LCD to display the information given by the humidity and temperature sensor. Since I have had some experience programming with an Arduino, it wasn’t too difficult to make the two devices function together. However, the LCD was very dim and it was hard to see the reading, most likely because the device was old. Later in the day, the MQ sensors arrived and I began calibrating the MQ-7 sensor. I chose to calibrate it first because it detects Carbon Monoxide which is one of the indoor air pollutants that I want my device to monitor. Soon enough I got the sensor activated on the Arduino, I already had the code for it, and connecting the wires was fairly simple.

LCD displaying humidity and temperature.

 Since it had a “burn-in” period, I kept it connected and tried to calibrate the Hydrogen sensor. After connecting the Hydrogen sensor though, the readings for both MQ sensors became unstable. I found out that the readings were coming out inaccurate because there was not enough power on the Arduino to energize all of the devices that were connected to it. Eric and Josh brought me an additional breadboard connected to a power source so that the devices could function properly. I used both breadboards to distribute the power better but the readings were still all over the place. I tried to activate different sensors to figure out what the problem was. I had the humidity/temp, CO, alcohol, and combustible gas sensors running all at once. 

On the next day, I learned that the powered breadboard and the Arduino have to have the same ground to function together. I used a wire to connect the breadboard’s ground to the Arduino’s ground and the readings became more stable. I also realized that the only MQ sensor that was fully calibrated was the MQ-7, the other ones were only reading the analog value given by the sensor, and the concentration of the indoor air pollutants was not being represented. Since many of the MQ sensors detected similar elements, I decided that I would focus on the MQ-7 and MQ-135 (CO2) sensors for now. Later in the day, everyone worked together to make our DTSF shirts. Casey, Michael, and I created the design for it and we printed them out on the shirts. 

Various MQ sensors powered on.

By Thursday I had the temp/humidity, CO, and CO2 sensors running on the Arduino. Since none of my other sensors had arrived yet, I began thinking about what the case for my device may look like. I used tinkerCad some more to begin mapping out a model for the case. Later in the day, the Ozone sensor arrived and I began my work to add it to the Arduino. I created a separate sketch for the Ozone sensor to test it by itself. Once I configured it, I added it to the main sensor program. The issue with the Ozone sensor was that it took a good deal of time to calibrate and load before it showed the readings. All of the other sensors began showing their readings instantly. To solve this timing issue I added a loop to my code so that after 30 readings, the sensor would pause to calibrate the Ozone sensor. This way the Ozone sensor functioned properly and the readings were still instant.

On Friday morning we went to the copyright and licensing workshop hosted by the library. In the afternoon, I assembled the other sensors that had arrived onto the Arduino. By following the instructions laid out in the example code for each sensor I was able to get all of them working. The PM2.5, VOC, CO, CO2, and Ozone sensors were all giving their readings, however, some of them need to “burn in”. Next, I have to focus on power distribution so that all of the sensors are functioning at 100%, designing a case for my device, and transporting the data onto a page.

PM2.5, VOC, CO, CO2, and Ozone sensors powered on.

Week 1: Introduction

Hello, my name is Divya Gautam and this summer I plan to create an air quality sensor that can be used to monitor the air quality of various buildings on campus. Currently, I am focusing on building a device that will be capable of monitoring five different indoor air pollutants: PM 2.5, CO2, VOCs, CO, and Ozone. Each of these pollutants, at certain concentrations, can create a hazardous living environment for humans which is why monitoring their concentration levels is vital for human health.

On day one, I listed out my goals for the project which include: assembling all of the various pollutant sensors onto an Arduino board, figuring out the code to make sure all of the sensors function simultaneously, 3D printing a case for the device, and finding a way to feed the collected data from the device onto another platform. I also began my research on the individual pollutants and compiled a document listing all of the necessary sources that I could use to learn more information. 

On day two, I took my initial step into learning how the Arduino board functioned. I was doing this because I decided that I will build my sensor device using an Arduino. I followed a number of tutorials online to learn the basics of the board and the functions of the pins. The tutorials I followed were very simple: I figured out how to adjust the brightness of an LED using a potentiometer, how to turn an LED on and off using a button, how to activate a buzzer, etc. After learning some of the basics, I watched a few tutorials about activating a humidity and temperature sensor with an Arduino. It took me a little time because each tutorial had varying advice but I was able to make the sensor work, it successfully relayed the humidity and the temperature of the room. I decided that I will incorporate this sensor onto my device as well. 

Turning on an LED.
Activating the humidity and temperature sensor.

On day three, I began my search for the sensors that I would implement onto my device. I had to find sensors that were compatible with the Arduino board which proved to be fairly easy once I figured out the certain keywords that would give me the results that I was looking for. I made a list of all the parts I needed for my project, the Arduino board, the display screen, and each sensor. Additionally, I continued my research on the indoor air pollutants that my device would monitor. Eventually I figured out the governmental concentration standard for each pollutant. A very interesting piece of information I learned was that the 24/hr concentration standard for carbon dioxide is 400 to 1,000 ppm, yet there are studies which show that humans may have subtle declines in cognitive thinking if CO2 levels reach 1000 ppm.

On day four, I began incorporating the code for each sensor into one sketch. I went through more Arduino tutorials to better understand how I could make all of the moving parts of the device function together. Since I do not have any of the sensors yet, I do not fully know how they will work with the Arduino board. This means that the code that I have compiled together is very rough. Once I have the sensors, I can begin testing each one individually and I will be able to better understand how I can put them all together. I also began using the tinkerCad website to prepare for the 3D printed casing that will hold the device.