Motion-activated light with PIR sensor and RGB LED
FunduinoLast updated on
Licht, das bei Bewegung von selbst angeht
You need this
SR602 motion detector - PIR sensor, 0-5 m, 3.3-15 V
2,27 € *Item no. F23107467About the product — SR602 motion detector - PIR sensor, 0-5 m, 3.3-15 V
RGB LED 10 mm - common cathode, 4 pins
0,55 € *Item no. F25110734About the product — RGB LED 10 mm - common cathode, 4 pins
Funduino UNO R3 Microcontroller - ATmega328P, 16 MHz, for Arduino
13,90 € *Item no. F23107480About the product — Funduino UNO R3 Microcontroller - ATmega328P, 16 MHz, for Arduino
Resistor Assortment 100 Pieces - 5 Values 100 Ω to 10 kΩ, 0.5 W
1,72 € *Item no. F23107216About the product — Resistor Assortment 100 Pieces - 5 Values 100 Ω to 10 kΩ, 0.5 W
830-point Breadboard - solderless breadboard for Arduino
2,90 € *Item no. FUN-1010553About the product — 830-point Breadboard - solderless breadboard for Arduino
Breadboard Cables Male-to-Male - 40 Pieces, 20 cm
1,74 € *Item no. FUN-1010558About the product — Breadboard Cables Male-to-Male - 40 Pieces, 20 cm
All 6 parts together 23,08 € *Ready to ship immediately · Delivery time: 1-3 business days
* All prices include statutory VAT, plus shipping costs.
How the Motion Light Works
Connect components
Upload sketch
Motion sensor light
const int pir = 2;
const int red = 9;
const int green = 10;
const int blue = 11;
void setup() {
pinMode(pir, INPUT);
pinMode(red, OUTPUT);
pinMode(green, OUTPUT);
pinMode(blue, OUTPUT);
}
void loop() {
if (digitalRead(pir) == HIGH) {
analogWrite(red, 255);
analogWrite(green, 255);
analogWrite(blue, 255);
delay(5000);
}
analogWrite(red, 0);
analogWrite(green, 0);
analogWrite(blue, 0);
}
Test the project
Troubleshooting and extending the lighting
Rate the instructions