Implementation of Low Cost Data Logger Using Flash Disk with File Allocation Table

Panupong Thanutong1, Dusit Thanapatay2, Kamol Kaemarungsi3 and Tsuyoshi Isshiki4

1TAIST Tokyo Tech, ICTES Program, Dept. of Electrical Engineering, Kasetsart University, Jatujak, Bangkok 10900, Thailand 2Dept. of Electrical Engineering, Kasetsart University, Jatujak, Bangkok 10900, Thailand 3Embedded System Technology Laboratory, National Electronics and Computer Technology Center, Pathumthani 12120, Thailand 4 Dept. of Communications & Integrated Systems, Tokyo Institute of Technology, S3-66, 2-12-1, Ookayama, Meguro-ku, Tokyo 152-8550, JAPAN

computer for further analysis using software analyzing tools. Abstract— Data logger is a device used for storing Data loggers can be applied in various fields such as in [1] measurement data. It can be used in wide range of embedded where data logger is used to observe city’s air environment or in logging applications. This paper reports on practical development [2] where it is used for collecting galvanic skin response (GSR). experience and design’s details of a low cost data logger prototype. In this paper, we developed a prototype of low cost data The data logger in this paper is also compared with two of existing data loggers in the literature. This data logger combines 32-bits logger as a part of our planned research project in a microcontroller and flash disk with file allocation system (FAT) hydrological system application for monitoring rivers. The data together with programming technique to control the hardware for logger will be connected to a hydrological sensing system recording and monitoring of general proposes measurements. which consists of a set of wireless sensor nodes and several This data logger stores the data on removable flash disk for hydrological sensors. However, to test our prototype in this convenient and can forward real time measurement data through paper we decided to use basic sensor device which can be RS232 standard serial port to be display on LCD. The applications studied in this paper are based on logging of obtained easily such as temperature and humidity sensors. temperature and relative humidity from a SHT15 digital sensor. These sensor devices are low cost and simple to integrate to our The data are stored in form of comma-separated values file (CSV) data logger prototype. For example, SHT15 is an integrated because this file format can be read and understood by many temperature and relative humidity sensors in one package [9] platform applications such as MySQL, MS-Excel, and MATLAB. which is very convenient. We designed our prototype of data The microcontroller in this prototype provides power down mode logger based on [3] with different structure for both hardware function that can save energy during long waiting operation and its storage memory can record measurement data for several and software. years.

Keyword: data logger, , temperature and Relative humidity sensing, FAT system.

I. INTRODUCTION owadays, the applications of embedded and ubiquitous N sensing systems are increasingly popular. Examples of embedded sensing application are in the area of monitoring systems such as meteorology, hydrological, mining and food industries. A data logger is an embedded electronic device that can be a part of those monitoring systems. The main functionality of data logger is to record data from sensing system over time. Generally, a data logger can obtain data from Fig 1. System architecture of the data logger measurements in several ways such as through attached Fig. 1 illustrates the system architecture of the data logger in analog-to-digital converter (ADC) or sensory data sent via this paper. At the center, the microcontroller is the heart of the various communication protocols and serial communication data logger where we use STM32 ARM Cortex M3 which is a port (USART). The data maintained in the data logger collected low cost 32-bit microcontroller with a lot of built-in from monitoring system can be transferred to personal functionalities. Our data logger consists of major component such as a RS232 serial interface for communication with personal computer, a SHT15 temperature and relative humidity

