{"id":550,"date":"2024-10-11T07:04:20","date_gmt":"2024-10-11T05:04:20","guid":{"rendered":"https:\/\/www.hh3dlab.fi\/blog\/?p=550"},"modified":"2024-10-11T07:07:36","modified_gmt":"2024-10-11T05:07:36","slug":"550","status":"publish","type":"post","link":"https:\/\/www.hh3dlab.fi\/blog\/esp32\/550\/","title":{"rendered":"Air Quality and Control System"},"content":{"rendered":"<p>October 2024 &#8211; (c) Stephen Swanson<\/p>\n<p><a href=\"https:\/\/github.com\/YB-BigSwan\/air_quality\/tree\/main\" target=\"_blank\" rel=\"noopener\">Check it out on GitHub<\/a><\/p>\n<h3>Introduction<\/h3>\n<p>Hi! I\u2019m Stephen, a 3rd-year student at Haaga-Helia UAS. Programming and creating IoT and embedded devices are recent hobbies of mine, which I picked up in summer 2024 after some friends (Alisa Dunaeva and David Gianadda) suggested I give it a try.<\/p>\n<p>I came in with some programming experience, but circuits were completely new to me. Before diving into any projects, I took an online Udemy course to get up to speed on circuits, reading schematics, and other basics.<\/p>\n<p>One of the projects I worked on over the summer was an air quality monitoring device for my apartment, which I later expanded into a more advanced system for my course project.<\/p>\n<h3>Ideas<\/h3>\n<p>As I mentioned, the system I created for the IoT experimental project course is a continuation of my personal air quality monitor project from the summer.<br \/>\nThe idea came up when I was walking to dinner with my girlfriend. She asked if the air in our apartment was good enough for our cat, who has some breathing issues, or if we should have left a window cracked. This got me thinking about building a system to remotely monitor and control the air in our apartment.<\/p>\n<p>The goal was to create a system that would let me monitor the air quality remotely and control my AC unit\u2014whether to pull in fresh air, cool, or heat the apartment as needed.<\/p>\n<h3>What did you need to learn<\/h3>\n<p>Most of the project built on my previous experience with web hosting, port forwarding, React, Express, Node, and ESP32-based devices. It was just a matter of combining them into one cohesive system.<\/p>\n<p>However, one new thing I had to learn was IR protocols, since I needed to send IR signals to control the AC unit. This was a challenging process, as the IR protocol for my AC remote was somewhat uncommon. I had to switch IRremote libraries a couple of times but eventually got everything working.<\/p>\n<h3>The building phase<\/h3>\n<p>The building phase technically started back in June with the construction and programming of my air quality monitor. This device uses an ESP32, a DHT11 temp and humidity sensor, an SGP30, and a TFT display panel.<\/p>\n<figure id=\"attachment_555\" aria-describedby=\"caption-attachment-555\" style=\"width: 557px\" class=\"wp-caption aligncenter\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"wp-image-555 size-full\" src=\"https:\/\/i0.wp.com\/www.hh3dlab.fi\/blog\/wp-content\/uploads\/2024\/10\/Picture1.jpg?resize=557%2C743&#038;ssl=1\" alt=\"Night view of the system\" width=\"557\" height=\"743\" srcset=\"https:\/\/i0.wp.com\/www.hh3dlab.fi\/blog\/wp-content\/uploads\/2024\/10\/Picture1.jpg?w=557&amp;ssl=1 557w, https:\/\/i0.wp.com\/www.hh3dlab.fi\/blog\/wp-content\/uploads\/2024\/10\/Picture1.jpg?resize=225%2C300&amp;ssl=1 225w\" sizes=\"auto, (max-width: 557px) 100vw, 557px\" \/><figcaption id=\"caption-attachment-555\" class=\"wp-caption-text\">Night view of the system<\/figcaption><\/figure>\n<p>The monitor collects temperature and humidity data, calculates the absolute humidity, and uses that value to calibrate the SGP30. After a short warm-up period, it displays the data in a grid on the bottom half of the screen. The top half shows a GIF sprite that I created in Aseprite and converted to an RGB565 header file using a tool from Maduinos. The GIF has 9 frames and loops through one frame every 200ms.<\/p>\n<p>The second part of the system is the air control unit, which is much simpler. It consists of an ESP32, an IR LED, and a transistor. Building it was straightforward, but programming it was frustrating due to the earlier IR protocol issues. Once that was resolved, the rest of the programming and setup went smoothly.<\/p>\n<figure id=\"attachment_556\" aria-describedby=\"caption-attachment-556\" style=\"width: 644px\" class=\"wp-caption aligncenter\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"wp-image-556 size-full\" src=\"https:\/\/i0.wp.com\/www.hh3dlab.fi\/blog\/wp-content\/uploads\/2024\/10\/Picture2.jpg?resize=640%2C500&#038;ssl=1\" alt=\"The board\" width=\"640\" height=\"500\" srcset=\"https:\/\/i0.wp.com\/www.hh3dlab.fi\/blog\/wp-content\/uploads\/2024\/10\/Picture2.jpg?w=644&amp;ssl=1 644w, https:\/\/i0.wp.com\/www.hh3dlab.fi\/blog\/wp-content\/uploads\/2024\/10\/Picture2.jpg?resize=300%2C234&amp;ssl=1 300w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><figcaption id=\"caption-attachment-556\" class=\"wp-caption-text\">The board<\/figcaption><\/figure>\n<p>The third item on the to-do list was configuring and deploying the web server, which I set up using Express and Node on Heroku. The server manages routes for devices to register their local IPs, get and post air quality data, and send IR commands.<\/p>\n<p>After configuring the web server, I went back to the devices to make some tweaks for smoother communication. I adjusted the air control device\u2019s API routes and server registration function. On the air quality device, I added a function to send data to the server. Finally, I set up a port forwarding rule on my router for the air control unit to allow the server to forward commands.<\/p>\n<p>Once everything was connected and working properly, I created a basic React client hosted on GitHub Pages. The client serves as a control panel that displays the information and control buttons when the user is logged in. Authentication is handled via Google OAuth and is restricted to household members.<\/p>\n<p>After logging in, users can view the air quality info and control the AC unit via the air control device. One final fun feature I added is the gif, but the gif starts crying when the CO<span style=\"font-size: 10px;\">2<\/span> and VOC levels exceed certain thresholds. Et voil\u00e0\u2014remote home air monitoring and control system is born!<\/p>\n<h3>The outcome<\/h3>\n<p>Aside from learning about IR protocols, the main outcome is that I now have a cool system in my apartment that\u2019s useful for daily life.<\/p>\n<p>This project got me more interested in tinkering, and I even started another side project\u2014an automatic plant watering and fertilizing system that uses sensors to monitor soil moisture and nutrient levels and pumps water or nutrients as needed. I\u2019m currently waiting for parts to arrive from Alibaba. I think this will be a lifelong hobby and potentially a career path!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>October 2024 &#8211; (c) Stephen Swanson Check it out on GitHub Introduction Hi! I\u2019m Stephen, a 3rd-year student at Haaga-Helia UAS. Programming and creating IoT and embedded devices are recent hobbies of mine, which I picked up in summer 2024 after some friends (Alisa Dunaeva and David Gianadda) suggested I give it a try. I [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[34,20,62],"tags":[],"class_list":["post-550","post","type-post","status-publish","format-standard","hentry","category-bmp-280-sensor","category-esp32","category-sensors"],"jetpack_featured_media_url":"","jetpack-related-posts":[{"id":596,"url":"https:\/\/www.hh3dlab.fi\/blog\/iot\/snake-and-pong-games-on-an-esp32\/","url_meta":{"origin":550,"position":0},"title":"Snake and Pong games on an ESP32","author":"Lab Student","date":"28.10.2025","format":false,"excerpt":"Introduction Hi, our team is formed with three members Roope Rajahalme, Rasmus Rautakallio and Phong Phan. Before this course our background in programming and electronics was quite basic. We had some experience with Java programming projects but had never worked with displays or games before. We all had deep love\u2026","rel":"","context":"In &quot;ESP32&quot;","block_context":{"text":"ESP32","link":"https:\/\/www.hh3dlab.fi\/blog\/category\/esp32\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.hh3dlab.fi\/blog\/wp-content\/uploads\/2025\/10\/b7f9bdbb5cfd3042dea94ae15f62ccff-1024x768.jpeg?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.hh3dlab.fi\/blog\/wp-content\/uploads\/2025\/10\/b7f9bdbb5cfd3042dea94ae15f62ccff-1024x768.jpeg?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.hh3dlab.fi\/blog\/wp-content\/uploads\/2025\/10\/b7f9bdbb5cfd3042dea94ae15f62ccff-1024x768.jpeg?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":250,"url":"https:\/\/www.hh3dlab.fi\/blog\/madrid-2022\/introduction-to-the-team-3-29-3-2022\/","url_meta":{"origin":550,"position":1},"title":"Introduction to the team 3 &#8211; 29.3.2022","author":"M team 3","date":"29.3.2022","format":false,"excerpt":"Our main goal is to build a portable GPS weather station for Madrid 2022 seminar. If that name confuses you, don't worry! During this course we'll be documenting everything here, so you get a comprehensive idea of this machine! But alas, let's start with a quick introduction to our team!\u2026","rel":"","context":"In &quot;ESP32&quot;","block_context":{"text":"ESP32","link":"https:\/\/www.hh3dlab.fi\/blog\/category\/esp32\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.hh3dlab.fi\/blog\/wp-content\/uploads\/2022\/03\/WhatsApp-Image-2022-03-29-at-12.23.33.jpeg?resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.hh3dlab.fi\/blog\/wp-content\/uploads\/2022\/03\/WhatsApp-Image-2022-03-29-at-12.23.33.jpeg?resize=350%2C200 1x, https:\/\/i0.wp.com\/www.hh3dlab.fi\/blog\/wp-content\/uploads\/2022\/03\/WhatsApp-Image-2022-03-29-at-12.23.33.jpeg?resize=525%2C300 1.5x, https:\/\/i0.wp.com\/www.hh3dlab.fi\/blog\/wp-content\/uploads\/2022\/03\/WhatsApp-Image-2022-03-29-at-12.23.33.jpeg?resize=700%2C400 2x, https:\/\/i0.wp.com\/www.hh3dlab.fi\/blog\/wp-content\/uploads\/2022\/03\/WhatsApp-Image-2022-03-29-at-12.23.33.jpeg?resize=1050%2C600 3x, https:\/\/i0.wp.com\/www.hh3dlab.fi\/blog\/wp-content\/uploads\/2022\/03\/WhatsApp-Image-2022-03-29-at-12.23.33.jpeg?resize=1400%2C800 4x"},"classes":[]},{"id":491,"url":"https:\/\/www.hh3dlab.fi\/blog\/innovation-course\/medication-dispenser-project\/","url_meta":{"origin":550,"position":2},"title":"Medication dispenser project","author":"Heikki Hietala, lab admin","date":"1.6.2023","format":false,"excerpt":"Introduction\u00a0 I have only taken Introduction of Programming course before and basically have no background of coding, neither in 3D printing. This course is a total new experience for me to combine the 3D printing and programming together and the first time to get to know about ESP32 and Arduino.\u00a0\u2026","rel":"","context":"In &quot;Innovation course&quot;","block_context":{"text":"Innovation course","link":"https:\/\/www.hh3dlab.fi\/blog\/category\/innovation-course\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.hh3dlab.fi\/blog\/wp-content\/uploads\/2023\/06\/image-25.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.hh3dlab.fi\/blog\/wp-content\/uploads\/2023\/06\/image-25.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.hh3dlab.fi\/blog\/wp-content\/uploads\/2023\/06\/image-25.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":5,"url":"https:\/\/www.hh3dlab.fi\/blog\/3d-robo-lab\/tervetuloa-haaga-helian-3d-robo-labiin\/","url_meta":{"origin":550,"position":3},"title":"Haaga-Helia 3D + Robo Lab equipment","author":"Heikki Hietala, lab admin","date":"13.3.2022","format":false,"excerpt":"Haaga-Helia 3D + Robo Lab is the 3D, robotics and IoT research lab at our University. 3D is a family of technologies that can be seen to affect every field of business today. Virtual reality, augmented reality, mixed reality, 3D modeling, scanning and printing open new business opportunities every day.\u2026","rel":"","context":"In &quot;3D + Robo Lab&quot;","block_context":{"text":"3D + Robo Lab","link":"https:\/\/www.hh3dlab.fi\/blog\/category\/3d-robo-lab\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.hh3dlab.fi\/blog\/wp-content\/uploads\/2022\/03\/IMG_20190202_194403_807.jpg?fit=1200%2C1200&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.hh3dlab.fi\/blog\/wp-content\/uploads\/2022\/03\/IMG_20190202_194403_807.jpg?fit=1200%2C1200&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.hh3dlab.fi\/blog\/wp-content\/uploads\/2022\/03\/IMG_20190202_194403_807.jpg?fit=1200%2C1200&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/www.hh3dlab.fi\/blog\/wp-content\/uploads\/2022\/03\/IMG_20190202_194403_807.jpg?fit=1200%2C1200&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/www.hh3dlab.fi\/blog\/wp-content\/uploads\/2022\/03\/IMG_20190202_194403_807.jpg?fit=1200%2C1200&ssl=1&resize=1050%2C600 3x"},"classes":[]},{"id":481,"url":"https:\/\/www.hh3dlab.fi\/blog\/uncategorized\/irrigation-project\/","url_meta":{"origin":550,"position":4},"title":"Irrigation project","author":"Heikki Hietala, lab admin","date":"1.6.2023","format":false,"excerpt":"Group members: Sara, Youmna, Anna, Olympe Introduction Hello! We are four students who worked together for five months on an interesting project for our Innovation and Prototyping course at Haaga-Helia. We all have different backgrounds, but we managed to combine our strengths to work together and to get this project\u2026","rel":"","context":"Similar post","block_context":{"text":"Similar post","link":""},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.hh3dlab.fi\/blog\/wp-content\/uploads\/2023\/06\/image-21.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":643,"url":"https:\/\/www.hh3dlab.fi\/blog\/3d-robo-lab\/643\/","url_meta":{"origin":550,"position":5},"title":"The Smart Gardener \u2013 A Connected Plant Pot","author":"Heikki Hietala, lab admin","date":"20.3.2026","format":false,"excerpt":"By Florent Gilli\u00e9ron, Julien Mignon & L\u00e9on Ehrwein Introduction We are three students taking the IoT Experimental Project - DIG008AS3AE-3004. Our backgrounds are quite different. Florent and Julien had some prior experience with coding and web development and worked with microcontrollers and physical sensors before. L\u00e9on had no experience at\u2026","rel":"","context":"In &quot;3D + Robo Lab&quot;","block_context":{"text":"3D + Robo Lab","link":"https:\/\/www.hh3dlab.fi\/blog\/category\/3d-robo-lab\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.hh3dlab.fi\/blog\/wp-content\/uploads\/2026\/03\/word-image-643-2.jpeg?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.hh3dlab.fi\/blog\/wp-content\/uploads\/2026\/03\/word-image-643-2.jpeg?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.hh3dlab.fi\/blog\/wp-content\/uploads\/2026\/03\/word-image-643-2.jpeg?resize=525%2C300&ssl=1 1.5x"},"classes":[]}],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.hh3dlab.fi\/blog\/wp-json\/wp\/v2\/posts\/550","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hh3dlab.fi\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hh3dlab.fi\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hh3dlab.fi\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hh3dlab.fi\/blog\/wp-json\/wp\/v2\/comments?post=550"}],"version-history":[{"count":7,"href":"https:\/\/www.hh3dlab.fi\/blog\/wp-json\/wp\/v2\/posts\/550\/revisions"}],"predecessor-version":[{"id":563,"href":"https:\/\/www.hh3dlab.fi\/blog\/wp-json\/wp\/v2\/posts\/550\/revisions\/563"}],"wp:attachment":[{"href":"https:\/\/www.hh3dlab.fi\/blog\/wp-json\/wp\/v2\/media?parent=550"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hh3dlab.fi\/blog\/wp-json\/wp\/v2\/categories?post=550"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hh3dlab.fi\/blog\/wp-json\/wp\/v2\/tags?post=550"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}