Arduino LCD Thermometer


Arduino LCD Thermometer Using Dallas DS1822+

Arduino LCD Thermometer Using Dallas DS1822+

The Dallas DS1822+ is a tiny little IC in a typical transistor package that can be used for temperature readings. I put together a simple little sketch using this device together with a 16×2 LCD for the read out. The code is based on two other sketches I found; one for LCD and the other for reading temperatures with the Dallas 1822+.

It is powered by 5V via USB. I had to use both the 3V and 5V outputs of the Arduino to power the Dallas DS1822+ and the LCD simultaneously. The LCD wouldn’t work when I tried to power it on the same 5V as the IC. Does anyone know how to make them work together? This is one of my first Arduino projects and I’m just thinking the circuits I can combine is limited if they all need separate power supplies.

This code prints the temperature only when it changes. It prints to the serial port that you can read from your computer if hooked up and it prints to the LCD.

#include
	
#include
long temp_old = 0;
	
DallasTemperature tempSensor;
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
	
void setup(void) {
  lcd.begin(16, 2);
  Serial.begin(9600);
  tempSensor.begin(10);
  Serial.println(\"LCD Thermometer by M. Starnes and the Arduino Community\");
}
	
void loop(void) {
  // Ask the library whether the device is valid
  switch(tempSensor.isValid())
  {
    case 1:
      Serial.println(\"Invalid CRC\");
      tempSensor.reset();
      return;
    case 2:
      Serial.println(\"Not a valid device\");
      tempSensor.reset();
      return;
  }
	
  long temp = DallasTemperature::toFahrenheit(tempSensor.getTemperature());
  // update only if the temperature has changed
  if( abs(long(temp)) != abs(long(temp_old)) ) {
    Serial.print(temp);
    Serial.print(\"F\");
    lcd.setCursor(0, 1);
    lcd.print(temp);
    lcd.print(\"F\");
    temp_old = temp;
    Serial.println();
  }
}

To put the project together, I used the following components:

  • Breadboard
  • Dallas DS1822+ IC Thermometer (board mount)
  • 4.7K resistor
  • 10K Pot
  • NMTC-S16205DRGHS Gray Reflective Microtips LCD Character Display Module (16×2)
  • Arduino Duemilanove

Connections:

  1. Arduino 3V to Breadboard +
  2. Arduino GND to Breadboard GND
  3. Arduino 5V to DS1822+ VDD
  4. DS1822+ to 4.7k resistor
  5. 4.7k  Resistor to DS1822+ Data pin
  6. DS1822+ GND to Breadboard GND
  7. DS1882+ Data pin to Arduino Pin 10
  8. 10k Potentiometer legs to Breadboard GND and Breadboard +
  9. LCD Pin 1 to Breadboard GND
  10. LCD Pin 2 to Breadboard +
  11. LCD Pin 3 to 10k Pot Wiper (center)
  12. LCD Pin 4 to Arduino Pin 12
  13. LCD Pin 5 to Breadboard GND
  14. LCD Pin 6 to Arduino Pin 11
  15. LCD Pin 11 to Arduino Pin 5
  16. LCD Pin 12 to Arduino Pin 6
  17. LCD Pin 13 to Arduino Pin 7
  18. LCD Pin 14 to Arduino Pin 8

Be prepared for the coming food shortage.