I decided to use the Arduino Yun I had on hand to collect the data and make it available on the internet. A quick Google search for "TTF-103 arduino" and I found some code to convert the readings from the thermistor to temperature. I added some code to log readings from two thermistors to the SD card on the Linux side of the Yun.
File dataFile = FileSystem.open("/mnt/sd/temperature.log", FILE_APPEND);
if (dataFile) {
dataFile.println(getTimeStamp()+","+String(ADCPin)+","+String(fTemp,4));
dataFile.close();
}
I put the Yun in a Radio Shack project box and attached it to the back of the snake's enclosure with velcro.
I used regular old scotch tape to attach the thermistors inside the enclosure.
Initially I created a page using jpgraph that displays the temperature readings of both sides of the enclosure .
This was working fine, but wouldn't it be cool if I could just ask the terrarium what the temperature was like? Enter Alexa. It was actually easier than I thought to get a custom skill up and running using the Amazon documentation. The biggest issue I had was trying to get Amazon to use a page served from the web server on the Yun. No matter what I did it complained about the security of the SSL certificate I was using. I ended up finding an Amazon Lambda function that acts as a proxy to bypass this security requirement. All that was left was writing a quick page to return the temperature readings in a format that Alexa can understand.
<?php
exec("tail -n 2 /mnt/sd/temperature.log",$lines);
$left = explode(',',$lines[0]);
$right = explode(',',$lines[1]);
$readings = array('left'=>$left[2],'right'=>$right[2]);
$outputSpeech = array("type"=>"PlainText","text"=>"Left side temp ".$readings['left'] ." degrees. Right side temp ".$readings['right'] ." degrees");
$card = array("content"=>"Left: ".$readings['left']." F\nRight: ".$readings['right']." F","title"=>"Temp Readings","type"=>"Simple");
$response = array("version"=>"1.0","response"=>array("outputSpeech"=>$outputSpeech,"card"=>$card,"shouldEndSession"=>true));
header('Content-Type: application/json');
echo json_encode($response,JSON_PRETTY_PRINT);
?>
This produces JSON like this:
{ "version": "1.0", "response": { "outputSpeech": { "type": "PlainText", "text": "Left side temp 76.5225 degrees. Right side temp 81.8562 degrees" }, "card": { "content": "Left: 76.5225 F\nRight: 81.8562 F", "title": "Temp Readings", "type": "Simple" }, "shouldEndSession": true } }