I want to display negative temperature on channel view

4 views (last 30 days)
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.

Accepted Answer

Ardish Morawala
Ardish Morawala on 21 Oct 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.

More Answers (1)

Christopher Stapels
Christopher Stapels on 19 Oct 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 Comments
Christopher Stapels
Christopher Stapels on 20 Oct 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?

Sign in to comment.

Categories

Find more on Visualize Data in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!