├── .gitattributes └── Fan_Speed_Regulator_using_Blynk └── Fan_Speed_Regulator_using_Blynk.ino /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /Fan_Speed_Regulator_using_Blynk/Fan_Speed_Regulator_using_Blynk.ino: -------------------------------------------------------------------------------- 1 | /************************************************************* 2 | This is the code for making your own Fan Regulator that works over internet using Blynk IoT Platform 3 | 4 | A full tutorial video on this project is uploaded on my YouTube channel. 5 | Have a look over it to know more 6 | 7 | techiesms YouTube Channel - https://www.youtube.com/techiesms 8 | 9 | Code written by - Sachin Soni 10 | Code written on - 11.07.20 11 | 12 | Download latest Blynk library here: 13 | https://github.com/blynkkk/blynk-library/releases/latest 14 | 15 | techiesms 16 | explore | learn | share 17 | 18 | 19 | *************************************************************/ 20 | 21 | /* Comment this out to disable prints and save space */ 22 | #define BLYNK_PRINT Serial 23 | 24 | 25 | #include 26 | #include 27 | #include 28 | 29 | #define Speed1 21 30 | #define Speed2 19 31 | #define Speed4 18 32 | 33 | 34 | // You should get Auth Token in the Blynk App. 35 | // Go to the Project Settings (nut icon). 36 | char auth[] = "fmjTsPbnvXbnNDyzmXik9AtI0uaQSh4n"; 37 | 38 | // Your WiFi credentials. 39 | // Set password to "" for open networks. 40 | char ssid[] = "SmS_jiofi"; 41 | char pass[] = "sms123458956"; 42 | 43 | BLYNK_WRITE(V0) 44 | { 45 | int fan_speed = param.asInt(); // assigning incoming value from pin V1 to a variable 46 | if (fan_speed == 0) 47 | { 48 | //All realys Off - Fan Off 49 | 50 | digitalWrite(Speed1, HIGH); 51 | digitalWrite(Speed2, HIGH); 52 | digitalWrite(Speed4, HIGH); 53 | } 54 | 55 | if (fan_speed == 1) 56 | { 57 | //Speed1 Relay On - Fan at speed 1 58 | 59 | digitalWrite(Speed1, HIGH); 60 | digitalWrite(Speed2, HIGH); 61 | digitalWrite(Speed4, HIGH); 62 | delay(500); 63 | digitalWrite(Speed1, LOW); 64 | } 65 | 66 | if (fan_speed == 2) 67 | { 68 | //Speed2 Relay On - Fan at speed 2 69 | 70 | digitalWrite(Speed1, HIGH); 71 | digitalWrite(Speed2, HIGH); 72 | digitalWrite(Speed4, HIGH); 73 | delay(500); 74 | digitalWrite(Speed2, LOW); 75 | } 76 | 77 | if (fan_speed == 3) 78 | { 79 | //Speed1 & Speed2 Relays On - Fan at speed 3 80 | 81 | digitalWrite(Speed1, HIGH); 82 | digitalWrite(Speed2, HIGH); 83 | digitalWrite(Speed4, HIGH); 84 | delay(500); 85 | digitalWrite(Speed1, LOW); 86 | digitalWrite(Speed2, LOW); 87 | } 88 | 89 | if (fan_speed == 4) 90 | { 91 | //Speed4 Relay On - Fan at speed 4 92 | 93 | digitalWrite(Speed1, HIGH); 94 | digitalWrite(Speed2, HIGH); 95 | digitalWrite(Speed4, HIGH); 96 | delay(500); 97 | digitalWrite(Speed4, LOW); 98 | } 99 | // process received value 100 | } 101 | 102 | void setup() 103 | { 104 | // Debug console 105 | Serial.begin(115200); 106 | 107 | pinMode(Speed1, OUTPUT); 108 | pinMode(Speed2, OUTPUT); 109 | pinMode(Speed4, OUTPUT); 110 | 111 | //Initially the fan will be in OFF state 112 | digitalWrite(Speed1, HIGH); 113 | digitalWrite(Speed2, HIGH); 114 | digitalWrite(Speed4, HIGH); 115 | 116 | 117 | Blynk.begin(auth, ssid, pass); 118 | } 119 | 120 | void loop() 121 | { 122 | Blynk.run(); 123 | } 124 | --------------------------------------------------------------------------------