Led Automatic Stairs Lighting

hello everyone,
i am planning to make a automatic stairs ligtning system for my new house.
but i dont know how i can do the coding i am not getting the start point of how i can code the arduino to the task i want him to do.
below are some videos of the idea how i want my system to work.

i want to make the things work like in the 1st video and then assemble them like in the last video.
pls pls pls
atleast give me some hints or tutorials how i can make it.
the bad part is just coding

thanks in advance :slight_smile:

Hi, interesting project!

Have you some components in mind? What leds will you use, what voltage and current do they need and how many stairs? What kind of detectors were you thinking? Beam-brake like that first vid, or ir movement detectors?

I would think a basic Arduino like uno will have more than enough outputs and speed, but I guess you will need some transistor or mosfet drivers for the leds.

Paul

hi,paul,
well my first aim is to build the prototype and yes ill be using the ir detectors like in the first video.
and i do have arduino uno,leonardo and some home build also with atmega8.
and i have 16 stairs at my house i was thinking , that arduino will trigger only 8 transistors and each transistor would have 2 led strips at output.
means almost 16 led strips almost of 1 or 2 meters.

and i first thought, that ill trigger the led strips with the relays but it would be quit noisy at night.
so i then thought to use the transistors or mosfets.

so finally can someone help me with the code. pls

the parts ill be using is :
tsop ir reciver or ir photoresistor X 2
ir led X 2
8 transistors
and 8 small leds just to see weather the transistor r active or not :wink:
and 12v led stripes
and arduino would also be powered with 12v

thats all

thanks in advance :slight_smile: :slight_smile: :slight_smile: :slight_smile:

Well, I must leave it to others to help you because I am going on Holiday tomorrow.

For transistors, I can recommend bc337 (npn) or bc327 (pnp) for up to 800mA. For larger currents, irl520 is a suitable n-channel fet.

The coding seems straight forward to me so don't worry about that. You will get all the help you need here as long as you don't expect it to be all done for you.

Good luck.

Paul

P.S. keep it simple, perhaps just one detector at each end of the stairs. If there are inducations of 2 or more persons on the stairs at once, the circuit can fall back to switching off after a set time like 1 min.

Thx paul,
But is there anyone who can atleast give some hints how I can start my coding according to first or last video pls help me out with this

Thanks in advance :slight_smile: :slight_smile:

Hi

I doing the same project with 13 stairs.
I have difficuty in programming.
I didn't use RGB and choose just one colour and without the photoresistance.

Hi, I have what you are doing on my stairs controlled by an arduino and activated by 2 pir's one at the top and one at the bottom. If you like I'll send you the sketch that I used to program my stairs.

I would be interrested in that sketch as well ...it sounds very interresting.
BobD

Hi sorry for the delay been really busy, I'll dig out the sketch tonight for you. Email me if you like and I'll be happy to help. Darren@pcrepairswansea.co.uk

this is the basic sketch i started off with. customize how ever you like.

/*
  STAIRS 
 
 
 The circuit:
 * LED's light up the stairs when going up or down
 * 10K resistor attached to pin 2 from ground
 */

const int irup = 2;     // IR Beam at the bottom of the stairs
const int irdown = 4;     // IR Beam at the top of the stairs
const int partybutton = 7;     // Party button
int led1 = 0;
int led2 = 1;
int led3 = 3;
int led4 = 5;
int led5 = 6;
int led6 = A0;
int led7 = 8;
int led8 = 9;
int led9 = 10;
int led10 = 11;
int led11 = 12;
int led12 = 13;



// variables will change:
int buttonState = 0;         // variable for reading the pushbutton status

void setup() {
  pinMode(led1, OUTPUT);        // sets the digital pin as output
  pinMode(led2, OUTPUT);      // sets the digital pin as output
  pinMode(led3, OUTPUT);        // sets the digital pin as output
  pinMode(led4, OUTPUT);      // sets the digital pin as output
  pinMode(led5, OUTPUT);        // sets the digital pin as output
  pinMode(led6, OUTPUT);      // sets the digital pin as output
  pinMode(led7, OUTPUT);        // sets the digital pin as output
  pinMode(led8, OUTPUT);      // sets the digital pin as output
  pinMode(led9, OUTPUT);        // sets the digital pin as output
  pinMode(led10, OUTPUT);      // sets the digital pin as output
  pinMode(led11, OUTPUT);        // sets the digital pin as output
  pinMode(led12, OUTPUT);      // sets the digital pin as output
  pinMode(irup, INPUT);  
  pinMode(irdown, INPUT); 
  pinMode(partybutton, INPUT);   
}