sensor for measuring environment, a 16-character by 2-line [9]. Finally, this data logger prototype can also take inputs from liquid crystal display (LCD) to display data output, Micro SD other measurements through additional ADC ports on the card for a storage memory, and other analog input/output (I/O). MCU. The ARM Cortex M3 provides three channel of 10-bit The organization of this paper is as follows. First, Section II ADC for connecting with other sensors such as CO2 sensor as in describes the hardware design and each major component. [1]. Note that the data logger circuit can measure voltage Next, Section III describes our embedded software design for between 0 and 3.3V at ADC channel 1. the data logger. Next, Section IV reports on preliminary C. Storage Memory measurement results and compares our data logger with others. Finally, Section V concludes our work and briefly mention Traditionally, the storage memory for most data loggers was about our future works. based on electrically erasable programmable read-only memory (EEPROM) or small general purpose random access memory II. HARDWARE DESIGN (RAM) [6]. These devices were easy to use and require lower write cycle. However, today in form of MicroSD A. Microcontroller Unit (MCU) card is getting cheaper with larger capacity. Thus, MicroSD The selected microcontroller unit for the data logger system cards are gaining popularity in modern embedded system. The is an STM32F103 ARM Cortex M3 [15]. This microcontroller MicroSD cards used in this prototype are very small with (MCU) provides a good price per performance when compared dimension of 15mm x 11mm x 0.7 mm and weight only 0.0.4g to others well known microcontrollers such as MSP430 [5], [1]. The capacity of MicroSD used in this work is 2 GBytes AVR32 [6], and PIC16 [7]. The price of this MCU is very since it is the maximum physical limitation for FAT16 [1]. The attractive among those popular MCUs. With 32-bit main advantage for using MicroSD card as data storage system architecture, it provides better computational power at similar is the ease of transferring data directly to other electronic or lower price point than some 16-bit architecture. The major devices such as laptops or smart phones which support FAT advantage of ARM Cortex M3 lies in its Thumb-2 instruction format as file system. User can reduce the time to transfer and set which allows this MCU to have 32-bit performance with convert the data from traditional EEPROM to other data 16-bit code density [8]. Moreover, it can run at 1.25 DMIPS analysis systems. (Dhrystone Million Instructions per Second)/MHz. The MCU D. Circuit Diagram is faster up to 35% and up to 45% less code than ARM7TDMI [8]. It is fully equipped with a number of peripheral interfaces Our data logger prototype is developed on existing such as I2C, SPI, USART, analog-to-digital converter (ADC) development board called ET-STM32F103 from ETT and digital-to-analog converter (DAC). Another reason for Company [11]. Fig. 2 depicts a circuit diagram of our prototype choosing this MCU is that its manufacturer provides free which is based on schematic from [11] that were attached with license of standard firmware libraries to be used in SHT15 from [9] and an LCD. Note that the peripherals around development of complex applications. the MCU are similar to the architecture in Fig. 1 which consists of RS232 interface, LCD, SHT15 sensor, and SDMCC socket B. Measurement Module for SD card. We chose this board because we needed a stable For our evaluation purpose, we initially use only one sensor hardware platform for programming and performing for our test. A sensor device called SHT15 is attached directly experiment. We plan to develop our own print circuit board to the microcontroller ARM Cortex M3. SHT15, which is a (PCB) once the prototype and its peripherals have been well known sensor device, is applied in measurement module verified. where it provides sensory data to our data logger. This sensor device has analog-to-digital conversion over linear temperature and relative humidity and it has built-in on chip ADC circuit [9]. Thus, we do not require separate ADC before attach the sensor device to MCU. This simplifies the testing of our prototype. Note that with the structure of this SHT15 sensor chip is different from the one used in [3] where they used pure analog sensors. Additional advantages of this sensor device are that it can reduce the component count and the hardware complexity. Another advantage of SHT15 is that it has fast response time and uses CMOSens technology to guarantee reliability and stability [9]. The size of this device is also small with a dimension of 7.47 x 4.93 x 2.5 mm. Its weight is only 100 mg. The sensor also requires low power consumption with average current consumption of 28µA and can be used with single power supply between 2.4V and 5.5V [9]. The SHT15 has operating range for temperature between -40 to 123.8 Fig 2.Simplified circuit diagram of the system

Celsius and range for relative humidity between 0 to 100%RH

