First things first. Let's see what I needed and why I used Arduino.
I have two fermentation buckets which I always put into thermal bags. This gives me the option to achieve the 4-5°C less than room temperature. It is the simplest way to control temperature. You just need to put 2 bottles with frozen water inside the bags with the fermentation buckets.
Sometimes I want to know exactly how the temperature history log looks throughout the night etc. I need sleep so of course I don't want to sit and look at the thermometer all the time. I just need to test it to be able to know when and how much bottles I need to put into the bags to keep the necessary temperature inside. This is why I need a temperature logger. Of course you can buy something like it in many shops. But why not use my old Arduino board and create my own logger? This is why I used Arduino for that. I like to play with it and I've got already many pieces like a board, cables, resistors, temperature sensors etc.
You can use this kind of tool in many other situations, not only in home brewery of course.
Ok so here’s what we need to achieve our goal.
I needed a simple NodeJS app that would log the temperature in the bag each hour. So it should prepare a file with the date and time and also temperature reading line by line. This should be a standard .txt file. We will use a standard laptop with Ubuntu OS. So you need to keep your computer on when using this logger, but of course you could use other small computers like Raspberry Pi etc. It just needs to run Node and log the temperature each hour. Actually, it could do many things like prepare some charts or data sheets. You are limited only by your imagination.
What hardware do we need?
We need the Arduino board. I use Arduino Uno. You also need BreadBoard + Jumper Wires, resistor (you can use 4,7 kΩ), Cable Temperature sensor DS18B20 with probe. We will use a small temperature sensor for the tests, but of course at the end we need a long sensor with a probe to be able to place it inside the bag. But for the tests we can use a standard small sensor, which is the same DS18B20 type sensor but much smaller. You can buy all that stuff on eBay and other electronic shops. These links are just samples.
What software do we need?
How do you install and use Arduino IDE?
What you need to do first is to install Arduino IDE. We need Arduino IDE 1.6.4 or higher. You can find instructions on the net but it depends on your operating system. We will use an Ubuntu-like system here so here are the instruction: https://www.arduino.cc/en/Guide/Linux.
After you run your Arduino IDE app. You'll need to do couple of things. First we need to set up our port. We need to go to
Tools -> Port in the main menu and set up the port to
/dev/ttyACM0. (It could differ depending on your OS) Then we need to install
ConfigurableFirmata which is needed to run our temperature sensor with Johnny Five. You need to go to
Sketch -> Include Library -> Manage Libraries and then search for
ConfigurableFirmata and click on Install. You'll find more information here: https://github.com/firmata/ConfigurableFirmata. After installing it you’ll be able to load it to your board, but first we need to connect our Arduino board.
How do you prepare Arduino board?
We will use the Thermometer – DS18B20 sensor to be able to read the temperature. All you need is to connect your sensor and Arduino board exactly as it is shown on the picture:
As you can see, we’re going to use small DS18B20 sensor just for the demo purposes, but you can also connect another sensor with a cable to be able to put it in the cooling bag with fermentation buckets and measure it outside.
Our circuit here is quite simple. We just use one resistor and some cables to wire it up to our Arduino board and be able to receive the data through the digital slots. On the image above you can see how to connect particular parts.
Ok, let's see how we can use our hardware configuration.
Temperature logger app.
We have our Arduino board connected and we also have our Arduino IDE running. All we need to do now is to write our simple application in Node which will log the Arduino's temperature sensor readings into the standard .txt file.
Oh, and remember to load ConfigurableFirmata. In Arduino IDE go to
File -> Examples -> ConfigurableFirmata and click the 'load' button.
You can clone the app from here: https://github.com/juliancwirko/arduino-temperature-logger
As you can see, this is a very basic and simple app. For now we just need it to be able to prepare our temperature log in the log.txt file.
What I've done here is install Johnny Five from Npm and I also use standard Node's IO operations to be able to create and write to the .txt file. Of course I also use the Johnny Five API to read the temperature. The whole app is located in one index.js file. The code is a simple example of using Johnny Five. We use Johnny Five to connect to our Temperature Sensor connected through Arduino board and we just listen to data changes (temperature readings) and then we create a file and write the readings line by line with one hour frequency (we don't need more frequent readings here but of course you can change it). The code is quite readable and you can always refer to the Johnny Five API docs: http://johnny-five.io/api/.
As soon as you connect your Arduino board and clone the app, you need to install dependencies by
npm install and then you can run it by
sudo node index.js. If you are using Ubuntu-like OS you would probably run it as a super user. When the app starts, it will create the log.txt file and it will write the new temperature reading every hour.
Ok, so how can I expand this starter demo app?
You’re probably thinking – ok so you have your private temperature logger and it’s quite messy. What is this article for?
I wanted to maybe open some doors so you would be able to open the next ones. I mean, this is what I wanted at the moment, but from this point you can do whatever you want with this kind of app. Imagine some backend app integration and automatic logger which will log the temperatures all the time. Imagine e-mail notifications or even SMS notifications if the temperature goes below its limit. You can also integrate it with some native smartphone apps. You could use something like Raspberry Pi to compress the size of your computer behind it. You could even integrate it with other services like social services or other specialistic services. I’m sure you’ll find many other applications for it.
My basic temperature logger is quite useful. Of course for now I have to remember not to shut down my computer and to be careful with all the wires, but it’s quite cool. All the parts are really cheap, even in my country ;) So I have it almost for free.
This also shows how simple it is to build something useful even when you don't know about electronics much and you are just a front-end guy.
Just wanted to share my thoughts on this occasion. I hope that someone finds it useful. Cheers!