Making A Remote Sensing LED Strip With A Relay And Arduino

This is my remote sensing LED strip with a relay and Arduino. I saw s similar video a few years ago and wanted to do this myself. I tried to find that video so I could post a link here, but I never found it.

I did find this video which I used for inspiration:

This is a list of items I used in this project:

Mode Electronics – Warm White Water Resistant LED strip 1m 12vDC@400mA
Circuit-Test Switching Power Supply 12vDC 3A
OSEPP PIR Sensor 9v-12v
Seeed Studio/Grove Relay
Seeed Studio/Grove Relay Shield
Seeed Studio Screw Shield
On/Off Switch 2.1mm x 5.5mm male/female
A/B USB cable

const int ledPin = 5;
const int sensorPin = 4;
const long stayOnPeriod = 900000; // length of time to stay on (in milliseconds)

unsigned long turnOffTime = millis(); //Start with the led turned off

void setup() {
pinMode(ledPin, OUTPUT);
pinMode(sensorPin, INPUT);

void loop() {
// check if the sensor is detecting then increase the time to stay on.
if (digitalRead(sensorPin) == HIGH)
turnOffTime = millis() + stayOnPeriod;

if (turnOffTime > millis())
digitalWrite(ledPin, HIGH);
digitalWrite(ledPin, LOW);

Leave a Reply

Your email address will not be published. Required fields are marked *