Back to Blinky

In this post I describe the trials an tribulations of bringing up my Timed LED Lighting Controller and how I went about implementing my first I²C Slave Driver for the ATTiny20.

Continue reading Back to Blinky


Stairwell Foot Lighting System

When getting back into electronics, one of the projects I had in mind was to revamp our stairwell lighting system. In 2010, we renovated our stairwell. I took the opportunity to design in a foot-lighting system that was motion controlled. It has worked faultlessly for the last six years. But who can stop at revision 1.0 when there is so much more can be done? This entry is about working out a new stair well foot lighting controller.

Fixing What is Not Broken

If it has worked faultlessly for six years, then what is there to fix? The basic driver was the size of the original solution. Like the doorbell project, the original was put together with what I could obtain with what I understood at the time. I have no regrets about that and would take that approach again since it solved the problem. However, since day-one, I had always had it in mind that I would like to rework this with my own Micro-Controller solution. Now with what I have learned in nearly two years, it’s time.


This initial solution comprised of an electro mechanical timer – that I have to manually set for Summer time and Winter time. It has three PIR13 modules from ELV as the motion detection sensors and three sets of PIR13 timers (also from ELV but now obsolete) connected to a LED driver from SLV that can drive up to eight high power LEDs each. In my system, I have only a maximum of four in each bank.

Initial Ideas – to the big picture

lcu1sI had envisaged using a small embedded device with an inbuilt touch display. This device the LCU1 was released by EQ3 through ELV. It has a tool set for UI development with direct interfacing to analogue inputs and four relays. I was attracted to this device because of the the embedded Linux and the size. I imagined having this positioned in place of the existing control system. Instead of the mechanical timer, the timing would be internal and possibly supported by “Astro” calculation. Any additional changes to the set up could be done by using the touch screen. I also have the thought that this could be eventually expanded as a burglar alarm. I had got as far as a rudimentary graphical user interface. There was still a lot to sort out with regard to interfacing with the motion sensors and eventually the connection to LED foot lighting. This is where I seemed to reach my limit and the project was put in a drawer. …In the mean time, the Raspberry Pi arrived!

The Raspberry Pi, with its huge support network, inspires and enables new ideas to be realised. After EQ3 brought out their Homematic transponder for Raspberry Pi, I was inspired to get this project back on the table.  In our house we have the Homematic system from EQ3. This is a Home Automation system that has a rich set of sensors and actuators using a bi-direction wireless protocol. It also has provision for a wired solution too, for larger, more complex installations. The beauty of this system is that it can be built upon. Starting only with, say, one heater regulator, then perhaps adding a wall thermostat and eventually adding in the Central Control Unit (CCU) to handle more complex relationships between the sensors and actuators. For a couple of years now EQ3 released their CCU2 firmware for Raspberry Pi. This now opens an exciting new world of possibilities that goes beyond a simple foot lighting controller

I realised that even though the touch display would be a cute feature, it was not actually essential to the solution. From a user point of view, any changes to the system would be better made by simply picking up a tablet and making the changes over a browser rather than having to go down into the basement each time – which is how changes are currently made.

So the plan is that the Raspberry Pi will be taking over the operation of the CCU2 with the lighting controller connected to the Raspberry Pi via the I²C bus and a Web User Interface enabling remote control of the lighting system and Homematic installation. I need to stress that I have no big interest in accessing this outside the home. The possibility is still there with the Raspberry Pi as the “back bone”.


I modelled the complete set of ideas as a SysML block “context” diagram. The idea here is that the new Lighting Controller is type of I²C device connected to a Home Server. The Home Server is an abstract description that is modelled as one or possibly more Raspberry Pis. The CCU2 and a web server is envisaged to run on the Pi.

The diagram below is similar to the context diagram but only contains the components relevant to the stairwell foot lighting. Taking this one level further I modelled the internal block diagram for Lighting Controller to start to explore the different power domains that the system will have to deal with. I have decided from the start that I will be trying to work solely with 3.3Volts and not the 5V/3V3 mix that I had with the Clock Project. However, I have found it prudent that 3V3 is suitable for micro controller but 12V is probably better for driving the relays and the motion detectors.



The Timed LED Lighting Controller (TL2C) has four basic parts. A Power System a Controller , three banks of LEDs including their drivers (I will be still using the drives from SLV) and three motion detectors (PIR13 modules).

The original intention for the Power System was to pass through 240V to the LED drivers and also provide the 3V3 for the controller and 12V for the relays.


A short discussion with my tutor, Chris Gammell of Contextual Electronics hinted that the design of an off-line power converter would probably shift the focus of this project to power supply design. This could certainly be tackled but maybe in parallel or at a later stage. It would be quicker to simply use a “Wall Wart” for the 240V to 12V conversion. A simple LDO  regulator can then be used for the 12V to 3V3 conversion.

As the larger context block diagram indicates, there will be more components to this final project than just a single micro controlled device. I will need to move the existing CCU2 set up I have to the Raspberry Pi, build some type of Web User Interface to be able to interface and configure the Stairwell Foot Lighting system and finally see if it is possible to integrate the astro timer of the CCU2 to the foot lighting system. My initial thought is through the XML-API offered by the CCU2. This will be confirmed in a future post.

To be honest, I am not sure how the web interface will work between the lighting controller and the Homematic CCU2. I figure I will let that piece evolve as I learn more about website deign, CGI and Python or what other scripting language I will choose to interface the I²C bus with Web front end.

In the next entry, I will be talking about the design I will come up with for the Timed LED Lighting Controller and the parts selected.