Arduino Basic Temperature Monitor

Can someone please help me with this project?

https://support.exosite.com/hc/en-us/articles/200095738-Arduino-Basic-Temperature-Monitor

It's working fine to me, but i'd like to change the temperature readings from Fahrenheit to Celsius.

I already tried everything but no success.

Thx

In the Source Code of the example you'll find the header sensors.h which provides the sensing stuff in the class DallasTemperature. In that class you have to member functions to get the temperature - one for Celsius, and one for Farenheit. In the Example they use the index based function

  // returns temperature in degrees C
  float getTempC(uint8_t*);

  // returns temperature in degrees F
  float getTempF(uint8_t*);

  // Get temperature for device index (slow)
  float getTempCByIndex(uint8_t);
  
  // Get temperature for device index (slow)
  float getTempFByIndex(uint8_t);

further the class also provides functions to convert a given temperature from C to F and vice-versa

  // convert from celcius to farenheit
  static float toFahrenheit(const float);

  // convert from farenheit to celsius
  static float toCelsius(const float);

also, the temperature sent to exosite is fahrenheit. It is defined here

String tempValue = dtostrf(tempF, 1, 2, buffer);

to get Celsius, change that line to

String tempValue = dtostrf(tempC, 1, 2, buffer);

as tempC is also defined above as the temperature in Celsius

Thank you but i dont know how to implement that in the original code.

https://github.com/exosite-garage/arduino_exosite_library/tree/master/examples/TemperatureMonitor

Sorry i'm not an expert :).

I aded some formulas to the exosite widget that recalculates F to C. Now i'm getting the right temp, but i'd still like to fix the code.

Thx.

traxander: https://support.exosite.com/hc/en-us/articles/200095738-Arduino-Basic-Temperature-Monitor

It's working fine to me, but i'd like to change the temperature readings from Fahrenheit to Celsius.

The standard code you allude to provides a conversion in line 119, so I guess all you need do is print it. Just looking at the stuff myself, I see that it calls for the EEPROM library but I cannot see where an EEPROM is used and I wonder if you can enlighten us.

Sorry to hijack this thread, but I see you are using millis to time the loop and I am having a bit of grief with that.

EDIT! Ignore my comment about the eeprom, the code compiles OK with it deleted, so evidently it is junk.

Nick,

That sketch calls for the EEPROM library for the Exosite library (of which I'm the author) to be able to save the CIK -- an auth token for talking to Exosite. From what I can tell Arduino won't pull in a library when another library asks for it. It still compiles for you because the IDE has already cached the EEPROM library. If you try to compile for the first time w/o that include it'll complain when it compiles the Exosite library that it can't find EEPROM.h. If you know of a better way to fix that problem I'd love to hear it.

Also, traxander, I commented on what I think the issue is in your old thread here.

Azdle: It still compiles for you because the IDE has already cached the EEPROM library. If you try to compile for the first time w/o that include it'll complain when it compiles the Exosite library that it can't find EEPROM.h. If you know of a better way to fix that problem I'd love to hear it.

OK, I only just understand this and certainly don't have the expertise to make any recommendation. I have never knowingly used eeprom before, hence my question, and cosm just uses a char for the key. I copied a version of the programme with the first line stripped to another laptop and yes, it refused to compile - complaining about eeprom. There appears to be more nuances in the IDE than I imagined.

My main interest in this was that I thought it was using millis to time the loop - apparently not...

While I have your ear, would the following code be kosher for multiple sensors?

writeParam = "temps="; //parameters to write e.g. 'temp=65.54' 
String InValue = dtostrf(InTemp, 1, 2, buffer); // convert float to String, min size = 1, decimal places = 2
String OutValue = dtostrf(OutTemp, 1, 2, buffer); 
String DrainValue = dtostrf(DrainTemp, 1, 2, buffer); 
String diffValue = dtostrf(diff, 1, 2, buffer); 

writeParam += InValue + OutValue + DrainValue + diffValue; //add converted temperature String value

Our libraries have to have some sort of non-volatile storage because the CIK can only be read out once in a time-limited windows after a "device" has been added to our system (or "re-enabled for activation") which is a security mechanism.

It is using millis to time the loop, both on line 111 and on line 128. It stores both the last time it read from the temp sensor and the last time that it sent data to Exosite and in each line (respectively) it checks whether "X_TIMEOUT" seconds have elapsed. There is actually a small bug with this that will pop up every 52 days (I think?) when the millis timer overflows, but it would just cause a small hiccup in the timing.

That actually isn't quite going to work. Since those vars are Strings the "+" operator will concatenate them, which mean that you'll end up with the string "temps=65.425.23.623.34.25" which isn't really all that meaningful. What you want to end up with is something more like: "tempin=65.42&tempout=5.23.62&tempdrn=3.3&tmpdiff=4.25". You're actually building the urlencoded string that this API is using: http://docs.exosite.com/data/#write

Let me know if any of that is unclear.

Thanks for the comments and link. You probably realise that I have not used Exo but I'm preparing to give it a try. What I was questioning was you are not using millis for the whole loop, but I'm having some grief of my own on that front. I need to do this to measure water flow. As for the millis bug, there seems to be as many gurus denying its existence as there are predicting dire consequences.