author
1Instructables26,008Views24CommentsJoined November 10th, 2015

Tell us about yourself!

Complete Your Profile

Achievements

10K+ Views Earned a bronze medal
  • snikogos commented on snikogos's instructable LED NeoPixel Motion Sensor Stair Lighting9 months ago
    LED NeoPixel Motion Sensor Stair Lighting

    There are 3 connections if you're using a ws2812b LED strip. Data in (from an arduino pin), +5V DC power and Ground (GND).Hope that helps.

    View Instructable »
  • snikogos commented on snikogos's instructable LED NeoPixel Motion Sensor Stair Lighting10 months ago
    LED NeoPixel Motion Sensor Stair Lighting

    Millis is milliseconds.

    View Instructable »
  • snikogos commented on snikogos's instructable LED NeoPixel Motion Sensor Stair Lighting10 months ago
    LED NeoPixel Motion Sensor Stair Lighting

    Arduinos and i believe any microcontroller does not support multithreading meaning, it cannot perform 2 tasks at once. For example, it cannot monitor the bottom sensor while the top has been activated. I dont understand why you need the bottom sensor polling if the top sensor has been activated. If the top sensor is activated, then the lights are on so there is no need to activate the bottom sensor.If the issue is that it takes the person longer to go down the stairs and the light turn off, I would suggest increasing the delay time that the lights stay on for. Or using a PIR sensor and mount it up high to monitor the entire stair area and code in such a way that the light stay on when the sensor it triggered.There are ways to make the arduino do 2 things at once through using millis and...

    see more »

    Arduinos and i believe any microcontroller does not support multithreading meaning, it cannot perform 2 tasks at once. For example, it cannot monitor the bottom sensor while the top has been activated. I dont understand why you need the bottom sensor polling if the top sensor has been activated. If the top sensor is activated, then the lights are on so there is no need to activate the bottom sensor.If the issue is that it takes the person longer to go down the stairs and the light turn off, I would suggest increasing the delay time that the lights stay on for. Or using a PIR sensor and mount it up high to monitor the entire stair area and code in such a way that the light stay on when the sensor it triggered.There are ways to make the arduino do 2 things at once through using millis and or coding. I do not have much experience coding in this way but you can search for "arduino multithreading" and research how this is done through coding. With using the "delay" function, you prohibit the arduino to do any other tasks, therefore while using millis. Also interrupts can help you acheive what you want. https://www.arduino.cc/en/Reference/InterruptsI hope that helps.

    Hellow Vidar,To acheive a fading effect you have to write a for loop to loop through brightness values 0-255. And an algorithm to make each RGB value at each brightness. below is a code snippet of what I am talking about: for(uint8_t b=0; b <255; b++) { \\for every brightness from 0 to 255 for(uint8_t i=0; i < strip.numPixels(); i++) { //turn on each pixel i until less than the strip length strip.setPixelColor(i, red*b/255, green*b/255, blue*b/255); // this keeps the correct RBG color but controlls the brightness } strip.show(); delay(wait); };You would put this in the colorwipeup/colorwipedown functions.I had tried fading myself when I was coding but found it impractical because it takes so long to light up each step. So do some testing. When i activated o...

    see more »

    Hellow Vidar,To acheive a fading effect you have to write a for loop to loop through brightness values 0-255. And an algorithm to make each RGB value at each brightness. below is a code snippet of what I am talking about: for(uint8_t b=0; b <255; b++) { \\for every brightness from 0 to 255 for(uint8_t i=0; i < strip.numPixels(); i++) { //turn on each pixel i until less than the strip length strip.setPixelColor(i, red*b/255, green*b/255, blue*b/255); // this keeps the correct RBG color but controlls the brightness } strip.show(); delay(wait); };You would put this in the colorwipeup/colorwipedown functions.I had tried fading myself when I was coding but found it impractical because it takes so long to light up each step. So do some testing. When i activated one of the sensors, I could be at the top of the stairs already and the arduino is still fading the steps. So a slow fade on is not practical. A fade out might look nice.Hope that helps! Good luck!

    Contact me through here with your questions. I am not familiar with how the rings work, but if it is ws2812B then it should be similar addressing to activate the LEDs

    View Instructable »
  • snikogos commented on snikogos's instructable LED NeoPixel Motion Sensor Stair Lighting10 months ago
    LED NeoPixel Motion Sensor Stair Lighting

    How many steps do you have? The below relay would allow you to control up to 16 channels/steps:https://www.amazon.com/SainSmart-101-70-103-16-Channel-Relay-Module/dp/B0057OC66UArduino uno has 14 digital IOs but if you do a little research, i think you can use the analog outputs like a digital 1. As for coding, search an instructable that shows you how to activate the relays. And you can add delay (waittime) between activating eacg step relay to get you desired look and functionality. See in comments below about adding an ldr to the pir sensor so it only activates in dark light. Unfortunately i do not have time to straight up write a code for you but if i do find time, i can help you debugged/plan the code. Let me know if you have any other questions. Wish you luck on your build!

    View Instructable »
  • snikogos commented on snikogos's instructable LED NeoPixel Motion Sensor Stair Lighting10 months ago
    LED NeoPixel Motion Sensor Stair Lighting

    Awesome find SimtechBen. thank you for the share, i will definitely have to try this out and I will let update on how this works! Have a great day!

    View Instructable »
  • snikogos commented on snikogos's instructable LED NeoPixel Motion Sensor Stair Lighting10 months ago
    LED NeoPixel Motion Sensor Stair Lighting

    Thank you dallas Sommers. Take a look at all of step 4 images. there is a close up of how i terminate the led strips to protect all circuitry to prevent shocking anyone! I use a dot of silicone and i think it was 1/2" heat strink to termimate each end where wires were soldered. I would suggest doing this in a similar manner and never leaving circuits exposed especially is there are kids of animals around. Although 5 volts and the low amperage wont kill anyone, it will prolong the life of your project meanwhile keeping everyone safe. Wish you luck on your build and feel free to share pictures once youve completed it!Let me know if you have any other questions.

    You're very welcome! Good luck!

    View Instructable »
  • snikogos commented on snikogos's instructable LED NeoPixel Motion Sensor Stair Lighting10 months ago
    LED NeoPixel Motion Sensor Stair Lighting

    Thank you for the positive feedback michail1!

    Thank you for the positive feedback samee14326. Sorry for the late reply, see my feedback to your questions below. 1. colourWipeDown(strip.Color(50, 50, 30), 40); // Warm Whitethe brightness is controlled by 0-255 values for the RGB values. 0 is off and 255 is the brightest. In my case, 50,50,30 is a warm white at about 20% brightness.2. I used 300/meter and have about 10 meters. My code currently works with WS2812b pixels.Adafruit_NeoPixel strip = Adafruit_NeoPixel(525, PIN, NEO_GRB + NEO_KHZ800);you can change NEO_KHZ800 to NEO_KHZ400 to work with WS2811 drivers.3. As long as you do the power calculations for your application, you can use any power supply. However, a laptop charger usually outputs 18V so you would have to set it down to 5V which is required by the neopixels. You ma...

    see more »

    Thank you for the positive feedback samee14326. Sorry for the late reply, see my feedback to your questions below. 1. colourWipeDown(strip.Color(50, 50, 30), 40); // Warm Whitethe brightness is controlled by 0-255 values for the RGB values. 0 is off and 255 is the brightest. In my case, 50,50,30 is a warm white at about 20% brightness.2. I used 300/meter and have about 10 meters. My code currently works with WS2812b pixels.Adafruit_NeoPixel strip = Adafruit_NeoPixel(525, PIN, NEO_GRB + NEO_KHZ800);you can change NEO_KHZ800 to NEO_KHZ400 to work with WS2811 drivers.3. As long as you do the power calculations for your application, you can use any power supply. However, a laptop charger usually outputs 18V so you would have to set it down to 5V which is required by the neopixels. You may also use a PSU for a desktop computer by that also would require a setdown to 5v. SMP power supplies are fairly cheap and they work well.4. void colourWipeDown(uint32_t c, uint16_t wait) this function calls the color (variable c) and the wait time between steps. So when you call the function: colourWipeDown(strip.Color(255, 255, 250), 25 ); // Warm White25ms is the wait time between each step.So you can increase this number to slow down each step. I played around with this value and found 25 to be the best.5. Take a look at this instructable to add a display: https://www.instructables.com/id/Connecting-an-LCD...As for modes, you can write new functions and add a button to cycle through the modes and it can display which mode is activated on the LCD display. This is too indepth to answer in a question and would require a moderate/expert programming skill.6. You would need to create 3 variables for RGB values and a random number generator to generate values from 0 to 255.Try this in a new sketch:void setup() { // put your setup code here, to run once:Serial.begin(9600);for (int n =0; n<5; n++){ int R = random(0,255); int G = random(0,255); int B = random(0,255); Serial.print("RGB: "); Serial.print(R); Serial.print(","); Serial.print(G); Serial.print(","); Serial.print(B); Serial.println();}}This will generate 5 random RGB values and show them in SerialLet me know if you have any other questions! Good luck on your build!

    See below post.

    View Instructable »
  • snikogos commented on snikogos's instructable LED NeoPixel Motion Sensor Stair Lighting11 months ago
    LED NeoPixel Motion Sensor Stair Lighting

    Thank you very much MichaelM for the positive feedback

    View Instructable »
  • LED NeoPixel Motion Sensor Stair Lighting

    Nice, good luck with the project. If you want precision, then you will need to do some testing with the code. It won't be impossible, but it will be tricky! Let me know how it turns out!

    View Instructable »
  • LED NeoPixel Motion Sensor Stair Lighting

    Hey quix,Thank you for checking out my instructable. You can easily add another motion detector to put on both sides of the stair entrance on the bottom. add the following lines to the set up variables part int alarmPinBottom2 =12; // PIR at the bottom of the stairs int alarmValueBottom2 = LOW; // Variable to hold the PIR statusIf you're using neopixels, you would have modify the number of pixels you are using: (I am using 525 PIXELS)Adafruit_NeoPixel strip = Adafruit_NeoPixel(525, PIN, NEO_GRB + NEO_KHZ800);add this to the void setup:pinMode(alarmPinBottom2, INPUT_PULLUP); // for PIR at bottom of stairs initialise the input pin and use the internal restistoradd this to void loop: alarmValueBottom = digitalRead(alarmPinBottom2); // Constantly poll the PIR at the bottom of the ...

    see more »

    Hey quix,Thank you for checking out my instructable. You can easily add another motion detector to put on both sides of the stair entrance on the bottom. add the following lines to the set up variables part int alarmPinBottom2 =12; // PIR at the bottom of the stairs int alarmValueBottom2 = LOW; // Variable to hold the PIR statusIf you're using neopixels, you would have modify the number of pixels you are using: (I am using 525 PIXELS)Adafruit_NeoPixel strip = Adafruit_NeoPixel(525, PIN, NEO_GRB + NEO_KHZ800);add this to the void setup:pinMode(alarmPinBottom2, INPUT_PULLUP); // for PIR at bottom of stairs initialise the input pin and use the internal restistoradd this to void loop: alarmValueBottom = digitalRead(alarmPinBottom2); // Constantly poll the PIR at the bottom of the stairs //Serial.println(alarmPinBottom2);Now to modify the algorithm to control which pixels turn on in which sequence is the tricky part. you have to make a pixel chart and determine which pixel range for each step. The following code controls which pixels to turn on: // Fade light each step strip void colourWipeDown(uint32_t c, uint16_t wait) { for (uint16_t j = 0; j < 15; j++){ int start = strip.numPixels()/15 *j; Serial.println(j); for (uint16_t i = start; i < start + 35; i++){ strip.setPixelColor(i, c); } strip.show(); delay(wait); }// Fade light each step strip void colourWipeUp(uint32_t c, uint16_t wait) { for (uint16_t j = 15; j > 0; j--){ int start = strip.numPixels()/15 *j; Serial.println(j); //start = start-1; for (uint16_t i = start; i > start - 35; i--){ strip.setPixelColor(i-1, c); } strip.show(); delay(wait); } You would have to play around with the code to get it so the bottom 2 stairs activate at the same time.I think you can also do this by tricking the neo pixels to this that 2 LEDs are the same address. See attached image, the green would be the data wires. if you y-split at the location and have wire go to each side of the bottom stairs, the strip should have the same pixel address for the two sides of the stairs. So in the attached picture, both the pixels on each step will be the 100th, 101, 102, etc. number pixel. This is easier that figuring out the code if you are not good at coding, but you lose the ability to control each step independently in the future. I have not tested this way so it would be a good idea to do a small scale test to see if you have 1 strip and branch 2 strips ensure that the 2 strips light up identically. (see my other picture for what i mean) strip 2 and strip 3 should have the same pixel number if this will work.Let me know if that helps! Good luck and if you complete this project I would love to see it.

    View Instructable »
  • LED NeoPixel Motion Sensor Stair Lighting

    Hey, sorry for the late reply, what kind of motion sensors are you using? Some motion sensor will send a HIGH signal when motion detected and some send a LOW signal when motion is detected. Do a search for the model of motion sensor you have to verify how it operates. Or simply try to change the code from LOW to HIGH and see if that fixes the issue.In my case, my sensors send a HIGH signal when motion is detected, thus i initially set them to LOW then if a HIGH signal is sent when motion is detected, it initiates the light sequence.Change the following to HIGH int alarmValueTop = LOW; // Variable to hold the PIR status int alarmValueBottom = LOW; // Variable to hold the PIR statusChange the following to LOWif (alarmValueTop == HIGH && downUp != 2)if (alarmValueBottom == HIGH ...

    see more »

    Hey, sorry for the late reply, what kind of motion sensors are you using? Some motion sensor will send a HIGH signal when motion detected and some send a LOW signal when motion is detected. Do a search for the model of motion sensor you have to verify how it operates. Or simply try to change the code from LOW to HIGH and see if that fixes the issue.In my case, my sensors send a HIGH signal when motion is detected, thus i initially set them to LOW then if a HIGH signal is sent when motion is detected, it initiates the light sequence.Change the following to HIGH int alarmValueTop = LOW; // Variable to hold the PIR status int alarmValueBottom = LOW; // Variable to hold the PIR statusChange the following to LOWif (alarmValueTop == HIGH && downUp != 2)if (alarmValueBottom == HIGH && downUp != 1)Hope that helps, let me know if you have any other questions

    View Instructable »
  • LED NeoPixel Motion Sensor Stair Lighting

    Thanks for checking out the tutorial. I was temporarily using the 9V to test the system. Since it's powered on 24/7 I just wired a DC connector to the 5V power supply I'm using to power the lights. The current draw from the arduino is very minimal.Hope that helps, let me know if you have any other questions!

    View Instructable »
  • snikogos followed Woodworking, Life Hacks, Robots, Electronics and 9 others channel 1 year ago
  • LED NeoPixel Motion Sensor Stair Lighting

    The delay between each step is coded when you call the function to turn on the lights. There are two functions that either turn the lights on going up the stairs and going down the stairs. Those two functions are called: colourWipeDown and colourWipeUp. Let's look at this line of code. This is the function to controls turning on the lights and it receives two inputs when the function is called in the void topdown() and void bottomup(). The two inputs of this function are color (uint32_t c) and delay time (uint16_t wait) void colourWipeDown(uint32_t c, uint16_t wait) So to reduce the time between each step you would change the "wait" parameter when you call the function. If you look in the void topdown() function, it calls for colourWipeDown: colourWipeDown(strip.Color(255, 255...

    see more »

    The delay between each step is coded when you call the function to turn on the lights. There are two functions that either turn the lights on going up the stairs and going down the stairs. Those two functions are called: colourWipeDown and colourWipeUp. Let's look at this line of code. This is the function to controls turning on the lights and it receives two inputs when the function is called in the void topdown() and void bottomup(). The two inputs of this function are color (uint32_t c) and delay time (uint16_t wait) void colourWipeDown(uint32_t c, uint16_t wait) So to reduce the time between each step you would change the "wait" parameter when you call the function. If you look in the void topdown() function, it calls for colourWipeDown: colourWipeDown(strip.Color(255, 255, 250), 25 ); // Warm WhiteThis turns the strip on to a warm white color (strip.Color(255, 255, 250)) with a delay of 25.If you want the lights to turn on faster between steps change the 25 value to 5 or 10 in both the colourWipeDown and colourWipeUp functions and that should make each step turn on almost instantly. You can try using 0 but I don't this that will work.Hope that clears things up.

    Also, you can reference https://www.arduino.cc/en/Reference/Delay to help understand the Delay function. It pauses the program for a period of time and that time value is measured in milliseconds. So in my code, I wait 25 milliseconds between turning on each step.

    View Instructable »
  • LED NeoPixel Motion Sensor Stair Lighting

    Hello Sergey,Can you give me a bit more detail on what exactly is not working. And what you have done so far. I've just uploaded the current code (led_stair_final_2) that is currently running and all working. Let me know if the new code works. I am not using an LDR sensor at the moment which is not coded.

    Also, just to be technical, I am only using 1 channel (output pin 6). Which is a benefit of the neopixel strip. using the algorithm above allows me to create "psudochannels" by using this key code line: int start = strip.numPixels()/15 *j;I'm glad it's working for you!

    The following code is responsible for lighting up each step:The first for loop controls the number of steps (in my case it's 15) the int start is an algorithm to determine the starting pixel for each step. so it goes from 0, 34, ect.The next for loop sends the information to light up each pixel from start to start + 35, and then light up that entire strip (strip.show()).In short, the 35 is the number of pixels per strip for each step. I would love to see your setup if you get a change post some images! // Fade light each step strip void colourWipeDown(uint32_t c, uint16_t wait) { for (uint16_t j = 0; j < 15; j++){ int start = strip.numPixels()/15 *j; Serial.println(j); for (uint16_t i = start; i < start + 35; i++){ strip.setPixelColor(i, c); } strip.show(); ...

    see more »

    The following code is responsible for lighting up each step:The first for loop controls the number of steps (in my case it's 15) the int start is an algorithm to determine the starting pixel for each step. so it goes from 0, 34, ect.The next for loop sends the information to light up each pixel from start to start + 35, and then light up that entire strip (strip.show()).In short, the 35 is the number of pixels per strip for each step. I would love to see your setup if you get a change post some images! // Fade light each step strip void colourWipeDown(uint32_t c, uint16_t wait) { for (uint16_t j = 0; j < 15; j++){ int start = strip.numPixels()/15 *j; Serial.println(j); for (uint16_t i = start; i < start + 35; i++){ strip.setPixelColor(i, c); } strip.show(); delay(wait); } }

    View Instructable »
  • snikogos followed Arduino channel 1 year ago