III. SOFTWARE DESIGN B. Programming Language A. Flowchart Diagram of the Data Logger The software was developed using C language, cross-compiled, and loaded into the MCU. We used IAR The flowchart of embedded software that controls our data Embedded Work Bench for ARM as a complier tool [12]. logger is showed in Fig. 3. In this section, we briefly explain the operation of our data logger. C. FAT File System In the first step, user needs to configure parameters for To implement the FAT File System into the propose data sensory data recording via USART. The parameters include logger, we applied the Embedded File Systems Library (EFSL) time, date, sampling rate of data, and recording periods. Next, which is an open source software in our embedded software. the MCU checks status of memory whether the memory is full EFSL is a generic FAT file system library for embedded or not connected. If there is no problem on the status of the systems device [13]. It currently supports Microsoft FAT file memory, the MCU can continue to the next step. However, if system family for FAT12, FAT16 and FAT32. The source code there is a problem, the data logger will display error notification to its user on the LCD and will continue without saving data to of EFSL is based on pure ANSI C which can be adapted to any the storage memory. Next, the MCU is put in standby mode and C language compiler. However, the EFSL requires an waits for measuring next data from sensor. The waiting period allocation of large memory block for fetching and writing a depends on predefined sampling rate. During the wait period, 512-byte sector [13]. the MCU is put into power down mode to save its energy D. Data Storage File and Record consumption. The MCU will be woken up to take the next The format of data logged on the MicroSD flash card is in measurement based on the interrupt from the built-in real time clock (RTC) of the MCU. After obtaining data from sensor, the CSV file format. The design goal for our data logger is to store MCU will put the sensing data into a buffer space. Next, it the logged data in format that is portable or convenient for checks for the type of data whether it is a temperature or reading by most software analysis tool. The CSV file type is relative humidity data. Before storing the data to its compatible with Microsoft Excel and widely accepted for corresponding sensor files using FAT16, the MCU attaches a transferring data between computers or software using different timestamp to each data. Finally, the MCU rechecks the storage data format. The CSV file can be used on all computer memory for its status before goes back to wait for the next platforms and allows to be converted into many file types measurement and changes its status to power down mode again. including spread sheet files such as XLS, HTML, XML, and DBF. The CSV file is a simple file data format and requires less memory storage space than using the Extensive Markup Language (XML) file. Although the XML is very portable for external data representation and exchange, it requires very large size of storage space due to its markup tags [14]. The XML was initially planned for use in our data logger but the size of its data storage requirement was not suitable for embedded systems. The CSV is convenient because user can convert CSV file into other desired file format after transferring the file from MicroSD to personal computer. CSV file is a plain text file which is usually used to store spreadsheet or database information in a simple format. Although the CSV format is portable, it requires larger storage space than binary format. For example, each record of sensor sample, the binary format will require 8 bytes which consists of two bytes for measurement data, three bytes for time (hour, minute, and second) and three bytes for data (day, month, and year). On the other hand, the CSV format would require approximately 29 bytes per record and additional 183 bytes for file builder. However, we argue that the constraint of storage space is less for our system when we utilize the MicroSD card. For each sensory data, the data logger records each sample into a single line and separates each field with a comma [15]. In our prototype, each sampling record of sensory data consists of three fields: data, time, and sensor value. Note that the sensor

Fig 3.Flow chart diagram of the system value can be either temperature or relative humidity. Each record from the sampling of sensor consumes approximately

212 bytes of memory on the MicroSD. Examples of records in

