Done by Tan Yong Ziab.
This project aims to build a simple automatic fan that is suitable for office or study use in order to reduce our reliance on air-conditioning. This would help to reduce one's carbon footprint by providing a manner of targeted cooling that is able to automatically switch itself on and off, instead of relying on grossly power hungry air conditioning. Additionally, it is power-efficient enough to be driven off a power bank, which means that it is more portable than similar desk fan solutions while being smarter than handheld fans.
You would need:
1x Arduino UNO
Male-to-Female stacking headers
Male pin headers
Female pin headers
Single core wires (Sufficient and of various colours for ease of reference)
1x SPDT switch
1x HC-SR04 ultrasonic sensor
1x 3386 2 kilo ohm potentiometer
1x TIP110 power transistor
1x Fan blade (Mountable onto the motor of choice)
1x 3V motor
Equipment for testing, assembly, and programing:
1x stripboard cutter
1x digital multimeter (DMM)
1x wire stripper
1x wire cutter
1x soldering iron
1x soldering iron stand
1x soldering iron tip cleaner
1x desoldering pump (Wick if preferred)
1x any machine capable of running the Arduino IDE
Arduino IDE, installed on your machine of choice
Step 1: Testing Hardware
Firstly, test the hardware. A breadboard is immensely useful for this, though jumper cables may also be used when a breadboard is not available. The images show the testing process along with a Tinkercad screenshot of how the circuit is wired. There is not much to say beyond ensure your components work on their own and work together in a simple testing circuit. A DMM at this stage is also helpful to check if your components are not faulty.
Step 2: Building the Circuit
Next, solder the circuit. You should have your Arduino, stripboard, and stacking headers for this step.
Align the stripboard and headers with the headers on the Arduino. Once you confirm your spacing is correct, solder the stacking headers on. Remember to cut out traces where you do not want shorts. You can use your DMM to check for continuity between the shield and the Arduino itself. When you have finished your continuity checks, start soldering the parts on.
You can refer to the Tinkercad diagram earlier or the EAGLE schematic and stripboard pictures shown here to wire the circuit.
The layout of the components is such that soldering can be minimised. It may not be the most compact, but it would be easier to lay out components in a larger shield.
At where the female headers the ultrasonic sensor sits on the stripboard, I can already utilise pins GND, D13, and D12 to provide GND, Echo and Trigger to the ultrasonic sensor. I only needed to cut the trace between the female header that the ultrasonic sensor sits in and pin D11 in order to supply +5V to the sensor.
Likewise, the potentiometer sits at where there are already +5V and GND pins so that I only need to cut the trace between the wiper of the potentiometer (It is the middle pin) and the second GND pin it is adjacent to in order to provide my analog speed setting to pin A3 without sending the signal to GND, which would defeat the point of the analog input.
The motor breakout header is positioned such that I can take advantage of where the TIP110's emitter pin is and one would only need to solder the motor's ground to the one near the ultrasonic sensor. I used a 4 pin Molex connector as my breakout cable, though anything that fits is also fine. Pick your poison, I suppose.
The only exception is the SPDT switch, which is positioned further to the edge of the stripboard so as to be accessible to the user once the ultrasonic sensor is inserted into the female headers.
The +5V line is shared between the ultrasonic sensor, TIP110's collector pin and the potentiometer.
The TIP110's base pin is connected to pin 9 of the Arduino through the shield. Feel free to use other pins that are available for PWM control.
Again, your DMM is useful here to ensure that there are connections where there should be, and nothing where there is not. Remember to check if the shield's components are properly connected to the Arduino itself through carrying out continuity testing between the solder joints of the Arduino and the component(s) you intend to test.
Step 3: Programming (and Testing the Programming Of) the Circuit
This step is either the most unamusing or most frustrating of the steps. The objective of the program is to carry out the following:
1. Check for distance
2. If distance < predetermined threshold, start sending PWM signal to the motor based on the analog input of the potentiometer.
3. Else, stop the motor by setting the PWM signal to 0
Both steps 2 and 3 have a debug() in them that prints out the ultrasonic distance and analog input detected. You can delete it if desired.
The variables "refresh" and "max_dist" in the program each control the polling rate and the maximum detection distance respectively. Tune this to your liking.
The file is attached here.
Step 4: Put Together Everything
If you have the circuit behaving as it should and got to this step, congratulations! This project can now function on its own. In the picture, you can see that the whole circuit is powered by a battery pack through an on-board Micro USB connector and is no longer bound to your laptop.
At this stage, you can modify the circuit, or if you are feeling more adventurous, build your own take on this.
In good time, I do hope to be able to, or attempt to, mill out the PCB for this project using a CNC router. You can see the generated PCB layout in the image above
Step 5: Future Plans and Some Notes
With this project done, some of the more immediate things I hope I can achieve with this project in my spare time include, but are not limited to:
- An actual stand for the fan
- Shrink this down to an even more compact and self-contained size; I would probably need an Arduino Nano for this
- A more appropriate power solution, i.e. the power bank you see in the previous step is a bit too big for a self-contained design I just referenced
Some notes (for my future self and any soul venturing through the Internet):
You may notice that while the parts list calls for an Uno board, the board you see through this guide is anything but an Uno. This is actually a variant of the Uno called the SPEEEduino, which was developed in Singapore Polytechnic by a group of students and their supervising lecturer. It is functionally very similar, save for additions like the Micro USB power-only input that you see driving the project in the previous step and even has headers to plug in ESP01 Wi-fi module. You can learn about the SPEEEduino here.