On our company's Christmas celebration (December 2013) all employees got a small present: A Raspberry Pi. This was the initial event for me to investigate what (internet of) things can be done driven by this tiny computer.

This blog is to document my findings and to share what others shared with me.

Freitag, 25. August 2017

sauna temperature measure device

Two years ago I built a sauna. Since our house has no basement the sauna is not within the house. It is in a detached house:


Especially in winter we don't want to waste to much energy and use the sauna as soon as the temperature is OK. So in the last two years we needed to guess after which period it is OK or go outside to check the temperature.

Now I installed an ESP8266 module to measure the temperature so I can check from inside the main building.

This is quite simple and takes just a few steps:
  1. Buy a DS18B20 temperature sensor
  2. Buy a nodemcu ESP8266 module
  3. Connect them as shown
  4. Install the software (see GitHub)
  5. Install the device in your sauna
 That's it 😊

How to connect the sensor
The sensor placed in the sauna
The ESP8266 module in the sauna
The result

Samstag, 19. August 2017

Irrigation management

We built our house only a couple of years ago. This year we wanted to build a terrace in order to get more out of our garden. Caused by the position of our well which we use for irrigation and the size of the new terrace, the well would be entirely hidden by the new terrace. It became necessary to install an irrigation system because once the terrace will be finished I won't be able to bring tubes into the well. Unfortunately irrigation systems are expensive so I decided to build it on my own.

Most of the irrigation systems on the market use solenoid valves at 12V or 24V. Some of them use rotating valves. Both is necessary because they need to be able to switch tubes of big diameters (e.g. PE pipes with 3/4" or 1" inner diameter or even more) and thus need power. In a normal sized garden (mine is about 800m² of lawn area needing to be watered) the region watered by each irrigator is not that big. A smaller tube diameter of 1/2" should be sufficient. If your pump provides a lot of water you can even choose to turn on two or three sprinkler at the same time, each connected by a 1/2" tube. You just have to use a bigger diameter for the tubes connecting the pump and the solenoid valves so each line is supported by enough water.

Nevertheless I want to run my irrigation sytem on top of the RaspberryPi which is powered by a 5V USB supply. There are no valves using 5V, but there are valves using 230V AC. Of course there is 230V AC available: the same plug socket which my RaspberryPi is connected to. But be aware: 230V AC is powerful but also dangerous and using it requires a lot of responsibility and carefulness - do not forget to unplug the 230V line after each test! Lucky for me the friendly chinese store got some cheap solenoid valves using 230V.

solenoid valves connected to the main water support line
(ignore the metal stripes on the wall - they are not part of the irrgation system)

So what's next? I used a relay panel to switch the 230V lines for the solenoid valves. I connected it to a level converter because the panel needs 5V inputs but the RaspberryPi only got 3.3V. It turned out that a converter is not necessary because the relay opens the N/C (normally closed) circuit once the input pin is pulled to GND. So the relay panel can be connected to the RaspberryPi directly. The photo shows the part connected including the level converter.
the RaspberryPi connected to the relay panel which is connected to the solenoid valves

The box is only for development. It is necessary to use a plastic box locked by screws to be sure the 230V lines are entirely hidden and children won't reach them! They are a danger to life!

At last a software is required to control the valves/relays. For a first draft I wrote a simple Java program which uses a property file to read the configuration from (see GitHub: https://github.com/RasPelikan/IrrigationManagement). It has a web UI for basic interaction like stopping/starting a certain sprinkler, pause an active irrigation cycle or shutting down the RaspberryPi. The software is started at boot time using the cron daemon.

So that's it. See it in action:
switching two sprinklers using the web UI

Right now the software supports GPIO based irrigators (switched by relays as mentioned above) and URL based irrigators. I bought some ESP8266 modules at the friendly chinese store mentioned before and wrote a simple Lua script (is part of the GitHub repository) which switches relays on calling an URL. I will use them to extend my irrigation system into the peripheral regions of my garden. This works at the bench and I will do another blog post once I can show it in action.

PS:
I also found a "ready to use" open source software on GitHub called sprinklers_pi. It seems to be nice and it should work straight forward using my relay switched valves. So I will give it a try. There ist also an open issue for ESP8266 based irrigators, but it does not work yet.