# Staircase LEDs using Arduino

#### allenpitts

Joined Feb 26, 2011
129
Hello AAC forum,

Started this project using PIR sensors to trigger a 555 timer that turns on LEDs for twenty seconds for a walker on a staircase.

But then the concept of directionality popped up and it was decided that the system
should operate a head of the walker. So the LEDs come on below the walker
if she is going down and above the walker if she is going up. So the simple
555 approach would not allow that complexity.

So the Arduino was programmed to if say, S2 is triggered and L1s are on then
L2s come on (going up). And conversely, if S2 is triggered and L2s are on then L1s are
turned on (going down).

As usual the design, the programming, even the PCBs are not as difficult as the
wiring and construction of the system to scale, as a model.

The schematic is pretty straight forward.

So to keep from getting lost in wiring and construction a diagram was drawn.

However my buddy says that the wiring in this diagram will not work because the voltage, the +5v power,
is wired in series and must have a direct connection back to the power supply. In fact, he says that only
the LEDs operated by S6, L51 and L52 will come on.

So to explain what he meant he drew this diagram.

And so the question:
Will the wiring shown in the diagram dated 200526 work?
Or is the direct connection shown in the diagram revised 200528 necessary
to have a working circuit?

Thanks.

Allen in Dallas

Joined Jan 15, 2015
5,456
The original the top row shows no ground? Yes, the LED boards are in series and I see no LED series current limiting resistors. This would go much better with data sheets for the LEDs and the sensors. Anyway yes, in the original drawing the LED boards are in series.

Ah wait, I see the series resistors in the first drawing. Keep in mind the 2N2222 is an 800 mA (absolute maximum current) transistor and I have no idea what your LED loads require.

Ron

#### eetech00

Joined Jun 8, 2013
1,912
Hello AAC forum,

Started this project using PIR sensors to trigger a 555 timer that turns on LEDs for twenty seconds for a walker on a staircase.
View attachment 208460
But then the concept of directionality popped up and it was decided that the system
should operate a head of the walker. So the LEDs come on below the walker
if she is going down and above the walker if she is going up. So the simple
555 approach would not allow that complexity.

So the Arduino was programmed to if say, S2 is triggered and L1s are on then
L2s come on (going up). And conversely, if S2 is triggered and L2s are on then L1s are
turned on (going down).

As usual the design, the programming, even the PCBs are not as difficult as the
wiring and construction of the system to scale, as a model.

The schematic is pretty straight forward.
View attachment 208461
So to keep from getting lost in wiring and construction a diagram was drawn.

However my buddy says that the wiring in this diagram will not work because the voltage, the +5v power,
is wired in series and must have a direct connection back to the power supply. In fact, he says that only
the LEDs operated by S6, L51 and L52 will come on.
View attachment 208462
So to explain what he meant he drew this diagram.
View attachment 208463
And so the question:
Will the wiring shown in the diagram dated 200526 work?
Or is the direct connection shown in the diagram revised 200528 necessary
to have a working circuit?

Thanks.

Allen in Dallas
hello

Questions:

1. No longer using the external 555 modules...correct?
2. What is the part number for the each LED? And how many LEDs is each driver supposed to drive?
This is needed to check the transistor driver circuit current drive capacity.
3. It would be clearer if you drew the schematics as functional blocks.
For example, draw the led board as a standalone circuit schematic, so it is clear what is contained on the module.
4. The base of each transistor driver should be pulled to ground to ensure turn-off and, the MCU weak pull-ups for the pins driving them should be turned off.
5. What is the squarish looking thingy on each of the "S(n)" boards?

#### DarthVolta

Joined Jan 27, 2015
456
Now that's a cool project!. I'm just starting Arduino, I want to hack my old DMM w/ a new MCU.

At eetech00 I think those are the transisitors, squares things wearing a hat I guess

Joined Jan 15, 2015
5,456
5. What is the squarish looking thingy on each of the "S(n)" boards?
I think those are the PIR sensors. Only because he labeled them "S" as in Switch designations.

Ron

#### Tonyr1084

Joined Sep 24, 2015
4,554
Why not just have (for instance) four steps ahead and behind the climber illuminate based on his location? That way - going up or down - the stairs are illuminated. And with a timed circuit, the climber has to (or is limited to) the speed at which the LED's light and extinguish. If there's a step switch pad on every step then wherever he is or how fast or slow he's moving the stairs remain illuminated throughout his climb or descent.

