TMP36 value so high

Thank you for taking the time to submit your bug/issue! Please use the points below as a guide when submitting.

Arduino Uno with W5100 ethernet shield

  • What dashboard are you using? : (Web, iOS)

Hello,

I recently use CayenneDevice, it’s a really good application for IoT, good job for the team!

But i have a issue, i want to read a temperature (of my living room around 22°Celcius) but the value return its 62.22°Celcius …

i use 5V Pin and Analog Pin (0)

How to apply a correction ?

Thank’s and sorry if my english is not verry good (i’m french :fr: )

I seem to have a similar issue. However, on the Cayenne dashboard my sensor reads -50 degrees Celsius…

What is your code?

i use the original code (use for exemple)

> /*
> Cayenne TMP36 Example

> This sketch shows how to send temperature data to a TMP36 Sensor in the Cayenne Dashboard.

> The Cayenne Library is required to run this sketch. If you have not already done so you can install it from the Arduino IDE Library Manager.

> Steps:
> 1. In the Cayenne Dashboard add a new TMP36 widget.
> 2. Set the widget to Value Display.
> 3. Select Virtual Pins and a virtual pin number.
> 4. Set VIRTUAL_PIN to the pin number you selected.
> 5. Attach a TMP36 to an analog pin on your Arduino. Make sure to use an analog pin, not a digital pin.
>    Schematic:
>    [Ground] -- [TMP36] -- [5V]
>                   |
>               Analog Pin
> 6. Set the tmpPin variable to match the pin used to connect the TMP36.
> 7. Set the voltage variable to match the voltage used to connect the TMP36.
> 8. Set the token variable to match the Arduino token from the Dashboard.
> 9. Compile and upload this sketch.
> 10. Once the Arduino connects to the Dashboard it should automatically update the TMP36 widget with data.
> */

> #define CAYENNE_PRINT Serial   // Comment this out to disable prints and save space
> #include <CayenneTemperature.h>

> // If you're not using the Ethernet W5100 shield, change this to match your connection type. See Communications examples.
> #include <CayenneEthernet.h>

> // Cayenne authentication token. This should be obtained from the Cayenne Dashboard.
> char token[] = "6tcjr4rk6u";

> // Virtual Pin of the TMP36 widget.
> #define VIRTUAL_PIN V1

> // Analog pin the TMP36 is connected to.
> const int tmpPin = 0;

> // Voltage to the TMP36. For 3v3 Arduinos use 3.3.
> const float voltage = 5.0; 

> TMP36 tmpSensor(tmpPin, voltage);

> void setup()
> {
> 	Serial.begin(9600);
> 	Cayenne.begin(token);
> }

> void loop()
> {
> 	Cayenne.run();
> }

> // This function is called when the Cayenne widget requests data for the Virtual Pin.
> CAYENNE_OUT(VIRTUAL_PIN)
> {
> 	// This command writes the temperature in Celsius to the Virtual Pin.
> 	Cayenne.celsiusWrite(VIRTUAL_PIN, tmpSensor.getCelsius());
> 	// To send the temperature in Fahrenheit or Kelvin use the corresponding code below.
> 	//Cayenne.fahrenheitWrite(VIRTUAL_PIN, tmpSensor.getFahrenheit());
> 	//Cayenne.kelvinWrite(VIRTUAL_PIN, tmpSensor.getKelvin());
> }

Measure the voltage at 5V pin Arduino, and the measured voltage into the code instead of 5.0.

I measure the voltage on the arduino, it’s 4,68 volts. I change 4,68 volts in the code but its the same problem …
I try also on the 3v pin but its the sam problem…

Other solution ?

Thank’s for your help

Try this code.
It’s a modified code from Adafruit website.

Cayenne-TMP36.txt (1.5 KB)

Thank’s, i try your code but it’s the same problem …
but in the console, the value is correct ! show the picture :

but not correct in the webpage of mydevice

the problem comming from the webpage of mydevice ? (i have the same value of 62 in the IOS application)

thx

Try to add a Add new-Custom Widgets-Value-…

i try with Add new-Custom widgets-Value …

And the result is … :

Ouch ! so warm in my room … most bad with the precedent try :confused:

Change
Cayenne.virtualWrite(VIRTUAL_PIN, temperatureC, TEMPERATURE, CELSIUS);

@rsiegel can you try and reproduce this issue when you have time? Add a TMP36 to Arduino using the Cayenne generated code. It’s odd because the serial monitor is showing the correct values but Cayenne is not…

-B

i make this change but always the same issue :confused:

change
Cayenne.celsiusWrite(VIRTUAL_PIN, temperatureC);

is not running because “celciusWrite” not exist in this scope

i retry with the original code, it’s the same issue. The monitor show me the good value (around 20°Celcius) but Cayenne show around 62°Celcius :confused:

it’s possible that issue comming from the CayenneTemperature.h (arduino libraries file)?