CSV format of temperature file and relative humidity file are During the testing of data logger, the MCU will send the showed in Fig. 4. reading data to display both via ICL3232 pin to a serial port and LCD. Temperature file The graphs in Fig. 5 and Fig. 6 plot the measurement results Date,Time,Temperature of temperature and relative humidity, respectively. Both results 07/11/2009,00:00:01,28.73 were recorded on two separate files on MicroSD using FAT16. 07/11/2009,00:01:01,28.70 The temperature recording is varied around 28.6C˚ in Fig. 6 … while the relative humidity is fluctuated around 61% in Fig. 7. Relative humidity file Note that dramatically dropping in temperature to 28.38C˚ at 0:39:01 showed in Fig. 5 was caused by the change when we Date,Time,Relative humidity turned on the air condition. However, the relative humidity is 07/11/2009,00:00:01,61.00 rapidly increased to 61.22% after that time. 07/11/2009,00:01:01,61.00

Fig4. Sample CSV data logs file content

IV. MEASUREMENT RESULTS AND DISCUSSION

In this section we demonstrate preliminary results of sensor recording using our data logger. We also discuss the capacity of our data logger based on the architecture described in Section II. Specifications of our data logger are compared to existing data loggers found in literature. A. Data Acquisition Operations

After the MCU sent a request for data to SHT15 sensor, the sensor will measure the sensory data and signal a completion of measurement by transmitting four bits of low signal as shown Fig 6. Temperature results from recording in Figure 5 to the MCU. The actual measured data is transmitted next as 12 bits of data to MCU. The MCU will receive one bit at a time and continue to receive the rest of data until the whole 16-bit is collected. The 16-bit data will be calibrated and stored in float variable. Before saving the data into MicroSD card, the system will convert the float variable to

ASCII string format and use this variable to write data into file and display it on LCD screen.

Fig 7. Relative humidity results from recording

Fig 5. Data Stream from sensor C. Estimating of Capacity and Spanning Time Since the spanning time of records depends on the sampling B. Testing of Sensor Recording rate selected by the user, in this subsection we estimate the spanning time of the data logger with 2GBytes of memory. To test the main functionality of our data logger, we collected Table I shows the estimation of storage size per hours in the environmental temperature and relative humidity using the second column according to the sampling rate in the first hardware described in Section II. The data logger was set to column. In the last column, we calculated the spanning time of record both sensory data every minute for a total of one hour. total number of records that can be fitted into 2GBytes We began our measurement at the room temperature and later MicroSD card. This estimation is applicable for both we turned on an air conditioner to change the room temperature and relative humidity data. temperature. Initially, the data logger required the user to configure operating parameters which are date, time, recording duration and sampling rate through RS232 serial port. The date and time values are also needed when the RTC was reset.

Equation 1 expresses the average current consumption of TABLE I MCU over one hour. Using the values listed above in the RECORDING TEMPERATURE AND R.H. SPANNING TIME USING 2 GB OF MEMORY equation, we can calculate current consumption Iavg by: Sampling rate Storage size per Spanning time (1) resolution 1 hour (approximately) 1s 178,174 bytes 1.2 years The calculation of power consumption (in Watt) and energy (in 10s 17,866 bytes 12 years Joules) of the system are expresses in the Equation 2 and 3. 1min 3,022 bytes 75 years P = Iavg x Vdd (2) 10 min 870 bytes 262 years E = P x Ttotal (3) 1 hour 578 bytes 3,900 years D. Power Consumption where P is the power in Watts and E is energy in joules. Therefore, the average current consumption of MCU operation In this subsection, we estimate the power consumption of data with power down mode per unit of time (1 hour) is 21.6µA. logger which is based on various current consumptions at Thus, the total power consumption is 71.28 µW and energy different states of microcontroller STM32F103 [8]. Note that consumption is 0.26 J. we begin our analysis with the current consumption of the MCU first and then list the current consumptions of other TABLE II peripherals in this analysis. We assume that the data logger is SUMMARIZE OF POWER CONSUMPTION OF THE SYSTEM WITHOUT set to one-minute sampling rate to demonstrate an example of POWER DOWN MODE power calculation. To reduce the power consumption, the MCU Energy in will be put into sleep state or power down mode when it waits Current @ Power Module 1 hour for the next sampling time. When the MCU woke up to take a 3.3V (mA) (Watts) sample from the sensor, the MCU will be in active state that (Joules) 27 mA (without consumes higher current or more energy. When the MCU Arm Cortex M3 power down 89.1 mW 320.7 J finished reading the data, it will be put into power down state MCU which consumes less energy. A current timing diagram of mode) MCU is showed in Fig. 8. For test duration of 1 hour, we can SHT15 Sensor 0.55 mA 1.8 mW 6.4 J then estimate the energy consumption as follows MicroSD Card 20 mA 66 mW 237.6 J LCD 16 x 2 3 mA 9.9 mW 35.6 J Total 50.55 mA 166.8 mW 600.3 J

