Steve Woodrough from United States  [47 posts]
7 year
Are you familiar with the ESP8266 wifi chip?
I have Arduino code that I load into an 8266 chip to create a web server, read temperature data from a 18B20 temp sensor , and transmit temperature data for viewing on a web page.  I did not write the code, I just downloaded and it works.  

I was wondering if I could use RR to log the data from one or multiple 8266 devices.  

Going further, I was thinking it might be interesting to use RR as a data hub to monitor various sensor states on various ESP 8266, and given a set of conditions transmit commands to other ESP 8266 to activate the GPIO.

An example would be using an esp8266 and 18B20 sensor input to monitor the temperature in an attic space.  If the temp gets too hot, send a command to another esp8266 to activate one of 2 gpio and turn on a fan or something.  

Thanks for the time.

Steve Woodrough
Steve Woodrough from United States  [47 posts] 7 year
Below is the sample code that is loaded into the ESP8266 using the Arduino IDE.

The temp sensor data loads a web page at

I figure I should be able to use the socket client module to "capture" the temperature data but I'm not having much luck with the configuration.  Any suggestions?


  Rui Santos
  Complete project details at http://randomnerdtutorials.com  

// Including the ESP8266 WiFi library
#include <ESP8266WiFi.h>
#include <OneWire.h>
#include <DallasTemperature.h>

// Replace with your network details
const char* ssid = "hobby";
const char* password = "stopsign";

// Data wire is plugged into pin D1 on the ESP8266 12-E - GPIO 0
#define ONE_WIRE_BUS 0

// Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)
OneWire oneWire(ONE_WIRE_BUS);

// Pass our oneWire reference to Dallas Temperature.
DallasTemperature DS18B20(&oneWire);
char temperatureCString[6];
char temperatureFString[6];

// Web Server on port 80
WiFiServer server(80);

// only runs once on boot
void setup() {
  // Initializing serial port for debugging purposes

  DS18B20.begin(); // IC Default 9 bit. If you have troubles consider upping it 12. Ups the delay giving the IC more time to process the temperature measurement
  // Connecting to WiFi network
  Serial.print("Connecting to ");
  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED) {
  Serial.println("WiFi connected");
  // Starting the web server
  Serial.println("Web server running. Waiting for the ESP IP...");
  // Printing the ESP IP address

void getTemperature() {
  float tempC;
  float tempF;
  do {
    tempC = DS18B20.getTempCByIndex(0);
    dtostrf(tempC, 2, 2, temperatureCString);
    tempF = DS18B20.getTempFByIndex(0);
    dtostrf(tempF, 3, 2, temperatureFString);
  } while (tempC == 85.0 || tempC == (-127.0));

// runs over and over again
void loop() {
  // Listenning for new clients
  WiFiClient client = server.available();
  if (client) {
    Serial.println("New client");
    // bolean to locate when the http request ends
    boolean blank_line = true;
    while (client.connected()) {
      if (client.available()) {
        char c = client.read();
        if (c == '\n' && blank_line) {
            client.println("HTTP/1.1 200 OK");
            client.println("Content-Type: text/html");
            client.println("Connection: close");
            // your actual web page that displays temperature
            client.println("<!DOCTYPE HTML>");
            client.println("<head></head><body><h1>ESP8266 - Temperature</h1><h3>Temperature in Celsius: ");
            client.println("*C</h3><h3>Temperature in Fahrenheit: ");
        if (c == '\n') {
          // when starts reading a new line
          blank_line = true;
        else if (c != '\r') {
          // when finds a character on the current line
          blank_line = false;
    // closing the client connection
    Serial.println("Client disconnected.");

Steve Woodrough from United States  [47 posts] 7 year
Attached is my lame attempt to get this off the ground.  I can make a socket connection at and I am trying to create a variable named TEMPERATURE.  I'm sure I'm missing a step or two and some configuration.  


This forum thread has been closed due to inactivity (more than 4 months) or number of replies (more than 50 messages). Please start a New Post and enter a new forum thread with the appropriate title.

 New Post   Forum Index