20
Gina Oliver | Final Report 1 Water Resources Institute, California State University San Bernardino Watershed Management Experimental Learning For USDA Careers Measuring Fuel and Soil Moisture with Custom Data Loggers in the San Dimas Experimental Forest, California Gina C. Oliver California State University, Long Beach March 2014 to March 2015 Faculty Advisor: Dr. Matthew Becker, PhD. California State University, Long Beach Department of Geological Sciences Submitted March 2015

Measuring Fuel and Soil Moisture with Custom Data Loggers ... · This research focused on developing an economically portable data logger using the Arduino technology to collect fuel

Embed Size (px)

Citation preview

Page 1: Measuring Fuel and Soil Moisture with Custom Data Loggers ... · This research focused on developing an economically portable data logger using the Arduino technology to collect fuel

Gina Oliver | Final Report

1

Water Resources Institute, California State University San Bernardino

Watershed Management Experimental Learning For USDA Careers

Measuring Fuel and Soil Moisture with Custom Data Loggers in

the San Dimas Experimental Forest, California

Gina C. Oliver

California State University, Long Beach

March 2014 to March 2015

Faculty Advisor: Dr. Matthew Becker, PhD.

California State University, Long Beach

Department of Geological Sciences

Submitted March 2015

Page 2: Measuring Fuel and Soil Moisture with Custom Data Loggers ... · This research focused on developing an economically portable data logger using the Arduino technology to collect fuel

Gina Oliver | Final Report

2

Table of Contents

Acknowledgements.……………………………………………………………….... 3

Executive Summary……………………………………………………………….... 4

Project objectives………………………………………………………………….... 5

Project Approach………………………………………………………………….... 6-7

Project Outcomes………………………………………………………………........ 8-9

Conclusions……………………………………………………………………..….. 10

Appendices…………………………………………………………………..............11-17

Page 3: Measuring Fuel and Soil Moisture with Custom Data Loggers ... · This research focused on developing an economically portable data logger using the Arduino technology to collect fuel

Gina Oliver | Final Report

3

Acknowledgments

This project was supported by Hispanic-Serving Institution’s Education Program

Grant no. 2011-38422-31204 from the USDA National Institute of Food and Agriculture.

Thanks to California State University, Long Beach for the use of its facilities and to Dr.

Matt Becker, Jared Butler, and Dan Pankratz for their guidance and assistance. Thanks to

Mike Oxford and the support of the U.S. Forest Service at the PSW Research Station at

the San Dimas Experimental forest.

Page 4: Measuring Fuel and Soil Moisture with Custom Data Loggers ... · This research focused on developing an economically portable data logger using the Arduino technology to collect fuel

Gina Oliver | Final Report

4

Executive Summary

This research focused on developing an economically portable data logger using

the Arduino technology to collect fuel moisture, soil moisture, and temperature and

humidity measurements to later help predict fire danger ratings within the San Dimas

Experimental Forest (SDEF). These variables are necessary for monitoring fuel moisture

and rating high-risk fire areas according to the National Fire-Danger Rating System

(NFDRS) (Cohen & Deeming, 1985) and Zahn and Henson (2011). Utilizing this data

logging method in future experiments could lend insight into how the soil moisture,

temperature and humidity regimes impact fuel moisture and fire risk. Here, two

experimental procedures using 10-hour and 100-hour fuel moisture dowels were tested to

calibrate the accuracy and sensitivity of the data logger. With the support from the Forest

Service at the Pacific Southwest Research Station, the Arduino data loggers were tested

in the SDFE.

Page 5: Measuring Fuel and Soil Moisture with Custom Data Loggers ... · This research focused on developing an economically portable data logger using the Arduino technology to collect fuel

Gina Oliver | Final Report

5

Project Objectives

Measuring moisture in dead fuels and soils are valuable components in assessing

fire danger. According to Zahn and Henson (2011), live and dead fuel moisture values are

used for various management purposes, including determining drought or drying trends,

formulating fire danger ratings, providing a basis for severity funding, gathering input for

