Flowing LEDs on a stairway ..better idea?

newplumber

Senior Member
Hi

Before I begin not making sense I will try to add a schematic when picaxe forums be my friend to load it.
Okay I have 16 stairs in my house going from main level to basement ..
My idea is I am going to make a board 1"X12"x 16 ' that will be cut to form the stairs against both sides of the stair walls
Then every step will have 4 or 6 5mm white leds drilled in the board plus the board will be router'd to make room for the wires on back side,
since I want the leds to flow up or down and activated with two motion sensors one on top/bottom I was going to use
alot of 74hc595's but thought maybe there is forum here on someone doing such a thing but I didn't see any (and I am wearing glasses)
I have seen they have led strips that are controlled with one wire in a 24 bit per led chip to turn on a rgb led but the speed if i am understanding it right
goes like .4 high .4 low = 0 .8 high .3 low = 1 per bit and in MICRO seconds so very fast
When my leds start to turn on ..like one after another I am thinking my timing per led on would be 10 to 20 mill sec
so if I used 96 leds X2 for both sides but only controlling 96 i could have all leds on in about 1 to 2 seconds or even slower but nothing over 8 secs
If it was possible to use the led strip that uses a WS2812B only you pros would know how to get that speed ..shown here from kevin dude using a arduino
https://www.youtube.com/watch?v=VAa4duqMrgs <--- start it at 4:25
I plan on using a 20X2 (I ordered from picaxe cause they are my friends and price is almost perfect....perfect would be if they accepted popcans :) )
I tried to explain what i plan on doing, so any input would be a great health booster/or not.. incase my kids/me try to beat them(leds) down/up
I have like 100's of 74hc595s because westaust is cool and explained well so a plumber could use them thru some picaxe forum
Thanks ahead of time incase my picaxes get repo'd
your harbor freight track member friend
 

newplumber

Senior Member
Thanks westaust
I will search ... its just tweeking the search words you mentioned and bingo I have 200 more hours of reading/learning ... I know its going to be very hard for me
to grab on the different LED drivers but if I can use the led strips ...APA102 that would be awesome because 4 wires is way easier then 200 wires.
I will read them and try to get some where ,I downloaded technicals APA102 zip file which saves me half of a year love it.
thanks again
 
Last edited:

premelec

Senior Member
I don't know how bright you want the lights or if true white color is what you want - I have had some experience with driving APA102s with an 08M2 quite successfully... you can use 4 wire telephone cord and individual lights and there are lenses you can put on the lights to broaden their beam - and they are remarkably bright also dimmable and color changing if you wish. There are some RGBW units that I have no experience with - they have a white LED added - I don't know if they can be driven with PICAXE as I haven't looked at the protocol. Note what strings of APA102s can be cut apart if for instance you want only one per stair... still with need of two signal and two power wires between each LED cluster.
 

hippy

Technical Support
Staff member
As suggested; APA102 strip with LEDs separated and then joined by 4-core cable would be my choice.

They will be harder to mount on a baseboard but you could rout out a strip, line that white perspex which covers the LEDs or use polished aluminium strip with holes cut for the LEDs.

A 20X2 should be good for the job and is what I would choose.

Two things to remember for when you come to do it -

1) Get each strip working separately, and when chained, before cutting them into individual LEDs.

2) There are reports I have read which say new APA102 modules need more 'end of data' clock pulses sent to update the LEDs, and more than 64 LEDs require that as well; so don't panic if the end LEDs are not updating, that can be easily fixed.
 

newplumber

Senior Member
@ premelec thanks I was searching for 5 meter strips of just white but I only see rgb which it can be white with all turned on but not true white
maybe you have seen them (just white) in 5m strips then I could have true white if they make them but maybe for my kids they would enjoy different colors so its +/-

@ hippy thanks.. "but you could rout out a strip" <-- thats exactly what i was planning on doing ... and testing different degrees ect.
I haven't ordered any thing yet but plan on using 5m strip = 16 ft with 150 leds to keep cost down and my power bill under 200 a month.
So to make it simple I wouldn't cut any of the strips just use all 5m ( i think it would work out perfect if I remember my stair length)
I shouldn't panic lol and "that can be easily fixed" translates for me... just another 10 to 100 hours jk ...but for reals with all your/everyones help
gives me momentum knowing it can be possible.

