Introduction: Fanduino - Cool Automatic Arduino Fan

While we in the northern hemisphere enjoy the winter chill, we can't help but feel sorry for those less fortunate suffering the horrible heat in the southern hemisphere... :-D

So, in the true Christmas spirit, I decided to share some of our cool, in the form of an Arduino controlled fan :-)

Step 1: Components

Needed components:

  1. One Arduino (I use Mega because I have one available, but UNO is perfectly good for this project)
  2. One Breadboard
  3. One Texas Instruments LM35 Thermometer
  4. One Small Servo with a plastic arm (I used SG90 Servo)
  5. One Ultrasonic Ranger HC-SR04 or similar
  6. One large paperclip
  7. Few jumper wires
  8. One piece of paper to use for the flap
  9. Some Glue, and Adhesive Tape

Optional recommended components:

  1. 2 capacitors to reduce noise (I use 100 uF and 0.01 uF but you can use other values)
  2. One external power supply for the Servo. (You can power the servo with the Arduino board, but then there will be a lot of noise in the Thermometer readings)

Step 2: Make the Flag

  1. Fold the paper flap through the center as shown in Picture 1
  2. Shape the paper clip into an asymmetric U shape, and insert the 2 ends through the Servo arm (Picture 2)
  3. Insert the 2 ends through the fold in the paper flap(Picture 3)
  4. Bend the paper clip as shown on Picture 4 and 5
  5. Secure the clip to the paper with Adhesive Tape (Picture 6)
  6. Apply glue to the paper (Picture 7)
  7. Glue the 2 inner sides of the paper together to form the flag as shown on pictures 8 and 9

Step 3: Connect the LM35 Thermometer

  1. Place the LM35 Thermometer on the Breadboard, and connect the Ground (Black wire), and Power (Red wire) to the power bus of the Breadboard as shown on Picture 1
  2. Optionally add a small capacitor between Ground and Power near the Thermometer, to reduce high frequency power noise as shown on Picture 2
  3. Optionally add a bigger capacitor between Ground and Power on the power bus to improve the power stability as shown on Picture 3
  4. Connect a wire (Green wire) to the middle pin of the Thermometer (Picture 4). This pin will output the analog temperature value measured by the LM35
  5. Connect Ground (Black wire) and Power (Red wire) wires to the power bus of the Breadboard to provide power from the Arduino Board (Picture 5)
  6. Connect the Temperature(Green wire) to the Arduino Analog 0 pin, the Power (Red wire) to the 5V Arduino Power pin, and the Ground(Black wire) to an Arduino Ground Pin (Picture 6)

Step 4: Connect the Ultrasonic Ranger

  1. Place the Ultrasonic Ranger on the Breadboard
  2. Connect the Power(Red wire), Ground(Black wire), Trigger(Yellow wire), and Ping/Echo(White wire) to the Ultrasonic Ranger. Connect the other end of the Power and Ground wires to the Power and Ground of the Power bus of the Breadboard (Picture 1)
  3. Connect the other end of the Trigger(Yellow wire) to Digital Pin 2 of the Arduino board, and Ping/Echo(White wire) to Digital Pin 3 of the Arduino board (Picture 2)

Step 5: Connect the Servo

For my Fan, I used external power for the Servo as recommended. It also reduces the power noise which affects the temperature measurements.

You can connect the Servo directly to the power of the Arduino board, but that is not recommended.

  1. Connect a jumper wire between the grounds of the two power buses on the breadboard as shown on Picture 1
  2. Add Ground(Black wire), Power(Red wire), and Control(Orange wire) to the Servo connector (Picture 2)
  3. Connect the other end of the Ground(Black wire), and Power(Red wire) to the separated power bus on the Breadboard(Picture 3) . If you decide to power the Servo directly from Arduino, connect to the same Breadboard power bus, where the Thermometer and the Ultrasonic Rangers are connected
  4. Connect the other end of the Control(Orange wire) to the Digital Pin 4 of the Arduino board (Picture 4)
  5. Add a Power Supply to the side of the breadboard where the Servo Power is connected (Pictures 5 and 6)
  6. Mount the Servo vertical using whatever convenient objects are around (In my case Spool of prototyping wire) (Picture 7)

Step 6: Start Visuino, and Add Components to Read the LM35 Thermometer and Reduce the Noise

To start programming the Arduino, you will need to have the Arduino IDE installed from here: http://www.arduino.cc/ .

Please be aware that there are some critical bugs in Arduino IDE 1.6.6. Make sure that you install 1.6.7 or higher, otherwise this Instructable will not work!

The Visuino: https://www.visuino.com also needs to be installed.

  1. Start Visuino
  2. From the Component Toolbox expand the "Measurement" Category, then the "Analog" Sub Category, and select the "Texas Instruments Thermometer LM35" component as shown on the first picture, and drop it in the design area
  3. From the Component Toolbox expand the "Math" Category, and select the "Average Period" component (Picture 2), and drop it in the design area. The Average component will help reduce noise by averaging multiple readings
  4. Connect the components as shown on Picture 3
  5. Set the Average Period to 100000 (Picture 4)

Step 7: In Visuino Add the Components to Read the Ultrasonic Ranger

  1. From the Component Toolbox expand the "Measurement" Category, then the "Analog" Sub Category, and select the "Ultrasonic Ranger" component as shown on the first picture, then drop it in the design area
  2. From the Component Toolbox expand the "Math" Category,and select the "Average Period" component, then you drop in in the design area, as you did with the Thermometer in the previous step. The Average component will help reduce noise by averaging multiple readings
  3. Connect the components as shown on (Picture 2)
  4. Set the value of the Period propertyof the AveragePeriod2 component to 2000000 (Picture 3)

