Author Topic: House-level interior smart lighting scheme  (Read 2252 times)

0 Members and 1 Guest are viewing this topic.

Offline John BTopic starter

  • Frequent Contributor
  • **
  • Posts: 822
  • Country: au
House-level interior smart lighting scheme
« on: July 30, 2020, 11:52:38 pm »
I've got a long term plan for a house wide lighting system. See below:


DC supply voltages are just approximate for now. The main idea is to unify the control of ceiling lights in the house, utilising more flexible wall controls and extensive use of motion sensors. I have had good results in moving away from mains switched motion sensors to simple DC logic only motion sensors. I want to do all the logic and timers etc in a single controller, as motion sensors would overlap multiple lights and vice versa. It can also take care of dimming controls as well. I'm thinking wall controls would have a few simple commands such as on/off/auto/dim level etc.

There would be multiple AC/DC converters for the lights, probably 1 per room. Each converter would probably be powering multiple light panels, hence the separate CC drivers. This also keeps any one converter operating in an efficient power band, and also I will probably end up with different voltage requirements depending on the LED combination. The controller would also be able to switch off mains power to the AC/DC converters to reduce quiescent power being wasted when lights aren't on.

There's also other gimmicks to add down the track, like super dim night light functions for hallways etc. I'm quite set on making my own CC drivers as I make a point of going above and beyond with filtering and eliminating ripple. No flickery crap pumping out tons of EMI for me thanks.

So I'm mainly looking for feedback and ideas at the moment. For example I'm obviously concerned about safety and mains isolation. Apart from the off the shelf AC/DC converters (probably meanwell) the weak points would be the relays which will probably be Omron or TE connectivity 250VAC relays. Probably a separate board with isolation slots.

Apart from that, I am thinking 0V DC should be tied to mains earth? I am also thinking that the entirety of the circuit will be centrally located in a rack unit or something, then cabling will radiate out to the individual panels.

The biggest hurdle for me will be the controller. My digital skills are lacking and I haven't programmed something on this scale  that would be taking care of perhaps 30 inputs and at least that many outputs. Is there anything pre existing that would be suitable to use? Smart lighting systems are a big thing in modern commercial buildings to reduce power consumption.

Am I crazy with this? Biting off more than I can chew?
 

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 9935
  • Country: us
Re: House-level interior smart lighting scheme
« Reply #1 on: July 31, 2020, 03:53:37 pm »
IO expanders will take care of your input/output needs.  These devices typically run on an SPI or I2C bus.  This one uses I2C and there can be 8 devices on the bus resulting in 128 IO pins

https://www.ti.com/lit/ds/symlink/pcf8575.pdf?ts=1596209643414

There are others...  Microchip makes some as well.

The Raspberry Pi IO library knows about I2C.

I don't know where you are in terms of Raspberry Pi GPIO processing but I really like the Freenove Ultimate Starter Kit for getting up to speed with interfacing things to the Pi.

https://www.amazon.com/gp/product/B06W54L7B5

The tutorials are EXCELLENT!  Every single thing you need to know from opening the box and initializing the Pi up through device interface is covered in detail.  Do the experiments in order or you may not build required libraries before they are required.  Pages 109 and 110 of the Tutorial.pdf shows a couple of examples.

I have found the tutorial to be 100% spot on.


 
The following users thanked this post: John B

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 9935
  • Country: us
Re: House-level interior smart lighting scheme
« Reply #2 on: July 31, 2020, 08:29:41 pm »
Does Amazon Voice Service (AVS) play into this?  I have no idea what can be done with the service but here is a video on how to install it on a Pi:



Here's a simple Alexa project to turn on/off an LED

https://www.hackster.io/nishit-patel/controlling-raspberry-pi-using-alexa-33715b

The interaction seems wordy but that might not be the final answer.
 
The following users thanked this post: John B

Offline John BTopic starter

  • Frequent Contributor
  • **
  • Posts: 822
  • Country: au
Re: House-level interior smart lighting scheme
« Reply #3 on: August 01, 2020, 04:08:20 am »
I don't think I'll be looking to integrate any of those online voice recognition services. I'm a bit tin foil hat with that, but also I don't think I'd use it. If I wanted remote control I could incorporate something along the lines of Open Sound Control or even DMX on a phone app.
 

Offline tmadness

  • Regular Contributor
  • *
  • Posts: 83
  • Country: us
Re: House-level interior smart lighting scheme
« Reply #4 on: August 01, 2020, 07:12:58 am »
You know, kudos for rejecting the "assistants". Your tin foil hat looks better on you anyway. These companies need to give us more rights on our data. Until then I'm not using their product.
Anyway, very ambitious project, I dreamed of doing something like this, I just don't have the house or capital to do so yet.
Best of luck
 

