Written by
Michał Zgrzywa

Michał Zgrzywa

And there was light…

Die Wundrelampe

I was encouraged by Peter’s last post to share my pet project with the blog audience. The current manifestation of my progress is the 10-bit, monochromatic, intelligent, one and only “die Wunderlampe”. As a picture is worth a thousand words, behold:

I hope you feel enlightened. The lamp turns on and off, depending on the amount of light in a room. It additionally shows the status on the LCD screen.


This device is based on the Arduino Uno unit. The power supply is a single 9V battery. It utilises a photoresistor to measure the amount of light in a room. When the amount of light drops below a threshold value, a LED turns on. There is also an LCD connected, showing the state of the lamp (ON / OFF) and the level of light (in %).

The most interesting part of this is, of course, the photoresistor. Depending on the level of light, it becomes a stronger resistor or a weaker resistor. So it changes the voltage in part of the system, which can be then read by a 10-bit analog-to-digital converter. Such information is then utilised to control the lamp and the LCD.

The code that reads the input and steers the outputs (LED, LCD) is written in the “C-like” programming language, that is well supported by the Arduino community (including the free IDE). You can find the code here: code. (Just for the most observant readers: there is a bug in the code – if you manage to find it, you will win the possibility to write about it in the comments! Nice, isn’t it?)


Why bother playing with Arduino? Many reasons:

  1. What I like the most is the possibility to interact with the physical environment. As a former developer, it is natural for me to write software that is located on a machine, and people interact with it via a computer or a phone. Possibility to move an object or to react to the changing environment is a kind of magic for me.
  2. Not only I had to learn a lot, but also I could apply the knowledge I used to have and forgotten. For example, to understand how the photoresistor works, I had to understood Kirchhoff’s Law. What fun!
  3. I can interact with the most primitive components of current hardware and understand how they are working.
  4. The Arduino Community is very strong. I can find countless components that will make almost any use case possible: LCD screens to show status, GSM, WiFi and Bluetooth modules to enable communication, servo engines that allows to build robotic arms, air temperature and pressure meters, distance meters, etc. There are also a lot of online courses and examples to learn from and libraries to reuse.
  5. I can pursue, and one day realise, my own pet project in its final form.

The final form

Is my project a robot? Is it a coffee machine? No! It is the control system for my floor heating! (Impressive, isn’t it?)

The problem of floor heating is more difficult than you could expect. You can affect the temperature of your floor by adjusting the flow of hot water in the floor pipes. As a result, the floor heats the room. Sounds simple. Unfortunately, the system has quite some delay – counted in hours. Additionally, if you have a lot of windows in your house, on sunny days you will have significant heat gains. This will not happen on a cloudy day. You can also open windows and change the balance completely. In the end, assuring in an automated way that the temperature in your room is optimal is very difficult.

Arduino may help in solving most of these problems. I will be able to measure temperature in different parts of my house using thermometers. I will be able to open and close valves with hot water using motors. Thanks to GSM gate I will be able to get the weather forecasts and adjust the setting during the night. I will be also able to measure the sunshine impact with photoresistors and react accordingly. A smart algorithm utilising all these inputs, historical data and a pinch of madness will move my heating system to an epic level.

Will I ever finalise my project? I doubt myself. But the joy is in the journey and the opportunity to practice pure magic is just too tempting to ignore.

Share this post on

One thought in Comments

  1. Peter Brookes-Smith

    I like it!

    If you’re thinking about how to change the state by setting a series of controls depending on the current state and then hoping to eventually arrive at an optimal state, you could include qLearning (a type of ai) on your list of strategies to potentially solve.

    It would require a method of you informing the system that the temperature is optimal or not. Of course, you could use a sensor for that but I’m much more attracted to the vision of you shouting at it 😉 or giving it encouraging feedback (another arduino possibly?).

    There’s another potential problem in that qLearning typically takes a lot of cycles to learn. And the more variables there are that define the state and the more granular those variables are, the number of cycles grows exponentially.

    And if that’s not enough (!), qlearning needs to explore to really optimise. That means that even when it knows it should close the valve and tell the boiler not to fire, it will do the opposite! Don’t worry though, when you shout at it, it will improve it’s learning and try not to do it again.

    You could get around these problems by building a model of your heating system and then using that to train. That way, the training could probably complete in a day or so rather than the 1000 years I estimate from training on the home system.

    Whichever way you go, I predict endless hours of fun 🙂


Leave a Reply

Required fields are marked *

Read next

Making sense of Governance

What is Governance? Why do we need it? Does it mean the end of fun? Is it all bad? Is it the same as Management? Over the years, I thought about these questions and many more. It’s a journey that started with dislike and fear for Governance and now I accept and embrace it. So, I thought I would […]

Read more