Power consumption of the system without power down mode consumes total current of 50.55 mA. Thus, from Equation 2 and 3, the total power (in Watts) of the system at 3.3V operation is 166.8 mW and the total energy consumption in 1 hour is 600.3 J as shown in Table II. From calculation above, we can compare energy consumption of MCU using power down mode with MCU running without Fig 8. Power down current timing diagram power down mode. This can save MCU’s power consumption approximately up to 89 mW. Note that the difference in MCU The STM32F103 microcontroller operates at Vdd = 3.3V. power consumption is 89.1 mW -71.28 µW = 89.028 mW. Based on the current timing diagram in Fig. 7 and from the Therefore, the total power consumption of the system with datasheet of STM32F103 in [8], we can list the current power down mode in 1 hour is 166.8mW – 89.028 = 77.8 mW consumption at different states and durations of each state as or in total energy is 280 J. following: To enable power down mode in the MCU, we used STOP

• Ipowerdown = 14µA, mode of the ARM CortexM3 STM32 which is the second level of power down functions. Based on the CortexM3 STM32’s • Iactive = 27mA, user manual [4], execution of WFI or WFE instruction will put • Tpowerdwon = 3599 sec, • T = 1 sec, the MCU into the STOP mode. During this mode, the MCU active will be halt and oscillators will be switched off. The FLASH • T l = 3600 sec, tota memory, SRAM and peripherals are still powered. The state of where I is the current that MCU operates in power down powerdown STM32 is preserved. Similar to SLEEP mode of the MCU, the mode when it is waiting for sampling data from sensor, I is active STOP mode can be changed to other operating mode by an the current that MCU operates in active mode when it is interrupt generated from STM32 peripheral. In other words, the recording data from sensor to MicroSD, T is the powerdwon STOP mode halts all peripheral clocks but it can still accept duration of time that MCU is in power down mode, T is active external interrupts from peripherals. duration of time that MCU is in active mode, and T is the total The data logger prototype showed in Fig. 9 can work without total time that MCU run in this experiment. any problems with the sensory data from SHT15 sensor. The accuracy of sampling rate depends on the accuracy of the RTC

which is built in the MCU. To maintain time and clock, the computer because our data logger uses the CSV file format. RTC is in the backup (BKP) domain which is still powered by With any software applications that support CSV file, the data VBAT when VDD is switched off. Therefore, the RTC can be read and analyzed easily. configuration will not be lost if a battery is connected to the TABLE III VBAT pin. A key value is written in backup data register 1 COMPARISON WITH OTHER DATA LOGGERS (BKP_DR1) to indicate whether the RTC is already configured. (A) Data logger products If user turns off the VBAT, RTC will be reset and require Company Veriteq Moghavvemi Our purpose setting of a new time manually through a HyperTerminal. name [3] device Product name Spectrum Data 2000 - 2000 Type Digital Digital Digital Temperature -40 to 70 0 to 85 -40 to 123.8 Range (C˚) Temperature ± 0.25 C˚ ± 1.0 C˚ ± 0.3 C˚ Accuracy R.H. Range 0 to 95 10 - 90 0 to 100 (%) R.H. ± 2% ± 3% ± 2% Accuracy (B) Data logging