your dislike fishing/loving soldering boards (mostly wrong) all day friend
 

premelec

Senior Member
i think there used to be some all white - however wrong drive coding for PICAXE and evidently not popular. It would seem uneconomical to use RGBW with ONLY W. I wouldn't think you want more than 3 LEDs per stair... lots of light... when you actually get some units on hand you'll have a better feel for your project.. you may want to put them on the ceiling above the stairs... ;-0 As a 3^4 year old kid I'd go for colors and changing them when going up or down in color and intensity...
 
Last edited:

newplumber

Senior Member
thanks premelec lol everytime you add your info? ......more work for me!! :) no for reals its awesome but okay "changing them when going up or down in color and intensity" lol that would make me superman in my house instead of janitor
But I am with you ...just one problem my IQ is divided in half on the lowest scale ...but hmmm gobig/gohomeless challenge I am going to try it but not on the ceiling (no one looks at ceiling when climbing stairs)
So heres my thought like hippy said router out a piece of wood trim put the light strips in it then for to sense each step? IFR? <- that all i know how to do it with line switches but your the pro
but I am into a challenge so I am going to try ....all you been patient with me so FAR!! so I have confidence you will help when i blow a fuse..
project cost went from 4 dollars to 800+ dollars jk but i'm all for it
Now back to the drawning board
 

newplumber

Senior Member
Hi Here is my first thought on making my lighted stairs I plan on using 16 hc-sr501 which I will test
to see if its possible , I though about using IR sensors but the transmitter takes alot of power ( in my test)
I will test and see how much power the hc-sr501 take
Unless someone (like always) comes up with even a better idea
Thanks tho
 

Attachments

lbenson

Senior Member
Your biggest problem with this may be actually fitting the board to the steps. It would usually not be a trivial mark-and-cut. For instance, do the treads have noses?
 

hippy

Technical Support
Staff member
It might be worth looking to see what the professionals use. I am sure there must be some clear extrusion, trunking or similar which gets used in commercial installations.
 

newplumber

