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:
- 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.
- 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!
- I can interact with the most primitive components of current hardware and understand how they are working.
- 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.
- 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.