How to Build a DIY Electronic Device to Automatically Turn Off Your Lights and Save on Your Electric Bill

Building a DIY electronic device to automatically turn off your lights can help you save money on your electric bill. With some basic electronic components and a bit of tinkering, you can create a simple automation device that turns lights off when you leave a room. Here is a step-by-step guide on how to build your own automatic light switch off device.

What You Will Need

To build the automatic light switch off device, you will need the following components:

Optional components:

Circuit Design

Here is how to connect the components together:

The motion sensor detects movement and sends a HIGH signal to the Arduino. The Arduino reads this signal and triggers the relay to turn on the light. When motion is no longer detected, the relay turns the light back off.

Programming the Arduino

The Arduino code needs to do the following:

Here is example code to achieve this:

```cpp
// Motion sensor on pin 2
int motionSensor = 2;

// Relay on pin 4
int relay = 4;

void setup() {

// Set relay as output
pinMode(relay, OUTPUT);

// Set motionSensor as input
pinMode(motionSensor, INPUT);
}

void loop(){

// Check if motion detected
if (digitalRead(motionSensor) == HIGH) {

// Turn ON relay (and light)
digitalWrite(relay, HIGH);

}
else {

// Turn OFF relay (and light)
digitalWrite(relay, LOW);

}

// Small delay
delay(200);
}
```

This code turns the relay and light on when motion is detected. It turns them off a few moments after motion is no longer detected.

Installation Tips

Here are some tips for installing the finished device:

Conclusion

Building your own automatic light switch off device is an easy Arduino project that can save energy and money. With basic electronic components like a motion sensor, relay, and Arduino, you can create a simple automation system to turn lights off automatically when you leave a room. Install it in any indoor lighting fixture to start saving electricity!