void loop(){
  // read the state of the ir sensor value:
  buttonState = digitalRead(irup);

  if (buttonState == 1) {     
    // turn LED's on:    
  digitalWrite(led1, HIGH);
  delay(300);
  digitalWrite(led2, HIGH);
  delay(300);
  digitalWrite(led3, HIGH);
  delay(300);
  digitalWrite(led4, HIGH);
  delay(300);
  digitalWrite(led5, HIGH);
  delay(300);
  digitalWrite(led6, HIGH);
  delay(300);
  digitalWrite(led7, HIGH);
  delay(300);
  digitalWrite(led8, HIGH);
  delay(300);
  digitalWrite(led9, HIGH);
  delay(300);
  digitalWrite(led10, HIGH);
  delay(300);
  digitalWrite(led11, HIGH);
  delay(300);
  digitalWrite(led12, HIGH);
  delay(5000);
  digitalWrite(led1, LOW);    
  delay(1200);
  digitalWrite(led2, LOW);  
  delay(1100);               
    digitalWrite(led3, LOW);     
  delay(1000);
  digitalWrite(led4, LOW);   
  delay(900);                    
    digitalWrite(led5, LOW);    
  delay(800);
  digitalWrite(led6, LOW);   
    delay(700);                  
  digitalWrite(led7, LOW);  
  delay(600);
  digitalWrite(led8, LOW);   
  delay(500);           
    digitalWrite(led9, LOW);    
  delay(400);
  digitalWrite(led10, LOW); 
  delay(300);                   
    digitalWrite(led11, LOW);   
  delay(250);
  digitalWrite(led12, LOW);  
  } 
  
    // read the state of the irdown value:
  buttonState = digitalRead(irdown);

  if (buttonState == 1) {     
    // turn LED on:    
  digitalWrite(led12, HIGH);
  delay(300);
  digitalWrite(led11, HIGH);
  delay(300);              
  digitalWrite(led10, HIGH);    
  delay(300);
  digitalWrite(led9, HIGH);   
  delay(300);                  
  digitalWrite(led8, HIGH);   
  delay(300);
  digitalWrite(led7, HIGH);  
  delay(300);
  digitalWrite(led6, HIGH);
  delay(300);
  digitalWrite(led5, HIGH);
  delay(300);                    
  digitalWrite(led4, HIGH);    
  delay(300);
  digitalWrite(led3, HIGH);  
  delay(300);                    
  digitalWrite(led2, HIGH);   
  delay(300);
  digitalWrite(led1, HIGH); 
  delay(5000);                    
  digitalWrite(led12, LOW);    
  delay(1200);
  digitalWrite(led11, LOW);   
  delay(1100);                  
    digitalWrite(led10, LOW);    
  delay(1000);
  digitalWrite(led9, LOW);   
  delay(900);                   
    digitalWrite(led8, LOW);     
  delay(800);
  digitalWrite(led7, LOW);    
    delay(700);                  
  digitalWrite(led6, LOW);     
  delay(600);
  digitalWrite(led5, LOW);   
  delay(500);                  
    digitalWrite(led4, LOW);    
  delay(400);
  digitalWrite(led3, LOW);  
  delay(300);                 
    digitalWrite(led2, LOW);      
  delay(250);
  digitalWrite(led1, LOW);   
  }
  
      // read the state of the partybutton value:
  buttonState = digitalRead(partybutton);

  if (buttonState == 1) {     
    // turn LED on:    
  digitalWrite(led12, HIGH);
  delay(100);
  digitalWrite(led12, LOW);
  delay(1);
  digitalWrite(led11, HIGH);    
  delay(100);
  digitalWrite(led11, LOW);   
  delay(1);
  digitalWrite(led10, HIGH);   
  delay(100);
  digitalWrite(led10, LOW);   
  delay(1);
  digitalWrite(led9, HIGH);
  delay(100);
  digitalWrite(led9, LOW);
  delay(1);
  digitalWrite(led8, HIGH);  
  delay(100);
  digitalWrite(led8, LOW);   
  delay(1);
  digitalWrite(led7, HIGH);   
  delay(100);
  digitalWrite(led7, LOW);  
  delay(1);
  digitalWrite(led6, HIGH);    
  delay(100);
  digitalWrite(led6, LOW);   
  delay(1);
  digitalWrite(led5, HIGH);     
  delay(100);
  digitalWrite(led5, LOW);    
  delay(1);
  digitalWrite(led4, HIGH);     
  delay(100);
  digitalWrite(led4, LOW);   
  delay(1);
  digitalWrite(led3, HIGH);      
  delay(100);
  digitalWrite(led3, LOW);    
  delay(1);
  digitalWrite(led2, HIGH);     
  delay(100);
  digitalWrite(led2, LOW);   
  delay(1);
  digitalWrite(led1, HIGH);    
  delay(100);
  digitalWrite(led1, LOW);   
  delay(1);
    digitalWrite(led2, HIGH);
  delay(100);
  digitalWrite(led2, LOW);
  delay(1);
  digitalWrite(led3, HIGH);   
  delay(100);
  digitalWrite(led3, LOW);  
  delay(1);
  digitalWrite(led4, HIGH);    
  delay(100);
  digitalWrite(led4, LOW);  
  delay(1);
  digitalWrite(led5, HIGH);
  delay(100);
  digitalWrite(led5, LOW);
  delay(1);
  digitalWrite(led6, HIGH);  
  delay(100);
  digitalWrite(led6, LOW);   
  delay(1);
  digitalWrite(led7, HIGH);   
  delay(100);
  digitalWrite(led7, LOW);  
  delay(1);
  digitalWrite(led8, HIGH);    
  delay(100);
  digitalWrite(led8, LOW);    
  delay(1);
  digitalWrite(led9, HIGH);     
  delay(100);
  digitalWrite(led9, LOW);   
  delay(1);
  digitalWrite(led10, HIGH);   
  delay(100);
  digitalWrite(led10, LOW);   
  delay(1);
  digitalWrite(led11, HIGH);   
  delay(100);
  digitalWrite(led11, LOW);   
  delay(400);
  digitalWrite(led1, HIGH);
  digitalWrite(led2, HIGH);
  digitalWrite(led3, HIGH);
  digitalWrite(led4, HIGH);
  digitalWrite(led5, HIGH);
  digitalWrite(led6, HIGH);
  digitalWrite(led7, HIGH);
  digitalWrite(led8, HIGH);
  digitalWrite(led9, HIGH);
  digitalWrite(led10, HIGH);
  digitalWrite(led11, HIGH);
  digitalWrite(led12, HIGH);
  delay(1000);
  digitalWrite(led1, LOW);
  delay(500);
  digitalWrite(led12, LOW);
  delay(500);
  digitalWrite(led3, LOW);
  delay(500);
  digitalWrite(led10, LOW);
  delay(500);
  digitalWrite(led5, LOW);
  delay(500);
  digitalWrite(led8, LOW);
  delay(500);
  digitalWrite(led7, LOW);
  delay(500);
  digitalWrite(led6, LOW);
  delay(500);
  digitalWrite(led9, LOW);
  delay(500);
  digitalWrite(led4, LOW);
  delay(500);
  digitalWrite(led11, LOW);
  delay(500);
  digitalWrite(led2, LOW);
  
  }
  
      // read the state of the irdown value:
  buttonState = digitalRead(irdown);

  if (buttonState == 0) {     
    // turn LED off:  
  digitalWrite(led12, LOW);
  digitalWrite(led11, LOW);                  
  digitalWrite(led10, LOW);    
  digitalWrite(led9, LOW);  
  digitalWrite(led8, LOW);  
  digitalWrite(led7, LOW);  
  digitalWrite(led6, LOW);
  digitalWrite(led5, LOW);
  digitalWrite(led4, LOW);     
  digitalWrite(led3, LOW);  
  digitalWrite(led2, LOW);   
  digitalWrite(led1, LOW);  
  
    }
    
          // read the state of the partybutton value:
  buttonState = digitalRead(partybutton);

  if (buttonState == 0) {     
    // turn LED off:  
  digitalWrite(led12, LOW);
  digitalWrite(led11, LOW);                  
  digitalWrite(led10, LOW);    
  digitalWrite(led9, LOW);  
  digitalWrite(led8, LOW);   
  digitalWrite(led7, LOW); 
  digitalWrite(led6, LOW);
  digitalWrite(led5, LOW);
  digitalWrite(led4, LOW);   
  digitalWrite(led3, LOW); 
  digitalWrite(led2, LOW);   
  digitalWrite(led1, LOW);  
  
    }
  
      // read the state of the pushbutton value:
  buttonState = digitalRead(irup);

  if (buttonState == 0) {     
    // turn LED off:  
  digitalWrite(led12, LOW);
  digitalWrite(led11, LOW);                  
  digitalWrite(led10, LOW);    
  digitalWrite(led9, LOW);  
  digitalWrite(led8, LOW);  
  digitalWrite(led7, LOW);  
  digitalWrite(led6, LOW);
  digitalWrite(led5, LOW);
  digitalWrite(led4, LOW);   
  digitalWrite(led3, LOW);  
  digitalWrite(led2, LOW);  
  digitalWrite(led1, LOW);   
  } 
  else {
    // turn LED off:
    digitalWrite(led1, LOW);
    digitalWrite(led2, LOW); 
    digitalWrite(led3, LOW); 
    digitalWrite(led4, LOW); 
    digitalWrite(led5, LOW); 
    digitalWrite(led6, LOW); 
    digitalWrite(led7, LOW);
    digitalWrite(led8, LOW); 
    digitalWrite(led9, LOW); 
    digitalWrite(led10, LOW); 
    digitalWrite(led11, LOW); 
    digitalWrite(led12, LOW); 
  }
}