Memory Type EEPROM RAM MicroSD

Memory 32 K 64K 2 GB capacity

Fig 9. The data logger prototype Minimum sampling 10 sec 1 sec 1 sec period E. Comparison with Existing Data Loggers Maximum After the preliminary testing of our data logger in previous sampling 24 hour 1 hour 1 hour subsection, we compare our data logger with a commercial period model and a data logger in reference [3]. The commercial data User-selectable Yes Yes Yes logger is called Spectrum 2000 from a company named Veriteq sampling rate [22], while another data logger is based on a research paper in Power down No No Yes [3] called Data 2000. The comparisons in Table III are divided mode into four groups: the sensor part, the data logging capability (C) Recording span with selected sampling rate part, the total record length part, and the price part. 1 Second No 18.2 hours 1.2 year Generally, our data logger and the sensor functionality are 10 Second 30 hours 91 hours 12 years comparable to both existing data loggers as showed in Table III 1 min 7.4 days 22.7 days 75 years (a). With the SHT15, our temperature sensing’s range is wider 1 hour 1.2 years 7.5 years 3900 years than the other two with slightly worse accuracy than the (D) Price (USD) Spectrum 2000. Our relative humidity denoted by R.H. also has a wider range with equivalent accuracy to the Spectrum 2000. Hardware 400 USD 100 USD 70 USD For data logging specification, our prototype provides largest Software 100 USD Free Free storage memory of 2GBytes with smallest sampling rate of 1 Total 500 USD 100 USD 70 USD second as showed in Table III (b). However, the maximum sampling rate based on the current software is limited to 1 hour. V. CONCLUSION AND FUTURE WORKS We could extend this in the future work. Note that our data This paper presented details of construction and design of logger also has power down mode which could save the energy low cost flash disk based data logger. This general purpose data consumption of data logger. This function is very important if logger integrated with temperature and relative humidity sensor we operate our data logger using battery only. called SHT15 that can be used in any sensing, monitoring or Based on the large size of memory space, our data logger measurement systems. The total cost of data logger including could provide an extended period of sensor recording as the SHT15 sensor is approximately lower than 100 USD. showed in Table III (c). All data loggers can provide multiple This general purpose data logger still has a number of ports selectable sampling rates. This is under an assumption that we available for recording other data through USART and ADC collect only temperature and humidity data. Finally, the channels on the MCU. Users may apply these free ports to hardware price of our data logger is cheapest at 70 USD as connect with other sensors for data logging in the following showed in Table III (d). The software price is also free too. Finally, an important feature of our data logger, which was applications: not showed in the comparison table, is its ability to • For weather application, connecting the data logger to conveniently port data recorded in the MicroSD to any personal other sensors which use to observe measurements of wind

