Robert Korn
Published © MIT

Linkit ONE Wifi Meat Thermometer

If you have a BBQ Smoker you need one of these.

EasyFull instructions provided389
Linkit ONE Wifi Meat Thermometer

Things used in this project

Hardware components

LinkIt ONE
MediaTek Labs LinkIt ONE
×1
AD-DTTC Temperature robes
×3
3/32 Mono Headphone Jacks
×3
Futaba Serial VFD Display
×1

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)

Story

Read more

Schematics

Meat Thermometer Schematic

Code

Thermometer.ino

Arduino
//****************************************************************
//*  Name    : Multi Channel Meat Thermometer                    *
//*  Author  : Robert Joseph Korn                                *
//*  Date    : 11/30/15                                          *
//*  Version : 1.2                                               *
//*  Notes   :                                                   *
//*          :                                                   *
//****************************************************************
//-----------------------------------------------------------------------------
#include <LTask.h>
#include <LWiFi.h>
#include <LWiFiServer.h>
#include <LWiFiClient.h>
#include <LAudio.h>

#define meatTemp0 A0                           
#define meatTemp1 A1                            
#define meatTemp2 A2                            

#define WIFI_AP "APNAME"
#define WIFI_PASSWORD "PASSWORD"
#define WIFI_AUTH LWIFI_WPA // change as per your WiFi AP config to the encryption used - LWIFI_OPEN, LWIFI_WPA, or LWIFI_WEP
//I would try LWIFI_WPA first
//if that fails LWIFI_WEP
//if that fails LWIFI_OPEN 
int serverPort = 80;
LWiFiServer server(serverPort);

int val;
boolean alarm = 0;
const int lowlim = 20;                          
const int targetTemp = 160;                               
const int chs = 3;                               
long tempInArray[chs];              
int channel = 0;                                   
int reading[chs];                             

void setup()
{

  Serial1.begin(9600);
  LAudio.begin();
  LAudio.setVolume(4);
  
  LAudio.playFile(storageFlash, (char*)"Dive.mp3");

  Serial1.println();
  Serial1.print("MediaTek LinkIt ONE");
  delay(3500);
  Serial1.println();
  Serial1.print("  Meat Thermometer");
  delay(2500);
  Serial1.println();
  Serial1.print("Initializing WiFi...");
  
  LWiFi.begin();

  while (0 == LWiFi.connect(WIFI_AP, LWiFiLoginInfo(WIFI_AUTH, WIFI_PASSWORD)))

  printWifiStatus();
  
  server.begin();
  
  Serial1.println();
  Serial1.print("IP: ");
  IPAddress ip = LWiFi.localIP();
  Serial1.print(ip);
  delay(2500);
                                                
  for (int channel = 0; channel < chs; channel++) { 
      tempInArray[channel] = 0;                 
  }
        
}                                                 

void loop() {
  
  alarm = 0; 

  tempInArray[0] = analogRead(meatTemp0);
  delay(25);
  tempInArray[0] = analogRead(meatTemp0);
  
  tempInArray[1] = analogRead(meatTemp1);
  delay(25);
  tempInArray[1] = analogRead(meatTemp1);
 
  tempInArray[2] = analogRead(meatTemp2);
  delay(25);
  tempInArray[2] = analogRead(meatTemp2);
   
  for (channel = 0; channel < chs; channel++) {

// 32 = 100  212 = 795
   reading[channel] = map(tempInArray[channel], 100, 795, 32, 212);
     
   if (reading[channel] > targetTemp) {
       alarm = 1; 
   }   
   
//   reading[channel]  = tempInArray[channel]; // uncomment this to calibrate probes
 
  }
  
  Serial1.println();
  Serial1.print("A:");
  if (reading[0] < lowlim) {
    Serial1.print(" NA"); 
  } else if (reading[0] > lowlim & reading[0] < 100) {
    Serial1.print(" "); 
    Serial1.print(reading[0]);
  } else {
    Serial1.print(reading[0]);
  }
  Serial1.print(" "); 
 
  Serial1.print("B:");
  if (reading[1] < lowlim) {
    Serial1.print(" NA");
  } else if (reading[1] > lowlim & reading[1] < 100) {
    Serial1.print(" "); 
    Serial1.print(reading[1]);
  } else {
    Serial1.print(reading[1]);
  }
  Serial1.print(" ");
 
  Serial1.print("C:");
  if (reading[2] < lowlim) {
    Serial1.print(" NA"); 
  } else if (reading[2] > lowlim & reading[2] < 100) {
    Serial1.print(" "); 
    Serial1.print(reading[2]);
  } else {
    Serial1.print(reading[2]);
  }
  Serial1.print(" ");
  
  String str = "";
  String url = "";
  int i; 

  LWiFiClient client = server.available();
  
  if (client)
  { 
    // an http request ends with a blank line
    boolean currentLineIsBlank = true;
    while (client.connected())
    {
      if (client.available())
      {
        // we basically ignore client request, but wait for HTTP request end
        char c = client.read();
        if (c != '\n')
          str += c;
        if (c == '\n')
        {
           if (str.startsWith("GET "))
          {
            url = str.substring(4, str.lastIndexOf(" "));
          }
          str = "";
        }

        if (c == '\n' && currentLineIsBlank)
        {
          // send a standard http response header
          client.println("HTTP/1.1 200 OK");
          client.println("Content-Type: text/html");
          client.println("Connection: close");  // the connection will be closed after completion of the response
          client.println();
          if (url != String("favicon.ico"))
          {
            client.println("<!DOCTYPE HTML>");
            client.println("<html>\n<head>\n<meta http-equiv='refresh' content='15'><title>Linkit One Meat Thermometer</title>\n</head>");
            IPAddress ip = LWiFi.localIP();
            client.println("<body>\n<center>");
            client.println("<p><h2>Linkit One <br> Meat Thermometer</h2>");
            client.println("<h3>Readings:</h3>");
            url.toLowerCase();
            val = url.substring(4).toInt();
            client.println("*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*<br>");
            client.print("Temperature Probe A =  ");
            if (reading[0] < lowlim) {
                client.print(" NA"); 
            } else {
                client.print(reading[0]);
                client.println(" F");
            }
            client.println("<br><br>");
            client.print("Temperature Probe B = ");
            if (reading[1] < lowlim) {
                client.print(" NA"); 
            } else {
                client.print(reading[1]);
                client.println(" F");
            }
            client.println("<br><br>");
            client.print("Temperature Probe C = ");
            if (reading[2] < lowlim) {
                client.print(" NA"); 
             } else {
                client.print(reading[2]);
                client.println(" F");
             }
            client.println("<br><br>");
            client.println("</center>\n</body>\n</html>");
            client.println();
            break;
          }
        }
        if (c == '\n')
        {
          // you're starting a new line
          currentLineIsBlank = true;
        }
        else if (c != '\r')
        {
          // you've gotten a character on the current line
          currentLineIsBlank = false;
        }
      }
    }

  // give the web browser time to receive the data
  delay(100);

  // close the connection:
  client.stop();
  }  
  delay(1000);
 
   if (alarm == 1) {
     if (LAudio.getStatus() == 0) {
        LAudio.playFile(storageFlash, (char*)"Klaxon.mp3");
     }
   }
   
} 


void printWifiStatus()
{
  Serial1.println();
  Serial1.print("IP: ");
  IPAddress ip = LWiFi.localIP();
  Serial1.print(ip);
}

Credits

Robert Korn

Robert Korn

7 projects • 19 followers
I Made the Internet of Things before people had a name for it.

Comments

Add projectSign up / Login