找了一個暖暖包,把溫度計包進去,外頭再包一個毛巾,開啟電腦的serial port開始接收資料
ts '%Y-%m-%d %H:%M:%S', < /dev/ttyACM1 >>log
![IMAG2314](https://farm9.static.flickr.com/8676/28696678411_085a97d480_z.jpg)
這是測試的前40分鐘,溫度上升到70度了
![heat](https://farm9.static.flickr.com/8837/28158790803_92bd22df7f_z.jpg)
經過兩個小時之後,斜率快要為零了,這個時間能維持多久呢?
![heat2](https://farm9.static.flickr.com/8863/28668534552_f0aa474631_z.jpg)
到了隔天,看到昨晚開始作的暖暖包溫度計畫結束了。使用的是袋鼠暖暖包,宣稱最高溫度63°C,平均溫度53°C,持續時間12小時。做出來的結果是這樣,不過其宣稱的效果應該有特定的測定方式,我則是直接用暖暖包包著溫度計去測試的。實際使用時,若是直接讓暖暖包接觸皮膚,顯然會有煮熟皮膚的可能性。
![heat3](https://farm9.static.flickr.com/8434/28742205326_c9f57a5aa3_z.jpg)
![IMAG2313](https://farm9.static.flickr.com/8612/28156217014_d95f7010bb_z.jpg)
以下是各種程式的寫法
----------------------
Arduino
----------------------
unsigned long time;
// 匯入程式庫標頭檔
//from http://playground.arduino.cc/Learning/OneWire
#include <onewire .h="">
//from https://github.com/milesburton/Arduino-Temperature-Control-Library
#include <dallastemperature .h="">
#include <wire .h="">
// Arduino數位腳位2接到1-Wire裝置
#define ONE_WIRE_BUS 2
// 運用程式庫建立物件
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
void setup(void)
{
sensors.begin();
// 初始化
Serial.begin(9600);
}
void loop(void)
{
// 要求匯流排上的所有感測器進行溫度轉換
// 參數0代表匯流排上第0個1-Wire裝置
sensors.requestTemperatures();
time = millis();
Serial.print(time);
Serial.print(",");
Serial.println(sensors.getTempCByIndex(0));
delay(1000);
}
--------------------------------
gnuplot script
--------------------------------
set xdata time
set datafile separator ","
set timefmt "%Y-%m-%d %H:%M:%S"
set xrange [0:12*60*60]
set yrange [0:80]
set xlabel "經過時間(時:分)"
set ylabel "攝氏溫度"
set title "暖暖包溫度"
set grid
unset key
startTime=strptime("%Y-%m-%d %H:%M:%S","2016-08-02 20:05:58")
plot "logfile" using (timecolumn(1)-startTime):3 with lines linetype rgb "red"
pause -1
</wire></dallastemperature></onewire>