Arduino

I decided, after seeing all of the components included in the UNO kit, to create a fan that turns on if the temperature is above a certain point and a light that turns on if humidity is above a certain point. This was after contemplating possibly using the joystick for something, or perhaps experimenting with the IR receiver. For the temperature/humidity circuit, I am using two main components along with a light:

DHT11 Temperature and Humidity Module

Fan Blade and 3-6V Motor

So, the process began with me attempting to make the DHT11 work. Here was my initial wiring, using 5V source, ground, and pin 4:

However, this was not working for me. After playing with the code for a while and tinkering with the wiring, it turned out that the order was wrong, as I was getting conflicting information from multiple internet sources. Here was the final wiring, with (from left to right) data to 7, positive to 5V, and negative to GND:

Here is a diagram I found online that represents my wiring:

How to Set Up the DHT11 Humidity Sensor on an Arduino
https://www.circuitbasics.com/wp-content/uploads/2015/10/Arduino-DHT11-Tutorial-3-Pin-DHT11-Wiring-Diagram.png

Here was the code I used to get the circuit working. I downloaded the library from the Arduino IDE, and used the following documentation: https://lastminuteengineers.com/dht11-dht22-arduino-tutorial/.

Now, we need to alter this code to first turn on a light when the humidity is at a certain level. We will call this level “barrier”. Here is my new code:

Essentially, this code checks the humidity value, and makes a red light flash if its above a threshold. I got this working with this wiring, with pin 13 for data, a resistor from the long leg to the data pin, and grounding the short leg:

Here is a diagram I found online that represents my wiring of the LED:

Arduino LED - Complete Tutorial - The Robotics Back-End
https://www.google.com/url?sa=i&url=https%3A%2F%2Froboticsbackend.com%2Farduino-led-complete-tutorial%2F&psig=AOvVaw0AjsUTPYjOLXscUQE1TGHT&ust=1678967950094000&source=images&cd=vfe&ved=0CA4QjRxqFwoTCIi13pLx3f0CFQAAAAAdAAAAABAN

Finally, I now want to make the fan turn on when the temperature is above a threshold. This took a little more research than the light, but still wasn’t too bad. We had to write to analog this time, with the following code:

And here was the wiring setup, using a 3.3V source, diode, transistor, and a resistor:

Here is a diagram I found online that represents my wiring of the fan DC motor:

Arduino - DC Motor
https://www.tutorialspoint.com/arduino/images/dc_motor_connections.jpg

My bedroom was consistently at 22% humidity and 22º C, so I had to change the parameters in order to fully test both functionalities. I had already tested if they worked individually when programming each component, so now, to see if they worked together, I altered the code in the following way:

And then subsequently tested, both working with values above the threshold:

And not doing anything when below the threshold (25% and 28º):

Thus, the project was a smashing success!

This was my first time working with circuits hands-on, so I found it difficult to visualize what was actually happening when I was connecting everything. Further, due to the small size of the pins it was extremely easy to mess up wiring, so that was frustrating to continuously have to triple check each wire. Through working with the Arduino, I gathered a much better understanding of circuits and valuable experience for working with them, even in such a simple manner. I am excited to continue tinkering! In my life, the Arduino could be applied in a variety of ways, not the least of which being with the LCD screen. I’m sure I can program some sort of message to correspond to a sensor and have running all the time to give me a status; perhaps something I will try in the coming weeks.