[SOLVED] SK6812 staircase with 11 steps, light up one by one

I thought I was suppose to power inject at every strip? But your idea with taking out the Black seems nice(less cable management).

Edit: And yes autocorrect made that sentence weird. I mean t terminal power distribution block.

1 Like

I promise! The least I can do to give back to the community.

1 Like

You can do it at every strip, but you don’t have to (I thought I said that before? If not, sorry! lol). Typically, the suggestion is to power inject every 5m of strip, but that is entirely dependent on the project. I’m trying to think about what would be cleanest and also the least amount of work and (imho) that would be running power at every strip. That way, you get all the soldering done at once, mount the strips, attach the wires and you’re done. If you choose to serpentine all 3 wires, you can do it that way too (for easier cable management), but then you’d want to inject somewhere in the middle of the steps.

1 Like

“that would be running power at every strip” you mean directly from the power supply/terminal birsge thingy? So I solder on two cables for each strip that are to be connected to the two terminal (power and ground respectively). Then solder on datacables between each strip and finnaly mount the cables to the terminal (also connecting the termina blockl to the power supply and the ground block to the controller)

Yup! You got it! So, you’ll have 1 power wire and 1 ground wire going to the terminal blocks from your power supply. From there, you run power and ground to each strip (and don’t forget a ground wire from the ground terminal block to the NodeMCU. THIS IS IMPORTANT without it, your lights won’t work).

In total, you’ll have 11 power wires leaving the power terminal block and 12 ground wires leaving the ground terminal block. The nice thing about this setup is that you can have a long run of wire from wherever you want to place the power supply and mount the power and ground terminal blocks somewhere close to the stairs. For instance, for my lights, I have my power supplies up in my attic mounted in a electrical box. Then, I just run cables from that down to my yard, living room, etc. Then I run power and ground to the lights from the terminals. It looks a lot better than dozens of cables running all over the place. :slight_smile:

1 Like

SK6812 has the tinyest size led that is SK6805-EC15,the size just is 1.5*1.5mm.Does anyone have some experience for it?

@Todilo do you have an update of your project? I’m planning to do this as well, I’m curious!

It is almost finished, I have some bugs to fix and it has been put on hold. But I can give you some pointers.
Shopping list and some explanation (I have included the long names so you can search on amazon):

TF-LIGHTING RGBW RGB+Warm White SK6812 60 led/m .
Ok so this is pretty self-explanatory but I went for the SK6812 for adressability. The 60led/m as you want them pretty close together (especially if you dont put it in a rails/cover) but I would advise from even denser as the power requirement goes up significantly.

BTF-LIGHTING 3Pin WS2812B WS2811 SK6812 Connector 10mm Wide Dual End with 15cm Cable LED Strip Solderless DIY LED Flexible Strip 10PCS .
Ok so this one you dont really need. My problem with these was that I still had to cut them and solder the wires together. More on that later. But you could just as well solder directly on the SK6812

BTF-LIGHTING DC5V 60A 300W Aluminum Power Supply for WS2812B APA102 LED8806 WS2801 SK6812 LED
Ok, power power power!. 300w seemed like overkill but damn these draw a lot of power. I don’t have the calculation exactly in my head but I think it SK6812 takes 40 mA / led. So 40mA * 60 * how many meters. In my case it was about 12m which is about 30A and you should probably be under 75% of maxload.

Microcontroller:
Any ESP8266 should do. I went with (I think, that or ESP32, should really work the same)
MakerHawk 3pcs ESP8266 NodeMCU LUA CP2102 ESP-12F WiFi Internet Development Board Serial Wireless Module for Arduino IDE/Micropython New Version

Level shifter(essential) 3 .3 to 5V. Ok so what is the problem? Your data channel from your microcontroller is 3.3v and that woun’t be enough to control the lights, especially if you connect multiple together. You will get really weird errors where only some of the lights are controllable, after a few sections the lights become uncontrollable or unreliable. I got this one but there are many others. I will post a finished schematic and some well needed images of everything but am unable to do so this week.
ICQUANZX 10pcs 4 Channels IIC I2C Logic Level Converter Bi-Directional Module 3.3V to 5V Shifter