fire behavior modeling, determining prescription parameters for prescribed burns, and

determining the effects of fire in an ecosystem. Since Southern California’s wild lands

are dominantly characterized as chaparrals and are high-risk fire areas in dry seasons

(USDA, 2008), it is crucial to continuously monitor fuel and soil moisture. Soil moisture

was chosen to couple fuel moisture measurements knowing that both are dependent on

current weather conditions (Fosberg & Deeming, 1971). Arduino technology allows for

continual data recording and is inexpensive so that more loggers can be built and a larger

data set can be collected.

Initial objectives for this project included developing, constructing and emplacing

multiple Arduino data loggers in the SDEF at various topographical locations in The Bell

watershed to compare moisture measurements from slopes, ridges and ravines. Soil

moisture patterns have been observed to exhibit different types of dependence on

topography (Yin et al. 2001). For instance, the temporal dynamic type of soil moisture

shows significant correlation with relative elevation and slope (Yin et al. 2001).

Furthermore, the SDEF is ideal since it is a field laboratory for ecosystem, watershed,

and natural resource science research in chaparral and related Mediterranean-climate

ecosystems that is managed by the USDA Forest Service Pacific Southwest Research

Station (PSW) (USDA, 2008).

Final objectives for this research were modified to develop and test the Arduino

data logger so that it would perform on a portable external power supply for the time

needed to collect appropriate fuel and soil moisture measurements. Fosberg and Deeming

(1971) protocols were used, where the 10-hour fuel dowels have a 24-hour timelag and

the 100-hour and 1000-hour fuel dowel calculations take an average 24-hour timelag over

2-7 days respectively. Initial objectives were changed due to the limitations found during

this project, which included battery life estimations and sensitivity of the sensors used for

fuel moisture. Continuation of this project could lead to a career in the USDA Forest

Service by developing new innovative methods for monitoring fire danger in Southern

California.

Page 6: Measuring Fuel and Soil Moisture with Custom Data Loggers ... · This research focused on developing an economically portable data logger using the Arduino technology to collect fuel

Gina Oliver | Final Report

6

Project Approach

Arduino software is easily accessible to the general public and was downloaded

through their trademark website. Arduino libraries provide sample sketches or coding

scripts to connect compatible sensors onto the microcontroller. The application here

demanded sample sketch modification for reading and saving hourly measurements onto

an SD card. The coding for this data logger reads two moisture sensors, a temperature

and humidity sensor, and a Real Time Clock (RTC). Measurements were then stored on

an SD card that produced the values on an Excel spreadsheet. The script allowed the

programmer to change the start time of each experiment.

Production of the data logger included selecting and connecting compatible

sensors onto the Arduino (Figure 1.) and writing the Arduino sketch (Figure 4.). The use

of a breadboard was necessary for operating multiple sensors. Without the breadboard,

the user is limited to two sensors since the microcontroller has only two power pins. As

seen in the schematic (Figure 1.), the 5Volt power pin was connected to the positive

column (red line) on the breadboard and the ground pin was connected to the negative

column (black line) with jumper wires. Next, the power column was connected with a 40-

Ohm resistor to a chosen row on the breadboard. Each sensor’s power pin was emplaced

into that specific row. The same process was done connecting the sensors and ground

pins using a small jumper wire. The information or data pins for the moisture sensors and

Real Time Clock (RTC) were connected directly into an analog pin on the Arduino. The

temperature and humidity data pin was connected to a chosen digital pin. This

differentiation between the analog and digital pins were due to the type of sensor being

used. The right resistor for the circuit was found by using Ohm’s law, where resistance

(R) is equal to the quotient of voltage (V) and current (I). The resistance for the circuit

was calculated using 5Volts from the Arduino regulator and the sum of the Arduino current

plus the current drawn from the four sensors was 0.1425 amperes. The resulting

resistance was 35.08 Ohms; therefore a 40-Ohm resistor was used to regulate current

flow.

Next, sensor calibrations were done to find a relationship between water weight

and sensor values. To do this, a dry sponge was weighed and then saturated with water,

