I recently made an Arduino thermostat using a DHT11 and a tft screen. I am trying to get it to show a temperature Fahrenheit. I got it to do this but then had an issue with it. It was only showing degrees Fahrenheit that were divisible by 1.8. If anyone knows a solution to this please help.
#define BLACK 0x0000 #define RED 0xF800 #define GREEN 0x07E0 #define WHITE 0x000FFF #define GREY 0x8410
void setup(void)
{
uint16_t ID = tft.readID();
if (ID == 0xD3D3) ID = 0x9481; //force ID if write-only display
tft.begin(ID);
tft.setRotation(45);
dht.begin();
}
void loop(void)
{
float converted = 0.00;
The DHT11 sensor has a resolution of 1 degree Celsius, so you are going to gets steps of 1.8 degrees in Fahrenheit. You can keep a running average over several samples to smooth the transitions, but if you want better resolution use a DHT22, which has a resolution of 0.1 degree Celsius.
Ok the temperature does no very often so the average will probably be similar to the data values it reads. I think I am going to use a DHT22 or other sensor. Thank you for the help.
That does the calculation for Celsius to Fahrenheit in the library, but the DHT11 only sends data in Celsius with a resolution of 1 degree so the Fahrenheit temperature will still be in steps of 1.8 degrees.