Some good resources for why level shifter and how to handle the sk6812 can be found here(i havent validated these as I didn’t use exactly these when I built)


Again I will post more images and schematics but how do you put it all together? So some helpful tips.
Connect the power supply to at least very 2 segments in what is called “power inject”, these is because of the resistance found in the strips so you give the singal a “boost” or you will get lost color spectrum / no light at all. Again this is very dependant on your exact setup. Also for the love of god, make sure(really sure) that you connect the led strips ground to ground and power to power, I can assure you they will burn otherwise(not that it happened to me 
).
Ok so after connected to strips together, you need to make sure that each 2 strips(or how many you have connected together before power inject) has the same ground as the rest, as well as your microcontroller!

Each strip(stair in my case) is also connected via the datacable, the middle one on the strip. All the way from the first to the last, and of cause connected from your microntroller so you can actually control your lights.

That is all for the hardware side. Let’s talk software!

  1. Homeassistant
  2. ESPHome was my plugin of choice, WLED is another option, however it has a smaller limitation to how many light strips can be controlled. At least a few month ago when I tried.

here is the esp script for reference:

esphome:
  name: trappan_ljuskontroller
  platform: ESP8266
  board: nodemcuv2

wifi:
  ssid: "Your wifi ssid"
  password: "cvjgsn"

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Trappan Ljuskontroller"
    password: "apassword"

captive_portal:

# Enable logging
logger:

# Enable Home Assistant API
api:
  password: "apassword"

ota:
  password: "apassword"

light:
  - platform: neopixelbus
    type: GRBW
    pin: GPIO3
    num_leds: 551
    variant: SK6812
    name: "Trappljus"
    id: light1
  - platform: partition
    name: "Trappljus 1"
    segments:
      - id: light1
        from: 0
        to: 45
  - platform: partition
    name: "Trappljus 2"
    segments:
      - id: light1
        from: 46
        to: 90
  - platform: partition
    name: "Trappljus 3"
    segments:
      - id: light1
        from: 91
        to: 136
  - platform: partition
    name: "Trappljus 4"
    segments:
      - id: light1
        from: 137
        to: 182
  - platform: partition
    name: "Trappljus 5"
    segments:
      - id: light1
        from: 183
        to: 228
  - platform: partition
    name: "Trappljus 6"
    segments:
      - id: light1
        from: 229
        to: 274
  - platform: partition
    name: "Trappljus 7"
    segments:
      - id: light1
        from: 275
        to: 320
  - platform: partition
    name: "Trappljus 8"
    segments:
      - id: light1
        from: 321
        to: 366
  - platform: partition
    name: "Trappljus 9"
    segments:
      - id: light1
        from: 367
        to: 412
  - platform: partition
    name: "Trappljus 10"
    segments:
      - id: light1
        from: 413
        to: 458
  - platform: partition
    name: "Trappljus 11"
    segments:
      - id: light1
        from: 459
        to: 504
  - platform: partition
    name: "Trappljus 12"
    segments:
      - id: light1
        from: 505
        to: 550

I almot forgot, we need some automtion thrown to this! For this I have 2 motion sensor, I guess you could just buy some off the shelf stuff for this. However, I wanted to make sure that the motion was just under the ceiling, so not for too much of the room. To build this:
Another esp8266 . Hook it up to a motion sensor like this:

3 HC-SR501 Human Body Sensor Module Pyroelectric Sensor Infrared PIR Motion Sensor Detector Module for Arduino Raspberry Pi or Arduino Projects

This one is very easy to connect. Just connect the power output/ground from your microcontroller to the 2 pip sensors (see their descriptions) as well as the data channel to two inputs (1 for each controller). Then we leveredge ESPHome again like this:

esphome:
  name: trappan_rorelsekontroller
  platform: ESP32
  board: esp-wrover-kit

wifi:
  ssid: "yyourssid"
  password: "pass"

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Trappan Rorelsekontroller"
    password: "pass"

captive_portal:

# Enable logging
logger:

# Enable Home Assistant API
api:
  password: "pass"

ota:
  password: "pass"

