I want to display negative temperature on channel view

5 visualizzazioni (ultimi 30 giorni)
I am reading temperature data from DS18B20 and plotting to thingspeak graph on a channel. Positive temperatures show up correctly, but negative temperatures show only as values (above zero). How do I plot negative values? I have a LCD display which shows both positive and negative temperatures properly.

Risposta accettata

Ardish Morawala
Ardish Morawala il 21 Ott 2022
Hello Christopher,
I solved the problem. It was a stupid mistake on my part, in the coding. I used the processed 2's complement data (which is always seen as positive) instead of the raw data sentby DS1B20.
That is why the LCD always proper temperature (positive and negative) but the Data being uploaded to Thingspeak is always positive. This code follows the LCD display code.
I used the raw temperature data in two separate variables, one for the LCD code and one for the thingspeak code. This worked.
Regards.

Più risposte (1)

Christopher Stapels
Christopher Stapels il 19 Ott 2022
Here are a few ways to get negative numbers into ThingSpeak or to plot them in MATLAB.
https://api.thingspeak.com/update?api_key=xxxxxxxxxxxxxxxx&field1=-1
or in MATLAB visualization
plot(-10:0,-100:-90)
  2 Commenti
Ardish Morawala
Ardish Morawala il 20 Ott 2022
Hello Christopher,
I solved the problem. It was a stupid mistake on my part, in the coding. I used the processed 2's complement data (which is always seen as positive) instead of the raw data sentby DS1B20.
That is why the LCD always proper temperature (positive and negative) but the Data being uploaded to Thingspeak is always positive. This code follows the LCD display code.
I used the raw temperature data in two separate variables, one for the LCD code and one for the thingspeak code. This worked.
Regards.
Christopher Stapels
Christopher Stapels il 20 Ott 2022
Thank you for clarifying. I thought I remembered that you had solved this, but I didnt find the other question right away. Can you put the explanation in an answer (button below) and accept it, just in case someone else happens upon this thread?

Accedi per commentare.

Categorie

Scopri di più su Act on Data in Help Center e File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by