Introduction: Arduino Data Logger Shield Small Project
Hey guys
Today I am presenting you one easy example with Arduino Data logger shield. This is very easy project to make and you don't need that many parts to make it.
The project is about measuring temperature and humidity with dht sensor. This project allows you to keep a track on the temperature at certain time, and temperature will be stored on to the sd card which i connected to your Data logger shield.
So because this project is very easy to make and understand I will start my steps now.
Step 1: Obtaining of All Parts
This project can be made with few parts.
List of parts in the project:
- Arduino uno rev3
- Arduino Data logger shield
- SD memory card
- LCD 1602 green display with I2C
- DHT22 (you can use any other dht sensor)
- Few jumper cables
- Breadboard
- Battery 9v
Keep in mind that you can use any other Arduino for this project. You can also change type of display that you have, and you can use another sensor(Soil moisture sensor, any other dht sensor, or even sensor in which you can measure distance at certain time).
I decided to use DHT sensor this time because this project can be very useful if you want to measure temperature through the day at certain place and keep a track how it changes.
Step 2: Connecting All Parts Together
This one is very easy to connect.
Just put the Data Logger shield on the top of the Arduino. It will take all pins from Arduino, but don't worry you will still have pins that are on the Data Logger shield. You can use that pins same as the Arduino pins.
In this step you can see the schematic I made with fritzing. I will also write down how to connect sensor and LCD so somebody that is new to this can understand it.
As you see we will be using 5V and GND from Arduino(Data logger shield) to power the bread board.
LCD:
- VCC to 5V(+ part on breadboard)
- GND to gnd(-part on breadboard)
- SDA to analog pin A4
- SCL to analog pin A5
DHT22:
I used dht with board in which there are three pins to be used :
- + to 5V
- - to GND
- out to digital pin 7
Step 3: Writing Code
I'll explain code in few parts here. A good part of the code is commented so somebody who uses it can easily understand the code.
1.First thing to keep in mind that this code will need few libraries installed on your PC. Those are: Time(TimeLib), Wire, LiquidCrystal, DHT, OneWire, SPI, SD, RTClib. You can probably use some other libraries but this libraries worked for me.
2. After that we are defining everything that is needed for this project. DHT sensor is easy to define, you just need to say the pin that is sensor connected to and type of sensor. After that you need to define some pins that will be used for SD card and RTC pin. And after that you can see variables used for this project.
3. Project uses few methods and all of them are for working with DHT sensor. If you are working on project with this type of sensor you can use it. Those methods are getTemperature(), getHumidity(), readSensorData(), printLcdTemperature(), printHumidity.
4. In setup there are few things that are needed to get done.
First of all you need to define time. Because we are using RTC here we want to have proper time when our Arduino saves data from sensor. That part will be commented in code. If you uncomment //RTC.adjust(DateTime(__DATE__, __TIME__)); line you can set time on your project. After you set proper time you can comment that part again, and you can use your arduino without computer. This is cool because you can use your temperature sensor in some other room and keep track of temperature without need of your computer.
Second part that is to be done is using your SD card on which there will be data stored. Shield will try to see if there is card and initialize it. If there is not the error message will be shown in the Serial screen on Arduino ide.
last part of the setup is initializing lcd, and dht sensor.
5. Last part is loop part or the main part of the project.
It is very simple. At start of the loop Arduino will read data from sensor. After that RTC will check what time is it. I am using my RTC for every 10 minutes this time because it is nice to see how the Data Logger shield works. You can change minutes on the code if you want your data to be saved in 5 minutes, 15, 30 or even in hours. Feel free to change it. If the minute is even to 10 or 20 the data will be saved on sd card. Last part of the project is displaying current temperature on LCD.
I will also put picture of my txt file of SD card so you can see how the temperature is written here.
Attachments
Step 4: Using Your Arduino
The whole point of this project is seeing how the data logger shield works with arduino.
The best thing with this shield is that it has SD card slot which can be used for saving data and reading data from card. Also another thing is that it has RTC module which is used so you can do certain actions on the certain times. Best thing about RTC module is that it uses one small 3V battery and it can keep date and time stored for quiet a long time.
Main point for this project is that it can be portable. Let's say that you want to know how the temperature changes in nature while you are camping. You don't need to bring your laptop for this, or you don't need to check on the internet temperature. You can have this, and you don't need to worry that you will forget what was the temperature when it will be stored. This was just example.
Thank you guys for reading this project on Instructables. I hope it will help somebody out.
Thank You.
With all regards
Sebastian