Wednesday, April 3, 2013

Temperature based flow regulator

Since almost none of the readers of this blog understand Swedish, I decided to go international and start writing in English.

In this post I will cover the construction of a temperature based flow regulator that some friends and I have built in order to make sure that the wort temperature is cooled from boiling point to 25°C in our micro brewery. This is important to make sure that the yeast is not killed when added. Since i have some experience in wireless communication we figured it would be cool to make the regulator remotely controlled from an android application.

The setup is kind of similar to my previous project and is built around two Atmega88 with wireless communication through two nRF24L01 adapters (see my tutorial covering the nRF24L01 and AVR).

Regulator setup
- Power supply, 5V 2A USB-power supply (Powerful phone charger that both supplies the Atmega88 and drives the motorized ball valve)

Atmega88, the "computer", a microcontroller that takes and gives commands.

- nRF24L01, 2,4 GHz module that sets up a wireless link with the other nRF-module attached to the computer.

- LM35, Temperature sensor 10mV/°C scale factor and +-0,5°C accuracy.

- Motorized ball valve, 12V (DC-motor works perfectly on 5V, just a bit slower)

- H-bridge, to drive the ball valve DC-motor in ether direction (H-bridge described well here). The components used are two IRF540N (N-channel) and two IRF9540N (P-channel) mosfets.

- Prototype PCB, to solder everything on.

- Heat-exchanger 44kW

- Garden hose connections female, male.

Armed with a soldering iron, the process went fairly quick and the result is shown below.

The top corner is where the motorized ball valve is connected, and powered via the H-bridge (the fore black mosfets). The temperature probe is attached in the left corner, and the RF-module is the green to the left. The black thing next to the RF-module is a linear regulator that converts the 5 V to 3,3 V since it cannot work with 5 V. When the motor on the valve starts, it produces a huge voltage drop in the system, and therefore it is necessarily to put a large capacitor on the power supply. 

For anyone that wants to construct a H-bridge, i found a great way of soldering them together as you can see at the very top of this picture. Put the two P-channel ones at the back row, and the two n-channel ones in the front row so they line up. Then on each p-channel mosfet you bend the two right connectors (seen from underneath) and solder them to the n-channel ones which you can cut off. For each pair of p+n-channel mosfet you then connect the right rail to respective i/o port on the micro controller, and the middle one to respective DC-motor connection. The  left connectors of the P-channel mosfets connects to 5V, and the left connectors on the N-channel ones connects to ground.

The temperature measurements is done in the hose connector where the wort leaves the heat-exchanger. It looks a bit messy, but at least it does not leak and the quick connector still works! ;)


The heat exchanger is used as a counter current flow type, and is regulated by controlling the flow of the cold tap-water outlet, so that the temperature of the wort outlet matches its predefined value.

This is an overview of the complete setup of the system (the +-2°C should be -+0,5°C). The home-made module attached to the computer is a similar unit as the regulator, but instead of USB power, temperature probe and dual H-bridge it is connected to the computer via a USB to COM adapter like this one: (i have a small tutorial about USART and Atmega88 here)


The android application is communication via TCP (wifi or 3G) and is controlled by the same visual basic program i built in the last post to control the ultimate IR-RF remote control:

Screenshots of the android application:

The user can tap on the picture representing the heat exchanger above and set a new temperature for the regulator to aim for. The current temperature is automatically updated every 2 s where it now says "- °C". The two other temperature fields are not up and running at the moment, but in the future they are suppose to regulate the temperature of the boiler and the mash-tun.

If anyone have questions about the build or want me to explain my projects further, please just write a comment!


  1. Hi, I wrote on for the RF24L01 project. I have no idea how to contact you. If you can see my address here use that or look it up on my hp: Look for "Kontakt".

  2. The approach followed is really appreciative. Temperature control is capable of measuring the input and thereby regulating the heat perfectly in order to get the desired temperature at the output. Such experiments seem to gain knowledge either ways.

  3. your tutorial is very very useful.I like your coding style.
    I am a learner and very much interested in embedded programming.but i am stuck with how analyze a situation? how to design it for the requirement? how to split up the program into a module?how to develop the skills to design a standard project or program?
    please guide me to the right direction...... (replace "_ with "@")

    1. Well, in my case i usually have an idéa of what i want to do, and then i try and find a way of doing it either by finding simular projects (google it), or by using knowladge from my previous projects.
      Start by creating simple projects, and go on from there... I started by taking tutorials like this one

  4. This is a great device! I found some more information on this website:

  5. MestiQQ Adalah perusahaan judi online KELAS DUNIA ber-grade A

    Sudah saatnya Pencinta POKER Bergabung bersama kami dengan Pemain - Pemain RATING-A

    Hanya dengan MINIMAL DEPOSIT RP. 10.000 anda sudah bisa bermain di semua games.

    Kini terdapat 8 permainan yang hanya menggunakan 1 User ID & hanya dalam 1 website.


    100% tanpa robot, 100% Player VS Player.
    Live Chat Online 24 Jam Dan Dilayani Oleh Customer Service Profesional.

    Segera DAFTARKAN diri anda dan Coba keberuntungan anda bersama MestiQQ
    ** Register/Pendaftaran : WWW-MestiQQ-POKER
    Jadilah Milionare Sekarang Juga Hanya di MestiQQ ^^

    Untuk Informasi lebih lanjut silahkan Hubungi Customer Service kami :
    BBM : 2C2EC3A3
    WA: +855966531715
    SKYPE :