Senior Member
@ the bear .. thanks for the link 65 mA ? so it should be total of 1 amp (16) +/- I seen that video and thought someday I am going to try making something cool like that
@ Ibenson thanks for the concern lol I know it sounds crazy but I might be a little simple at PICAXE but I can do trim like a pro ( depending who's looking) plus its carpet steps so it doesn't have to be exact .. just showed wood for easy drawing
@ hippy thanks but you mean what you use? jk but i searched and found little but it's okay to do something the hard way for me (even if my electric meter sounds like a jet engine)
btw would it be possible to read all 16 sensors in a (can't remember but opposite of a 74hc595) using two of them.

Here is my theory ..the hc-sr501 can be 1 or 0 so I figure (with tweeking it so it reads one step per sensor) I can then control everything with the data I receive
(i.e make leds brighter where sensors = 1) <-- sounds so easy ..(wiping forehead) but I know for me ...might take a few keyboards taking flight unexpectedly JK ( i really am a calm misunderstanding person)
 
Last edited:

lbenson

Senior Member
If you don't have enough pins on your picaxe (even a 40X2?) to control all your I/Os, the MCP23008 i2c I/O expander adds 8 bits of digital I/O, and the MCP23016 adds 16. As many as you require (up to 8=16*8=128 additional I/O pins) can be added.
 

newplumber

Senior Member
@ Ibenson thankyou for that .. so 1 chip (mcp23016) will/should solve my sensor I/O .. another tool in my mini tool box , now back to understanding it :)
but thanks again
 

newplumber

Senior Member
Thanks Hippy yes those mounting extrusions would work awesome for any surface mount but in my case I purposely left the stair trim off so I can custom make my own
but like always its a great idea for those that already have trim installed
I might put the led strips in the handrails (metal or wood) on both sides and put the sensors in the trim ...its up in the air
((For reading multiple sensor activations there are 16-to-4 and 8-to-3 multiplexors, but it may be just as easy to program a PICAXE))
Thats a good idea to run another 20X2 picaxe ... but to run I2c I am trying to get out of the fog but need more learning
If I did run two 20X2 's then all my I/O would be more then enough.
 

newplumber

Senior Member
@ lbenson yes of course it would be.. thats probably what i will use, except if I can grab a hold of I2C then I would go that route
I seen goeytex awesome information
http://www.picaxeforum.co.uk/showthread.php?19363-Communication-Between-2-Picaxe-20X2-s-Using-I2C&highlight=communication+20x2
and read it 3 times but I am missing like the starter of it but know how it runs
maybe the 5th time might flash some light
btw I like the 20x2 too and I have so much more to learn about it tho .. it really is amazing for the price/memory/speed with basic
 
Last edited:

lbenson

Senior Member
[And now that I've read your other post I see that you've already gotten here. Congratulations.]

To use a 20X2 as an I2C slave, you don't need to use the interrupts as in the code in the goeytex thread--you can just poll for changes at every pass through your master loop.

If the slave I2C is used only for digital inputs, then slave code could be as simple as:
Code:
#picaxe 20x2
hi2csetup i2cslave, %10100000 ' set up i2c slave mode
do
  ptr=0
  @ptrinc = pinsB
  @ptrinc = pinsC
loop
Then for your master,
Code:
hi2csetup i2cmaster, %10100000, i2cfast_16, i2cbyte
do
  ' your other stuff here

  hi2cin 0,(b26,b27)  'read 2 bytes from slave from address 0
loop
Then check to see if b26 and b27 are different from their previous values.

You can run that slave code in the simulator. Set up the "Memory" pane to look at scratchpad. Then click on the pins and you will see the values of scratchpad addresses 0 and 1 change.
 
Last edited:

hippy

Technical Support
Staff member
If the slave I2C is used only for digital inputs, then slave code could be as simple as:
Code:
#picaxe 20x2
hi2csetup i2cslave, %10100000 ' set up i2c slave mode
do
  ptr=0
  @ptrinc = pinsB
  @ptrinc = pinsC
loop
That could be simplified to "PUT 0, pinsB" and "PUT 1, pinsC". I would however go for a more complicated version -

Code:
b0 = pinsB   : Put 0, b0
b1 = pinsC   : Put 1, b1
b2 = b0 + b1 : Put 2, b2
Or something like that, so one can include some error checking when the data is read from the slave.

It would also be advisable to include at least some PAUSE in the slave loop so there is less chance that a read occurs while the slave is doing something which holds up that reading or causes an incorrect result to be transferred.
 

newplumber

Senior Member
This is why I always say picaxe forums is the best college in the world for none degree people
because of the last 2 posts (or all posts) "helping a normal/unnormal guy like me get a project done!"
Thanks alot hippy ,lbenson ,premelec,westaust, bear<-- opps i mean THE bear and everyone and always I will post my Finnish project in the forum in the year 2099 jk
Now the easy fun part begins ( building it) hopefully get a good start this weekend (if wife oks bill = 30 for parts 20,000 for installation)
btw I do have a master plumber card but am I really a master plumber? I love to bill like one lol )
have a good day
 
Last edited:

newplumber