Step 8: In Visuino Add Components to Control the Servo

  1. From the Component Toolbox expand the "Motors" Category, and select the "Servo" component as shown on the first picture
  2. From the Component Toolbox expand the "Generators" Category, then the "Analog Generators" Sub Category, and select the "Sine Analog Generator" component as shown on the Picture 2, then drop it in the design area
  3. Connect the components as shown on Picture 3
  4. For the Sine Generator specify Amplitude of 0.3 (Picture 4)

Step 9: Add Pins to the Sine Generator to Enable It, and Control Its Frequency

To Enable/Disable the Sine generator and control its frequency, we need to add pins to some of the properties:

  1. In the Object Inspector click on the Pin button at front of the Enabled property, and select "Boolean SinkPin" (Picture 1)
  2. In the Object Inspector click on the Pin button at front of the Frequency property, and select "Float SinkPin" (Picture 2)

Step 10: In Visuino Add Components to Control the Speed of the Fan

We want the temperature to control the speed of the fan. To do that we need to calculate frequency from the temperature.

  1. Type "subtr" in the Filter box of the Component Toolbox, then select the "Subtract Value" component (Picture 1), and drop it in the design area
  2. Type "mul" in the Filter box of the Component Toolbox, then select the "Multiply By Value" component (Picture 2), and drop it in the design area.
  3. In the Object Inspector set the Value of the Subtract component to 18 (Picture 3)
  4. In the Object Inspector set the Value of the Multiply component to 0.3 (Picture 4)

We also want to update the speed only once every 10 seconds. For this we will add a snapshot component and a clock component to send clock to the snapshot once every 10 seconds.

  1. Type "sna" in the Filter box of the Component Toolbox, then select the "Analog Snapshot" component (Picture 5), and drop it in the design area
  2. Type "clock" in the Filter box of the Component Toolbox, then select the "Clock Generator" component (Picture 6), and drop it in the design area.
  3. Connect the components as shown in Picture 7
  4. In the Object Inspector, set the value of the "Frequency" property of the Clock Generator to 0.1 (Picture 8) This way, the generator will generate a clock once every 10 seconds
  5. Connect the "Out" pin of the AnalogSnapshot1 component (Picture 9) to the "Frequency" input pin of the SineAnalogGenerator1 (Picture 10)

Step 11: In Visuino Add Components to Enable/disable the Fan

  1. Type "compare" in the Filter box of the Component Toolbox, then select the "Compare Analog Value" component (Picture 1), and drop two of them in the design area
  2. In the Object Inspector for CompareAnalogValue1set the CompareType property to ctBigger and the Value property to 20 (Picture 2)
  3. In the Object Inspector for CompareAnalogValue2 set the CompareType property to ctSmaller and the Value property to 80 (Picture 3)
  4. Connect the Compare components as shown on Picture 4
  5. Type "and" in the Filter box of the Component Toolbox, then select the "Boolean And" component (Picture 5), and drop it in the design area
  6. Connect the "Out" pints of the CompareAnalogValue2 components to the inputs of the And1 component as shown in Picture 6
  7. Connect the "Out" pin of the And component (Picture 7) to the "Enabled" input property of the SineAnalogGenerator1 (Picture 8)

Step 12: And Chill...

On the pictures you can see the completed fan.

To generate the Arduino code, press F9 in Visuino. This will generate the Arduino code, and will open the Arduino IDE, where you can compile and upload the code to the Arduino board.

If you stand at front of the Sonic Ranger, and if the temperature in the room is above 20 degrees Celsius, the fan will start working.

If the temperature gets higher, the fan will wave faster.

In Picture 4 you can see the complete Visuino connection diagram,

You can change the starting temperature setting by modifying the Value property of the CompareAnalogValue1 component.

You can change the starting distance from the Ultrasonic Ranger setting by modifying the Value property of the CompareAnalogValue2 component.

By changing the values of the SubtractValue1 and MultiplyByValue1 components you can adjust how the speed of the fan will depend on the temperature.

I have also attached the Visuino project for this Instructabe, as well as a PDF file with the Visuino flag :-) .

You can download and open the project in Visuino : https://www.visuino.com

Enjoy the cool! :-)

Comments

author
ErwanD1 (author)2015-12-17

What are the advantages of using Visuino instead of the basic Arduino IDE? Is it just to have something more clear than just code lines?

author
BoianM (author)ErwanD12015-12-17

Actually the advantages are many IMHO. It takes seconds to develop things that will take hours in the Arduino IDE, and it also includes packaged communication, so you can easily monitor, and soon hopefully control multiple data channels directly from the IDE as you can see in the video :-)
You can also very easily modify a project from one board to completely different one. It also includes a support for number of items not supported in the Arduino in general including a number of Maxim Integrated chips. So there are a lot of advantages I think :-)

author
DragNfLyDale (author)2015-12-11

Hahaha I love it ;-)

author
BoianM (author)DragNfLyDale2015-12-11

Thank you! :-)

author
ThomasK19 (author)2015-12-11

Lol. "Cool" idea :-) Got my vote!

author
BoianM (author)ThomasK192015-12-11

Thank you for the vote :-)