and again weighed to calculate water content in grams. Calibration curves were created

by a series of wetting and weighing a sponge, inserting the sensor into the sponge, and

recording the sensor value over a range of different water measurements. Each sensor

was placed inside a custom size slot made in the middle of the sponge to take a moisture

reading. The sensors required a tight fit in the material it is measuring to provide an

accurate measurement value. Calibrations were done three times for accuracy. The

exponential trend line looked to be the best fit for the data (Figures 2 and 3).

Once the Arduino circuit and sensors were prepped for data logging, the design

for the experimental application was carried out. Following protocols from Fosberg and

Deeming (1971) and Zahn and Henson (2011), ponderosa pine fuel dowels were cut to fit

Page 7: Measuring Fuel and Soil Moisture with Custom Data Loggers ... · This research focused on developing an economically portable data logger using the Arduino technology to collect fuel

Gina Oliver | Final Report

7

the moisture sensors. The sensors were two pronged (Figure 1.) with each prong

measuring 0.6cm wide, 3.8cm in length, and 0.15cm thick. Therefore, two custom slots

were cut into the 2.4cm diameter 100-hour fuel dowel for insertion of the moisture

sensor. Whereas two separate 10-hour, 1.3cm fuel dowels were cut and emplaced on each

prong of the sensor.

Two methods for the initial fuel moisture measurements were applied. The first

was to dry and weight the fuel dowels before the experiment. The second was to saturate

and weight the fuel dowels before the experiment, this method was primarily done to test

for the accuracy of the moisture sensors. After each experiment, the dowel or dowels

were weighed again to measure the water content. Both methods allowed for monitoring

the accuracy of the moisture sensors. Both experiments were run on either one or two

eight pack AA battery packs that fit into the chosen electrical box to make it portable.

Battery power supply and consumption were calculated and accommodated for.

Battery life expectancy and power consumption were found by using the electrical power

equation, where power (Watts) is equal to the product of the battery voltage (V) and

current (mA) drawn from the Arduino circuit. These calculations were then used to find

the Watt-hour estimates. All calculations and battery life estimates can be found in the

supporting information (SI) below. The power needed to run a 100-hour fuel experiment

required two eight battery packs in parallel. To run battery packs in parallel, the cathode

of the first battery pack was soldered to the cathode battery lead to the second battery

pack. The same process was done with the anode battery leads. To make sure the parallel

pack is producing the most effective amount of power, both battery packs must output the

same amount of voltage. Placing the batteries in parallel allows the same voltage output

but doubles the amount of current output.

According to Zahn and Henson (2011), fuel moisture sticks should be placed

30.48cm or one foot above the ground floor. The data logger was placed into a Cantex

electrical box mounted on a wooden stake with the temperature and humidity sensor

bolted onto the bottom of the Cantex box for protection from direct sunlight or rainfall.

