Arduino + DS18B20 + HD44780 | HomeBrewTalk.com - Beer, Wine, Mead, & Cider Brewing Discussion Community.

Homebrew Talk

Help Support Homebrew Talk by donating:

  1. Dismiss Notice
  2. We have a new forum and it needs your help! Homebrewing Deals is a forum to post whatever deals and specials you find that other homebrewers might value! Includes coupon layering, Craigslist finds, eBay finds, Amazon specials, etc.
    Dismiss Notice

Arduino + DS18B20 + HD44780

Discussion in 'Brew Stands' started by PhattieMcgee, Jan 16, 2011.

 

  1. #1
    PhattieMcgee

    Member

    Posted Jan 16, 2011
    I have an Arduino that I got for x-mas a few years ago, it has been collecting dust and I'd like to use it to monitor my Brother in Laws mash tun/kettle/HLT temps.

    So far I've found http://www.brewershardware.com/BrewTroller-Sensors/ & http://www.hacktronics.com/LCDs/LCD-HackPack/flypage.tpl.html and the code to run both of them separate.

    My problem now is how to print the temps to the LCD. I haven't ordered the parts yet, so I cant test out my mad ctrl+c/v skills. so I was hoping someone here might happen to have this already coded, and would be willing to share :D
     
  2. #2
    jfkriege

    Well-Known Member

    Posted Jan 16, 2011
    You should check out the brewtroller. It is an open source setup for brewery automation based on the arduino platform. What they have done above and beyond what you have is to create a custom arduino board. All of the program, including the LCD code is on the website.

    Joshua
     
  3. #3
    PhattieMcgee

    Member

    Posted Jan 16, 2011
    I've seen the brewtroller project, I don't have that kinda money to spend right now. I'm also not a coder, hence why the Arduino has been collecting dust. I looked over the code over at brewtrollers to see if I could mash it together somehow, but I couldn't make heads or tails of what I needed.
     
  4. #4
    gromitdj

    Well-Known Member

    Posted Jan 17, 2011
    I can give you the code that I wrote to use with my arduino, but it may not be of any use to you. I used the Serial Backpack from Sparkfun. It was alot easier because it allowed me to hook it up with only 3 wires rather than 12+.
     
  5. #5
    PhattieMcgee

    Member

    Posted Jan 17, 2011
    I might not be able to find a use for it, but others might. So please go ahead and post your code :) and thanks for the heads up on the Serial Backpack, I probably wont use it since I'm very limited on funds from divorcing my wife. But in the future, I may look into getting one to spare some ports!
     
  6. #6
    gromitdj

    Well-Known Member

    Posted Jan 17, 2011
    It's way too ugly for the public domain!
     
  7. #7
    PhattieMcgee

    Member

    Posted Jan 18, 2011
    Well here is my code...remember, im not a code jockey, so its just cut and pasted :eek: I dont have the parts to test it, so no idea if it works or not, but hey it compiled! :mug:

    Code:
    #include <OneWire.h>
    #include <DallasTemperature.h>
    #include <LiquidCrystal.h>
    
    // Data wire is plugged into pin 7 on the Arduino
    #define ONE_WIRE_BUS 7
    
    // Setup a oneWire instance to communicate with any OneWire devices
    OneWire oneWire(ONE_WIRE_BUS);
    
    // Pass our oneWire reference to Dallas Temperature. 
    DallasTemperature sensors(&oneWire);
    
    // Assign the addresses of your 1-Wire temp sensors.
    // See the tutorial on how to obtain these addresses:
    // http://www.hacktronics.com/Tutorials/arduino-1-wire-address-finder.html
    
    DeviceAddress kettleThermometer = { 0x28, 0x94, 0xE2, 0xDF, 0x02, 0x00, 0x00, 0xFE };
    DeviceAddress mashThermometer = { 0x28, 0x6B, 0xDF, 0xDF, 0x02, 0x00, 0x00, 0xC0 };
    DeviceAddress HLTThermometer = { 0x28, 0x59, 0xBE, 0xDF, 0x02, 0x00, 0x00, 0x9F };
    
    // Connections:
    // rs (LCD pin 4) to Arduino pin 12
    // rw (LCD pin 5) to Arduino pin 11
    // enable (LCD pin 6) to Arduino pin 10
    // LCD pin 15 to Arduino pin 13
    // LCD pins d4, d5, d6, d7 to Arduino pins 5, 4, 3, 2
    LiquidCrystal lcd(12, 11, 10, 5, 4, 3, 2);
    
    int backLight = 13;    // pin 13 will control the backlight
    
    void setup(void)
    {
      pinMode(backLight, OUTPUT);
      digitalWrite(backLight, HIGH); // turn backlight on. Replace 'HIGH' with 'LOW' to turn it off.
      // start serial port
      Serial.begin(9600);
      // Start up the library
      sensors.begin();
      // set the resolution to 10 bit (good enough?)
      sensors.setResolution(kettleThermometer, 10);
      sensors.setResolution(mashThermometer, 10);
      sensors.setResolution(HLTThermometer, 10);
    }
    
    void printTemperature(DeviceAddress deviceAddress)
    {
      float tempC = sensors.getTempC(deviceAddress);
      if (tempC == -127.00) {
        Serial.print("Error getting temperature");
      } else {
        Serial.print("C: ");
        Serial.print(tempC);
        Serial.print(" F: ");
        Serial.print(DallasTemperature::toFahrenheit(tempC));
      }
    }
    
    void loop(void)
    { 
      lcd.begin(20,4);              // columns, rows.
      lcd.clear();                  // start with a blank screen
      delay(2000);                  // is the delay needed?
      lcd.setCursor(0,0);           // set cursor to column 0, row 0 (the first row)
      lcd.print("Getting temperatures...\n\r");    // inform me that its doing something
      sensors.requestTemperatures();
      lcd.setCursor(0,1);           // set cursor to column 0, row 1
      lcd.print("Kettle temperature is: ");
      printTemperature(insideThermometer);
      lcd.print("\n\r");
      lcd.setCursor(0,2);          // set cursor to column 0, row 2
      lcd.print("Mash temperature is: ");
      printTemperature(outsideThermometer);
      lcd.print("\n\r");
      lcd.setCursor(0,3);          // set cursor to column 0, row 3
      lcd.print("HLT temperature is: ");
      printTemperature(dogHouseThermometer);
      lcd.print("\n\r\n\r");
      
    }
    
     
  8. #8
    jasper9

    Well-Known Member

    Posted Jan 18, 2011
    Whoa i didn't realize p'jamming on those things was so straight forward. I'm totally going to get started with one soon. I saw a nifty beginners kit on Sparkfun for about $100. I have played with resistors since I was a kid with one of those big plastic electronics teaching kits.
     
Draft saved Draft deleted

Share This Page

Group Builder