Post topics, source code that relate to the Arduino Platform

User avatar
By Creamers
#14295 I think I used a very bad example. Anyone having a good example to use and that's proven to work ?

*EDIT: found it. Powersupply was too high and that make the esp unstable. Second problem was not setting the arduino ide board type correctly. (3.3v 8mhz)
User avatar
By swilson
#14997 Creamers,
Glad to hear you got it working. I was just going to mention mine is still cruising right along and I haven't touched it. I also have my thingspeak setup using ThingTweet and React to send me a tweet if the alarm goes above or below set temperatures.

The one thing I would do differently now, if I was doing it again, is ditch the Arduino and go strictly ESP using the Arduino IDE for ESP8266.
User avatar
By HobbyGuy
#20699
swilson wrote:Creamers,
Glad to hear you got it working. I was just going to mention mine is still cruising right along and I haven't touched it. I also have my thingspeak setup using ThingTweet and React to send me a tweet if the alarm goes above or below set temperatures.

The one thing I would do differently now, if I was doing it again, is ditch the Arduino and go strictly ESP using the Arduino IDE for ESP8266.


Very nice work, and thanks for sharing. I built a little temperature sensor using the esp and a TMP36 sensor, and programmed a little sketch in the arduino ide to send the data to freeboard.io. it's pretty simple and works well. I found your thermistor project here because now i'm trying to use a thermistor instead of the TMP36 (I want a web-enabled meat thermometer for grilling). The problem I'm having, though, is calculating the steinhart-hart equation on the esp. seems that there's not good support for math.h functions and log calculations are needed. Have you tried porting your project to run natively on the ESP?
User avatar
By Angelo Santagata
#21201 guys,

Ive written up something very similar, actually almost the same , and it appears to be working just fine...

My only bones with it is that the arduino doesnt support https so it can be a little insecure... but for pushing temperature its ok..

My code
Code: Select all#include <ESP8266WiFi.h>
#include <ESP8266WiFiMulti.h>
#include <WiFiClient.h>
#include <WiFiServer.h>
#include <WiFiUdp.h>

#include <DallasTemperature.h>
#include <OneWire.h>

#define tempSensor 4
#define LED 5
const char* ssid = ".......";
const char* password = ".....";
const char* host = "api.thingspeak.com";



OneWire oneWire(tempSensor);
DallasTemperature sensors(&oneWire);


void setup(void)
{
  // start serial port
  Serial.begin(9600);
  // Start up the library
  sensors.begin();
  pinMode(LED, OUTPUT);
  WiFi.begin(ssid, password);
  Serial.print("Connecting to WIFI ");
  Serial.print(ssid);
  while (WiFi.status() != WL_CONNECTED) {
    digitalWrite(LED, HIGH);
    delay(50);
    digitalWrite(LED, LOW);
    delay(50);
    Serial.print(".");
  }
  Serial.println("");
  Serial.println("WiFi connected");
  Serial.println("IP address: ");
  Serial.println(WiFi.localIP());
}
void loop(void)
{
  // locate devices on the bus
  sensors.begin();
  sensors.requestTemperatures();
  float tempC = sensors.getTempCByIndex(0);
  char buffer[10];
  String temp = dtostrf(tempC, 4, 1, buffer);
  Serial.println("Temp" + temp);
  // Make LED Flash
  digitalWrite(LED, HIGH);
 
 

  // Send value to thingspeak
  WiFiClient client;
  if (!client.connect(host, 80)) {
    Serial.println("connection failed");
    return;
  }
  // Store value in thingSpeak
  String url = "/update?key=<enteryourkey>&field1=";
  url += temp;
  // This will send the request to the server
  client.print(String("GET ") + url + " HTTP/1.1\r\n" +
               "Host: " + host + "\r\n" +
               "Connection: close\r\n\r\n");
  delay(10);
 
  // Read all the lines of the reply from server and print them to Serial
  while (client.available()) {
    String line = client.readStringUntil('\r');
    Serial.print(line);
  }

  Serial.println();
  Serial.println("closing connection");
  digitalWrite(LED, LOW);
  // Sleep for 5mins
  delay(300000);
}




Image from https://dl.dropboxusercontent.com/u/16856082/babyimage.jpg
Angelo