Open the Serial Monitor at a baud rate of 9600 and check if everything is working properly. In this code we create a loggingTime() function and a loggingTemperature() function that we call in the loop() to log the time and temperature to the DATA.txt file in the SD card. Serial.println("Failed to read from DHT sensor!") Check if any reads failed and exit early (to try again). Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor) Reading temperature or humidity takes about 250 milliseconds! MyFile = SD.open("DATA.txt", FILE_WRITE) MyFile.println("Date,Time,Temperature ✬") Serial.println("initialization failed!") following line sets the RTC to the date & time this sketch was compiled While(!Serial) // for Leonardo/Micro/Zero Data loggin SD shields and modules: pin 10 Arduino Ethernet shield and modules: pin 4 change this to match your SD shield or module initialize DHT sensor for normal 16mhz Arduino #define DHTPIN 2 // what pin we're connected to Move the DHT folder to your Arduino IDE installation libraries folderĬopy the following code to your Arduino IDE and upload it to your Arduino board.Rename your folder from DHT-sensor-library-master to DHT.zip folder and you should get DHT-sensor-library-master folder Click here to download the DHT-sensor-library.
ARDUINO LCD LIBRARY AND RTC INSTALL
Installing the DHT sensor libraryįor this project you need to install the DHT library to read from the DHT11 sensor. Read “ Guide to SD card module with Arduino“. Note: make sure your SD card is formatted and working properly. The following figure shows the circuit’s schematics for this project. You can use the preceding links or go directly to /tools to find all the parts for your projects at the best price! The data logging shield comes with built-in RTC and a prototyping area for soldering connections, sensors, etc. Note: alternatively to the SD card module, you can use a data logging shield. Arduino UNO – read Best Arduino Starter Kits.Here’s a complete list of the parts required for this project: Complete Guide for DHT11/DHT22 Humidity and Temperature Sensor With Arduino.Guide for Real Time Clock (RTC) Module with Arduino (DS1307 and DS3231).We’ll use the DHT11 to measure temperature, the real time clock (RTC) module to take time stamps and the SD card module to save the data on the SD card.
ARDUINO LCD LIBRARY AND RTC HOW TO
This post shows you how to create a temperature Arduino data logger.