Then again, why not just light up all the stairs for a duration sufficient for someone to traverse the stairs? Why the need to sense direction?

Joined Jan 15, 2015
5,456
Then again, why not just light up all the stairs for a duration sufficient for someone to traverse the stairs? Why the need to sense direction?
That was my thinking. A sensor at the bottom and a sensor at the top. Illuminate stairway for a period allowing for the slowest climber. Then, depending on any handicap accessibility place a manual switch at the top and bottom, matter of fact a 3 way switch. Then I figured, as my mind wandered, just try and answer the question.

Ron

#### Tonyr1084

Joined Sep 24, 2015
4,554
@Reloadron There have been many questions I've asked and others have said "Why go that route? Why not go this way instead?"

On a different thread about doorbells I did exactly what I just said. The response was that the TS wanted to MAKE something on his own. As a beginner he wants to exercise his design strengths along with guidance from the experienced.

#### eetech00

Joined Jun 8, 2013
1,912
Then again, why not just light up all the stairs for a duration sufficient for someone to traverse the stairs? Why the need to sense direction?
I think because the operation will be aesthetically pleasing rather than just practical.

Joined Jan 15, 2015
5,456
I think because the operation will be aesthetically pleasing rather than just practical.
I guess it would look pretty nice if we look at it that way. Makes sense.

Ron

#### allenpitts

Joined Feb 26, 2011
129
Hello eeTech00, Reloadtron, Tonyr1084 and the AAC forum,

If I may, the 'original drawing' is dated 200526. The second diagram
is revised 200529. Perhaps we could refer to them
SPPLM 200526 and SPPLM 200529
(StairCase Project: PIR and LED Modules). Is that acceptable?

It was read that BC547 transistors are equivalent to 2N2222 but now see the max on the BC547 is 100ma.

BC547 data sheet
Current - Collector (Ic) (Max) 100mA

The LEDS are
LED specs
20 mA each.

Using 18 LEDs on the L7 and L1 LED modules and twelve on L2 thru L6 modules.
So L7 and L1 are drawing 18 x 20mA = 360 mA, almost four time max.

Will reduce number of LEDs to three (60 mA) per module for testing and
replace the BC547s with 2n2222s for implementation.

+++++++++To eetach00++++++++++++

1. 555s scrubbed because they did not allow for this programming:
IF LED module above on THEN turn on LED module below
and conversely. To use 555 would have sensor turn on LEDs
above and below which does not meet design specs.

