Go Down

Topic: Arduino Temperature Web Monitoring (Read 3347 times) previous topic - next topic

joshuasimi

Aug 14, 2013, 08:20 am Last Edit: Dec 10, 2013, 01:23 pm by joshuasimi Reason: 1
The Arduino Uno is a microcontroller board based on the ATmega328 (datasheet). It has 14 digital input/output pins (of which 6 can be used as PWM outputs), 6 analog inputs, a 16 MHz ceramic resonator, a USB connection, a power jack, an ICSP header, and a reset button. It contains everything needed to support the microcontroller; simply connect it to a computer with a USB cable or power it with a AC-to-DC adapter or battery to get started.
Some time it is very difficult to setup the temperature monitoring system for Arduino Uno. Here you can find information about how to setup your basic Arduino Uno temperature web monitoring. It uses the Exosite library to set up a connection to the Exosite One Platform over Ethernet, reads the temperature over the one-wire interface, and sends the value to the platform every 120 seconds with the Basic HTTP API from Exosite.

joshuasimi

If anyone has any questions let me know! You can also build your own custom apps as well. Connect, build, deploy!

Happy programming!


frasart

I have changed and we do not indicate the true temperature on exsosite
On the Arduino - monitor shows me the true value but this value  I can not download the exosite only in Fahrenheit

sumaye

please send me the correct tutorial.
because until now my masi difficult to join the new device to the exosite.
thank you

traxander

Hello everyone.

The project works great for me.
What do i have to change to get the temperature in C on exosite and not in F?

Thx for help.

Alex

Azdle

Hey Alex,

There's actually a conversion in the code that converts from C to F, you'll just need to bypass that. Line 115 is where the temperature in C is actually read out.

You'll want to make the deceleration of 'tempC' outside of the if statement so the rest of the program can use it and make it static like 'tempF', then replace 'tempF' with 'tempC' on line 135 so that the temp in C is what gets actually sent. You could also just remove all of the references 'tempF' since you're no longer using it.

Let me know if you have any trouble getting it to work.

--Patrick (@ Exosite)

traxander

Hey Azdle,

Thank you for your answer.
This is what i did but i get the result 0 on Exosite and i dont know why.

Code: [Select]
#include <EEPROM.h>
#include <SPI.h>
#include <Ethernet.h>
#include <OneWire.h>
#include <DallasTemperature.h>
#include <Exosite.h>
 
// Pin use
#define ONEWIRE 7 //pin to use for One Wire interface

// Set up which Arduino pin will be used for the 1-wire interface to the sensor
OneWire oneWire(ONEWIRE);
DallasTemperature sensors(&oneWire);
 
/*==============================================================================
* Configuration Variables
*
* Change these variables to your own settings.
*=============================================================================*/
String cikData = "26eff170d21c965f0aca8f1bf60a81d370c34353";  // <-- FILL IN YOUR CIK HERE! (https://portals.exosite.com -> Add Device)
byte macData[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};        // <-- FILL IN YOUR Ethernet shield's MAC address here.

// User defined variables for Exosite reporting period and averaging samples
#define REPORT_TIMEOUT 30000 //milliseconds period for reporting to Exosite.com
#define SENSOR_READ_TIMEOUT 5000 //milliseconds period for reading sensors in loop


/*==============================================================================
* End of Configuration Variables
*=============================================================================*/

class EthernetClient client;
Exosite exosite(cikData, &client);

//
// The 'setup()' function is the first function that runs on the Arduino.
// It runs completely and when complete jumps to 'loop()'
//
void setup() {
  Serial.begin(9600);
  Serial.println("Boot");
  // Start up the OneWire Sensors library
  sensors.begin();
  delay(1000);
  Serial.println("Starting Exosite Temp Monitor");
  Serial.print("OneWire Digital Pin Specified: ");
  Serial.println(ONEWIRE);
  Ethernet.begin(macData);
  // wait 3 seconds for connection
  delay(3000);
 
}
 
//
// The 'loop()' function is the 'main' function for Arduino
// and is essentially a constant while loop.
//
void loop() {
  static unsigned long sendPrevTime = 0;
  static unsigned long sensorPrevTime = 0;
  static float tempC;
  char buffer[7];
  String readParam = "";
  String writeParam = "";
  String returnString = ""; 
   
  Serial.print("."); // print to show running
 
 // Read sensor every defined timeout period
  if (millis() - sensorPrevTime > SENSOR_READ_TIMEOUT) {
    Serial.println();
    Serial.println("Requesting temperature...");
    sensors.requestTemperatures(); // Send the command to get temperatures
    float tempC = sensors.getTempCByIndex(0);
    Serial.print("Celsius:    ");
    Serial.print(tempC);
    Serial.println(" C ..........DONE");
    sensorPrevTime = millis();
  }
 
  // Send to Exosite every defined timeout period
  if (millis() - sendPrevTime > REPORT_TIMEOUT) {
    Serial.println(); //start fresh debug line
    Serial.println("Sending data to Exosite...");
   
    readParam = "";        //nothing to read back at this time e.g. 'control&status' if you wanted to read those data sources
    writeParam = "temp="; //parameters to write e.g. 'temp=65.54' or 'temp=65.54&status=on'
   
    String tempValue = dtostrf(tempC, 1, 2, buffer); // convert float to String, minimum size = 1, decimal places = 2
   
    writeParam += tempValue;    //add converted temperature String value
   
    //writeParam += "&message=hello"; //add another piece of data to send

    if ( exosite.writeRead(writeParam, readParam, returnString)) {
      Serial.println("Exosite OK");
      if (returnString != "") {
        Serial.println("Response:");
        Serial.println(returnString);
      }
    }
    else {
      Serial.println("Exosite Error");
    }
 
    sendPrevTime = millis(); //reset report period timer
    Serial.println("done sending.");
  }
  delay(1000); //slow down loop
}


Coding Badly

Code: [Select]
byte macData[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};        // <-- FILL IN YOUR Ethernet shield's MAC address here.

Assuming the comment is correct, you missed that step.


traxander

Thanks for your answer but it's not that.
It sends temperature in F normaly.

I just wanted to change it in C.

Azdle

Hey, sorry I didn't see your last replies. I need to update my notification script. (For now, if you put the word "exosite" in the text somewhere I'll get an email.)

I'm thinking your problem is the line

Code: [Select]
float tempC = sensors.getTempCByIndex(0);

I think it might work if you get rid of the `float ` at the beginning of the line. I'm pretty sure this is making a new local variable instead of updating the one that was defined previously.

Am I correct in assuming that you see a temperature printed on the serial terminal, but not on exosite? If not, does the example code still send the right temp in F?

traxander

Thank you.

Yes that float was the problem.

Now it's working great.

thx again.

Go Up