Found an interesting temperature probe on the auction site and I decided to acquire two pieces to test them out. With the LCD module, it seems making a temperature meter is not that hard at all.
In this tutorial, I will show you how to make a temperature meter that allows you to measure temperature with a probe and display current, highest, and lowest temperatures on LCD module.
After I made this, I left it on the desk almost a week and it’s still working!
I guess it’s time to share how I did this.
See photo below:
- Arudino Mini Pro * 1
- LCD Module 4 x 20 (J204A) * 1
- Temperature Probe (DS18B20) * 1
- Protoboard * 1
- 22k resistor * 1
- Few jumper wires
- Arduino-GND to GND
- Arduino-VCC to VCC
- Temperature probe-GND to GND
- Temperature probe-VCC to VCC
- Temperature probe-Data to 2.2K resistor to VCC
- LCD-GND to GND
- LCD-VCC to VCC
- LCD-SDA to Arduino A4/SDA
- LCD-SLC to Arduino A5/SLC
- Protoboard VCC/GND to 5V DC power source
- Slide switch to VCC/GND (For LCD on/Off, but not shown below)
Connection:
LCD Module:
//Library version:1.1 #include <Wire.h> #include <LiquidCrystal_I2C.h> //Used for DS18S20 Temperature sensor #include <OneWire.h> #include <DallasTemperature.h> /*Define for DS18S20 data pins * This data pins needs to connect 220 Om resister and to 5V to work */ #define ONE_WIRE_BUS 4 //Define for LCD display pins, SLC 3, SDA 2 #define SCL_CLOCK_PIN 3 #define SDA_DATA_PIN 2 //Initialize OneWire library for temperature sensor OneWire oneWire(ONE_WIRE_BUS); DallasTemperature sensors(&oneWire); // set the LCD address to 0x27 for a 20 chars and 4 line display LiquidCrystal_I2C lcd(0x27,20,4); float HighestTemp = 0.0; float CurrentTemp = 0.0; float LowestTemp = 0.0; void setup() { // start temperature sensor sensors.begin(); sensors.requestTemperatures(); //get temperature // initialize the LCD //You may setup your own clock pin(SCL), data pin(SDA) 2013-12-14 //Wire.beginOnPins(SCL_CLOCK_PIN, SDA_DATA_PIN); lcd.init(); lcd.backlight(); //Set lowest, highest temperatues CurrentTemp = sensors.getTempCByIndex(0); HighestTemp = CurrentTemp; LowestTemp = CurrentTemp; lcd.setCursor(0,0); lcd.print(F("=Temperature Meter=")); lcd.setCursor(0,1); lcd.print(F("Highest: ")); LCDshowNum(8,1,HighestTemp); lcd.setCursor(0,2); lcd.print(F("Current: ")); LCDshowNum(8,2,CurrentTemp); lcd.setCursor(0,3); lcd.print(F("Lowest: ")); LCDshowNum(8,3,LowestTemp); } void loop() { sensors.requestTemperatures(); //get temperature //Get Current CurrentTemp = sensors.getTempCByIndex(0); LCDshowNum(8,2,CurrentTemp); //Check if Hightest if(CurrentTemp > HighestTemp){ HighestTemp = CurrentTemp; LCDshowNum(8,1,HighestTemp); } //Chekc if Lowest if(CurrentTemp < LowestTemp){ LowestTemp = CurrentTemp; LCDshowNum(8,3,LowestTemp); } delay(1); } /* * LCDshowNum * LCD display location: x, y * Float n: temperature to display */ void LCDshowNum(int x, int y, float n){ lcd.setCursor(x,y); lcd.print(n); }
In the video, I had three bottles filled with hot water from drinking fountain, room temperature tap water, and ice cube water. I told my son to place the probe into each bottle and we observed the changing in temperatures. It was a lot of fun to see the temperature goes high and low!
My son asked me “Is there a way to see temperature drop to 0 or minus”? We quickly found the answer from Internet. The answer is so simple, just put salt on top of ice cubes without water. With in a minute, the temperature dropped to -11 Celsius degrees (12 degrees in Fahrenheit). Actually, the lowest temperature we got was Celsius -14.31 (6.242 degrees in Fahrenheit), but not recorded in the video. See video below.
I hope you enjoy this tutorial and have fun with your kids!
I hope you enjoy this tutorial and have fun with your kids!
Stonez
自製 Arduino 溫度測量機
在這個教學中,我會教你們怎麼做一個可以讓你在LCD模型上測量出目前的溫度,最高的溫度和最低的溫度的「溫度測量機」。在我完成它之後,我把它放在桌子上大約一個星期後,它還在運作呢!☺ 我覺得是時候該跟大家分享我是怎麼製作它了。看看我的溫度測量機:
需要材料:
- Arudino Mini Pro * 1
- LCD 模組 4 x 20 (J204A) * 1
- 溫度探棒 (DS18B20) * 1
- 洞洞板 * 1
- 22k 電阻 * 1
- 幾根跳線
線路連接方法:
- Arduino-GND to GND
- Arduino-VCC to VCC
- Temperature probe-GND to GND
- Temperature probe-VCC to VCC
- Temperature probe-Data to 2.2K resistor to VCC
- LCD-GND to GND
- LCD-VCC to VCC
- LCD-SDA to Arduino A4/SDA
- LCD-SLC to Arduino A5/SLC
- Protoboard VCC/GND to 5V DC power source
- Slide switch to VCC/GND (For LCD on/Off, but not shown below)
電路圖如下:
我兒子問我:「有沒有可能讓溫度降到零度或更低?」我們很快的從網路上找到了答案。其實很簡單,只要在冰塊上撒鹽。過了大約一分鐘,溫度就降到了-11度 C(我們最低該溫度降到到-14.31度 C)!看著溫度快速的上升又急快的下降真有趣!請看底下的影片:
找個時間做這個Arduino 專案,再和小朋友一起同樂吧!
Stonez