Beruflich Dokumente
Kultur Dokumente
CHAPTER 1
INTRODUCTION
1.1 Introduction
Agriculture is one of the most vital perspectives in human exercises around the world.
Agriculture is about the art of farming that contains growing of the crops through soil
cultivating and providing foods, fleece and different products. Ever since the agriculture
was born, farmers have been experienced such different problems in their everyday lives.
Farmers are facing new challenges on how they will retain their crops and animals to be
healthy. Agriculture is highly dependent on the conditions of the climate. The state of the
atmosphere is truly matter for the farmers to produce healthy crops. Furthermore, the
technological development has a gigantic effect to the improvement of agriculture. With the
advent of technology, there are lot of new ideas and more-effective devices that can be
integrated as a whole to implement a system. Innovation is the way to accomplish long haul
destinations and guarantee the logging and monitoring of data within specified set of time.
We are in a world that everything is being automated. Automatic systems are ideal
nowadays because it provides an energy efficiency and minimizes the need for tedious
physical work/lab. Smart farming is gradually used by the agriculturist to make agricultural
production more intelligent. This kind of technology is also called precision agriculture
where the idea is about how will observe, measure and respond to inter and intra-field
variability of crops. With the use of sensors, at the earliest moment, the proponents will
easily detect and monitor the possible abnormalities over specified period of time.
As engineers/developers we always rely upon the data collected to design or
improve a system. Recording data and analysing them is a common practice in most of the
industries, here we are building Arduino Data Logger Project where we will learn how we
can log data at a specific interval of time. We will use an Arduino board to read some data
(here temperature, humidity, date and time) and save them on a SD card and the computer
simultaneously.
The data saved can be easily opened in an excel sheet for further analyses. To
maintain the date and time we will use the famous Real Time Clock (RTC) project module
DS3231 and to get the temperature and humidity we will use the DHT11 Sensor. At the end
of this we will learn-
1. How to log data into SD card with date, time and sensor values.
2. How to write data directly to excel sheet on PC via serial communication.
A data logger or a data recorder is an electronic measuring device, logs the data over a
period of time with a sensor, built in instrument or via external instruments. The data logger
measurements may include: temperature and humidity of air, alternating and direct current
and voltage, air pressure, room occupancy, intensity of light, temperature of water, level of
water, water content in soil, dissolved oxygen, measurement of rain, motion of wind and its
path, pulse signals, leaf wetness etc.
Data logging systems are generally based on a computer or any processor that
processes in digital. These are usually little in size, portable, powered by battery and also
they are provided with a computer processor, sensors and memory required for the storage
of data. These are widely used inside the building, outside the building and in submarine
circumstances where the data is required and where there is a convenience of battery power
is preferred, and also they can record data months together at a time, unattended. This
embedded unit may be a single one and self-contained device with existing physical sensors
that detect the available data that fit in the hand, or it may be a multiple-channel device
provided with many external sensors. These systems connect with a computer and use the
particular software to run the data logger to review and determine the collected data, while
other data loggers use a nearby interfacing devices like handheld keyboard or LCD and can
be used as self-contained devices.
The purpose of having data loggers is its capacity to spontaneously collecting data in
24 hours cycle continuously without a break. After activating, the data loggers are left not
attending to measure and log data for the particular date and time. This permits exact and
complete image of the atmospheric conditions which are being observed such as
temperature of air, moisture content in the air, pressure and solar insolation and many more
parameters. The price of data loggers is varying day by day as the science and technology is
improving and it depends on the number of channels. As the number of channels reduce, the
cost reduces. Data loggers with simple and single channel cost as minimum as $25. The
more complex data loggers may cost very high.
CHAPTER 2
SYSTEM COMPONENTS
1. Breadboard 60
5. Connecting wires 40
6. Battery 20
2.2 Arduino
The Arduino Uno is a microcontroller board based on the ATmega328. It has 14 digital
input/output pins (of which 6 can be used as PWM outputs), 6 Analog inputs, a 16 MHz
crystal oscillator, a USB connection, a power jack, an ICSP header, and a reset button. It
contains everything needed to support the microcontroller; simply connect it to a computer
with a USB cable or power it with a AC-to-DC adapter or battery to get started. The Uno
differs from all preceding boards in that it does not use the FTDI USB-to-serial driver chip.
Instead, it features the Atmega16U2 programmed as a USB-to-serial converter. Revision 2
of the Uno board has a resistor pulling the 8U2 HWB line to ground, making it easier to put
into DFU mode. Revision 3 of the board has the following new features:
1. 1.0 pinout: added SDA and SCL pins that are near to the AREF pin and two other new
pins placed near to the RESET pin, the IOREF that allow the shields to adapt to the voltage
provided from the board. In future, shields will be compatible both with the board that 22
use the AVR, which operate with 5V and with the Arduino Due that operate with 3.3V. The
second one is a not connected pin that is reserved for future purposes.
2. Stronger RESET circuit.
3. Atmega 16U2 replace the 8U2.
"Uno" means one in Italian and is named to mark the upcoming release of Arduino 1.0. The
Uno and version 1.0 will be the reference versions of Arduino, moving forward. The Uno is
the latest in a series of USB Arduino boards, and the reference model for the Arduino
platform; for a comparison with previous versions, see the index of Arduino boards.
Microcontroller ATmega328 Operating Voltage 5V Input Voltage (recommended)
7-12V Input Voltage (limits) 6-20V Digital I/O Pins 14 (of which 6 provide PWM output)
Analogue Input Pins 6 DC Current per I/O Pin 40 mA DC Current for 3.3V Pin 50 mA
Flash Memory 32 KB (ATmega328) of which 0.5 KB used by boot loader SRAM 2 KB
(ATmega328) EEPROM 1 KB (ATmega328) Clock Speed 16 MHz.
2.2.1 Power
The Arduino Uno can be powered via the USB connection or with an external power
supply. The power source is selected automatically. External (non-USB) power can come
either from an AC-to-DC adapter (wall-wart) or battery. The adapter can be connected by
plugging a 2.1mm center-positive plug into the board's power jack. Leads from a battery can
be inserted in the Gnd and Vin pin headers of the POWER connector. The board can
operate on an external supply of 6 to 20 volts. If supplied with less than 7V, however, the
5V pin may supply less than five volts and the board may be unstable. If using more than
12V, the voltage regulator may overheat and damage the board. The recommended range is
7 to 12 volts. The power pins are as follows:
1. VIN - The input voltage to the Arduino board when it's using an external power source
(as opposed to 5 volts from the USB connection or other regulated power source). You can
supply voltage through this pin, or, if supplying voltage via the power jack, access it
through this pin.
2. 5V - The regulated power supply used to power the microcontroller and other
components on the board. This can come either from VIN via an on-board regulator, or be
supplied by USB or another regulated 5V supply.
3. 3V3 - A 3.3 volt supply generated by the on-board regulator. Maximum current draw is
50 mA.
4. GND - Ground pins.
2.2.2 Memory
The ATmega328 has 32 KB (with 0.5 KB used for the bootloader). It also has 2 KB of
SRAM and 1 KB of EEPROM (which can be read and written with the EEPROM library).
1. Serial: 0 (RX) and 1 (TX). Used to receive (RX) and transmit (TX) TTL serial data.
These pins are connected to the corresponding pins of the ATmega8U2 USB-to-TTL Serial
chip.
2. External Interrupts: 2 and 3. These pins can be configured to trigger an interrupt on a low
value, a rising or falling edge, or a change in value. See the attachInterrupt() function for
details.
3. PWM: 3, 5, 6, 9, 10, and 11. Provide 8-bit PWM output with the analogWrite() function.
4. SPI: 10 (SS), 11 (MOSI), 12 (MISO), 13 (SCK). These pins support SPI communication
using the SPI library.
5. LED: 13. There is a built-in LED connected to digital pin 13. When the pin is HIGH
value, the LED is on, when the pin is LOW, it's off.
The Uno has 6 analogue inputs, labelled A0 through A5, each of which provide 10 bits of
resolution (i.e. 1024 different values). By default they measure from ground to 5 volts,
though is it possible to change the upper end of their range using the AREF pin and the
analogReference() function. Additionally, some pins have specialized functionality:
1. TWI: A4 or SDA pin and A5 or SCL pin. Support TWI communication using the Wire
library.
There are a couple of other pins on the board:
1. AREF - Reference voltage for the analogue inputs. Used with analogReference().
2. Reset - Bring this line LOW to reset the microcontroller. Typically used to add a reset
button to shields which block the one on the board.
2.2.4 Interfacing
The Arduino Uno has a number of facilities for communicating with a computer, another
Arduino, or other microcontrollers. The ATmega328 provides UART TTL (5V) serial
communication, which is available on digital pins 0 (RX) and 1 (TX). An ATmega16U2 on
the board channels this serial communication over USB and appears as a virtual com port to
software on the computer. The '16U2 firmware uses the standard USB COM drivers, and no
external driver is needed. However, on Windows, a .inf file is required. The Arduino
software includes a serial monitor which allows simple textual data to be sent to and from
the Arduino board. The RX and TX LEDs on the board will flash when data is being
transmitted via the USB-to-serial chip and USB connection to the computer (but not for
serial communication on pins 0 and 1). A Software Serial library allows for serial
communication on any of the Uno's digital pins. The ATmega328 also supports I2C (TWI)
and SPI communication. The Arduino software includes a Wire library to simplify use of
the I2C bus; see the documentation for details. For SPI communication, use the SPI library.
The Arduino Uno has a number of facilities for communicating with a computer, another
Arduino, or other microcontrollers.
2.2.5 Programming
The Arduino Uno can be programmed with the Arduino software (download). Select
"Arduino Uno from the Tools > Board menu (according to the microcontroller on your
board). The ATmega328 on the Arduino Uno comes preburned with a bootloader that
allows you to upload new code to it without the use of an external hardware programmer. It
communicates using the original STK500 protocol (reference, C header files). To bypass the
boot loader and program the microcontroller through the ICSP (In-Circuit Serial
Programming) header; see these instructions for details. The ATmega16U2/8U2 is loaded
with a DFU boot loader, which can be activated by:
1. On Rev1 boards: connecting the solder jumper on the back of the board (near the map of
Italy) and then resetting the 8U2.
2. On Rev2 or later boards: there is a resistor that pulling the 8U2/16U2 HWB line to
ground, making it easier to put into DFU mode.
Atmel's FLIP software (Windows) or the DFU programmer (Mac OS X and Linux)
to load a new firmware can also be used. Or you can use the ISP header with an external
programmer (overwriting the DFU boot loader).
This setup has other implications. When the Uno is connected to either a computer running
Mac OS X or Linux, it resets each time a connection is made to it from software (via USB).
For the following half-second or so, the bootloader is running on the Uno. While it is
programmed to ignore malformed data (i.e. anything besides an upload of new code), it will
intercept the first few bytes of data sent to the board after a connection is opened. If a sketch
running on the board receives one-time configuration or other data when it first starts, make
sure that the software with which it communicates waits a second after opening the
connection and before sending this data. The Uno contains a trace that can be cut to disable
the auto-reset. The pads on either side of the trace can be soldered together to re enable it.
It's labelled "RESET-EN". You may also be able to disable the auto-reset by connecting a
110 ohm resistor from 5V to the reset line.
microcontroller. This sensor has a resistive component and also includes a sense of wet
NTC temperature measuring instruments. It has high power, anti-interference capability,
rapid response and quick implementation benefits. DHT 11 is very small in size and works
on a very low power and it is capable to transmit a signal up-to-20 meter. In DHT 11,the
digital output is directly proportional to the humidity and temperature and hence the name
DHT 11 and it is measured by the sensor. Every DHT11 sensor is properly measured in the
laboratory so that the internal OTP memory is used for the storage of calibration coefficient
of DHT 11.
Vcc 5V
Gnd Gnd
Nc Nc
Out Pin 7
10
Serial.print(DHT.humidity);
Serial.print(“%”);
Serial.print(“temperature=”);
Serial.print(DHT.temperature);
Serial.println(“C”);
delay(1000);
}
11
including corrections for leap year. The clock operates in either the 24-hour or 12-hour
format with an AM/PM indicator. Two programmable time-of-day alarms and a
programmable square-wave output are provided. Address and data are transferred serially
through an I2C bidirectional bus. A precision temperature-compensated voltage reference
and comparator circuit monitors the status of VCC to detect power failures, to provide a
reset output, and to automatically switch to the backup supply when necessary.
Additionally, the RST pin is monitored as a pushbutton input for generating a μP reset.
2.4.2 Applications
1. Servers
2. Telematics
3. Utility Power Meters
4. GPS
5. Smart Energy
6. Liquid Crystal Display(LCD)
12
13
nominal value pullup resistor to VCC. No external pullup resistors should be connected. If
the oscillator is disabled, tREC is bypassed and RST immediately goes high.
5. N.C. - No Connection. Must be connected to ground.
6. GND – Ground
7. VBAT Backup Power-Supply Input. When using the device with the VBAT input as the
primary power source, this pin should be decoupled using a 0.1µF to 1.0µF low-leakage
capacitor. When using the device with the VBAT input as the backup power source, the
capacitor is not required. If VBAT is not used, connect to ground. The device is UL
recognized to ensure against reverse charging when used with a primary lithium battery.
8. SDA Serial Data Input/Output. This pin is the data input/output for the I2C serial
interface. This open-drain pin requires an external pullup resistor. The pullup voltage can be
up to 5.5V, regardless of the voltage on VCC.
9. SCL Serial Clock Input. This pin is the clock input for the I2C serial interface and is used
to synchronize data movement on the serial interface. Up to 5.5V can be used for this pin,
regardless of the voltage on VCC.
14
15
2.8.1 Features
1. Operating voltage 5V (supplied from the Arduino Board)
2. Ethernet Controller: W5100 with internal 16K buffer
3. Micro-SD card slot
4. Connection speed: 10/100Mb
5. Connection with Arduino on SPI port Requires an Arduino board
16
1. Direct connection to the Router. There is an RJ-45 port on Router & a straight RJ45
cable to plug Ethernet shield to Router. Now PC/Laptop is also connected to the same
Router either by wire or through Wifi (if Router is WiFi capable).
2. Indirect connection shield is connected to the Laptop’s RJ45 with wire. Now the laptop
is connected to Router through WiFi. In this case you need to bridge the connections or
use the shield as unidentified second network with a different IP.
17
18
19
20
21
22
As soon as we connect the RJ45 cable you can see an UNIDENTIFIED NETWORK
23
24
CHAPTER 3
PROJECT WORKING
3.1 Working
First of all Arduino sends a high to low start signal to DHT11 with 18µs delay to ensure
DHT’s detection. And then Arduino pull-up the data line and wait for 20-40µs for DHT’s
response. Once DHT detects starts signal, it will send a low voltage level response signal to
Arduino of time delay about 80µs. And then DHT controller pull up the data line and keeps
it for 80µs for DHT’s arranging of sending data.
When data bus is at low voltage level it means that DHT11 is sending response
signal. Once it is done, DHT again makes data line pull-up for 80µs for preparing data
transmission. Data format that is sending by DHT to Arduino for every bit begins with 50µs
low voltage level and length of high voltage level signal determines whether data bit is “0”
or “1”.
One important thing is to make sure pull up resistor value because if we are placing
DHT sensor at <20 meter distance, 5k pull up resistor is recommended. If placing DHT at
longer the 20 meter then use appropriate value pull up resistor. Data loggers in present
market are too costly making them not to be feasible for important but low cost systems.
The data acquired may be important in such systems but the cost of acquisition shoots up
the system cost making it an economic constraint for project developers. The present DAQ
systems are costly, this project intends to develop a product which beats the present market
cost of the DAQ with additional features such as database storage with real time plotting of
collected data. This concept is implemented using microcontrollers and sensor circuits
which are developed and are custom designed as per the physical data to be captured.
Usual 8051 microcontroller uses external ADC which is interfaced with it and
converts the analogue signal fed into digital signal which is then fed to microcontroller for
processing. Here in this project Arduino Microcontroller board is used which has inbuilt
ADC and other peripheral circuitry necessary for operation. The physical parameter is
sensed by the sensors and is converted into analogue signal. This analogue signal is fed to
the Arduino board ADC pins which is then converted in to an equivalent digital quantity
and is further processed in the microcontroller. The raw digital signal or processed signal
out of microcontroller may be displayed on the LCD display or it’s saved in a database or
25
even at the same time this data is sent to computer through the USB serial port. The serial
port data is then accessed and is imported in MATLAB, Python or excel for computation
and graphical representation. This developed product can be readily implemented in
industry for logging of any physical quantity such as temperature, humidity or pressure etc.
The project is even suitable for digital signal processing of a physical signal into
computational software like MATLAB or Microsoft excel or even PYTHON.
Working of the Arduino Data Logger is simple. Once the hardware and the software are
ready it is time to burn the program into your Arduino Board. As soon the program gets
uploaded, the temperature and humidity values will start to get stored in your SD card.
Follow the steps below to enable PLX-DAQ to log the into Excel sheet in the computer.
Step 1: Open the “Plx-Daq Spreadsheet” file that was created on the desktop during
installation.
Step 2: If there is a Security block, click on Options->Enable the content -> Finish ->
OK to get the following screen.
26
Now leave this excel sheet open and monitor the values as they get logged. As this is
happening the SD card would also have saved the same values. To check is that is working
simply remove the SD card and open it on the computer. Now find a text file
named “LoggerCD.txt” in it. When opened it would look something like this.
27
CHAPTER 4
SIMULATION OF PROJECT
28
29
Using an SD card with Arduino is easy because of the SD card library which will be added
to the Arduino IDE by default. In the SD card initialize function we will create a text file
named “LoggerCD.txt” and write the first row of our content. Here we separate the values
by using a “,” as a delimiter. Meaning when a comma is placed it means we have to move to
the next cell in the Excel sheet.
b. Writing Data to SD card
As said earlier our intention is to save the Date, Time, Temperature and Humidity into
our SD card. With the help of the DS3231 library and the DHT11 library our Arduino will
be capable of reading all these four parameters and storing them into the following
parameters as shown in table below
c. Writing Data to PLX-DAQ
PLX-DAQ is Microsoft Excel Plug-in software that helps us to write values from Arduino
to directly into an Excel file on our Laptop or PC.
1. We can write and monitor the data at the same time and provides us way to plot them as
graphs. Data loggers in present market are too costly making them not to be feasible for
important but low cost systems.
2. We do not need a RTC Module like DS3231 to keep track of date and time. You can
simply use the date and time running on your Laptop/computer and save them directly on
Excel.
The software can recognize keywords like LABEL, DATA, TIME, DATE etc. In the
Initialize function the keyword “LABEL” is used to write the first ROW of the Excel sheet.
* Vcc->5V
30
* Gnd->Gnd
* MISO->pin 12
* MOSI->pin 11
* SCK-> pin 13
* CS-> pin 4
* Vcc->5V
* Gns->Gnd
* SCL->pin A5
* SDA-> pin A4
* Vcc->5V
* Gnd->Gnd
* Out-> pin 7
*/
#include <DS3231.h> //Library for RTC module (Download from Link in article)
#include <dht.h> //Library for dht11 Temperature and Humidity sensor (Download from
Link in article)
void setup()
31
Serial.begin(9600);
Initialize_SDcard();
Initialize_RTC();
Initialize_PlxDaq();
void loop()
Read_DHT11();
Write_SDcard();
Write_PlxDaq();
void Write_PlxDaq()
32
void Initialize_PlxDaq()
void Write_SDcard()
// open the file. note that only one file can be open at a time,
if (dataFile) {
else
33
void Initialize_SDcard()
if (!SD.begin(chipSelect)) {
return;
// open the file. note that only one file can be open at a time,
if (dataFile) {
dataFile.close();
void Initialize_RTC()
rtc.begin();
//#### The following lines can be uncommented to set the date and time for the first
time###
/*
34
*/
void Read_DHT11()
/*void Read_DateTime()
// Send date
Serial.print(rtc.getDateStr());
Serial.print(" -- ");
// Send time
Serial.println(rtc.getTimeStr());
}*/
/*void Read_TempHum()
Serial.print("Temperature = ");
Serial.println(DHT.temperature);
Serial.print("Humidity = ");
Serial.println(DHT.humidity);
// delay(1000);
}*/
35
// Connect a 10K resistor from pin 2 (data) to pin 1 (power) of the sensor
#include <SPI.h>
#include <Ethernet.h>
byte mac[] = {
0x90, 0xA2, 0xDA, 0x00, 0x23, 0x36 }; //MAC address found on the back of your ethernet
shield.
EthernetServer server(80);
void setup() {
Serial.begin(9600);
while (!Serial) {
dht.begin();
36
Ethernet.begin(mac, ip);
server.begin();
Serial.print("server is at ");
Serial.println(Ethernet.localIP());
void loop() {
// Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor)
float h = dht.readHumidity();
float t = dht.readTemperature();
// check if returns are valid, if they are NaN (not a number) then something went wrong!
if (isnan(t) || isnan(h)) {
} else {
Serial.print("Humidity: ");
Serial.print(h);
Serial.print(" \t");
Serial.print("Temperature: ");
Serial.print(t);
Serial.println(" *C");
if (client) {
Serial.println("new client");
37
while (client.connected()) {
if (client.available()) {
char c = client.read();
Serial.write(c);
// character) and the line is blank, the http request has ended,
client.println("Content-Type: text/html");
client.println();
client.println("<!DOCTYPE HTML>");
client.println("<html>");
client.println("<H2>");
client.print("Humidity: ");
client.println("</H2>");
client.println("<p />");
client.println("<H1>");
client.print(h);
client.print(" \t");
client.println("</H1>");
38
client.println("<p />");
client.println("<H2>");
client.print("Temperature: ");
client.println("</H2>");
client.println("<H1>");
client.print(t*1.8+32);
client.println(" °");
client.println("F");
client.println("</H1>");
client.println("</html>");
break;
if (c == '\n') {
currentLineIsBlank = true;
else if (c != '\r') {
currentLineIsBlank = false;
delay(1);
client.stop();
Serial.println("client disonnected");
39
4.5 Results
4.6 Application
1. This system can be altered marginally to log and record other physical signals rather than
temperature, humidity or pressure in requisite application.
2. Data acquired can be imported further into computational software like MATLAB,
Python for mathematical computations.
3. Multiple channel Data Logger can be implemented using collective number of sensors as
per sensing parameter and sensor specifications.
4.7 Advantages
1. Readings are accurate because there is no human error involve.
2. It automatically gives report to the user.
4.8 Disadvantages
1. If something goes wrong, you are the only person who can put it right. All updates need
to be done by you.
2. If you temporarily loose your internet connection or power your website will be offline.
40
CHAPTER 5
FUTURE SCOPE AND CONCLUSION
5.1 Future Scope
1. This system can be altered marginally to log and record other physical signals rather than
temperature, humidity or pressure in requisite application.
2. Product can be custom build to suit prerequisite accuracy and precision of measurement
by upgrading the analog to digital converter rather than using inbuilt 10 bit converter
embedded in microcontroller.
3. Data acquired can be imported further into computational software’s like MATLAB,
Python for mathematical computations.
4. Multiple channel data acquition can be implemented using collective number of sensors
connected to analog or digital inputs respectively as per sensing parameter and sensor
specifications.
5.2 Conclusion
1. The system is fully automated and once it is setup no human intervention is required for
monitoring. This will also reduce errors in measurements as because many times human
intervention leads to errors.
2. Designed system consumes very less power so this is also power efficient
41
CHAPTER 6
REFERENCES
[1] Karthik Krishnamurthi, Suraj Thapa, Lokesh Kothari, Arun Prakash, March 2015,
“Arduino Based Weather Monitoring System”, International Journal of Engineering
Research and General Science Volume 3, Issue 2.
[2] Ms. Vaishali Dhawale, Prof. S.M. Turkane “Data logger system Based on Web
Server” Ms. Vaishali Dhawale et al Int. Journal of Engineering Research and
Applications ISSN: 2248-9622, Vol. 4, Issue 1( Version 3), January 2014,pp.212-
215.
42