Offline John BTopic starter

  • Frequent Contributor
  • **
  • Posts: 822
  • Country: au
Re: House-level interior smart lighting scheme
« Reply #5 on: December 03, 2020, 11:23:32 pm »
OK, so far from being total vapourware, this project is actually coming along. I have purchased most of the parts I need and I'm now focusing on learning about the raspberry pi. Unfortunately, I also have to build large portions of the actual house, so I am spending much of my time being a timber engineer rather than electronics engineer. I imagine getting the lights in is a good 6 months off.

I'm getting into Node Red, some python and java scripting, but I'm still just starting out with what is possible. I've also been watching some videos about getting OpenHab to pass triggers and variables into Node Red, which I'm hoping will handle the actual GPIO.

The thing is I have a lot of IO needed, ie something like 90 input buttons and >200 digital outs. Why? Well I've envisioned each light driver being opto-isolated from the main control board by means of an 18 bit parallel interface. Each driver board is actually 2 separate drivers, each needing 1 on/off bit plus 8 bits to set the dimming level. Maybe a little convoluted but it keeps the driver universal and can even be run by manually setting jumper wires, which might be handy to use elsewhere since I'll have to do a decent production run of them.

Getting ~200 bits of data out of the pi doesnt seem to be too bad. I tried a simple python script and was able to shift out 256 bits in under 200us, so I'm thinking shift registers will be all I need. I'm hoping to implement a native solution in Node Red, where a java script will change the GPIO pins, but I can't seem to find the info whether the pins can be changed inside a Node Red script or whether they are only able to change a message payload.

I'm a little less certain about the inputs though. I have a bunch of 74HC165 parallel load registers. I guess I could just constantly just scan through 128 inputs to detect a change, though I don't know if that's the best in terms of processor usage. I may have to look again at I2C IO expanders, but from memory they were a little pricier and wasn't sure I was going to be able to daisy chain enough of  them. It would be ideal if there was only processor usage when there's a button change.

Probably a good thing the light installation is a ways off as I'm still in brainstorm mode.
 

Offline jmelson

  • Super Contributor
  • ***
  • Posts: 2823
  • Country: us
Re: House-level interior smart lighting scheme
« Reply #6 on: December 03, 2020, 11:55:05 pm »
I've got a long term plan for a house wide lighting system. See below:

Years ago I built an alarm system, it had wires running all over the house for control panels and window/door sensors.  Well, long wires running all over the place are great antennas for picking up lightning-induced transients.  We had a lightning strike a few blocks away, and it blew the whole thing to bits.  A couple chips exploded, a bunch more were damaged.  I have STILL not gotten it fixed, although I haven't put a lot of time into it.
I DID have some fairly decent design in it, but didn't put extensive TVS protection into it.

So, I'm not sure a totally centralized system with control wiring running in from all over is a great idea.

Jon
 

Offline John BTopic starter

  • Frequent Contributor
  • **
  • Posts: 822
  • Country: au
Re: House-level interior smart lighting scheme
« Reply #7 on: December 04, 2020, 03:14:32 am »
That's the kind of random feedback and ideas I need though. Thinking back, my other reason for using opto isolators was to avoid fault propagation where 36V makes it's way all through the RPi board, or the IO interface. I could also opto-isolate the buttons and motion sensors from the main board and add MOVs or TVS diodes.
 

Online NiHaoMike

  • Super Contributor
  • ***
  • Posts: 9232
  • Country: us
  • "Don't turn it on - Take it apart!"
    • Facebook Page
Re: House-level interior smart lighting scheme
« Reply #8 on: December 04, 2020, 03:52:14 am »
You know, kudos for rejecting the "assistants". Your tin foil hat looks better on you anyway. These companies need to give us more rights on our data. Until then I'm not using their product.
There are a few cloud-free alternatives like Mycroft.
https://mycroft.ai/
Cryptocurrency has taught me to love math and at the same time be baffled by it.

Cryptocurrency lesson 0: Altcoins and Bitcoin are not the same thing.
 
The following users thanked this post: I wanted a rude username

Offline John BTopic starter

  • Frequent Contributor
  • **
  • Posts: 822
  • Country: au
Re: House-level interior smart lighting scheme
« Reply #9 on: December 10, 2020, 10:17:35 pm »
I've decided to opto isolate all the button and sensor inputs from the main board. It will be a bit tedious with laying out an input board and soldering but the opto-isolators are cheap.

But I need some advice on clamping transients. I will probably protect each opto LED from reverse bias with a 1n4007, and the optos themselves can withstand a 1A pulse for a couple of microseconds. That hopefully will provide reasonable protection for differential voltages on board.

However, how should the board be referenced to main earth ground? It would be powered by a floating adapter, would it be better to connect the negative rail to mains ground? Would that be better or worse for induced transients?
 

