pibotsmakerhub / arduino_dht11

1 stars 5 forks source link

DHT.h files and other libraries are not available #1

Open twinankhs opened 2 years ago

twinankhs commented 2 years ago

Cannot get the download of DHT.h because the place to download the files is no longer online. Can't compile because the packages do not include the DHT libraries

twinankhs commented 2 years ago

https://github.com/adafruit/DHT-sensor-library is where you need to link to in order to download - the main source repository is broken

twinankhs commented 2 years ago

Adafruit Sensor.h file is missing: Arduino: 1.8.16 (Windows 10), TD: 1.55, Board: "Arduino Uno"

In file included from C:\Program Files (x86)\Arduino\libraries\DHT11\DHT_U.cpp:15:0:

C:\Program Files (x86)\Arduino\libraries\DHT11\DHT_U.h:36:10: fatal error: Adafruit_Sensor.h: No such file or directory

include

      ^~~~~~~~~~~~~~~~~~~

compilation terminated.

exit status 1

Error compiling for board Arduino Uno.

This report would have more information with "Show verbose output during compilation" option enabled in File -> Preferences.

twinankhs commented 2 years ago

Adafruit Sensor Library can be found at

https://github.com/adafruit/Adafruit_Sensor

twinankhs commented 2 years ago

You will need to merge all of the libraries into one directory else arduino will not see the libraries - needs to be in one path with the DHT files and libraries.

twinankhs commented 2 years ago

Recommend this sensor 👍 https://www.amazon.com/gp/product/B07TDFPKMW/ref=ppx_yo_dt_b_asin_title_o05_s00?ie=UTF8&th=1 Recommend this Arduino https://www.amazon.com/gp/product/B085RHTBJT/ref=ppx_yo_dt_b_asin_title_o02_s00?ie=UTF8&psc=1

Tested to work on 10/28/2021 - Andy Despres

twinankhs commented 2 years ago

https://create.arduino.cc/projecthub/pibots555/how-to-connect-dht11-sensor-with-arduino-uno-f4d239

Center Pin is the Data leg of the circuit, and the left and right are positive and negative, follow the board markings on the sensor not the manual. The yellow wire goes to the middle!

twinankhs commented 2 years ago

Drivers are located here for the Arduino keystudio plus - https://www.silabs.com/developers/usb-to-uart-bridge-vcp-drivers

twinankhs commented 2 years ago

Other files needed from here https://www.dropbox.com/sh/nue60dc28qi95fo/AAD-RWwJ3W61-L1uP7CrB_Kra?dl=0

twinankhs commented 2 years ago

This location no longer works - https://downloads.arduino.cc/libraries/Library_index.json

You actually should download both - you will sort of need to debug by putting everything into one directory seems to solve the issue. Then also copy it into a second directory to solve path issues depending on the product.

https://github.com/adafruit/Adafruit_Sensor

https://github.com/adafruit/DHT-sensor-library

You will see the invalid library found debug messages in arduino when you go to upload it.

Sketch uses 6722 bytes (20%) of program storage space. Maximum is 32256 bytes. Global variables use 219 bytes (10%) of dynamic memory, leaving 1829 bytes for local variables. Maximum is 2048 bytes. Invalid library found in C:\Program Files (x86)\Arduino\libraries\Adafruit_Sensor-master: no headers files (.h) found in C:\Program Files (x86)\Arduino\libraries\Adafruit_Sensor-master Invalid library found in C:\Program Files (x86)\Arduino\libraries\DHT-sensor-library-master: no headers files (.h) found in C:\Program Files (x86)\Arduino\libraries\DHT-sensor-library-master

twinankhs commented 2 years ago

Here is what the code ended up looking like -

/*

// REQUIRES the following Arduino libraries: // - DHT Sensor Library: https://github.com/adafruit/DHT-sensor-library // - Adafruit Unified Sensor Lib: https://github.com/adafruit/Adafruit_Sensor

include "DHT.h"

define DHTPIN 2 // Digital pin connected to the DHT sensor

define DHTTYPE DHT11 // DHT 11

//#define DHTTYPE DHT22 // DHT 22 (AM2302), AM2321 //#define DHTTYPE DHT21 // DHT 21 (AM2301)

// Connect pin 1 (on the left) of the sensor to +5V // NOTE: If using a board with 3.3V logic like an Arduino Due connect pin 1 // to 3.3V instead of 5V! // Connect pin 2 of the sensor to whatever your DHTPIN is // Connect pin 4 (on the right) of the sensor to GROUND // Connect a 10K resistor from pin 2 (data) to pin 1 (power) of the sensor

// Initialize DHT sensor. // Note that older versions of this library took an optional third parameter to // tweak the timings for faster processors. This parameter is no longer needed // as the current DHT reading algorithm adjusts itself to work on faster procs.

DHT dht(DHTPIN, DHTTYPE);

void setup() { Serial.begin(9600); Serial.println(F("DHTxx test!"));

dht.begin(); }

void loop() { // Wait a few seconds between measurements. delay(2000);

// Reading temperature or humidity takes about 250 milliseconds! // Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor) float h = dht.readHumidity(); // Read temperature as Celsius (the default) float t = dht.readTemperature(); // Read temperature as Fahrenheit (isFahrenheit = true) float f = dht.readTemperature(true);

// Check if any reads failed and exit early (to try again). if (isnan(h) || isnan(t) || isnan(f)) { Serial.println(F("Failed to read from DHT sensor!")); return; }

// Compute heat index in Fahrenheit (the default) float hif = dht.computeHeatIndex(f, h); // Compute heat index in Celsius (isFahreheit = false) float hic = dht.computeHeatIndex(t, h, false);

Serial.print(F(" Humidity: ")); Serial.print(h); Serial.print(F("% Temperature: ")); Serial.print(t); Serial.print(F("C ")); Serial.print(f); Serial.print(F("F Heat index: ")); Serial.print(hic); Serial.print(F("C ")); Serial.print(hif); Serial.println(F("F")); }

twinankhs commented 2 years ago

https://wiki.keyestudio.com/KS0486_Keyestudio_PLUS_Development_Board_(Black_And_Eco-friendly)#Installing_Driver

twinankhs commented 2 years ago

https://create.arduino.cc/projecthub/pibots555/how-to-connect-dht11-sensor-with-arduino-uno-f4d239

twinankhs commented 2 years ago

Box for Arduino to complete the project https://www.thingiverse.com/thing:2511299