A I2C controlled, LCD enabled Thermometer: Unterschied zwischen den Versionen

Aus DL8RDS Wiki
Wechseln zu: Navigation, Suche
(Images)
(Program)
 
(8 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt)
Zeile 1: Zeile 1:
 
Here's a demonstration of a very tiny Arduino project: It's a microcontroller driven very precise digital thermometer.
 
Here's a demonstration of a very tiny Arduino project: It's a microcontroller driven very precise digital thermometer.
  
== Ingredients ===
+
== Ingredients ==
 
* Arduino Mini Pro
 
* Arduino Mini Pro
 
* JHD 162A LCD display
 
* JHD 162A LCD display
* SE95 I2C temperature sensor
+
* SE95 I2C temperature sensor on a board from Horter & Kalb http://www.horter.de/i2c/index.htm
 
* 25 kiloOhm Poti
 
* 25 kiloOhm Poti
 
* 1 kiloOhm Poti
 
* 1 kiloOhm Poti
 
* Breadboard
 
* Breadboard
 
* 3x AA Alkaline cell
 
* 3x AA Alkaline cell
 +
 +
Costs:
 +
 +
* Arduino Mini Pro 15€
 +
* JHD 162A LCD display 10€
 +
* SE95 I2C temperature sensor & board 5€
 +
* 25 kiloOhm Poti 0.25 €
 +
* 1 kiloOhm Poti 0.25 €
 +
* Breadboard + jumper cables 10 €
 +
* 3x AA Alkaline cell 2 €
 +
 +
Overall costs: 42.50€
 +
 +
Surely not a very competitive price. But the brain value was immense!
  
 
== Program ==
 
== Program ==
 
Here's the sketch:
 
Here's the sketch:
  
 +
#include <LiquidCrystal.h>
 
  #include <Wire.h>
 
  #include <Wire.h>
 
   
 
   
 
  #define tmpaddress 0x48
 
  #define tmpaddress 0x48
 
   
 
   
  void setup()
+
// Wiring pattern: LiquidCrystal(rs,rw,enable,d0,d1,d2,d3,d4,d5,d6,d7)
{
+
LiquidCrystal lcd(12,11,10,2,3,4,5,6,7,8,9);
 +
 +
  void setup() {
 
   Wire.begin();
 
   Wire.begin();
  Serial.begin(1200);
 
 
  }
 
  }
 
   
 
   
  void loop()
+
  void loop() {
{
+
   lcd.clear();
   // get the temperature
 
 
   Wire.beginTransmission(tmpaddress);
 
   Wire.beginTransmission(tmpaddress);
 
   Wire.send(0x00);
 
   Wire.send(0x00);
Zeile 34: Zeile 49:
 
   }
 
   }
 
   Wire.endTransmission();
 
   Wire.endTransmission();
+
  lcd.setCursor(0,0);
   Serial.println("-----------");
+
   lcd.print("Temperatur: ");
   Serial.println(temperature-3);
+
   lcd.print(temperature);
   delay(1000);
+
  lcd.print(" C");
 +
   delay(2000);
 
  }
 
  }
  
Zeile 43: Zeile 59:
  
 
* battery voltage: 4,79 V
 
* battery voltage: 4,79 V
* current: 17 mA
+
* current: 12 mA with interrupted connection to the LCD LED
* power consumption: 81 mW
+
* power consumption: 57 mW
 +
 
 +
Given that a AA battery has an assumed capacity of 2850 mAh (3x Duracell Ultra MN1500), the thermometer would run for about 50 hours until the batteries are fully discharged. For short-time measurementy upon activation this means at least months of lifetime!
 +
 
 +
And this is given that the full potential of the sketch has not yet been released because it is possible to switch the sensor into sleep mode...
  
 
== Images ==
 
== Images ==

Aktuelle Version vom 3. November 2009, 17:34 Uhr

Here's a demonstration of a very tiny Arduino project: It's a microcontroller driven very precise digital thermometer.

1 Ingredients

  • Arduino Mini Pro
  • JHD 162A LCD display
  • SE95 I2C temperature sensor on a board from Horter & Kalb http://www.horter.de/i2c/index.htm
  • 25 kiloOhm Poti
  • 1 kiloOhm Poti
  • Breadboard
  • 3x AA Alkaline cell

Costs:

  • Arduino Mini Pro 15€
  • JHD 162A LCD display 10€
  • SE95 I2C temperature sensor & board 5€
  • 25 kiloOhm Poti 0.25 €
  • 1 kiloOhm Poti 0.25 €
  • Breadboard + jumper cables 10 €
  • 3x AA Alkaline cell 2 €

Overall costs: 42.50€

Surely not a very competitive price. But the brain value was immense!

2 Program

Here's the sketch:

#include <LiquidCrystal.h>
#include <Wire.h>

#define tmpaddress 0x48

// Wiring pattern: LiquidCrystal(rs,rw,enable,d0,d1,d2,d3,d4,d5,d6,d7)
LiquidCrystal lcd(12,11,10,2,3,4,5,6,7,8,9);

void setup() {
  Wire.begin();
}

void loop() {
  lcd.clear();
  Wire.beginTransmission(tmpaddress);
  Wire.send(0x00);
  Wire.requestFrom(tmpaddress, 1);
  int temperature = 0;
  if (Wire.available()) {
    temperature = Wire.receive();
  }
  Wire.endTransmission();
  lcd.setCursor(0,0);
  lcd.print("Temperatur: ");
  lcd.print(temperature);
  lcd.print(" C");
  delay(2000);
}

3 Tests

  • battery voltage: 4,79 V
  • current: 12 mA with interrupted connection to the LCD LED
  • power consumption: 57 mW

Given that a AA battery has an assumed capacity of 2850 mAh (3x Duracell Ultra MN1500), the thermometer would run for about 50 hours until the batteries are fully discharged. For short-time measurementy upon activation this means at least months of lifetime!

And this is given that the full potential of the sketch has not yet been released because it is possible to switch the sensor into sleep mode...

4 Images

I2C-Controlled LCD-enabled Thermometer.jpg

I2C-Controlled LCD-enabled Thermometer BreadBoard closeUp.jpg