Offline JL34

  • Contributor
  • Posts: 46
  • Country: fr
Re: House-level interior smart lighting scheme
« Reply #10 on: December 12, 2020, 09:41:07 am »
Hello John,

I am trying to make similar lighting. I've thought about it a lot and here is where I am. May be here are some things that might help you :

• If you are building your house, you could run a shielded 2-pair cable near all your outlets and switches. It will serve as low voltage DC bus, like the famous KNX in Europe, to communicate with all your outlets and switches. If you try to add smart control on your lighting, there is good chances that you want to do more and add smart control on heating, shutters, and others things too. It's contagious... Look at the KNX architecture, it gives good ideas for this kind of project.

• Having a central controller is way to do, but maybe not the most resilient. If you have a problem on your central controller, all your lights are out of order until you resolve the problem. If it is a bug it could take only just few minutes/hours. But if it is hardware problem, you will have to wait to receive new part for repair... I think it is a better idea to add an independent smart controller on all room, or better, on all lighting. If your bedroom lighting fail, you could continue to use your living room and cook in your kitchen.
I think a good way to achieve this is to use a general wired bus (like said above) with cheap µc on all elements, or wireless setup with ESP8266/32 on all elements. Important thing is to be able to edit configuration along the the time. And for this, ESPs are convenient things with wireless programming OTA.

• A convenient setup is to have a central controller that store scenarios and compute things, with OpenHab, HomeAssistent, Domoticz or other software like those. And to have local independent controller on all the elements, that can run in standalone mode when central controller fail.

• To play with power, i prefer separate AC and DC. Buy a standard and certified AC/DC converter, with 12Vdc 24Vdc or 48Vdc output voltage, and power all your room lighting with it. In this way you reduce electrocution and fire risk to minimum. There are lot of led drivers ICs (i am still trying to select the right one to fit my needs) that can be powered with low input voltage near 12/24V, and that adapt there output voltage to your led lighting. Only current is constant. Some have dimming capability.

• If you want to dim your lights, you could do the linear/analog way or the PWM way. Linear way are absolutely flicker free (if you have proper and stable input voltage), but efficiency is low, and led colors could change when current reduce. PWM way is more efficient and you could dim very low without changing led colors (current is always the same, only duty cycle is changing). PWM dimming frequency should be above 2Khz to so the flicker is never visible, and above 20Khz to not create audible noise. Some ICs seems to be suitable for this, like TI TPS61196-Q1, LP8860-Q1 or Analog LT3966.

• Having both 4000K and 2700K leds on each lighting and dimming those the right way, you could have nice dynamic light on day, and warm soothing light on evening to help your sleep.


This is where I am in my thoughts on lighting. If you have others idea do not hesitate to post them !  ;)

Have a good day.
 
The following users thanked this post: John B

Offline jmelson

  • Super Contributor
  • ***
  • Posts: 2823
  • Country: us
Re: House-level interior smart lighting scheme
« Reply #11 on: December 13, 2020, 11:31:38 pm »
• If you want to dim your lights, you could do the linear/analog way or the PWM way.
PWM dimming, if at a high enough frequency, will not cause any perceptible flicker.  But, having PWM pulses routed through many meters of cable may turn you house into a radio station, possibly coming to the attention of authorities.  Shielding can only go so far to mitigate this.  Also, running lots of low-voltage cabling around the house could be expensive, you'd need much thicker wires.  Look in the catalogs, there are thousands of LED lighting power supplies now available.  Some of them are quite affordable, and some models offer dimming.

Jon
 

Offline John BTopic starter

  • Frequent Contributor
  • **
  • Posts: 822
  • Country: au
Re: House-level interior smart lighting scheme
« Reply #12 on: July 04, 2021, 10:59:05 am »

• Having a central controller is way to do, but maybe not the most resilient. If you have a problem on your central controller, all your lights are out of order until you resolve the problem. If it is a bug it could take only just few minutes/hours. But if it is hardware problem, you will have to wait to receive new part for repair... I think it is a better idea to add an independent smart controller on all room, or better, on all lighting. If your bedroom lighting fail, you could continue to use your living room and cook in your kitchen.
I think a good way to achieve this is to use a general wired bus (like said above) with cheap µc on all elements, or wireless setup with ESP8266/32 on all elements. Important thing is to be able to edit configuration along the the time. And for this, ESPs are convenient things with wireless programming OTA.

• A convenient setup is to have a central controller that store scenarios and compute things, with OpenHab, HomeAssistent, Domoticz or other software like those. And to have local independent controller on all the elements, that can run in standalone mode when central controller fail.


Well it's about time for a check-in on this thread. I have built up a proof of concept board with a centralised controller, wrote a python program to interface with shift registers and the I2C bus, then interfaces the IO with MQTT. It works surprisingly well.

