Day 9 Solid State Relay, AC Fan Dimmer , DC Fan dimmer
Task
1) Make Solid State Relay
2) Make a AC fan Dimmer
3) Make a 3-4 Step Fan dimmer for Arduino
4) IR remote control Fan dimmer
5) DC fan Dimmer using Moter driver IC and PWM signal
How to make Solid State Relay
----------------------------------------------------------------------------------------------------------------------
How to Make AC fan Dimmer
How to make Remote control Fan dimmer
3 step Fan dimmer
#include <IRremote.h>
int RECV_PIN = 11;
IRrecv irrecv(RECV_PIN);
decode_results results;
int FanSpeed1=6;
int FanSpeed2=7;
int FanSpeed3=8;
int fanspeed=0;
void setup()
{
Serial.begin(9600);
pinMode(FanSpeed1,OUTPUT);
pinMode(FanSpeed2,OUTPUT);
pinMode(FanSpeed3,OUTPUT);
digitalWrite(FanSpeed1,0);
digitalWrite(FanSpeed2,0);
digitalWrite(FanSpeed3,0);
irrecv.enableIRIn(); // Start the receiver
Serial.println("Enabled IRin");
}
void loop() {
if (irrecv.decode(&results)) {
Serial.println(results.value, HEX);
Serial.println(results.value, DEC);
// Receive the next value
if (results.value==16740495){ //UP button
Serial.println("Fan speed up");
fanspeed=fanspeed+1;
if (fanspeed>3){fanspeed=3;}
delay(200);
}
if (results.value==16734375){ // Down button
Serial.println("Fan speed down");
fanspeed=fanspeed-1;
if (fanspeed<0){fanspeed=0;}
delay(200);
}
if (results.value==16752735){ // OK button stop fan
Serial.println(" ");
delay(100);
}
irrecv.resume();
}
if (fanspeed==0){
Serial.println("Fan speed 0");
digitalWrite(FanSpeed1,0);
digitalWrite(FanSpeed2,0);
digitalWrite(FanSpeed3,0);
}
if (fanspeed==1){
Serial.println("Fan speed 1");
digitalWrite(FanSpeed1,1);
digitalWrite(FanSpeed2,0);
digitalWrite(FanSpeed3,0);
}
if (fanspeed==2){
Serial.println("Fan speed 2");
digitalWrite(FanSpeed1,1);
digitalWrite(FanSpeed2,1);
digitalWrite(FanSpeed3,0);
}
if (fanspeed==3){
Serial.println("Fan speed 3");
digitalWrite(FanSpeed1,1);
digitalWrite(FanSpeed2,1);
digitalWrite(FanSpeed3,1);
}
delay(100);
}
--------------------------------------------------------------------
Five step AC 220 Volt Fan dimmer by Manmohan Pal
I R remote for Fan Regulator
#include <IRremote.h>
int RECV_PIN = 11;
IRrecv irrecv(RECV_PIN);
decode_results results;
int FanSpeed1=10;
int FanSpeed2=12;
byte fanspeed1status=0;
byte fanspeed2status=0;
void setup()
{
Serial.begin(9600);
pinMode(FanSpeed1,OUTPUT);
pinMode(FanSpeed2,OUTPUT);
digitalWrite(FanSpeed1,fanspeed1status);
digitalWrite(FanSpeed2,fanspeed2status);
// In case the interrupt driver crashes on setup, give a clue
// to the user what's going on.
Serial.println("Enabling IRin");
irrecv.enableIRIn(); // Start the receiver
Serial.println("Enabled IRin");
}
void loop() {
if (irrecv.decode(&results)) {
Serial.println(results.value, HEX);
Serial.println(results.value, DEC);
irrecv.resume(); // Receive the next value
if (results.value==16740495){ //UP button
Serial.println("Fan HIGH");
fanspeed1status=1;
fanspeed2status=1;
delay(100);
}
if (results.value==16734375){ // Down button
Serial.println("Fan LOW");
fanspeed1status=1;
fanspeed2status=0;
delay(100);
}
if (results.value==16752735){ // OK button stop fan
Serial.println("Fan OFF");
fanspeed1status=0;
fanspeed2status=0;
delay(100);
}
}
delay(100);
digitalWrite(FanSpeed1,fanspeed1status);
digitalWrite(FanSpeed2,fanspeed2status);
}
----------------------------------------------------------------------------------------------------------------------
No comments:
Post a Comment