BrewB0y – Arduino Powered thermometer for Homebrewing.

DSC_0111

The Plan:

I wanted to improve my homebrewing process and one part of the process requiring some attention was the constant monitoring of my beer and boiling temperatures.

I looked around for a thermometer with two probes, all I could find were food thermometer, I needed something better, something waterproof and something that could withstand temps of 90+. I couldn’t find one so I decided to make one!

The Outcome:

I was extremely pleased with the outcome, it actually worked and worked very well! The process was fairly plain sailing, as with most Arduino projects there were a number of existing libraries available so all I had to do was wire it up and create the functions I needed to make it mine.

The probes I bought were fantastic and to make life easier I could wire up multiple probes into a single port using the OneWire Library, then using a short bit of code, assign an address to each probe. This meant I could run both probes at the same time thus allowing me to keep an eye of the temperature in my mash tun while I boil up the next batch of water. I wanted a nice length so that I could run the probes around my shed without hassle and at 3meters, I had more than enough.

The first part was just getting the probes working and understanding how they worked, the next part was wiring up the LCD screen for which I used the Adafruit GFX library. After working out how to display text, this was actually a simple and fun part of the process.

Finally I tweaked and refactored some of my code to make the BrewBoy updated in a timely fashion.


DSC_0119
DSC_0109 DSC_0114 DSC_0115

Early Development Video:

https://goo.gl/photos/LoZtg522LKEUGH9P7

The Shopping List.

LCD Screen: http://www.ebay.co.uk/itm/Nokia-5110-LCD-Module-Monochrome-Display-Screen-84-x-48-for-Arduino-PIC-etc-/161258450379

Probes: (2 x 3m) http://www.ebay.co.uk/itm/111635721085?_trksid=p2057872.m2749.l2649&ssPageName=STRK%3AMEBIDX%3AIT

Arduino Nano: http://www.ebay.co.uk/itm/New-Arduino-Nano-V3-0-with-CH340G-5V-16M-compatible-ATmega328P-Headers-UK-/151765624720?hash=item2355efa790

4.7k Ohm Resistor http://www.maplin.co.uk/p/metal-film-06w-47k-ohm-resistor-m4k7

The Code.

The entire project and it’s dependancies can be found on GitHub here: https://github.com/zerosimms/Brewb0y

#include <OneWire.h>
#include <DallasTemperature.h>
#include <Adafruit_GFX.h>
#include <Adafruit_PCD8544.h>

//New display object.
Adafruit_PCD8544 display = Adafruit_PCD8544(12, 11, 10, 9, 8);
 
//Temperature Pins.
#define ONE_WIRE_BUS 3

//LCD Pins.
#define PIN_RESET 8
#define PIN_SCE   9
#define PIN_DC 10
#define PIN_SDIN  11
#define PIN_SCLK  12

//Onewire object.
OneWire oneWire(ONE_WIRE_BUS);
 
//Pass our oneWire reference to Dallas Temperature. 
DallasTemperature sensors(&oneWire);
 
//Each thermometer has a unique address, this can be found with addressFinder.ino
DeviceAddress thermometer1 = { 0x28, 0xFF, 0xE3, 0x86, 0x66, 0x14, 0x03, 0x4D };
DeviceAddress thermometer2 = { 0x28, 0xFF, 0xD7, 0x76, 0x66, 0x14, 0x03, 0xA7 };
 
int buttonOne = 7;
int buttonState = 0;
int temperature1;
int temperature2;
int timer = 90;
int seconds = 0;
boolean startCountDown = false;
 
//Prints all the data to the LCD screen.
void printScreen() {
  display.setCursor(0,0);
  display.println("---BREW-B0Y---");
  display.setCursor(0,10);
  display.println("BOIL:");
  display.setCursor(32,10);
  display.print( temperature1);
  display.print("c");
  display.setCursor(0,20);
  display.println("MASH:");
  display.setCursor(32,20);
  display.print(temperature2);
  display.print("c");
  display.setCursor(0,30);
  display.print("TIME:");
  display.setCursor(32 ,30);
  display.print(timer);
  display.print("m ");
  display.print(seconds);
  display.print("s");
  display.setCursor(0,36);
  display.print("--------------");
  display.display();
  display.clearDisplay();
}
 
void setup(void) {
  Serial.begin(9600); 
  pinMode(buttonOne, INPUT);
  display.clearDisplay();  
  display.begin();
  display.setContrast(45);
  display.setTextSize(1);
  display.setTextColor(BLACK);
 
  sensors.begin();
  sensors.setResolution(thermometer1, 10);
  sensors.setResolution(thermometer2, 10);
}
 
//Does what it says.
void getTemperatures() {
  temperature1 = sensors.getTempC(thermometer1);
  temperature2 = sensors.getTempC(thermometer2);
}
 
//Check to see what state the timer is at.
void checkTimer() {
  if (timer > 0 && startCountDown){
    if (seconds >= 1){
      seconds = seconds -1; 
    }
    if (seconds == 0){
      timer = timer -1;
      seconds = 60;
    }
    if (timer <= 0){
      timer = 0;
      seconds = 0;   
    }
    delay(1000);
  }
}
 
void checkIfTimerStarted() {
  if (buttonState == HIGH) {
    startCountDown = true; 
  }
}
 
void loop(void) {
  buttonState = digitalRead(buttonOne);
  printScreen();
  getTemperatures();
  sensors.requestTemperatures();
  checkIfTimerStarted();
  checkTimer();
}