Arduino Fairy Lights

Fairy lights that light up when the PIR sensor is triggered!


You'll need

  • x 1 9V battery
  • x 1 9V battery case
  • x 1 Arduino Uno
  • x1 PIR sensor
  • x 1 Fairy lights
  • Jumper wires/Connecting wires and wire stripper
  • Soldering iron
  • USB cable
  • Working laptop/computer

Step 1

Instructions

Making the Connections

Use the soldering iron to melt the solder that connects the wires to the battery pack and switch. Remove the battery pack and switch, you won't be needing them for this project.

Using the wire stripper, remove the ends of the wires of the fairy lights. Solder the end of each wire to a jumper wire. Connect one jumper wire to Digital Pin ~9 and the other to Ground (GND) on the Arduino.




Materials

  1. Fairy lights
  2. Arduino Uno
  3. Jumper wires
  4. Wire stripper
  5. Soldering iron

Step 2

Instructions

Connect a jumper wire to each of the 3 ends of the PIR sensor. The red wire on the PIR sensor should be connected to the 5V pin on the Arduino. Connect the yellow wire to Digital Pin 2 (PWM~) and the black wire to Ground (GND).




Materials

  1. PIR sensor
  2. Arduino Uno

Step 3

Instructions

Writing the Code

Download the Arduino software on your laptop/computer here. Make sure "Board: Arduino/Genuino Uno" is indicated under Tools, and plug your Arduino Uno board into the laptop/computer with your USB cable.

Now you're ready to start coding!




Materials

  1. Arduino Uno
  2. USB cable
  3. Working laptop/computer

Step 4

Instructions

Define the following integer values for the LED fairy lights and the PIR sensor. Set the PIR pin as input, and the LED pin as output.




Materials

  1. Arduino Uno
  2. USB cable
  3. Working laptop/computer

Step 5

Instructions

Code for the LED fairy lights to light up for 6 seconds and then turn off when the PIR sensor is triggered. If the PIR sensor is not triggered, the LED fairy lights should remain turned off.

You're done with the code now! Upload your code onto your Arduino board, and unplug it from your computer.




Materials

  1. Arduino Uno
  2. USB cable
  3. Working laptop/computer

Step 6

Instructions

Finishing Up

Place the 9V battery in the battery holder. Solder the wires on the battery holder to a jumper wire each. Connect the black wire to Ground (GND) and the red wire to the VIN pin.

There you have it, the ultimate room decor.




Materials

  1. 9V battery
  2. 9V battery holder
  3. Jumper wires
  4. Arduino Uno

Code and References

Completed this tutorial?

Spread the word! Let's get this trending on social media with #letsgethacking #ArduinoFairyLights