Senior Member
Little update on my stair project
I forgot to take pictures but I did make a short 6' long trim board (now i have my stair pattern) to test the motion sensors/light angle
They (MS) still need tweeked alittle more but I was able to fit the sensors inside the wood no problems (by routering square indention's with a small hole for the sensor)
I then cut out the led strip socket like in the picture and you can not see the leds which I was hoping for
The led strip I used was just the white nothing special but it did give me idea how far up the board to shine on the stairs with minimum dark spots
I used a 2 sensors for this test with a 20m2 and the kids are okay if I called this project finished :) (missing 10'+ more stair trim)
When I get back home I will pound it in my head to take a few pictures and add them
I am still waiting on my real led strips and sensors then the fun/challenge will begin.
I am working on a schematic and will add it when I can and like always you can feel free to make it better IN NICE WORDS!! jk lol
BTW I tested one of the motion sensors and it draws .18+/- milliamps when activated very small current draw

your tweeked motion sensor friend
 

newplumber

Senior Member
Okay I have designed my rough drawn schematic
I will try to use a 40x2 since it all should fit on the board (someday I will use two 20x2's with westaust speed 1k ic2) but not today
I only show one led strip but plan on using two
I will make a better schematic but this is my first plan so far
would it hurt to throw a 20 mhz on the 40x2? or would it become to fast to control leds or complicated for me
When I get my apa102 led strips I will test them with a 10mhz
anyway hope it somewhat is okay
thanks
 

Attachments

hippy

Technical Support
Staff member
You need to connect both V+ and both 0V on the 40X2.

We would recommend adding a download interface, not only can you change the code but so you can debug what is running.

You can probably add a 20MHz crystal but it doesn't seem it would gain you much, and it will interfere with SERTXD if you are debugging.

RESET should be wired through a 4K7, not direct to V+, and it would be worth adding a reset button.
 

techElder

Well-known member
Plumber, great job!

There must be a better way to detect when someone wants to use the stair than scanning every step.

You should be able to do this job with a lower pin count PICAXE, but not the way you are doing it.

I do understand the "training" factor you've built into this project, though.
 

hippy

Technical Support
Staff member
Assuming the sensors are on different steps of the stairs. It might be possible to Wire-Or them so you can have multiple sensors with fewer inputs. If there were an activation at the bottom of the stairs it is unlikely that the next one would be considerably further up on.
 

lbenson

Senior Member
Plumber, great job!
+1

Also agree about the onboard programing setup--invaluable for debugging, and I suspect you will want to do a lot of playing with light patterns.

What did you use to draw the schematic--nice the way it telescopes (or did you do that manually)?

P.S. If you're planning to make a PCB, I have an Eagle Cad 40X2 design you could modify--ports B, D, and A broken out for headers, the rest a jumble specific to my project:
40X2 Eagle PCB.jpg
Oshpark.com will make these--3 boards for a not too unreasonable price with turnaround of a couple of weeks. If you're interested, I can post the board and schematic files for anyone to use or modify. I2C broken out to a header footprint, but, unfortunately, not HSPI.
 
Last edited:

newplumber

Senior Member
@ hippy yes I will/would always have it hooked up so I can debug but i forgot to add it on schematic
so both 5v/ground need to be connected okay ...I was thinking they were connected internal
now that you mention it I am thinking I can use 1 sensor for every other step so now I will be down to 8
And i will add a switch to reset with a 20k ohm pull up resistor and thanks (so 20 things wrong not bad for a start!) :)

@texasclodhopper thanks yes for I call it learn the hard way and then do it a easier way (I'm a pro at trying that but keep getting sucked in on the hard way)
and I am trying to make it simple but also have a little gift called stubborn well to a point lol once I get a project going and it gets tough I just read more forums with a huge hammer

@Ibenson "What did you use to draw the schematic" I used free GIMP version manually not the 40x2 pin out tho and I tried using different programs (which I should try harder) but it takes alot learning
I also am using DRAWNING BOARD 1.0 but it will only work on 32 bit computers so I keep buying used 32 bit laptops I have been using it since 1996 and love it
Eagle Cad ? thanks for letting me know now that is a professional board layout compared to my spaghetti painting
I will look into that and see if I can learn it and let you know thanks
 

techElder

Well-known member
For your next version ...

You really only need two sensors: one at the top, one at the bottom.

There are only four states to detect: none, bottom, top and both. (Both is for those pesky kids that always want to screw something up! :D)

But, its your project and you've made remarkable progress.
 

newplumber

Senior Member
Ya true texasclodhopper and my next version ? lol ...I think after this stair project hopefully gets done and I still can live in my house
I will be hoping then no more versions for at least 5 minutes :)
but yes its a project and thanks.. but I am going to try using 8 sensors because premelec gave me a great idea so I am trying to make it work by following 1001 instructions in the forums
If it becomes to complicated I will just use the 2 sensors (top/bottom) like you said and the other sensors will be there for some kind of electronic art
It might be a while before I upload any pictures since i work away


@ibenson I tried downloaded/using eagle but it says to me "your computer is vintage and I need to quit being a cheap skate and a get a 64 bit" jk
no for reals it wont run on 32 bit so I will have to wait till I grab a 64bit

your friend in north dakota where we still argue the world is flat
 

lbenson

Senior Member
Sorry to hear that the 64-bit restriction on Eagle Cad cuts you out. Others on the picaxe forum like different schematic and pcb software, some of which probably will run on 32-bit Windows machines.

Eagle has plusses and minuses. On the plus side, it's free, is very widely used by hobbyists, there are thousands of parts available in various libraries, and some PCB houses, like Oshpark, will accept eagle ".brd" files without your having to generate gerber files. The big downside to Eagle is that its commands are not Windows-friendly--that is, for instance, mouse actions that you think might work because they work on many other Windows programs, don't. The other major drawback that I find is that if you can't locate the part you need out of the thousands available, making a new one is complex. I'm far from being accompished, but I've made more than a dozen boards, and after reading tutorials, I still can't make or modify a part.

Experientially, if all you are doing is following oxen with a plow, your world is flat (to a rough approximation). It's only when you wish to travel (or imagine) great distances that you need to consider that it might not be, and that a different view of topology might enable you to see your way from one point to another without the need for "Here there be dragons".
 

newplumber

Senior Member
Well I did try EASYEDA.com and made a few simple boards but lol the shipping time was like 2 1/2 months!
A person like me forgets what I ordered in that time but it did finally show up at my door
and one thing i liked is they have the software in the web page , and it didn't seem to difficult for me
except the layout of the virtual board was hard to know what a person was adding like ic socket etc
I watched a video on a oshpark board and if I get a chance I will try them out.. the board with gold plate looks like something
picaxe built ... all perfect and the cost is china price but looks way way better quality.
 

lbenson

Senior Member
For someone in the U.S. (or Canada), if you're not in a great hurry and you're willing to use Eagle, oshpark is a very inexpensive way of getting 3 good-looking boards. Turnaround seems to be about 2 1/2 weeks. I believe the boards are actually made in Asia.
 

tmfkam

Senior Member
I use Eagle, as I've said a few times before. Adding new components isn't easy, but I manage to survive, more intuitive than Orcad (shudder). I use Eagle both personally at home, and commercially at work, on both Windows XP and macOS Sierra. Is version 7 of Eagle 32 bit? I thought it was as I used it on XP on the old workshop PC, I use V7 on the workshop iMac still, as I can't justify the subscription pricing model they've introduced.

For PCBs I find DirtyPCBs are near unbeatable on price. Yes there is a twenty-some day delay from ordering to delivering but I ordered 10 boards of 12cm x 7cm and 50 boards of 7cm x 6cm yesterday for under £75 inc. shipping. For the UK, quick-tech are very reasonable on price, especially if ordering either large sized boards or large quantities.
 

newplumber

Senior Member
Thanks tmfkam I will see if I can get a older version
@lbenson <-- dont know if its a I or L for the start of the name lol but yes I think its true to in asia but way faster delivery what i heard

Okay I finished schematic #2 and now that i have it saved in a good file plus on drawning board 1.0 ... I will be able to change
any items that may seem wrong but for now hopefully its real close :)
Thanks again


