In this article, I will walk you through the process of building a simple do-it-yourself (DIY) electronic device that can solve a common problem that most people encounter in their daily lives. With just a few common components and basic skills, you can make a useful gadget in no time.

Identifying a Problem to Solve

The first step is to identify a common frustration or issue that could be solved with a simple electronic device. Here are some potential problems to consider:

I decided to focus on the issue of forgetting to turn off lights and appliances. This wastes electricity and money, so a device that can automatically shut off lights or electronics after a set period of inactivity would be very handy.

Selecting the Right Electronic Components

Now that I've identified the problem, it's time to figure out what electronic components I'll need to build the device. Here are the main items:

Prototyping on a Breadboard

With my components selected, it's time to build the circuit. I'll first prototype it on a solderless breadboard so I can test the functionality and make modifications easily.

Here are the steps I followed to construct the prototype circuit on the breadboard:

  1. Connect the 5V and GND pins from the Arduino to power and ground bus rows on the breadboard.
  2. Insert the PIR motion sensor on the breadboard and connect the VCC, GND, and OUT pins.
  3. Connect the IN pin on the relay module to a digital I/O pin on the Arduino.
  4. Connect the VCC and GND from the relay to power and ground.
  5. Connect the power supply to the Arduino and breadboard power rails.

At this point, I have a simple circuit that can detect motion with the PIR sensor and activate the relay based on a program I'll load onto the Arduino.

Programming the Arduino

Now for the brains of the operation - the Arduino program code. I wrote the following program to accomplish the automation logic I want:

const int pirPin = 3; //input from PIR sensor
const int relayPin = 4; //output to relay

void setup() {

pinMode(pirPin, INPUT);
pinMode(relayPin, OUTPUT);

digitalWrite(relayPin, HIGH); //turn on relay initially


void loop(){

if(digitalRead(pirPin) == LOW){ //if no motion

digitalWrite(relayPin, LOW); //turn off relay after 5 seconds



digitalWrite(relayPin, HIGH); //turn on if motion detected



This checks the PIR sensor continuously in a loop. If no motion is detected for 5 seconds, it turns the relay and connected device off. But it immediately turns back on when motion is detected again.

Assembling the Final Device

With the circuit functioning correctly on the breadboard, I just need to assemble it into a permanent device. I soldered the components onto a prototype perfboard with some headers for the Arduino. I added a hobby enclosure, switches, and a DC power jack.

Some tips for assembly:

And that's it! I now have a working DIY device that can automatically shut off lights and appliances to save power when I leave a room. Pretty handy for such a simple gadget!

Potential Improvements and Iterations

While functional, there are some ways this device could be enhanced:

The great thing about DIY electronics is that it's easy to test ideas and iterate on a basic concept. I may try some of these upgrades in the future!

So in summary, with just a few common components, basic DIY skills, and a simple Arduino program, I was able to create an automated power-saving device. Let me know if you build your own version or have ideas for other useful electronic gadgets!