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.

Mittwoch, 19. April 2017

ATX power supply

I began to think about the things necessary to build a table tennis robot. Next to the construction itself a lot of motors are needed!
I found a motor including a mounted wheel for accelerating the ball - it consumes 500mA at 3V. A second motor is needed for applying the spin. I need a lot of servos for different tasks, some are weak (consuming 150mA at 5V) others strong (consuming 1A at 5V). The RaspberryPi itself will need approximately 1A at 5V. The last part is a stepper which will drive the push mechanism to move the balls to the accelerating wheel.  That stepper will consume about 1A at 12V. So I will need a lot of current at 3V (1A), at 5V (~5A) and at 12V (1A).
But wait a minute: aren't those voltages provided by a regular ATX power supply? Yes they are. Except 3V but 3.3V will work as well.

There are some projects out there providing an ATX power supply for driving a RaspberryPi. But wouldn't it be boring simply ordering another part? It is much more interesting to build a circuit on my own. And this is what I did:


On GitHub you can find all information how to build it on your own:
https://github.com/RasPelikan/raspberrypi-atx

Sonntag, 26. Februar 2017

Table tennis robot

Unfortunately it is a long time ago that I wrote a blog post. I was on the way to build a mowing robot.

On the way I had to invent a lot of things. Some of them are:

  • For Pi4J:
    • Pull request - Added MCP44xx, MCP45xx and MCP46xx families to pi4j-i2c-devices
    • Pull request - New Concurrency in I2CDeviceImpl and I2CBusImpl
  • AVR-projects:
    • Eclipse-Plugin - Use usbasp programmer to show up UART in Eclipse
    • Gadget - A silver screen remote controller
But since I could not tell my wife when the mowing robot will mow the gras in our garden, she did not want to wait any more and I had to buy a ready-to-use product. And yes, it mows the garden.

So what now?

In the last fall my sun started playing table tennis. Due the fact that this is some sort of "farther and son"-thing I also learn table tennis. And after the first lessons I recognized that it would be fantastic the use a table tennis robot for the training. A robot would be able to place every ball to the same spot, with the same speed and the same spin. So you can focus on refining your technique. As always you can buy a cheap model which won't make you happy on the long run or you take a lot of money and buy a good model. Or, you DIY :-) ... which not necessarily means that you will be happy on the long run :-)=)

In the very beginning a saw a lot of Youtube videos showing DIY table tennis robots. But I also looked videos of professional robots to get inspired. And after a couple of days I knew that I want to build a robot which one day might be better than professionals. But step by step: 
  1. The first "version" should be similar to those cheap models: They sit in the middle of the table and shoot the balls to the left, to the middle or to the right. The cheap robots only know top-spin oder under-spin. My robot should be able to create every spin (top, under, left, right, combinations). Additionally it should also be able to shoot faster or slower in combination with up- and down-directions. And, of course, a ball recycler: A net which collects all the balls I return during practicing and brings them back to the robot to shoot them again.
  2. Once this works I want to build a rail on which the robots moves. This should enable an advanced training mode and generates shoots like a human player would do. Additionally the ball-cannon should be able to move up and down. Especially for this version I can reuse a lot of things I already bought for building the mowing robot.
  3. And in the end I want to add a RaspberryPi camera module to track the ball and move the robot not only in predefined ways. It should move along the returning ball to shoot the next ball from the place the returned ball hits the collector net. This should give a feeling as playing with a person.
In the last three months I tried some of this features to see whether I could make it. And yes, it seems to be makable. So I will report about the progress, the problems and the solutions in the upcoming posts.