Thanks for sharing !
BobbyD

Glad to be able to return the help I had a few months ago.

Hi guys. I'm new here and new to Arduino. I am thinking of undertaking a project exactly like this but need some advice on which board to get.

I want to have a play around and do some small test projects before undertaking the stair project so was thinking about getting the UNO starter kit. However, the board I get now will ultimately be the one that runs the stairs project, so I need to make sure I get the right one to start with.

I have 13 stairs and want to have them light up one at a time, I notice that you guys are going to be lighting up 2 stairs at a time thus requiring less outputs, is this as result of a restriction with the UNO, will I need one of the larger boards to do my 13 stairs individually?

Thanks all. I am looking forward to this project, and as a keen tutorial maker (for my industry) I am planning on recording a video tutorial series on the whole process of this project.

the project appears to be one motion sensor at the top, one at the bottom. then the lights go on for the stairs.
the video links show one light circuit per stair. you could easily do 50 stairs with one uno,
a shift registor could do 8 stairs, 8 shift registers, 64 stairs with an on/off.

if you are looking for ramping up to full brightness, and then dimming to off the software gets a little more complicated, but still within the UNO.

if you want to add colors, then rotate or change between, and have colors chase up or down, both the software and hardware get more complicated.

give us more details.

as for a prototype. easy, just get one LED for each stair. each LED would represent one circuit and they would all LEDs on that circuit would come on or off at the exact same time.
when you add more lights, all you need to do is beef up the power to accommodate the load.

