Go Down

Topic: Student Project -an LED RING(24LED) fade in and out with a micro PIR Sensor (Read 2877 times) previous topic - next topic


Dear Arduino Forum and Community,

I hope I post in the correct corresponding topic, if not, please note me further where I could find help.

My School Project:

I am a gold and silversmith, And handcrafted a new design of light object with the use of copper and silver. The idea is to make an electronic installment to let this object interact with human movement. But since I am specialized in the old crafting ways, electronic Codes are new for me. This is why I would like to ask the forum for help

I allready have this electronic installment:

- An Arduino Uno
  Connected to:
- Battery Pack
- On and Off Switch
- A loose PIR motion sensor (not connected anywhere yet) with three things on the bottom (looks like one minus, plus and grnd?)

I can already manually switch the LED ring on and off with the switch, which was pretty easy to do.
But I would like to let this LED ring FADE in when the PIR sensor detects Movement, burns for 10 seconds , and then FADES out again. Later to repeat this again.

I used this standard code which came with the Ada Fruit LED ring and made some changes to my specific wish:

Code: [Select]
// NeoPixel Ring simple sketch (c) 2013 Shae Erisson
// released under the GPLv3 license to match the rest of the AdaFruit NeoPixel library

#include <Adafruit_NeoPixel.h>
#include <avr/power.h>

// Which pin on the Arduino is connected to the NeoPixels?
// On a Trinket or Gemma we suggest changing this to 1
#define PIN            6

// How many NeoPixels are attached to the Arduino?
#define NUMPIXELS      24

// When we setup the NeoPixel library, we tell it how many pixels, and which pin to use to send signals.
// Note that for older NeoPixel strips you might need to change the third parameter--see the strandtest
// example for more information on possible values.
Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);

int delayval = 0; // delay for half a second

void setup() {
  // This is for Trinket 5V 16MHz, you can remove these three lines if you are not using a Trinket
#if defined (__AVR_ATtiny85__)
  if (F_CPU == 16000000) clock_prescale_set(clock_div_1);
  // End of trinket special code

  pixels.begin(); // This initializes the NeoPixel library.

void loop() {

  // For a set of NeoPixels the first NeoPixel is 0, second is 1, all the way up to the count of pixels minus one.

  for(int i=0;i<NUMPIXELS;i++){

    // pixels.Color takes RGB values, from 0,0,0 up to 255,255,255
    pixels.setPixelColor(i, pixels.Color(255,255,255)); // Moderately bright green color.

    pixels.show(); // This sends the updated pixel color to the hardware.

    delay(delayval); // Delay for a period of time (in milliseconds).


I would like to know where to connect the micro PIR motion detector, and what kind of code would suffice (or in what direction i have to search) for this idea and installment. I am willing to learn anything, and help acquiring further info if needed.

Thank you very much for your consideration and help!

Kind regards,


Try this for the pir sensor :

Try experimenting with the Adafruit Neo Pixels. It is the only way to learn.

Using something like :

for (byte intensity=0 ; intensity<250 ; intensity++)
  byte red=intensity;
  byte green=intensity;
  byte blue=intensity;

  pixels.setPixelColor(i, pixels.Color(red,green,blue));

by changing the values of red green and blue you can change color an intensity.

Good luck!

Go Up