2. LED specs at
LED specs
$.03 Emitting color: Green Diameter: 3mm Lens color:Water Clear Wavelength: 515 - 520 nm Forward voltage(V): 3.2 - 3.4 V Current(mA): 20 View angle: 20 - 25 Luminous intensity(MCD): 10000 - 12000 mcd Ligitek L8G2041-PF Using 18 LEDs on the L7 and L1 LED modlues and twelve on L2 thru L6 modules. It is now realized that the transistors are are overloaded, see +To Reloadtron+ above. 3. I have discovered, the hard way, that schematics are much better for electronic logic than pictograms, Fritzes, diagrams. I know that the diagrams make you double E types crazy. It is also true that more failures are experienced going directly from schematics to physical construction than any other stage and the diagrams help one from getting lost during construction. Nevertheless, your suggestion about functional blocks is understood and will redraw the schematics that way if time allows and certainly on the next project. 4. Sorry, not sure the meaning of this comment. 'Pulled to ground' means connected to ground? What the schematic does not show (and what SPPLM 200526 does show) is the +5v is fed directly to the LED modules. So the transistors, connect the LED modules to ground when the PIR sensors operate on the transistor bases. Is this not pulling the the transistor base to ground? 'MCU weak pull-ups for the pins driving them should be turned off.' Not familiar w acronym MCU. What is a weak pull up?. 'The pins driving them should be turned off' Is 'them' the transistors? Help me out here please. 5. The squarish looking thingies (with the hat on top) with designations like S8, S7, S6...S1 are mini PIRs (Mini AM312 IR Pyroelectric Infrared PIR). Refer to drawing titled 'Staircase Application: PIRs to Arduino to LEDs, dated 200423 indicates 'S1 =sensor' Again this shows the superiority of schematics over diagrams but not sure if there is a schematic symbol for PIR sensors (motion detectors). +++++++++to Tonyr1084 et. al. on directionality ++++++ There is some value to simplifying the design, turning on all the lights at once or using the 555 to turn on lights above and below the tripped PIR sensor. It was hoped to have the system interact with the walker and provide light just ahead as the walker progresses. A staircase similar to this design was seen at the Perot Museum in downtown Dallas. Other use cases have been applied to the system: What if the walker reverses direction mid staircase ? What if the walker takes two steps at a time? What about two walkers? ect. And so the system could be very complex or the system could be very simple (turn on all lights w PIR at top or bottom, turn on lights above and below each sensor, etc.) but after some thought it was decided that this was the goldilocks approach, not too simple not too complex. Thanks for the excellent feedback. Not sure if the original question was (or is able to be with the original info) answered: Will both SPPLM 200526 and SPPLM 200529 result in complete circuits, that is, make the LEDs come on? SPPLM 200526 shows the power to the LEDs and the PIRs connected in serial and the grounds to the PIRS connected in serial and is much easier to connect and takes a lot less wire. SPPLM 200529 makes runs from each LED and PIR module back to a sort of power distribution board, marked '21-117'. With a limited knowledge of electronics, it is thought that though the serial approach taken in SPPLM 200526 is subject to failure at each connection, as long as the ground and voltage elements are connected the circuit will complete. Right? Thanks again. Allen Pitts PS If there is anyone with electronics knowledge in the Dallas area I will bring the system to your place or meet you at Dallas MakerSpace or my place and make a donation to your favorite charity including you hip pocket. #### Reloadron Joined Jan 15, 2015 5,456 Allen, if I am not mistaken I believe forum member Wendy is Dallas and also very involved with Maker Space. Not 100% on that. OK, each LED block contains 6 LEDs. Two pair and each pair is three in parallel. Each group of three will be 3 x 20 mA = 60 mA or 120 mA per block. So each block in a group you just add 120 mA. Each block looks like this: Ron #### Tonyr1084 Joined Sep 24, 2015 4,554 Sometimes when we hear of someone desiring to accomplish a project we are driven to imagine what circumstances may actually be. Sure - you can create a system that steps to each next step going up or down on a staircase. The desires we have to deal with on a constant basis are whether the TS wants to save money, use products they have already on hand or whether they desire to create an elaborate system. I think I'm getting a better idea when you mention Perot. Never been there - but I can imagine a grand staircase that lights up as one walks up or down. However, to do something like that will require a fair bit of engineering circuit wise to accomplish it. One thing that comes to mind is pressure switches under the tread of each step. As a person climbs, each switch triggers the next step light. Then, depending on which direction the person is going - the next step sets up for the following step. And you have to account for people who want to climb two steps at a time as I so often do. The project is getting far more complex. And we don't know your skill level in designing and executing such a project. We don't know whether you want this staircase in a public place or in a home. We don't know what the fire codes are or what laws govern the power source, be it low voltage or high; DC as supplied by a power supply or battery. Whether the electronics can constitute a fire hazard. And I'm sure there's more to this than I can think of. One technique that had crossed my mind was to use an infrared beam and sensor. When the beam is interrupted it signals a counter or shift register. Each sub sequential beam interruption triggers a further step; and so on. Check YouTube for videos on shift registers. They're fairly simple devices and may actually inspire a thought process as to which way to approach the problem. Then, once you figure out the mechanism of lighting each step next in line - you have to tackle how you're going to power the lights and from what source(s). Switching those lights on and then off again because you don't want to leave a trail of lit stairs long after the climber has passed by. That kind of design is not an easy task for me. If I were hard pressed to come up with a solution - my approach would be to try and make a schematic that I THINK solves the problem. Then bring it here and see what others say about it. Listen to their advice and recommendations. Then decide further which way I want to go. But in the end, the design falls squarely upon my own shoulders; just as your project will require your due diligence. The folks here at AAC are stellar at solving problems. They're also pretty darn good at telling when someone wants them to do all the hard work. They don't care to engineer solutions for free. I've not seen anyone ask for money, so you can imagine that if I asked for a circuit for time travel in a hover craft - I'm not going to get many answers. The hardest work is going to have to be done by you yourself. I wish you success. #### Tonyr1084 Joined Sep 24, 2015 4,554 One possible solution that may ease the design factor would be to have both the next and previous step lit. Assume we have a staircase with 20 steps. Suppose you're at step seven. Steps six and eight will be lit. Step off seven and onto eight and six goes out, eight goes out, seven lights up and nine lights up. This way, regardless of the direction of travel, the next sequential light comes on. Now, as for two step climbers - - - well, when someone makes something idiot proof - someone will make a better idiot. In short, nothing is fool proof. Say you solve that problem. Now some tall fella (or gal) comes along and takes three step strides. That's going to play a lot of havoc with the system. In that case you'd need individual motion sensors at each step in order to light their way. In order to light three steps ahead - you're probably going to have to use a microprocessor. Again, I'm not the expert here. I'm just a novice with a little knowledge. And you know what they say about a little bit of knowledge - it can be a dangerous thing. #### eetech00 Joined Jun 8, 2013 1,912 +++++++++To eetach00++++++++++++ 1. 555s scrubbed because they did not allow for this programming: IF LED module above on THEN turn on LED module below and conversely. To use 555 would have sensor turn on LEDs above and below which does not meet design specs. OK. If you still need a timer function, you can use the Arduino. 2. LED specs at LED specs$.03
Emitting color: Green
Diameter: 3mm
Lens color:Water Clear
Wavelength: 515 - 520 nm
Forward voltage(V): 3.2 - 3.4 V
Current(mA): 20
View angle: 20 - 25
Luminous intensity(MCD): 10000 - 12000 mcd
Ligitek L8G2041-PF
I don't know how you plan to mount the LEDs but you might think about using an LED strip instead of single LEDs.