speed, light intensity and rain fall. REFERENCES • Other agriculture, transportation and biomedical [1] C. Coopmans, Ch. YangQuan, “A General-Purpose Low-Cost Compact applications Spatial-Temporal Data Logger and Its applications”, 2008, IEEE The future plans of this work are to improve the AUTOTESCON, pp. 64-68. [2] L. Rajesh, X. G. Robert, “Design and Realization of a Portable Data functionalities of the data logger such as implementing Logger for Physiological Sensing”, IEEE Transaction on Instrumentation database functionality and adding a built-in web server. To and Measurement. Volume 52 Issue 4, 2003, pp. 1289-1295. enhance the accuracy and setting of the RTC to standard local [3] M. Moghavvemi, M.O. Faruque, E. Ngkoon, Ch.Y. Soo, “A Simple Low Cost Data Acquisition System for Remote Sensing of Relative Humidity time, we need to develop a time synchronization mechanism in and Temperature”, Proceedings of the 44th IEEE, 2001, pp. 202-206. software to calibrate the RTC. One method is to implement [4] “Cortex M3 Technical Reference Manual”, Available: network time protocol (NTP) to allow this node to synchronize http://infocenter.arm.com/help/topic/com.arm.doc.ddi0337e/DDI0337E_ cortex_m3_r1p1_trm.pdf. with a time server [21]. Moreover, we are planning to add [5] MSP430 Mixed Signal Microcontrollers Data Sheet, Texas Instrument, smart functionality to warn status of environment in our Available: www.ti.com hydrological monitoring system for rivers. A global positioning [6] “AVR32 AVR32 AP Technical Reference Manual”, Available www.atmel.com system (GPS) receiver is also needed in our project to provide [7] “PIC16F72 Data Sheet”, Available: www.microchip.com location information for the sensory data. Finally, an internet [8] Hitex. (Feb, 2008). Title The Insider's Guide to the STM32 ARM-based connection is also necessary for our data logger to forward the Microcontroller Available: www.hitex.com [9] “Datasheet SHT1x Humidity and Temperature Sensor”, Available: log data to a base station. This can be implement using wireless www.sensirion.com. wide area network such as general packet radio service (GPRS) [10] R. Robert Dedrick, John D. Halfman, and D. Brooks McKinney."An which operates on global system for mobile communication Inexpensive, Microprocessor-Based, Data Logging System". Technical (GSM) network or wireless local area network such as WiFi. report, Hobart and William Smith Colleges, November 1999. [11] "User's Manual of Board Microcontroller version ET-STM32F103 (ARM Our data logger is a part of hydrological monitoring system Cortex-M3)", Available: www.etteam.com which is illustrated in Fig. 10. [12] "User and reference guides for IAR Embedded Workbench ARM tools", Available: http://www.iar.com/website1/1.0.1.0/78/1/ [13] “Embedded File Systems Library”, Available: http://efsl.be/ [14] E. Dumbill. (2004, December, 15). The Cost of XML. Available:http://www.xml.com/pub/a/2004/12/15/deviant.html [15] Kasper B. Graversen, 2006-2009 "An EBNF definition of the CSV format with explanation" Available: http://supercsv.sourceforge.net/csvSpecification.html [16] V.K. Sehgal, Nitin, D.S. Chauhan, R. Sharma,” Smart Wireless Using IEEE 802.15.4/ZigBee Protocol”, IEEE Region 10 Conference TENCON 2008, pp 1-6. [17] M. Moghavvemi, E. Ngkoon, Ch.Y Soo, “Remote Sensing of Relative Humidity”, Digital Object Identifier TENCON, 2000, pp. 96-101. [18] H. Erdem, Design and Implementation of Data Logger for Fuzzy Logic Controller, IEEE ICIT ’02 International Conference on Industrial Technology. Volume 1, 2002, pp. 199-204. [19] R. Mukaro, X.F. Carelse, “A Microcontroller-Based Data Acquisition System for Solar Radiation and Environmental Monitoring”. IEEE Transactions on Instrumentation and Measurement. Volume 48, Issue 6, 1999, pp.1232-1238. [20] B. Newberry, J.M. Conrad, “Data Logging Solution for Digital Signal Processors”, IEEE Proceedings SoutheneastCon, 2007, pp. 247-252. [21] "NIST Internet Time Service clock" Available: tf.nist.gov/tf-cgi/servers.cgi [22] "Veriteq 2000 Series data sheet", Available: www.veriteq.com

Fig 10. Hydrological monitoring system

Acknowledgment This research is financially supported by Thailand Advanced Institute of Science and Technology-Tokyo Institute of Technology (TAIST-Tokyo Tech), Nation Science and Technology Development Agency (NSTDA), Tokyo Institute of Technology (Tokyo Tech), Kasetsart University (KU) and the National Research Council of Thailand (NRCT). Moreover, the authors would like to thank the partners in the electronic laboratory at KU, ICTES students and staffs in the embedded system technology laboratory at NECTEC.