interesting video. looks like they have a motion sensor on each step, but wait until it is activated to turn on that step.
then delay until some time, before turning off.

better would be to light 5 stairs in front of the sensor tripped. then as each sensor is tripped, light the stair that is 5 above.
when I walk up stairs, my eyes are 5 steps above my feet. I would want that tread to be illuminated before my eyes were on it.

here is a great video showing the control board.

just watched a couple videos.
one thing I noticed is light placement. the eye and foot use the leading edge of the stair tread at the focal point. there are a few that illuminate the back of the tread and the riser, but the nose is black. poor lighting.

also, the person has no care or clue if the lights are on behind, only in front. but if they turn around to go back, the lights should work that was as well.

a note on the program that is listed. it uses delay, frequently. the basic program appears to assume a few things. that going on the stairs will be on direction and at a specific pace.

you could have a pot on an analog pin, then use that for a value.
blink without delay
if count is greater than delay, change state.
that way, you could have a fast or slow delay.

it would be more interactive if there was a sensor on each step, or every 3rd or 4th.
I have gone up the stairs. stopped, went back for something.
gone half way up, call the wife, had a conversation, then went back down.

Thanks for your reply.

I am only planning on using single colour LED's activated by a sensor at either end of the stairs. When either the top or bottom is triggered the 13 lights would ramp up in sequence (you are right about looking in front of you, maybe the first 5 ramp up quickly with a kind of 'fall off' in the speed of the sequence for step 6-13, interesting).

So with the UNO I could have 13 lights ramp up independently of one another?

the uno would need to use an external chip to do pwm for dimming.

you could bit-bang them.

the mega can handle 13 pwm outputs in one unit.
then you only need to address the LED power issue.

what lamps are you going to use ? if you can just pwm the power, you only need mosfets to handle the power.

To be honest I haven't nailed down the specifics of the lights yet, I am in the early stage of discovering what will be possible before deciding on that.

Been looking in to bit-banging, could be an option, sounds like the way a standard LED dimmer works

guys
everyone really thanks a lot for the help you all provided..
i was busy with some home automation project which i just now completed.
i'll soon post the information of the project but i don't know where i do post my ready project on arduino.

you can control all your house lights and fans including your setopbox and tv just with your android phone.
have a look at the link if anyone interested.

as soon as possible i'll even complete with the stairs light system

thanks a lot everyone
REGARDS
Parth Y. Temkar