Using 18 LEDs on the L7 and L1 LED modlues and twelve on L2 thru L6 modules.
It is now realized that the transistors are are overloaded, see +To Reloadtron+ above.
I've shown my version attached.
It requires a 12v supply but the current is lower thru each string. Total current is 40mA for 6 LEDs.

3. I have discovered, the hard way, that schematics are much better for
electronic logic than pictograms, Fritzes, diagrams. I know that
the diagrams make you double E types crazy. It is also true
that more failures are experienced going directly from schematics
to physical construction than any other stage and the diagrams
help one from getting lost during construction. Nevertheless, your
suggestion about functional blocks is understood and will redraw
the schematics that way if time allows and certainly on the next project.
Cool. This will help visualize how components with be organized and physically located.

4. Sorry, not sure the meaning of this comment. 'Pulled to ground'
means connected to ground?
What the schematic does not show (and what SPPLM 200526 does show)
is the +5v is fed directly to the LED modules. So the transistors,
connect the LED modules to ground when the PIR sensors operate on the
transistor bases. Is this not pulling the the transistor base to ground?
I thought the Arduino would drive the transistors directly(?)
I also thought each PIR sensor connected to the Arduino(?)
If this is the case, it would give you full control over the sensor inputs and LED outputs.
Program logic would be trivial (in my opinion).

Anyway, when the Arduino powers on, or reboots, the I/O pins change to "tristate"
mode at which time the transistor base would be "floating".

'MCU weak pull-ups for the pins driving them should be turned off.'
Not familiar w acronym MCU. What is a weak pull up?. 'The pins driving them
should be turned off'
Is 'them' the transistors? Help me out here please.
This comment was in line with my thinking the Arduino would drive the transistors directly.
When the Arduino powers on, or reboots, the I/O pins change to "tristate"
mode at which time the transistor base would be "floating". A pulldown resistor would prevent that.
But it would require the Arduino internal weak pull-up resistors to be disabled for the driving I/O pin.
This is a register setting in the Arduino programing.

5. The squarish looking thingies (with the hat on top) with designations
like S8, S7, S6...S1 are mini PIRs (Mini AM312 IR Pyroelectric Infrared PIR).
Refer to drawing titled 'Staircase Application: PIRs to Arduino to LEDs,
dated 200423 indicates 'S1 =sensor'
Again this shows the superiority of schematics over diagrams but
not sure if there is a schematic symbol for PIR sensors (motion detectors).
Ok...thanks.

#### allenpitts

Joined Feb 26, 2011
129
Hello AAC forum,

Working on a project using an Arduino, PIRs and transistors to control groups of LEDS.
Staircase lit by LEDS controlled by PIRs

Having the devil of a time getting it to work so I simplified the system down to one PIR
and one gr

Still can't get it to operate the LEDs.
So to just get something to work I simplified it further thinking there might be a power problem
with 18 LEDS,

Still no joy.

So to test that a signal was coming from Arduino pin A0 I connected the output from the microcontroller,
thru a resistor to the LED.
The LED then operated as expected.
(The Arduino sketch, copied herewith below is pretty simple. It declares to variables, one for the sensor input,
and for ouput to the LED and then tells the LED if it gets a signal from the PIR to turn the LED on for one
second.)

