TempSense is a simple Arduino project designed to read temperature and humidity data from a DHT11 sensor using an ESP8266 microcontroller. The project includes a single .ino file, tempsense.ino, which contains the code to initialize the sensor, read data, and print it to the Serial Monitor.
tempsense.ino: The main Arduino sketch for reading and displaying temperature and humidity data from the DHT11 sensor.
Before running the project, ensure you have the following:
-
Arduino IDE: Install the Arduino IDE if you haven't already.
-
ESP8266 Board Support: Add ESP8266 board support to the Arduino IDE. You can do this by going to File > Preferences and adding the following URL to the Additional Boards Manager URLs field: Then, go to Tools > Board > Boards Manager, search for ESP8266 and install it.
-
Required Libraries:
- Adafruit Sensor Library: Install it via the Library Manager in the Arduino IDE (Sketch > Include Library > Manage Libraries), or download it from Adafruit's GitHub.
- DHT Sensor Library: Install it from the Library Manager or download it from Adafruit's GitHub.
- ESP8266 Microcontroller: Use any ESP8266-based board such as the NodeMCU or Wemos D1 Mini.
- DHT11 Sensor: Connect the sensor to the ESP8266 as follows:
- VCC to 3.3V (or 5V if your board supports it)
- GND to GND
- DATA to D4 (GPIO2 on many boards)
- Open the
tempsense.inofile in the Arduino IDE. - Select your ESP8266 board and port from the Tools menu.
- Click the Upload button to compile and upload the code to your ESP8266.
- Open the Serial Monitor from the Arduino IDE (Tools > Serial Monitor).
- Set the baud rate to 115200.
- After uploading, you should see temperature and humidity readings printed to the Serial Monitor every 2 seconds.
- Setup Function: Initializes serial communication and the DHT sensor.
- Loop Function: Reads the temperature and humidity from the DHT sensor, checks for errors, and prints the data to the Serial Monitor.
- No Data Displayed: Ensure the DHT sensor is properly connected and powered. Check the connections and ensure the correct GPIO pin is used.
- Error Messages: Verify that all required libraries are installed and up-to-date.
This project is licensed under the MIT License - see the LICENSE file for details.
For any questions or support, please open an issue on this repository or contact mail@shan.is-a.dev.