Becky Button
Published © CC BY-NC-SA

Wireless Light Switch Manipulator

Have you ever gotten out of bed just to turn off or on the light switch? Well worry no more!

IntermediateFull instructions provided4 hours5,728
Wireless Light Switch Manipulator

Things used in this project

Hardware components

Arduino UNO & Genuino UNO
Arduino UNO & Genuino UNO
×2
Servos (Tower Pro MG996R)
×1
433 MHz Tranzmit and Recieve Module
×1

Software apps and online services

Arduino IDE
Arduino IDE

Hand tools and fabrication machines

3D Printer (generic)
3D Printer (generic)

Story

Read more

Custom parts and enclosures

Servo Enclosure

OpenSCAD Script for Servo Enclosure

Arduino Case

Schematics

Transmitter Circut

Receiver Circut

Code

Slave_Servo.ino

Arduino
#define rfReceivePin A0  //RF Receiver pin = Analog pin 0
 #define ledPin 13        //Onboard LED = digital pin 13
 #include <Servo.h>

 Servo  servo;

 unsigned int data = 0;   // variable used tostore received data
 const unsigned int upperThreshold = 70;  //upper threshold value
 const unsigned int lowerThreshold = 50;  //lower threshold value

 void setup(){
   pinMode(ledPin, OUTPUT);
   Serial.begin(9600);
   servo.attach(9);
 }

 void loop(){
   data=analogRead(rfReceivePin);    //listen for data on Analog pin 0
   
    if(data<upperThreshold){
     digitalWrite(ledPin, LOW);   //If a LOW signal is received, turn LED OFF
     Serial.println(data);
     servo.write(0);
   }
   
   if(data>lowerThreshold){
     digitalWrite(ledPin, HIGH);   //If a HIGH signal is received, turn LED ON
     Serial.println(data);
     servo.write(90);
   }
 }

Master_Remote.ino

Arduino
 #define rfTransmitPin 4  //RF Transmitter pin = digital pin 4
 #define buttonPin 2    
 #define led 13    
 
void setup() {
  // put your setup code here, to run once:
pinMode(rfTransmitPin, OUTPUT);     
   pinMode(buttonPin, INPUT);   
   pinMode(led, OUTPUT); 
   Serial.begin(9600);
}

int buttonState = 0; 

void loop() {
  // put your main code here, to run repeatedly:
buttonState = digitalRead(buttonPin);
   if (buttonState == HIGH) {
    // turn LED on:
    digitalWrite(rfTransmitPin, HIGH);
    digitalWrite(led, HIGH);
    Serial.println("transmit");
    delay(10);
  } else {
    // turn LED off:
    digitalWrite(rfTransmitPin, LOW);
    digitalWrite(led, LOW);
    Serial.println("no");
  }

}

Credits

Becky Button

Becky Button

3 projects • 25 followers
maker - hardware is my friend

Comments