Project showcase
PIR-Sensor Activated RGB Strip Controlled by Uno R3

PIR-Sensor Activated RGB Strip Controlled by Uno R3 © GPL3+

At my age you have to get up at night and tend to be tired on the way to the bathroom. Use a PIR-Sensor to trigger the light on!

  • 6 respects

Components and supplies

Apps and online services

About this project


Based on my My PIR project with a Particle Photon, I copied it here with the components of Seeedstudio. With the Grove components, simple plug and play is possible.

A second power supply is needed (one for operating the LED strip and one for the Arduino itself). Otherwise, I could quickly adjust my code. This solution is designed without WLAN. For my motivation and my application scenario, please read the photon project.

You can purchase Grove kits, so you can install additional Grove components and expand the solution, for example, by a button. I wish lots of success and a lot of light in dark corners!

What it looks like 

An schematic picture is not available: put the grove base shield with the pins on top the Arduino Uno. Thats all.

Examples from Grove

Further examples with a introduction in components from Grove Starter Kit can be found here:

More projects under my account.


MyPIR with Grove Components on Arduino UnoC/C++
// BOM
// 1x Arduino UNO R3
// 1x Grove Base Shield V2 for Arduino from
// 1x Grove LED Strip Driver V1.2 from
// 1x Grove Light Sensor V1.2 from
// 1x PIR Sensor Standard
// 1x one colored Standard LED
// 6x Jumper-cable for Standard LED and PIR Sensor
// 2x Grove 4pin Jumper from to plug there components
// 1x 12V 1A or 2A power output to power LED Strip
// 1x 5V power jack to power your Arduino Uno
// 1x power adapter from power jack (12V) to connect jumpers to power an LED Strip Driver
// 1x 4pin Standard cable to connect from LED Strip Driver to analog RGB Strip
// in my case I soldered the 4pin cable to the analog RBG Strip
// for flashing from your Desktop ( to Arduino UNO is an USB-cable necessary

// MyPIR - v1.0 - Ingo Lohs - 17.04.2017

// LEDStripDriver - Version: Latest from seeedstudio - download libary here:
#include <RGBdriver.h>

#define CLK 2 // pin definitions for the driver        
#define DIO 3
RGBdriver Driver(CLK,DIO);           // create instance for LED Driver Stripe

const int inputPin = 8;              // choose the input pin (for PIR sensor)
const int ledPin = 4;                // Standard LED connected to digital pin 4 to check that PIR Sensor works
int pirState = LOW;                  // we start, assuming no motion detected
int val = 0;                         // variable for reading the pin status
int analogvalue;                     // variable for environment light
int calibrateTime = 10000;           // wait for the thingy to calibrate
float light_threshold = 200;         // max brightness is presents with value 1304; decide its time for more light - adjust this value according to your needs
#define photoresistor A0             // photoresistor for reading analog values - bought by
void setup() {
  pinMode(photoresistor,INPUT);      // Our photoresistor pin is input     

    // LED Stripe off
  Driver.begin(); // begin
  Driver.SetColor(0, 0, 0); // set analog RBG Strip off
void loop() {
  // check to see what the value of the photoresistor is and store it in the int variable analogvalue
  analogvalue = analogRead(photoresistor);
  Serial.println(analogvalue); // --> output to Serial Monitor 
  // if the sensor is calibrated
  if ( calibrated() )
  // get the data from the sensor
  // report it out, if the state has changed

void readTheSensor() {
  val = digitalRead(inputPin);

bool calibrated() {
  return millis() - calibrateTime > 0;

void reportTheData() {

  // if the sensor reads high
  // or there is now motion
  if (val == HIGH) {

    // the current state is no motion
    // i.e. it's just changed
    // announce this change by publishing an eent
    if (pirState == LOW) {
      // we have just turned on
      Serial.println("Motion detected - Control LED is on, but analogvalue from environment > light_threshold");  

      pirState = HIGH;
      setLED( pirState );

        if (analogvalue < light_threshold) {
                Serial.println("Motion detected - spot lights on");
        } //else {


  } else {
    if (pirState == HIGH) {
      // we have just turned of
      // Update the current state
      pirState = LOW;
      setLED( pirState );

void setLED( int state )

void ColorFade() {

  // LED Stripe on
  Driver.begin(); // begin
  Driver.SetColor(255, 255, 255); //all RGB colors on
  delay(15000); // 15 sec on
  // LED Stripe off
  Driver.SetColor(0, 0, 0); // all RGB colors off


Similar projects you might like

Multicolor Knight Rider with RGB PL9823 LED + Arduino UNO

Project tutorial by Giovanni Gentile

  • 1 comment
  • 19 respects

Motor Controlled with Arduino

by Benjamin Larralde

  • 92 respects

Arduino controlled RGB LED strip

Project tutorial by Raphael Nestler and Danilo Bargen

  • 36 respects

Control RGB LED using Bluetooth

Project showcase by kamatalaashish

  • 21 respects

Motion Activated Night Light

Project tutorial by Haziq Afandi

  • 8 respects
Add projectSign up / Login