binary_sensor:
  - platform: gpio
    pin: GPIO35
    name: "kallare rorelse uppe"
    device_class: motion
  - platform: gpio
    pin: GPIO34
    name: "kallare rorelse nere"
    device_class: motion

I must say this was the easiest part to get up and running. You can probably find a lot of implementations about making your own motion sensor, anything that you can get events from works.

So lets tie it all together shall we. For this let’s go for Node-RED. Sorry it’s in swedish but you can probably use google transalte. Anyway for pseudo code it works like this.

On motion detected (depending of from top or from bottom). Start a counter and every 250ms send signal to light_#counterid# which will turn on a staircase step (a light_counterid defined a range of adressable LED id’s, defined in the ESPHome configuration). So every 250 a new step will light up. THen when all are done, turn of the lights. And you are done!!!

[{"id":"3cbabfe0.a058b","type":"tab","label":"Trappljus","disabled":false,"info":""},{"id":"821a76c2.5b1718","type":"inject","z":"3cbabfe0.a058b","name":"Rörelse uppifrĂ„n","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":200,"y":220,"wires":[["78066bbf.65af84"]]},{"id":"d9bec921.9553a8","type":"api-call-service","z":"3cbabfe0.a058b","name":"","server":"3e9f1d25.42bab2","version":1,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"","data":"{\"brightness\":255,\"rgb_color\":[255,0,0]}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":890,"y":480,"wires":[["58171478.c863bc"]]},{"id":"78066bbf.65af84","type":"trigger","z":"3cbabfe0.a058b","op1":"1","op2":"0","op1type":"str","op2type":"str","duration":"-500","extend":false,"units":"ms","reset":"","bytopic":"all","name":"Skicka signal varje 250 millisekunder","x":410,"y":380,"wires":[["9e4e763b.87ebe8"]]},{"id":"742f02f.5b778fc","type":"function","z":"3cbabfe0.a058b","name":"SĂ€tt identitetsid frĂ„n rĂ€knare","func":"msg.payload = {};\nmsg.payload.data = {};\nif(msg.reverse) {\n    msg.payload.data.entity_id = \"light.trappljuset_\"+(13-msg.count);\n\n    \n}\nelse {\nmsg.payload.data.entity_id = \"light.trappljuset_\"+msg.count;\n\n}\nreturn msg;","outputs":1,"noerr":0,"x":816.444465637207,"y":617.3333168029785,"wires":[["58171478.c863bc","d9bec921.9553a8"]]},{"id":"f4c40429.8aa548","type":"switch","z":"3cbabfe0.a058b","name":"Är rĂ€knareid mellan 1 och 12","property":"count","propertyType":"msg","rules":[{"t":"eq","v":"0","vt":"num"},{"t":"eq","v":"14","vt":"num"},{"t":"neq","v":"14","vt":"num"}],"checkall":"false","repair":false,"outputs":3,"x":496.44446563720703,"y":597.3333168029785,"wires":[[],["77eb4be9.d295e4","438a22e7.eeaebc"],["742f02f.5b778fc"]]},{"id":"77eb4be9.d295e4","type":"change","z":"3cbabfe0.a058b","name":"Ă„terstĂ€ll rĂ€knare och trigger","rules":[{"t":"set","p":"reset","pt":"msg","to":"0","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":636.444465637207,"y":297.3333168029785,"wires":[["9e4e763b.87ebe8","78066bbf.65af84"]]},{"id":"29db5d08.f440c2","type":"api-call-service","z":"3cbabfe0.a058b","name":"","server":"3e9f1d25.42bab2","version":1,"debugenabled":true,"service_domain":"light","service":"turn_off","entityId":"","data":"{\"entity_id\":[\"light.trappljuset_1\",\"light.trappljuset_2\",\"light.trappljuset_3\",\"light.trappljuset_4\",\"light.trappljuset_5\",\"light.trappljuset_6\",\"light.trappljuset_7\",\"light.trappljuset_8\",\"light.trappljuset_9\",\"light.trappljuset_10\",\"light.trappljuset_11\",\"light.trappljuset_12\"]}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1010,"y":340,"wires":[["504cdb7c.3834a4"]]},{"id":"9e4e763b.87ebe8","type":"counter","z":"3cbabfe0.a058b","name":"RĂ€kna frĂ„n 1 och upp","init":"0","step":"1","lower":"","upper":"","mode":"increment","outputs":"1","x":400,"y":500,"wires":[["f4c40429.8aa548"]]},{"id":"58171478.c863bc","type":"debug","z":"3cbabfe0.a058b","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":1126.444465637207,"y":477.3333168029785,"wires":[]},{"id":"504cdb7c.3834a4","type":"debug","z":"3cbabfe0.a058b","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":1086.444465637207,"y":217.33331680297852,"wires":[]},{"id":"438a22e7.eeaebc","type":"delay","z":"3cbabfe0.a058b","name":"VĂ€nta 3 sekunder","pauseType":"delay","timeout":"3","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":766.444465637207,"y":397.3333168029785,"wires":[["504cdb7c.3834a4","29db5d08.f440c2"]]},{"id":"af5d11c2.cf7ad","type":"inject","z":"3cbabfe0.a058b","name":"Rörelse nerifrĂ„n","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":136.44446563720703,"y":517.3333168029785,"wires":[["9abdf329.bba83"]]},{"id":"9abdf329.bba83","type":"function","z":"3cbabfe0.a058b","name":"","func":"msg.reverse = true;\nreturn msg;","outputs":1,"noerr":0,"x":106.44446563720703,"y":357.3333168029785,"wires":[["78066bbf.65af84"]]},{"id":"3e9f1d25.42bab2","type":"server","z":"","name":"Home Assistant"}]

2 images, one of the light controller and 1 image of the staircase (including what happens if led is not powered correctly/data doesn’t work)

Imgur
Ok, so I did a superduper quick movie some time ago, enjoy (music not included :slight_smile: ):
https://streamable.com/02knwm

4 Likes

This isn’t true. The first addressable chip takes 3.3v data in and buffers the signal (to 5v) on it’s data out line to the next chip.

That sure did not work for me. I got the same error as explained here


Basically after a few connected strips they would stop taking input. A level shifter fixed this. I might be wrong though, this certai ly is not my area of expertise

I remembered incorrectly. There’s a caveat. You have to drop the Vcc voltage of the first LED With a diode, like this:

Awesome write up of your project! Can’t wait for the schematics and more pictures, although I’m pretty sure how to wire it up.

One question though, how did you mount the PIR sensors?

Because you only want to light up the the stairs when you go up or down the stairs, not if you walk passed it.

I think it was this design on thingiverse https://www.thingiverse.com/thing:2489968 I modified it by adding a cylindrical/tube to decrease the field of view of the motion sensor. Only activated when you are directly under it. Works better than I expected. I can probably upload it to thingiverse later this week.

Ah, you put the sensor on the ceiling. I don’t really want that as I have to pull cables over the ceiling. Underneath my stairs is accessible so I was thinking to put an IR sensor on the bottom and top steps. Just need to look which sensor is available for this.

I thought about the step approach. There are laser breakers, like burgler alarm stuff from movies. However they are quite expensive in comparison.
The PIR sensor I have used should work on the step approach but try to make it pointing towards the wall if possible as to not get accidental triggers.
Also, in a position so you don’t accidently walk over it getting no trigger.

Yea I was thinking the same. I could do it with the PIR sensor, as the side of the steps are wood I could drill a hole so that only the dome of the PIR will fit, which should be surrounded by the wood so the field should be reduced by it. Otherwise adding a small cylindrical tube to decrease the field even more.

Very nice!
But


Do you know what I think would be even nicer/cooler?

First step is LEDs 0-45.
Imagine you turn on LED 23 first. Then delay 10 ms and then turn on LEDs 22 and 24.
Then a new delay and the 21 and 25 and so on.

So when one stair is fully lit up the next middle LED will turn on (almost).

Wouldn’t that be cool?
I know that will be so much work :slight_smile:

If you want that approach you might as well do a continuous led lightup. There are built in functions for that, at least WLED has that. Then you only need basically 1 light group that includes all the lights.

I have no idea how to do what you describe however. Someone more fluent in ESPhome or WLED would have to answer that.

did you concider load cells? they are cheap and installing them could be less invasive.