Khloud Mohamed
Published © GPL3+

Control a Fan with Your Mobile Phone

I want to show you how to control your room's fan just with your mobile phone, also you can use the same idea to control all house fans.

IntermediateShowcase (no instructions)3 hours5,145
Control a Fan with Your Mobile Phone

Things used in this project

Story

Read more

Schematics

How to connect

Code

Control room's Fan by your mobile phone

Arduino
Upload the code on Arduino IDE, then burn it to Arduino board.
/*Write the code on the Arduino program and upload it to the Arduino.*/

#define CUSTOM_SETTINGS

/* Include 1Sheeld slider library. */

#define INCLUDE_SLIDER_SHIELD

/* Include 1Sheeld library. */

#include

/* Define a variable to hold the value of the slider. */
int value;

/* A name for the fan on pin 3. */
int MotorPin = 3;

int LedPin=13;

int TempLevel;

/* A name for the temperature sensor LM 35 on pin A0. */
const int TempSensor=A0;

void setup()

{

/* Start communication. */

OneSheeld.begin();

/* Set the motor pin as output. */
pinMode(MotorPin,OUTPUT);

/* Set the LED pin as output. */

pinMode(LedPin,OUTPUT); }

void loop()

{

/* Read analogvalues from temprature sensor */
TempLevel=analogRead(TempSensor);

TempLevel=TempLevel*0.4828125;

/* Print the temperature on the serial monitor */

Serial.print("Temprature = ");

Serial.print(TempLevel);

Serial.print("C");

Serial.println();

if(TempLevel>30)

{

digitalWrite(LedPin,HIGH);

}

/* Always get the value of the slider and output it as PWM to pin 3 to control the fan speed . */

value = Slider.getValue();

analogWrite(MotorPin,value);

}

Credits

Khloud Mohamed

Khloud Mohamed

4 projects • 7 followers
Bio-medical engineer and interested in embedded systems projects and designing.

Comments