Skipping ahead a little bit, I have run all the cabling for lights, switches and networks.
For switches, I was using CAT5 Ethernet cable but int he end didn’t like it for the use even though it would be greatly flexible for future additions of POE (Power-over-ethernet) networked devices for control but I figured that there are other ways to do this. In the end I used cheap speaker wire. This would effectively make a loop back to the main Arduino board and either ground out or pull up a pin.
As a last minute addition to the switches was a power run, all switches now share a power loop (just of cheap speaker cable too) but this now means that I have cool switches:
Also means that I can run I2C devices as switches.
I did go a bit over board with the lighting though and originally had 26 15W LEDs in a 6m X 6m room (on 12 circuits). I changed this just before drilling the down light holes so now there is only 24 🙂 Still quite a few but it looks pretty good.
Physical wiring now being done, I can start on the Arduino side of things. The original plan was to run everything off the same Arduino Mega board, use the on board PWM pins, of which there was 14 (see the problem already) and have the whole thing rack mounted with DIM rail fuses. This worked but never well, the hardware was messy and updates to anything meant that the whole system needed to be turned off, so no updates at night.
Versions 2 to 4 were similar but different but just a learning journey so not very interesting but the current version is, I think, the way to go. Amazingly enough, it is very similar to a DMX setup in hardware where the signal is separated form the control
An Arduino Mega (or whatever but I have a few of these) is at the center, it is the primary interface between the world and the system. It handles all the input signals from switches, Ethernet, Bluetooth or internal commands. It also controls the “Scenes”; as a lighting state is made up of more than one light (in more than just an on or off state), there needs to be an extra level in between the input signal and the lights, especially when a scene can be controlled from more that one place.
When a scene is set, it talks via serial to a separate 1RU box with its own Arduino Nano. This Nano holds each circuits information and talks to a very neat little PCA9685 chip on the Adafruit’s PWM board. This board is a I2C driver 16 channel PWM breakout, taking away all the thinking from the Arduino (and its limited number of PWM pins) and putting it elsewhere. Another advantage is that the PCA9685 stores the channels stage if the connection to the master is removed, so you can do updates to the Arduino without having any downtime to your lights. I’m currently working on the Arduino code for the controller box, all code can be found in my GitHub.