EDIT --> a newer schematic is posted on page 5 the picture here was deleted by me :) because it wasn't quite right
 
Last edited:

AllyCat

Senior Member
Hi,

A nice clear diagram. The programming circuit is not strictly correct (but would probably work). Because a computer PSU is being used, I'd be inclined to put a small filtering impedance (a few Ohms or an Inductor) in series with the PICaxe supply and increase the local decoupling (probably adding another capacitor) to 100 nF or 10 uF.

Cheers, Alan.
 

lbenson

Senior Member
Yes, very informative diagram. As Alan suggests, .1uF decoupling capacitors close to the power pins on both sides of the 40X2 would be recommended, and 10uF reservoir/smoothing caps there wouldn't hurt.

I've forgotten--did you say there will be another 8 sensors (not shown). If not, you're back into 28X2 territory.

Good work.

Lance
 

rq3

Senior Member
Thanks tmfkam I will see if I can get a older version
@lbenson <-- dont know if its a I or L for the start of the name lol but yes I think its true to in asia but way faster delivery what i heard

Okay I finished schematic #2 and now that i have it saved in a good file plus on drawning board 1.0 ... I will be able to change
any items that may seem wrong but for now hopefully its real close :)
Thanks again
Look very closely at the 10K and 20 K resistors on the SerIn pin. Their value is not that critical, but the position may be (depending on your data source). The 10K resistor should be in series with the SerIn pin only, NOT the 20K AND SerIn. You may also have a problem sourcing a 20K resistor as it's not a "standard" value.

Also, in the states ExpressPCB has free layout software, is very easy to use, and allows "one click" ordering of relatively inexpensive boards with extremely fast turn around (less than a week sometimes). They're not quite as cheap as some other sources, but the quality and speed are excellent, and they recently started providing Gerber files if you need to ramp up production.
 
Top