So there is something wrong in the area marked 'Control Board'. I tried putting a probe at R1 and to ground
and there is a 5 volt signal coming from the Arduino for a second after there is movement at the PIR.
So I think there is some defect in the logic at the transistor but can't figure it out.

Thanks.

Allen in Dallas

Code:
/*
Arduino with PIR motion sensor
For complete project details, visit: http://RandomNerdTutorials.com/pirsensor
Modified by Rui Santos based on PIR sensor by Limor Fried
*/

int led = A0;                // the pin that the LED is atteched to
int sensor = 2;              // the pin that the sensor is atteched to
int state = LOW;             // by default, no motion detected
int val = 0;                 // variable to store the sensor status (value)

void setup() {
pinMode(led, OUTPUT);      // initalize LED as an output
pinMode(sensor, INPUT);    // initialize sensor as an input
Serial.begin(9600);        // initialize serial
}

void loop(){
if (val == HIGH) {           // check if the sensor is HIGH
digitalWrite(led, HIGH);   // turn LED ON
delay(1000);                // delay 1000 milliseconds

if (state == LOW) {
Serial.println("Motion detected!");
state = HIGH;       // update variable state to HIGH
}
}
else {
digitalWrite(led, LOW); // turn LED OFF
delay(200);             // delay 200 milliseconds

if (state == HIGH){
Serial.println("Motion stopped!");
state = LOW;       // update variable state to LOW
}
}
}

#### djsfantasi

Joined Apr 11, 2010
6,439
You’re trying to drive 18 LEDS and that doesn’t work. But it works with one LED.

The Arduino can only supply 200mA of current from the 5V regulator, including the MCU and components. 18 LEDs is too many. 10 is probably too much.

Use a different power supply for the LEDs and tie their grounds together.

Joined Feb 20, 2016
3,537
I would use a PWM pin to drive the LEDs. That will allow you to have brightness control.
3, 5, 6, 9, 10 or 11. Not A0.
And it is not really best practice to drive LEDs in parallel. I know it is often done, but LEDs in series with a common current limiting resistor, or LEDs in parallel, each with their own resistor is best.
Another thing, in your second circuit, using one LED with a 10R resistor. Is it a power LED as the current will be around 300mA or so?

#### KeithWalker

Joined Jul 10, 2017
918
You don't mention what your PIR is. Does it have a digital or analog output? It is marked "3v".
Keith

#### allenpitts

Joined Feb 26, 2011
129
Hello AAC Forum,

Thanks for the replies.

to djstantasi
to the power supply at the power board which is
connected at the node marked 'barrel jack to power'.
Its does not say it on the schematic but the
power supply is a regulated 5 volt 4 amp ac/dc
converter.

1. Changing the brightness of the LEDs is not in the design
requirements so using pulse width modulation adds a a layer
of complexity to a system which needs to be simplified.
The focus is to turn on just one LED with one transistor.

2. Will look at rewiring the LEDs in serial.

3. It is conjectured that the arrangement of R1, Q1
and R8 puts R1 and R8 in serial and therefore a cumulative
480 ohms. But it is this subsystem, marked 'Control board'
at the diagram titled 'Subsytem Test....' that is thought
to be the fly in the ointment. All the other components,
the PIR, the Arduino, the power supply, the LEDs have
been tested operational as expected. The only functional
block that has not been tested is the R1, Q1, R8 group.
If there is a method for turning the transistor on
and off and testing the transistor switching the LED
on and off that would be most helpful.

to keith walker
The PIR is a AM312 passive infrared sensor (motion detector)
AM312 page
AM312 data sheet

My perception of analog vs. digital is that analog is
a variable signal like AM radio or old time telephone
signal whereas digital is
binary, zero or one, on or off. In that the PIR
is either sending a signal (+3 volts) or not, it
would seem that the PIR is digital. Do you agree?

The PIR was tested using;
PIR tester

to the AAC forum
I also get a lot of good counsel from the guys
at the Dallas Makerspace Electronics room. A great
gentleman there is Richard Meyer PE, EE. Mr.
Meyer suggests reducing the value of R1 from
470 ohms to, say, 220 ohms. Will try that when
I get off work this evening.

Thanks again. It is written: 'The gods will smile on
he that helps a lost stranger.'

Allen in Dallas