The soil moisture sensor (Sensor #1) was extended out of the Cantex box with jumper

wires into the soil below the fuel dowel. The soil moisture sensor was protected from

outside disturbances but PVC piping. The fuel moisture sensor (Sensor#2) was extended

out of the Cantex box while also being protected with the same PVC piping, into the

wooden dowel or dowels one foot or 30.48cm above the soil. Three experimental data

sets were obtained for this project.

Page 8: Measuring Fuel and Soil Moisture with Custom Data Loggers ... · This research focused on developing an economically portable data logger using the Arduino technology to collect fuel

Gina Oliver | Final Report

8

Project Outcomes

Initial measurements with the Arduino data logger were taken in the San Dimas

Experimental Forest using the 100-hour fuel dowel. The first data set collection started on

June 13, 2014 at 12:40pm and lasted 39 hours after emplacement (Table 1). This data set

was performed before the RTC was added to the Arduino. Additionally, a single eight-

battery pack was used as the external power source. The power supply of this deployment

was not enough to collect efficient data to measure the moisture content of the 100-hour

fuel dowel after timelag. There was no change in weight of the 100-hour dowel measured

before and after the run time, representing zero water absorption. This could be

accounted for by the weather conditions. Temperatures peaked at 32C and had a

humidity low of 32 percent, these conditions could account for zero moisture values for

both soil and fuel measurements.

Further experiments were performed outside of the SDEF, yet the data logger

included the installment of the RTC and ran on two eight-battery packs in parallel. The

next experiment (Table 2) tested the wet 10-hour fuel dowels and soil moisture. This ran

for twenty-six hours and the dowels were weighed before measurements began and

weighed directly after the twenty-six hours. The second data set showed moisture content

in the dowels and soil. The soil moisture sensor first read 365 a value and was calculate

from the calibration curve to be about 4.17 grams of the water content. The fuel moisture

sensor first read a 57 value, which corresponds to about 0.621 grams of water content.

Dowel measurements taken before the second experiment of the pre-moistened dowels

showed a 0.652-gram increase. The sensor and weight values are in close comparison.

After the fifth hour of the experiment, the fuel moisture was too low for the moisture

sensor to detect. This sensor sensitivity effect was also seen in the calibration series. The

sensors can measure water content in a medium of 0.5 grams or more. The last

experiment (Table 3) ran for twenty-six hours to test the pre-conditioned wet 100-hour

fuel dowel. These results showed similar values to the second experiment. The 100-hour

dowel weight before water saturated was 47.822 grams and was 48.704 grams after it was

wet. These measurements correspond to the first sensor reading measuring about a 0.621-

gram increase. The 100-hour dowel was only measured for twenty-six hours due to time

constraints and was only being tested to validate the ability of the Arduino sensor to

measure fuel moisture. Again this test showed that the sensors could measure the fuel

moisture content in the 10-hour and 100-hour fuel dowels.

Calculations (SI) for the custom build data logger shows it can take hourly

measurements up to 78 hours from a power supply of two eight-battery packs in parallel

producing 12 volts to the Arduino. There is significant power loss to heat energy due to

the build in regulator on the Arduino microcontroller. Yet, the 10-hour and 100-hour fuel

sticks were used successfully to measure fuel and soil moisture. The sensitivity of the

sensors allows the detection of moisture content from 0.5 grams or more. The power

supply limitations and sensor sensitivity suggest multiple data sets should be taken for

Page 9: Measuring Fuel and Soil Moisture with Custom Data Loggers ... · This research focused on developing an economically portable data logger using the Arduino technology to collect fuel

Gina Oliver | Final Report

9

accuracy and comparison with this model data logger. For understanding the rate at

which fuel and soils dry after a rainfall during the summer, wetting the fuel and soil

before hand is necessary. Whereas, when deploying this data logger during a wet season,

drying the fuel stick and weighing before the experiment will allow the measurement of

the amount of moisture absorption in the soil and fuels.

Page 10: Measuring Fuel and Soil Moisture with Custom Data Loggers ... · This research focused on developing an economically portable data logger using the Arduino technology to collect fuel

Gina Oliver | Final Report

10

Conclusion

Monitoring fuel and soil moisture content within the San Dimas Experimental

Forest watersheds may lend insight into where the high-risk fire areas are and be able to

predict where the most severe fires are to be expected. Previous methods are labor

intensive and installing weather stations are expensive. The presented Arduino data

logger is the first step into building an economical weather station. Since the cost to

construct these data loggers is low, many can be built and placed into watersheds of

interest to collect specific data. The presented fuel and soil moisture data logger has the

ability to take continuous moisture, temperature and humidity measurements while

recording the time of each measurement taken that are all saved onto an SD card as an

Excel spreadsheet. Potential research with these data loggers may include simultaneously

emplacing multiple data loggers into one watershed at various topographical locations

during a wet season to measure how much moisture is absorbed in the soil and moisture

and how it varies from basins, slopes, and ravines. This would lend insight into where the

driest areas are within the watershed in relation to topography.

This internship provided a hands-on experience in hydrological science by

understanding how to develop and test a weather data logger. Arduino coding and data

logger construction helped develop my computational, mechanical and electrical

engineering skills. These skills can greatly benefit a future career with the USDA Forest

Service.

Page 11: Measuring Fuel and Soil Moisture with Custom Data Loggers ... · This research focused on developing an economically portable data logger using the Arduino technology to collect fuel

Gina Oliver | Final Report

11

References

Fosberg, M., A., & Deeming, J., E. (1971). Derivation of the 1- and 10-hour Timelag Fuel

Moisture Calculations for Fire-Danger Rating. USDA Forest Service, 207.

Qiu, Y., Fu, B., Wang, J., & Chen, L. (2001). Soil moisture variation in relation to topography

and land use in a hillslope catchment of the Loess Plateau, China. Journal of Hydrology,

240(3-4), 243–263. doi:10.1016/S0022-1694(00)00362-0

United States Department of Agriculture, Forest Service, Pacific Southwest Research Station. The

San Dimas Experimental Forest: A Vision. www.fs.fed.us/psw/ef

Zahn, S., & Henson, C (2011). A Synthesis of Fuel Moisture Collection Methods and Equipment

— A Desk Guide, (May).

Cohen, J. E., & Deeming, J. D. (1985). The National Fire-Danger Rating System: basic equations.

Gen. Tech. Report, 16.

Energizer. (n.d.). Energizer E91 Datasheet. http://data.energizer.com/PDFs/E91.pdf, 1–2.

http://data.energizer.com/PDFs/E91.pdf

Figures and Tables

(Figure 1. Schematic of the circuit (without the SD card shield) and battery power using Fritzing)

Page 12: Measuring Fuel and Soil Moisture with Custom Data Loggers ... · This research focused on developing an economically portable data logger using the Arduino technology to collect fuel

Gina Oliver | Final Report

12

(Figure 2(Top) Figure 3(Bottom) Calibration of moisture sensors using a sponge.)

Soil (#1) Fuel (#2) Temperature Humidity

y = 0.4181e0.0063x

0

5

10

15

20

25

30

35

40

45

0 200 400 600 800

wa

ter

we

igh

t(g

)

sensor reading

Calibration of Sensor #1

Series1

Expon. (Series1)

y = 0.4306e0.0062x

0

5

10

15

20

25

30

35

40

45

0 200 400 600 800

wa

ter

we

igh

t(g

)

sensor reading

Calibration of Sensor#2

Series1

Expon. (Series1)

0 0 26.00C 40.00%

0 0 29.00C 39.00%

0 0 32.00C 40.00%

0 0 32.00C 36.00%

0 0 32.00C 32.00%

0 0 30.00C 37.00%

0 0 29.00C 37.00%

0 0 27.00C 39.00%

0 0 26.00C 40.00%

0 0 20.00C 44.00%

0 0 16.00C 50.00%

Page 13: Measuring Fuel and Soil Moisture with Custom Data Loggers ... · This research focused on developing an economically portable data logger using the Arduino technology to collect fuel

Gina Oliver | Final Report

13

(Table 1. Data set collected in June 2014, with the dry 100-hour fuel stick)

Soil (#1) Fuel (#2) Temperature Humidity RTC

0 0 16.00C 51.00%

0 0 15.00C 44.00%

0 0 14.00C 44.00%

0 0 14.00C 43.00%

0 0 14.00C 43.00%

0 0 13.00C 43.00%

0 0 13.00C 43.00%

0 0 12.00C 44.00%

0 0 13.00C 44.00%

0 0 15.00C 43.00%

0 0 24.00C 37.00%

0 0 25.00C 36.00%

0 0 31.00C 32.00%

0 0 30.00C 35.00%

0 0 31.00C 33.00%

0 0 34.00C 32.00%

0 0 33.00C 31.00%

0 0 33.00C 31.00%

0 0 31.00C 33.00%

0 0 29.00C 35.00%

0 0 26.00C 38.00%

0 0 25.00C 39.00%

0 0 20.00C 42.00%

0 0 16.00C 48.00%

0 0 15.00C 53.00%

0 0 16.00C 60.00%

0 0 15.00C 59.00%

0 0 14.00C 63.00%

365 57 23.00C 34.00% 2/26/15 12:05 363 48 23.00C 34.00% 2/26/15 13:04 363 43 24.00C 34.00% 2/26/15 14:04 360 40 24.00C 34.00% 2/26/15 15:04 359 32 24.00C 34.00% 2/26/15 16:04 352 0 24.00C 34.00% 2/26/15 17:04 347 0 22.00C 35.00% 2/26/15 18:04 342 0 21.00C 35.00% 2/26/15 19:04 338 0 20.00C 36.00% 2/26/15 20:04 335 0 20.00C 36.00% 2/26/15 21:03 331 0 19.00C 36.00% 2/26/15 22:03 329 0 19.00C 36.00% 2/26/15 23:03 325 0 19.00C 36.00% 2/27/15 0:03

Page 14: Measuring Fuel and Soil Moisture with Custom Data Loggers ... · This research focused on developing an economically portable data logger using the Arduino technology to collect fuel

Gina Oliver | Final Report

14

(Table 2. Data set collected in February 2015, using wet 10-hour fuel sticks)

Soil (#1) Fuel (#2) Temperature Humidity RTC

302 59 16.00C 38.00% 2/28/15 12:15

307 56 16.00C 38.00% 2/28/15 13:14

289 54 17.00C 36.00% 2/28/15 14:14

288 45 18.00C 35.00% 2/28/15 15:14

289 39 20.00C 34.00% 2/28/15 16:14

283 0 18.00C 35.00% 2/28/15 17:14

288 0 17.00C 35.00% 2/28/15 18:14

282 0 16.00C 36.00% 2/28/15 19:14

281 0 15.00C 36.00% 2/28/15 20:14

271 0 15.00C 36.00% 2/28/15 21:13

319 0 15.00C 36.00% 2/28/15 22:13

318 0 15.00C 36.00% 2/28/15 23:13

318 0 15.00C 36.00% 3/1/15 0:13

319 0 14.00C 37.00% 3/1/15 1:13

318 0 14.00C 37.00% 3/1/15 2:13

318 0 14.00C 37.00% 3/1/15 3:13

317 0 14.00C 37.00% 3/1/15 4:13

320 0 14.00C 37.00% 3/1/15 5:13

318 0 14.00C 37.00% 3/1/15 6:12

318 0 14.00C 37.00% 3/1/15 7:12

317 0 14.00C 37.00% 3/1/15 8:12

316 0 14.00C 37.00% 3/1/15 9:12

315 0 14.00C 37.00% 3/1/15 10:12

315 0 14.00C 37.00% 3/1/15 11:12

314 0 14.00C 37.00% 3/1/15 12:12

318 0 14.00C 37.00% 3/1/15 13:12

(Table 3. Data set collected in February/March 2015 using the wet 100-hour fuel stick)

321 0 18.00C 37.00% 2/27/15 1:03 318 0 18.00C 37.00% 2/27/15 2:03 316 0 18.00C 37.00% 2/27/15 3:03 311 0 18.00C 37.00% 2/27/15 4:03 309 0 17.00C 37.00% 2/27/15 5:03 306 0 17.00C 37.00% 2/27/15 6:02 303 0 17.00C 37.00% 2/27/15 7:02 300 0 17.00C 37.00% 2/27/15 8:02 297 0 17.00C 37.00% 2/27/15 9:02 294 0 16.00C 38.00% 2/27/15 10:02 292 0 16.00C 38.00% 2/27/15 11:02 290 0 16.00C 38.00% 2/27/15 12:02 286 0 16.00C 38.00% 2/27/15 13:02

Page 15: Measuring Fuel and Soil Moisture with Custom Data Loggers ... · This research focused on developing an economically portable data logger using the Arduino technology to collect fuel

Gina Oliver | Final Report

15

Supporting Information (SI)

Battery Life Expectancy

Battery Capacity in Ampere Hour (Ah) = Wattage(W) x Time(Hours)/Battery Voltage(V)

Arduino UNO current (at 16mhz, 5V)= 46.5mA 50mA (Max) with no external outputs

Power (Watts)=Voltage (V) x Current (mA)

Power= 5V x .050A= 0.250W

With External Outputs

Arduino UNO50mA

Each moisture sensor= 35mA

Temperature and Humidity sensor= 2.5mA

Real Time Clock= <20mA

Battery Ampere Hour Calculations (Battery current data from the Energizer Datasheet)

Estimate Current (W): 50mA + 2 x 35mA +20mA + 2.5mA = 142.5mA = 0.1425A x 5V =

0.7125W

Battery Voltage: 12V (using an 8 battery pack with 1.5V per cell)

Power loss to heat= Input power – Arduino Input regulator

Power loss = 12v – 5v = 7V lost as heat

Constant Power Consumption (112.5mA, high estimate) 2000mAh x 8batteries / 5V

= 3200/1000 = 3.2Ah

Constant Power Consumption (112.5mA, low estimate) 900mAh x 8batteries / 5V

= 1440/1000= 1.44Ah

Constant Power Consumption in parallel (112.5mA, high estimate) 2000mAh x 16batteries /

5V = 6400/1000 = 6.4Ah

Constant Power Consumption in parallel (112.5mA, low estimate) 900mAh x 16batteries / 5V

= 2880/1000= 2.88Ah

Battery Capacity Estimate (7 days, 1000-hr): 0.7125W x 168hours / 5V = 23.94Ah

Battery Capacity Estimate (2-7 days, 100-hr): 0.7125W x 48hours / 5V = 6.84Ah

Battery Capacity Estimate (24 hours, 10-hr): 0.7125W x 24hours / 5V = 3.42Ah

Supply list:

1-Arduino UNO R3 board DIP ATmega328P

2-Arduino compatible High Sensitivity Moisture Sensor

1- Arduino compatible DHT11 Analog Temperature and Humidity Sensor

1- Arduino compatible Real Time Clock (RTC)

1-Stackable SD Card Shield for Arduino

1- SD Card

1-9V Battery Snap Connectors

Page 16: Measuring Fuel and Soil Moisture with Custom Data Loggers ... · This research focused on developing an economically portable data logger using the Arduino technology to collect fuel

Gina Oliver | Final Report

16

1- Enercell Adaptaplug

1- Enercell Replacement Adaptaplug Socket

1-8 “AA” Battery Holder

8- AA Lithium Batteries

1-1x3x30 Wooden Stake

1- Cantex Electrical Box

1- Elbow PVC

1- 2.4 cm (Diameter) x 7 in. (length) Pine Wooden dowel

2- 1 cm Pine Wooden dowels

2- 0.8 cm Pine Wooden dowels

2- 1x3 in. U-Bolts

4-Washers and Nuts

Dupont Wire Jumper Cable 2.54 male-male/female-female

Arduino Code

#include<SPI.h>

#include <SD.h>

#include <DHT11.h>

#include <Wire.h>

#include "LowPower.h"

#include "RTClib.h"

RTC_DS1307 rtc;

//SPI Settings

//MOSI, MISO, SCLK Set by default

int CS_pin = 10;

int pow_pin = 4;

float refresh_rate = 0.0;

int moisture_sensor=2;

int moisture_sensor2=3;

int pin=2;

DHT11 dht11(pin);

void setup()

{

Serial.begin(9600);

Serial.println("Initializing Card");

//CS Pin is an output

pinMode(CS_pin, OUTPUT);

//Card will Draw Power from Pin 4, so set it high

pinMode(pow_pin, OUTPUT);

digitalWrite(pow_pin, HIGH);

//Check if card ready

if(!SD.begin(CS_pin))

{

Page 17: Measuring Fuel and Soil Moisture with Custom Data Loggers ... · This research focused on developing an economically portable data logger using the Arduino technology to collect fuel

Gina Oliver | Final Report

17

Serial.println("Card Failed");

return;

}

Serial.println("Card Ready");

//Read the Configuration information (COMMANDS.txt)

File commandFile = SD.open("COMMAND.txt");

if (commandFile)

{

Serial.println("Reading Command File");

float decade = pow(10, (commandFile.available() - 1));

while (commandFile.available())

{

float temp = (commandFile.read() - '0');

refresh_rate = temp*decade+refresh_rate;

decade = decade/10;

}

Serial.print("Refresh Rate = ");

Serial.print(refresh_rate);

Serial.println("ms");

}

else

{

Serial.println("Counld not read command file.");

while (!Serial) {

; // wait for serial port to connect. Needed for Leonardo only

}

}

Wire.begin();

rtc.begin();

//Check to see if rtc is running

if (! rtc.isrunning()) {

Serial.println("RTC is NOT running!");

}

//Set the date and time

rtc.adjust(DateTime(2014,12,8,20,0,0));

}

void loop()

{

{ // Enter power down state for 8 s with ADC and BOD module disabled

LowPower.powerDown(SLEEP_8S, ADC_OFF, BOD_OFF);

}

// Check moisture

int moisture_val=analogRead(moisture_sensor);

{

Serial.print("moisture:");

Serial.print(moisture_val);

Serial.println();

int moisture_val2=analogRead(moisture_sensor2);

Page 18: Measuring Fuel and Soil Moisture with Custom Data Loggers ... · This research focused on developing an economically portable data logger using the Arduino technology to collect fuel

Gina Oliver | Final Report

18

{

Serial.print("moisture2:");

Serial.print(moisture_val2);

Serial.println();

//Check

int err;

float temp, humi;

if((err=dht11.read(humi, temp))==0)

{

Serial.print("temperature: ");

Serial.print(temp);

Serial.print("C");

Serial.print(" humidity: ");

Serial.print(humi);

Serial.print("%");

Serial.println();

}

else

{

Serial.println();

Serial.print("Error No :");

Serial.print(err);

Serial.println();

}

//Get the date and time

DateTime now = rtc.now();

//Print out the date and time to the serial line

Serial.print(now.year(), DEC);

Serial.print('/');

Serial.print(now.month(), DEC);

Serial.print('/');

Serial.print(now.day(), DEC);

Serial.print(' ');

Serial.print(now.hour(), DEC);

Serial.print(':');

Serial.print(now.minute(), DEC);

Serial.print(':');

Serial.print(now.second(), DEC);

Serial.println();

//Write Log File Header

File dataFile = SD.open("datalog2.csv", FILE_WRITE);

if (dataFile)

{

String header=("Moisture, Moisture2, Temperature, Humidity");

dataFile.print(moisture_val);

dataFile.print(",");

dataFile.print(moisture_val2);

dataFile.print(",");

dataFile.print(temp);

dataFile.print("C");

dataFile.print(",");

dataFile.print(humi);

Page 19: Measuring Fuel and Soil Moisture with Custom Data Loggers ... · This research focused on developing an economically portable data logger using the Arduino technology to collect fuel

Gina Oliver | Final Report

19

dataFile.print("%");

dataFile.print(",");

dataFile.print(now.year(), DEC);

dataFile.print('/');

dataFile.print(now.month(), DEC);

dataFile.print('/');

dataFile.print(now.day(), DEC);

dataFile.print(' ');

dataFile.print(now.hour(), DEC);

dataFile.print(':');

dataFile.print(now.minute(), DEC);

dataFile.print(':');

dataFile.print(now.second(), DEC);

dataFile.println(“,”);

dataFile.close();

}

else

{

Serial.println("Couldn't access file");

}

delay(refresh_rate); //delay for reread

}

}

(Figure 4. Arduino data logger sketch)

(Pictures of the data logger in the SDEF measuring a 100-hr fuel dowel, June 2014)

Page 20: Measuring Fuel and Soil Moisture with Custom Data Loggers ... · This research focused on developing an economically portable data logger using the Arduino technology to collect fuel

Gina Oliver | Final Report

20

(Picture of the Arduino circuit with the SD card shield)