For the past month, I have been teaching myself about Arduino, ESP32 and ESP8266 boards, and additional sensors, such as neopixels, buttons and more. This has been a fun and challenging process, and I would recommend it to anyone with even the slightest interest in hardware engineering.
After learning the ins and outs of the technology for 4 weeks, I finally decided to tackle my first project. In this article, I will cover the details of the project.
A Little Background
ESP8266 boards are built by a company called Espressif Systems. The ESP8266 NodeMCU board includes WiFi, giving it high-powered capabilities to web scrape and interact with APIs. Additionally, the IDE I use for interacting with ESP boards is called Arduino. This is a simple-to-use yet robust platform that includes collections of sample code, a library manager, and one of the strongest developer communities I’ve come across.
Thanks to the magnitude of this community, it is likely that you can find the answers to any problems you run into. This, along with the built-in code examples, significantly lowers the barriers to getting started. Following this section, I will give a brief overview of my project and the components I used. Then, I will discuss my next steps and a link to the code.
The Project
I utilized a DHT11 sensor, photoresistor, and digital button in this project. Additionally, I worked with IFTTT (this = webhooks, that= Google Drive spreadsheet) to send new rows of data to google sheets. This has allowed me to collect data on my project, which I will use to perform some mathematical modeling. Here is a screenshot of the layout:
What is a DHT11 Sensor?
A DHT11 sensor is made up of two parts: a humidity sensor and a thermistor (which measure, respectively, the humidity and temperature). The relative humidity is calculated by measuring the electrical resistance between two electrodes, giving the sensor an accurate reading of the amount of water vapor in the surrounding air. The thermistor’s resistance is dependent on the surrounding temperature.
There are many practical uses for these sensors in the IoT world. Specifically, I have seen individuals build applications that measured the temperature of a pot of water to track when it reached a boiling point (useful for cooking). DHT sensors can also be used to predict weather and manage heating and cooling in smart homes.
Photon + Resistor = Photoresistor
A photoresistor is a type of resistor whose resistance decreases as the intensity of light increases. Therefore, the flow of electricity through the photoresistor increases as the intensity of light increases. As light hits the photoresistor, electrons absorb the energy from the light, break their bond with atoms, and become ‘free.’ When the intensity of light is high, many electrons become free and carry the electric current with them. Overall, the amount of electric energy flowing through the photoresistor is dependent on the number of free electrons.
One of the most common uses of photoresistors is within mobile phones. Have you ever recognized how the brightness on your screen automatically adjusts in a dark room? That’s thanks to a photoresistor! Additionally, photoresistors can be used in night lights, alarm clocks, street lights, and more.
What Is a Digital Button?
Let’s break this down into two components: ‘digital’ and ‘button.’ In hardware, digital refers to an object with two set states, on (1) or off (0). Analog, the converse of digital, uses continuously changing aspects instead of just two. So, a digital button is only ever on or off. In my project, I used this button to track when I was in my room (on) or elsewhere (off).
Some real-world applications of digital buttons include reporting malfunctions, triggering a light or tracking the status of something.
Next Steps
So far, I have collected a week worth of data (about 10,000 rows). Now, I plan to inspect this dataset for bugs or any potential errors. If necessary, I will refine my c++ code to eliminate these errors. Then, I will run this project for one month, collecting data every minute and sending it to my Google Sheet database.
After collecting a sufficient amount of data, I plan to utilize Artificial Intelligence to build a model that will predict what time I will return to my room every day of the week. This will challenge my skills in both hardware and software engineering and ultimately allow me to take this project from ideation to production-ready.