Components and supplies
Fan
JustBoom IR Remote
Jumper wires (generic)
9V 1A Switching Wall Power Supply
IR receiver (generic)
Alphanumeric LCD, 16 x 2
Arduino UNO
Resistor 220 ohm
Rotary potentiometer (generic)
Tools and machines
Multitool, Screwdriver
Tape, Electrical
Wire Stripper & Cutter, 18-10 AWG / 0.75-4mm² Capacity Wires
Apps and platforms
Arduino IDE
Project description
Code
Digital Fan Code
arduino
Here is the code to build this fan
1/* Legal-Disclaimer 2This project is meant for informational purposes only! To better your knowledge on the concepts of electricity, electrical circuitry, entertainment component circuitry and all other wiring methods. DO NOT ATTEMPT ANY WIRING OF ANY KIND if you lack the knowledge and understanding required. Otherwise personal injury and/or death as well as property damage or loss could occur. 3 4WARNING 5 6Electricity is dangerous and can cause personal injury or DEATH as well as other property loss or damage if not used or constructed properly. If you have any doubts what so ever about performing do-it-yourself electrical work, PLEASE do the smart thing and hire a QUALIFIED SPECIALIST to perform the work for you. 7 8NEVER WORK WITH LIVE VOLTAGE. Always disconnect the power source before working with electrical circuits. 9 10When performing electrical work, ALWAYS READ AND FOLLOW THE MANUFACTURERS INSTRUCTIONS AND SAFETY GUIDELINES. Always follow your local electrical code and requirements which are specific to local areas. 11 12By utilizing this project and the information given, YOU are expressly holding "Orange (Youtube Account)" HARMLESS FOR ANY PROPERTY DAMAGE, PERSONAL INJURY AND/OR DEATH, OR ANY OTHER LOSS OR DAMAGE THAT MAY RESULT FROM YOUR ACTIONS. 13 14This information is provided for the use of individuals as they see fit! Orange and Youtube and all parties associated with it are not responsible for the use and results of this information by any party, especially those lacking sufficient skill or knowledge to perform these steps safely and ANY HAZARD CREATED IS THE SOLE RESPONSIBILITY OF THE USER.*/ 15 16// PROCEED AT YOUR OWN RISK 17 18 19 20#include <LiquidCrystal.h> 21#include <IRremote.h> 22 23int RECV_PIN = 12; // Pin no. on Arduino (Change depending on your Arduino) 24int Speed1 = 8; // Pin no. on Arduino (Change depending on your Arduino) 25int Speed2 = 9; // Pin no. on Arduino (Change depending on your Arduino) 26int Speed3 = 10; // Pin no. on Arduino (Change depending on your Arduino) 27int OSC = 11; // Pin no. on Arduino (Change depending on your Arduino) 28int relay[] = {0,0,0,0,0}; // no. of relays present / the state of the relay 29 30const int rs = 7, en = 6, d4 = 2, d5 = 3, d6 = 4, d7 = 5; // Pin no. on Arduino (Change depending on your Arduino) 31 LiquidCrystal lcd(rs, en, d4, d5, d6, d7); 32 33 34#define speed1 _________ // button code for speed no.1 (CHANGE Depending on your Button Code) 35#define speed2 _________ // button code for speed no.2 (CHANGE Depending on your Button Code) 36#define speed3 _________ // button code for speed no.3 (CHANGE Depending on your Button Code) 37#define power _________ // button code for ON/OFF (CHANGE Depending on your Button Code) 38#define Osc _________ // button code for Oscilation (CHANGE Depending on your Button Code) 39 40IRrecv irrecv(RECV_PIN); 41decode_results results; 42 43void setup() 44{ 45lcd.begin(16,2); // starts the LCD module 46lcd.print("Initilizing"); // prints "Initilizing" and starts to Initilize the fan 47lcd.setCursor(1,1); // sets the cursor to line 2, and moves 1 48lcd.print("Please Wait"); // prints "Please Wait" and tells the user to wait 49delay(500); // from lines 30 - 39, the display is making an animation 50lcd.setCursor(12,1); 51lcd.print("."); 52delay(500); 53lcd.setCursor(13,1); 54lcd.print("."); 55delay(500); 56lcd.setCursor(14,1); 57lcd.print("."); 58delay(500); 59lcd.clear(); 60lcd.print("Current Speed:"); // starts the UI (User Interface) 61lcd.setCursor(1,1); // sets the cursor to line 2, and moves 1 62lcd.print("0"); // displays the current speed of the fan 63 64Serial.begin(9600); // this line can be omitted as it tells the "SM" what button is pressed 65irrecv.enableIRIn(); // enables the IR reciver 66pinMode(Speed1, OUTPUT); // declares speed1 as an output 67pinMode(Speed2, OUTPUT); // declares speed2 as an output 68pinMode(Speed3, OUTPUT); // declares speed3 as an output 69pinMode(OSC, OUTPUT); // declares Oscilation as an output 70} 71 72void loop() { 73 if (irrecv.decode(&results)) { 74 unsigned int value = results.value; 75 switch(value) { 76 77 case speed1: 78 79 lcd.print(""); // clears the LCD 80 lcd.setCursor(1, 1); // sets the cursor 81 lcd.print("# 1"); // prints speed 1 82 83 if(relay[1] == 0) { 84 digitalWrite(Speed1, HIGH); // Sets the speed to 1 85 digitalWrite(Speed2, LOW); // makes sure that all other speeds are turned off to prevent multiple voltages going to the fan 86 digitalWrite(Speed3, LOW); // makes sure that all other speeds are turned off to prevent multiple voltages going to the fan 87 relay[1] == 1; // just an indicator for the program that speed 1 is currently ON 88} 89 90 break; 91 92 case speed2: 93 94 lcd.print(""); // clears the LCD 95 lcd.setCursor(1, 1); // sets the cursor 96 lcd.print("# 2"); // prints speed 2 97 98 if(relay[2] == 0) { 99 digitalWrite(Speed1, LOW); // makes sure that all other speeds are turned off to prevent multiple voltages going to the fan 100 digitalWrite(Speed2, HIGH); // sets the speed to 2 101 digitalWrite(Speed3, LOW); // makes sure that all other speeds are turned off to prevent multiple voltages going to the fan 102 relay[2] == 1; // just an indicator for the program that speed 2 is currently ON 103} 104 105 break; 106 107 case speed3: 108 109 lcd.print(""); 110 lcd.setCursor(1, 1); 111 lcd.print("# 3"); 112 113 if(relay[3] == 0) { 114 digitalWrite(Speed1, LOW); // makes sure that all other speeds are turned off to prevent multiple voltages going to the fan 115 digitalWrite(Speed2, LOW); // makes sure that all other speeds are turned off to prevent multiple voltages going to the fan 116 digitalWrite(Speed3, HIGH); // sets the speed to 3 117 relay[3] == 1; // just an indicator for the program that speed 3 is currently ON 118} 119 120 break; 121 122 case power: // when this button is pressed it will tell the fan to shut off all speeds and OSC 123 124 lcd.clear(); 125 lcd.print("Current Speed"); 126 lcd.setCursor(1, 1); 127 lcd.print("OFF"); 128 digitalWrite(Speed1, LOW); 129 digitalWrite(Speed2, LOW); 130 digitalWrite(Speed3, LOW); 131 digitalWrite(OSC, LOW); 132 133 break; 134 135 case Osc: 136 137 if(relay[4] == 0) { 138 lcd.setCursor(10, 1); // sets the cursor 139 lcd.print("SWING"); // prints "OSCIL." to indicate that OSC is activated 140 digitalWrite(OSC, HIGH); // sets the OSC motor to on 141 relay[4] = 1; // just an indicator for the program that OSC is currently activated 142 } 143 144 else { // turns off the OSC mode 145 lcd.setCursor(10, 1); // sets the cursor 146 lcd.print(" "); // clears the LCD that originally displayed OSCIL. 147 digitalWrite(OSC, LOW); // turns OFF the OSC motor 148 relay[4] = 0; // just an indicator that OSC is currently OFF 149 } 150 151 break; 152 153 } 154 Serial.println(value); // you can ommit this line 155 irrecv.resume(); // Receive the next value 156 } 157}
Button Code Finder
arduino
Use the code below to find out the decimal code assigned to your specific remote control First Connect your IR Receiver's sense pin to pin 12, then upload the code and use the Serial Monitor to find out each button's decimal ID, after collecting each decimal ID replace the code in the Digital Fan's button assignment
1#include <IRremote.h> 2int RECV_PIN = 12; // the pin where you connect the output pin of IR sensor (CHANGE Depending on your Arduino) 3IRrecv irrecv(RECV_PIN); 4decode_results results; 5void setup() 6{ 7Serial.begin(9600); 8irrecv.enableIRIn(); 9{ 10void loop() 11{ 12if (irrecv.decode(&results)) 13{ 14 int results.value = results; 15 Serial.println(" "); 16 Serial.print("Code: "); 17 Serial.println(results.value); 18 Serial.println(" "); 19 irrecv.resume(); 20}
Digital Fan Code
arduino
Here is the code to build this fan
1/* Legal-Disclaimer 2This project is meant for informational purposes only! To better your knowledge on the concepts of electricity, electrical circuitry, entertainment component circuitry and all other wiring methods. DO NOT ATTEMPT ANY WIRING OF ANY KIND if you lack the knowledge and understanding required. Otherwise personal injury and/or death as well as property damage or loss could occur. 3 4WARNING 5 6Electricity is dangerous and can cause personal injury or DEATH as well as other property loss or damage if not used or constructed properly. If you have any doubts what so ever about performing do-it-yourself electrical work, PLEASE do the smart thing and hire a QUALIFIED SPECIALIST to perform the work for you. 7 8NEVER WORK WITH LIVE VOLTAGE. Always disconnect the power source before working with electrical circuits. 9 10When performing electrical work, ALWAYS READ AND FOLLOW THE MANUFACTURERS INSTRUCTIONS AND SAFETY GUIDELINES. Always follow your local electrical code and requirements which are specific to local areas. 11 12By utilizing this project and the information given, YOU are expressly holding "Orange (Youtube Account)" HARMLESS FOR ANY PROPERTY DAMAGE, PERSONAL INJURY AND/OR DEATH, OR ANY OTHER LOSS OR DAMAGE THAT MAY RESULT FROM YOUR ACTIONS. 13 14This information is provided for the use of individuals as they see fit! Orange and Youtube and all parties associated with it are not responsible for the use and results of this information by any party, especially those lacking sufficient skill or knowledge to perform these steps safely and ANY HAZARD CREATED IS THE SOLE RESPONSIBILITY OF THE USER.*/ 15 16// PROCEED AT YOUR OWN RISK 17 18 19 20#include <LiquidCrystal.h> 21#include <IRremote.h> 22 23int RECV_PIN = 12; // Pin no. on Arduino (Change depending on your Arduino) 24int Speed1 = 8; // Pin no. on Arduino (Change depending on your Arduino) 25int Speed2 = 9; // Pin no. on Arduino (Change depending on your Arduino) 26int Speed3 = 10; // Pin no. on Arduino (Change depending on your Arduino) 27int OSC = 11; // Pin no. on Arduino (Change depending on your Arduino) 28int relay[] = {0,0,0,0,0}; // no. of relays present / the state of the relay 29 30const int rs = 7, en = 6, d4 = 2, d5 = 3, d6 = 4, d7 = 5; // Pin no. on Arduino (Change depending on your Arduino) 31 LiquidCrystal lcd(rs, en, d4, d5, d6, d7); 32 33 34#define speed1 _________ // button code for speed no.1 (CHANGE Depending on your Button Code) 35#define speed2 _________ // button code for speed no.2 (CHANGE Depending on your Button Code) 36#define speed3 _________ // button code for speed no.3 (CHANGE Depending on your Button Code) 37#define power _________ // button code for ON/OFF (CHANGE Depending on your Button Code) 38#define Osc _________ // button code for Oscilation (CHANGE Depending on your Button Code) 39 40IRrecv irrecv(RECV_PIN); 41decode_results results; 42 43void setup() 44{ 45lcd.begin(16,2); // starts the LCD module 46lcd.print("Initilizing"); // prints "Initilizing" and starts to Initilize the fan 47lcd.setCursor(1,1); // sets the cursor to line 2, and moves 1 48lcd.print("Please Wait"); // prints "Please Wait" and tells the user to wait 49delay(500); // from lines 30 - 39, the display is making an animation 50lcd.setCursor(12,1); 51lcd.print("."); 52delay(500); 53lcd.setCursor(13,1); 54lcd.print("."); 55delay(500); 56lcd.setCursor(14,1); 57lcd.print("."); 58delay(500); 59lcd.clear(); 60lcd.print("Current Speed:"); // starts the UI (User Interface) 61lcd.setCursor(1,1); // sets the cursor to line 2, and moves 1 62lcd.print("0"); // displays the current speed of the fan 63 64Serial.begin(9600); // this line can be omitted as it tells the "SM" what button is pressed 65irrecv.enableIRIn(); // enables the IR reciver 66pinMode(Speed1, OUTPUT); // declares speed1 as an output 67pinMode(Speed2, OUTPUT); // declares speed2 as an output 68pinMode(Speed3, OUTPUT); // declares speed3 as an output 69pinMode(OSC, OUTPUT); // declares Oscilation as an output 70} 71 72void loop() { 73 if (irrecv.decode(&results)) { 74 unsigned int value = results.value; 75 switch(value) { 76 77 case speed1: 78 79 lcd.print(""); // clears the LCD 80 lcd.setCursor(1, 1); // sets the cursor 81 lcd.print("# 1"); // prints speed 1 82 83 if(relay[1] == 0) { 84 digitalWrite(Speed1, HIGH); // Sets the speed to 1 85 digitalWrite(Speed2, LOW); // makes sure that all other speeds are turned off to prevent multiple voltages going to the fan 86 digitalWrite(Speed3, LOW); // makes sure that all other speeds are turned off to prevent multiple voltages going to the fan 87 relay[1] == 1; // just an indicator for the program that speed 1 is currently ON 88} 89 90 break; 91 92 case speed2: 93 94 lcd.print(""); // clears the LCD 95 lcd.setCursor(1, 1); // sets the cursor 96 lcd.print("# 2"); // prints speed 2 97 98 if(relay[2] == 0) { 99 digitalWrite(Speed1, LOW); // makes sure that all other speeds are turned off to prevent multiple voltages going to the fan 100 digitalWrite(Speed2, HIGH); // sets the speed to 2 101 digitalWrite(Speed3, LOW); // makes sure that all other speeds are turned off to prevent multiple voltages going to the fan 102 relay[2] == 1; // just an indicator for the program that speed 2 is currently ON 103} 104 105 break; 106 107 case speed3: 108 109 lcd.print(""); 110 lcd.setCursor(1, 1); 111 lcd.print("# 3"); 112 113 if(relay[3] == 0) { 114 digitalWrite(Speed1, LOW); // makes sure that all other speeds are turned off to prevent multiple voltages going to the fan 115 digitalWrite(Speed2, LOW); // makes sure that all other speeds are turned off to prevent multiple voltages going to the fan 116 digitalWrite(Speed3, HIGH); // sets the speed to 3 117 relay[3] == 1; // just an indicator for the program that speed 3 is currently ON 118} 119 120 break; 121 122 case power: // when this button is pressed it will tell the fan to shut off all speeds and OSC 123 124 lcd.clear(); 125 lcd.print("Current Speed"); 126 lcd.setCursor(1, 1); 127 lcd.print("OFF"); 128 digitalWrite(Speed1, LOW); 129 digitalWrite(Speed2, LOW); 130 digitalWrite(Speed3, LOW); 131 digitalWrite(OSC, LOW); 132 133 break; 134 135 case Osc: 136 137 if(relay[4] == 0) { 138 lcd.setCursor(10, 1); // sets the cursor 139 lcd.print("SWING"); // prints "OSCIL." to indicate that OSC is activated 140 digitalWrite(OSC, HIGH); // sets the OSC motor to on 141 relay[4] = 1; // just an indicator for the program that OSC is currently activated 142 } 143 144 else { // turns off the OSC mode 145 lcd.setCursor(10, 1); // sets the cursor 146 lcd.print(" "); // clears the LCD that originally displayed OSCIL. 147 digitalWrite(OSC, LOW); // turns OFF the OSC motor 148 relay[4] = 0; // just an indicator that OSC is currently OFF 149 } 150 151 break; 152 153 } 154 Serial.println(value); // you can ommit this line 155 irrecv.resume(); // Receive the next value 156 } 157}
Button Code Finder
arduino
Use the code below to find out the decimal code assigned to your specific remote control First Connect your IR Receiver's sense pin to pin 12, then upload the code and use the Serial Monitor to find out each button's decimal ID, after collecting each decimal ID replace the code in the Digital Fan's button assignment
1#include <IRremote.h> 2int RECV_PIN = 12; // the pin where you connect the output pin of IR sensor (CHANGE Depending on your Arduino) 3IRrecv irrecv(RECV_PIN); 4decode_results results; 5void setup() 6{ 7Serial.begin(9600); 8irrecv.enableIRIn(); 9{ 10void loop() 11{ 12if (irrecv.decode(&results)) 13{ 14 int results.value = results; 15 Serial.println(" "); 16 Serial.print("Code: "); 17 Serial.println(results.value); 18 Serial.println(" "); 19 irrecv.resume(); 20}
Downloadable files
Digital Fan Electronics Wiring
Schematic for Digital Fan
Digital Fan Electronics Wiring
Comments
Only logged in users can leave comments
fanele24
2 years ago
Sure, It can be done. However I need more information about the battery and charger that you are using; Please respond to this comment with your charger's specifications and your battery specifications, also tell what you use this battery for so that I can think of a optimal solution! Thanks, Fanele24
jay111
3 years ago
Hi fanele24, Cool project. I am looking for a solution for a problem that I am facing daily. I have a NiMh battery pack which needs to be charged to 241v DC. If I do not monitor the charger, it can over charge. So I need the charger to be shut off at 241v. Then I discharge it to 98v. Again, if I do not monitor the battery it can over discharge which can damage the battery. So I need the discharger to cut off at 98v. I have seen some use relays & circuits to achieve similar results. Is this something that can be done? Thanks in advance.