Reading DHT sensor value


#1

I am using DHT22 sensor for reading the temperature value and humidity value but i am getting the ADC value of it and not able to get it in DEGREE Celcius.
So, what do i code for getting temperature value in DEGREE Celcius. I am using Arduino as Micro-controller. Same case for Humidity.


#2

Hi @akkaman007

You can check the given link below for reference


#3

you are just sharing me the link which is not my solution.
I just want to know how to convert the digitalRead value of DHT sensor(i.e. temperature) to DEGREE celcius. I am only getting the ADC value whose screenshort i have attached above


#4

Hi @akkaman007

Your query is regarding conversion of temperature to degree celcius on an Arduino Platform. Such queries would find more detailed and in-depth solutions on multiple forums dedicated to Arduino including Arduino’s official forum i.e. https://forum.arduino.cc/.

However if you have any queries regarding Bolt or interfacing Bolt with an Arduino we would be glad to solve the same here.


#5

yeah, well I have the same question, and I’m not using an arduino. I want to know how to convert the output of the temperature sensor into Fahrenheit. Your page and hardware is really vague. I realize you’re a new company, but providing good directions with resource links as opposed to throwing out an incomplete example and wishing us the best is far from what you need.

So, again: I need either a link to a function or code that will convert the output of the thermal sensor or a link to resources that I can dig through to get it. I plan on showcasing your hardware at a stem presentation to many parents and kids, so this is either your opportunity to shine, or you will become unused.

Thanks


#6

Hi Charlie,

Apologies for the issues you are facing with our documentation. We are in the process of improving the documentation so that it is more user-friendly. I believe you had also suggested edits in the documentation for adding the conversion to Fahrenheit. We had made the updates to the docs based on your suggestions but missed out on replying back to you. I am sorry for that.

This link contains the information on how to build the temperature monitor as well as the code to convert the value into Fahrenheit: https://docs.boltiot.com/docs/getting-started-with-bolt-temperature-monitoring-system

I am also adding the section for conversion to Fahrenheit below for your reference. You can find this in the link I have shared above.:

**Edited based on the below discussion

Converting Temperature reading to Fahrenheit

The formula for converting temperature from Celcius to Fahrenheit is,
F = 1.8*C + 32

So, to show the reading in Fahrenheit, we will need to multiply the sensor reading by 1.8 and add 32 to it.
The code for this, will look similar to,

setChartLibrary('google-chart');
setChartTitle('Your Graph Title');
setChartType('lineGraph');
add(183);
mul(0.0977);
mul(1.8);

plotChart('time_stamp','temp');

Do try it out and let me know if you are able to get the temperature in Fahrenheit. If you are still having any queries or facing any issues let me know. I’ll be happy to help.


#7

So, for one thing, the variable name ‘temperature’ is not allowed because the variable string length cannot be more than 10 characters long. ‘temperature’ will not do it.

The second thing is that the reading is not accurate. here is a screenshot with your code and the return I am getting vs the correct temp in F. please see attached. It’s worth noting that changing the 'add() function does nothing. I tried adding the difference and got no change. Thoughts? I have five of your devices and all devices are equally innacurate… meaning that it’s either in the code or in the hardware…

and here is the output, graphically for that device… note that I downloaded the data and put it into a spreadsheet. These numbers are whackadoo. there is an issue here… agreed? Oh wait… I can only upload a set number of images and post three responses so I guess I’ll have to give you the data via copy/paste:
tempf
228
230
213
214
209
209
214
220
224
223
219
217
219
219
209
216


#8

another thing, if I might suggest, your screenshots showing the thermal sensor make it hard to determine which side you are showingas you know, the lettering on the IC is small and it was hard to tell which pin went to 5V, to A0, and which went to gnd. May want to consider better images…


#9

so here is the code i am running on one of your devices…


#10

@charliegalliher Which sensor are you using for measuring the temperature? Is it DHT or LM35 or some other one? It will be great if you could share a photo of the circuit you have created so that we are on the same page.


#11

the lm35…right out of the box… flat side facing…


#12

Hi Charlie,

Thank you for sharing the data. Please find my replies below

  1. Variable max length of 10 characters
    Yes, you are right. The max variable length allowed is 10. We had recently updated the validation for the same however the documentation link was not updated hence the issue. Apologies for the same.

  2. Mismatch in data values between downloaded data and graph data
    The downloaded data is the raw sensor values that are collected. The raw data falls within the range of 0 to 1023 as the sensor is connected to A0 pin which is a 10 bit ADC pin. The conversion formula is only applied to the values that are plotted on the graph. This is so that you can tune the conversion formula as per the requirements without losing the original raw sensor data.

  3. Incorrect data displayed on the graph vs temperature shown on the measuring device
    We applied the conversion formula to the raw sensor values that you shared and they are falling within the range of 68.75 to 72.77 Fahrenheit. This is almost same as the value displayed on your measuring device. Which means the sensor is giving the data correctly. However there is some issue in the data conversion happening in the graph. We are looking into this issue and I’ll get back to you shortly on how to fix it.


#13

@charliegalliher

Please upload the below code and check what are the values plotted on the graph

setChartLibrary('google-chart');
setChartTitle('Your Graph Title');
setChartType('lineGraph');
add(183); 
mul(0.0977); 
mul(1.8);
plotChart('time_stamp','temp');

There is a bug in our plotting library which is causing the conversion to be inaccurate. When both mul() and add() functions are present in the code, the add() function always runs first causing the mistake in the calculation. Hence, we have changed the value of the add function to account for the offset. The above code should ensure that the value are plotted correctly.

We shall get the issue fixed in the next few days and will let you know once it is done.

Do try out the above code and let me know if the temperature values are plotted correctly.


#14

MUCH better!


#15

So, on 11/3, we will be having a STEM fair at our school where parents and prospective families will be looking at what we do. I have quite a bit of experience with Raspberry pi’s and arduinos so we have projects there, but we also want to showcase new stuff. I bought five of these at the NYC makerfaire and they appear easy to use so I will be using these to demonstrate a more complex problem: designing space to save heat. Given that these devices can measure heat and heat loss in real time, it can give students the means to evaluate the effectiveness of their designs. Thank you for your help. I appreciate the time you took to look into this. Given that a lot of people will be seeing it in action, you may get some sales out of it.


#16

@charliegalliher
It’s great to know that your issue has been solved. Once again, apologies for the issues that you have faced. We will fine tune the documentation as well as get the issue for miscalculation fixed soon.

Also, thank you for choosing Bolt for the STEM faire. Its always great to reach out to more people and enable them to build IoT projects very quickly and easily. Do let us know if you face any issues while setting up the projects. We will be happy to help out.


#17

No - we are good. I am hoping that, at some point there will be a way to combine sensor graphs into one sheet. ThaNK YOU FOR YOUR HELP.


#19

@charliegalliher
The graphs look great. I will add this feature request to combine sensor graphs in one sheet to our list of requested features and take it up when we plan for new features in the next few months. Thank you for the suggestion.