- Why I Chose This Project
The heating in my room is quite aggressive and fluctuates greatly throughout the day. A fan that not only responds based on temperature, but also to the different times of day allows me to feel more comfortable in my room. In the morning, the fan either low or off so my room isn't too cold when I wake up. At night, I like the fan on high and my room cold for optimal sleeping conditions.Setting Up the DHT11
The only thing I cared about for the scope of this project was the temperature of my room so this is how I wired the breadboard and coded the sensor.
I wanted to use a stepper motor as I have the most control over revolutions and button pushing. I had never used it before so I thought it would be interesting to try out. In order to push the buttons on the top of my fan, I thought I would attach a wooden pencil or dowel-like object to the motor and press it from the motor resting on the top handle. I put together the breadboard and sample code to make sure the motor worked properly. The problem was actually having it push a button.
There are a few main reasons:
- I overestimated the height at which the button had to be pressed. It at most needed a couple centimeters above the button.
- I didn't think about how the step motor couldn't really lie flat on the surface of the fan. It is has a mostly circular shape and then two pieces on either side hanging out. My fan itself is curved as well so I couldn't get an accurate push where I needed it.
- Between the two above, at that point I would just be making my own servo which was quite unnecessary considered I already had a mini servo in my kit. My homemade servo would be an excessively taped wooden dowel, not ideal.
This part was much easier than figuring out the step motor and driver since there was only 3 pins I needed to worry about, similar to the DHT11: data, ground, and power. I used D6 for the data. I didn't have the conventional male to male jumper wire colors but I have an image below and the circuit diagram/schematic is at the bottom of the page.
Finding the correct angle was pretty much guess and check. The initial code I ran, a basic sweep, went from 180 to 0. 180 was fine to start, but 0 was slightly too far down so 10 degrees was enough to apply pressure without moving the servo itself dramatically.Making of the Box
The servo needs to remain in the same place because it needs the pressure of the arm to actually press the button. My solution was to create a box the servo could sit in so it wouldn't move up or down. Alternatively, the servo itself could just be taped down but I wanted to be able to reuse it and not have adhesive residue all over it as well as more surface area to secure the tape.
I trimmed the edges away so the box fit nicely on the front edge of my fan. After I was sure it was the right size, I used glue and tape to hold it together. The servo didn't need much to support it because it fit right into the enclosure, I just added some cotton balls in the empty space. I then covered the box with red tape so it was one solid color.
I already knew the range of temperatures I wanted to compare against so the next step was making sure the servo could push the button. In the video, you can see that initially, it needs the pressure of my finger to keep the box in place. It was already taped on the bottom but the box would still go up. To fix this, I used a long piece of tape stretching from the front to the back to hold it in placeHow It Works
- DHT11 Sensor: based on my desired temperature (based on the time of day), the fan speed will be adjusted after a time allotment of 5 minutes.
- Particle Time Function: I defined my windows of certain times of day and where I want the temperature to be.
Okay so this is the end. From the video below you can see that the temperature changes are drastic, just a couple degrees. This is just a stationary fan and it doesn't rotate, its just pointed at my bed. Although it gets the job done it would be cool to be able to control the exact degree which can be done with a AC unit, which I don't have.
Bonus test case! My room was not cold enough to set off the turn fan level down, here's a video of what it would look like if my DHT11 read as less than 65 (60 degrees for this case)