But I think I need radical shift in my design and I am tending to agree with your assessment. I think I will create light controllers/drivers which primarily act as slave devices for the RPi, but have a "dead man's switch" crossover, so if the RPi is down, they will still have rudimentary control, and can still be switched on/off with a control panel.

So the question is, what is a simple to implement digital bus system that would allow for a single master (the RPi)/multiple slave (the light drivers) arrangement, capable of working with wire lengths up to around 50m? So far I've come up with RS485 and Modbus, but I'm open to anything easier.
 

Offline xani

  • Frequent Contributor
  • **
  • Posts: 400
Re: House-level interior smart lighting scheme
« Reply #13 on: July 05, 2021, 02:23:52 am »

But I think I need radical shift in my design and I am tending to agree with your assessment. I think I will create light controllers/drivers which primarily act as slave devices for the RPi, but have a "dead man's switch" crossover, so if the RPi is down, they will still have rudimentary control, and can still be switched on/off with a control panel.

So the question is, what is a simple to implement digital bus system that would allow for a single master (the RPi)/multiple slave (the light drivers) arrangement, capable of working with wire lengths up to around 50m? So far I've come up with RS485 and Modbus, but I'm open to anything easier.

CANBus ? Long range, resilience, ability to have multiple masters, a lot of microcontrollers have it builtin.

I think having "single microcontoller's worth" of inputs/outputs is a good idea (just pick one with a lot of PWM), then just have them switch into "local mode" when they say dont hear "heartbeat" packet from the controller. I think simplest one would be the "local mode" be just 1:1 (input one activates output one etc) passthru, as you probably don't want to fuck around with something more complex when it will be used rarely.

As for reliability, on any multidrop bus you can just have 2 controllers with other activating if it detects first one is dead. Could even get fancy and islolate rPi via optocouples at the CANBus transceiver.
 

Offline jonpaul

  • Super Contributor
  • ***
  • Posts: 3591
  • Country: fr
Re: House-level interior smart lighting scheme
« Reply #14 on: July 05, 2021, 07:02:24 am »
Industry standard is DMX521, to control up to 512 channels.

https://en.wikipedia.org/wiki/DMX512

Many commercially availabe solutions.

No need to reinvent the wheel.

Jon
Jean-Paul  the Internet Dinosaur
 

Offline jonpaul

  • Super Contributor
  • ***
  • Posts: 3591
  • Country: fr
Re: House-level interior smart lighting scheme
« Reply #15 on: July 05, 2021, 07:34:07 am »
Hello again: BRAVO for the effort and project!

Any mains connected controller or dimmer must be designed for 24/7 use, line transients and shock/fire safety.

use only UL/VDE/TUV rated mains parts. ef filters/transformers/semiconductors.

Depending on your experience and risk tolerance, you may want to reconsider the approach.

Finally, modern LED lighting ballast include 0-10V current control. The ballst has PFC, filtering, etc.

Simple solution is use existing LED ballasts.

Kind Regards,

Jon
(designed lighting electronics 1970s..1990s)

Jean-Paul  the Internet Dinosaur
 

Offline xani

  • Frequent Contributor
  • **
  • Posts: 400
Re: House-level interior smart lighting scheme
« Reply #16 on: July 07, 2021, 02:14:50 pm »
Industry standard is DMX521, to control up to 512 channels.

https://en.wikipedia.org/wiki/DMX512

Many commercially availabe solutions.

No need to reinvent the wheel.

Jon

Yeah, now that I think about it there is little reason to design your own lighting size. You'd still need other bus for the switches and the sensors tho.
 

Online H.O

  • Frequent Contributor
  • **
  • Posts: 851
  • Country: se
Re: House-level interior smart lighting scheme
« Reply #17 on: July 07, 2021, 07:33:45 pm »
What about DALI?

For my house I need something that JUST WORKS. I don't want support calls from family members when the downlights in the kitchen won't come on due to a glitch in a DIY solution.

I settled on DALI and I have no regrets. I have a RS232 to DALI gateway connected to a RPi where I can play around with automation if I want to but the system does NOT rely on that or any other central controler.

It's simple, it's robust, products are available from many manufacturers and although the protocol specification isn't open source (IIRC) enough information IS out there to be able to do most things if you DO want to roll your own stuff.

The systems weakest point, I'd say, is probably the slightly special power supply. Should that fail the bus goes down and nothing works. Having a spare one at hand for when that happens is probably a good idea (I don't - yet). My system has been running for about 3 years now without any support calls :-)

Next step up from DALI, I think, would be KNX but that's a lot more complicated and expensive.

Friendly advise, take it for what it's worth: If you ARE going to do something custom then make sure it's easy enough to revert it in case it does not work out, or you lose interest in it or you decide to sell the house... Think of it from a potential buyers perspective :-)
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf