DATA LOGGER APPLICATION DEVELOPMENT USING MICROCONTROLLER ATMEGA 128 FOR A WEB-BASED GPRS COMMUNICATION Devi Munandar 1, Oka Mahendra 1, Djohar Syamsi 1 1 Research Center for Informatics, Indonesian Institute of Sciences Jl. Sangkuriang Komplek LIPI, Gd. 20 Lt. 3 Bandung, Indonesia email: devi@informatika.lipi.go.id 1, oka@informatika.lipi.go.id 1, djohar@informatika.lipi.go.id 1 ABSTRACT This paper discusses about the design and development application on a data logger using microcontroller ATMega 128 connected to the GPRS modem for web-based data transmission, which has a signal conditioning function adjusts the sensor signals from analog to microcontroller, which functioned as media MMC data storage, and RTC DS 1310 as a timer, microcontroller connected to the GPRS modem ITEGNO 3800 with serial RS- 232 system. Data logger sending a string through HTTP protocol to a defined web domain, web domain that is connected using a web server in the governance by using the web interface, data logger is connected by using three sensors: rainfall, temperature, and wind speed, from the other side of the interface application which consist of two parts: the first application of a back -end that takes data from sensors, the second is an application web base interface as front-end interface to display data in an instant, daily, monthly and annually data. In this paper we also discussed to provide a solution to use our results by reducing costs significantly for the price of data communication. Keywords: Data Logger, GPRS, Web Pages, Microcontroller. 1 INTRODUCTION Data logger as a data recorder device initially does not require long-distance communication system, data stored in storage media (memory) then can be used at another time one. This data collection can be done by taking a memory card to be used and read by computer, with the monitoring requirements data logger system, developed data logger equipped with communication system remotely, eg via GSM (SMS and dial-up), satellite, GPRS, or radio waves with specific frequencies and modulations. in several studies, data logger use SMS service to send the packet data from a note station to Master station, otherwise the Master station can also send to the station to request data using sms [2]. for long periods, with short intervals of data transmission, for example one minute or five minutes, use of SMS are in need of considerable cost, to overcome the problem of high cost, in this paper discussed how to use communication systems GPRS between data logger with base station, using this GPRS communication could reduce costs in addition, the speed of data transfer 2 MODEL, DESIGN AND IMPLEMENTATION In this section, we describe the theory, design model hardware and software and implementation of our application. 2.1 Microcontroller Microcontroller can be analogue as a computer system that is packaged in a chip. It can be interpreted as an IC actually being a minimum requirement that the microprocessor can work, which includes microprocessor, ROM, RAM, I / O and clock, as owned by a computer. Given the small packaging of a chip, it ability is smaller than a computer. Although in terms of lower ability, but for certain applications microcontroller become more flexible and practical as well as low power. In applications for automation and control systems with the ability to "stand alone", the use of microcontroller is the best option compared to using a PC Microprocessor (RAM) (ROM) Figure 1..Personal computer architecture (ROM) IV-27
IV- 28 The 6 th International Conference on Information & Communication Technology and Systems (RAM) Single Chip Microprocessor I/O (RAM) very specific devices for measuring in one environment or application type only. It is common for general purpose types to be programmable ; however, many remain as static machines with only a limited number or no changeable parameters. Electronic data loggers have replaced chart recorder in many applications. One of the primary benefits of using data loggers is the ability to automatically collect data on a 24-hour basis. Upon activation, data loggers are typically deployed and left unattended to measure and record information for the duration of the monitoring period. This allows for a comprehensive, accurate picture of the environmental conditions being monitored, such as air temperature and relative humidity[7]. Figure 2. Microcontroller base architecture In this paper we used the AVR microcontroller from ATMEGA 128 family. General specifications of ATMega128 are as follows: Flash memory: 128 Kb EEPROM: 4 Kb SRAM: 4096 bytes Other Features: 16-bit timer, 8-bit timers, PWM, RTC, SPI, UART, TWI, ISP, ADC, analog comparator, an external interrupt. Program code / instructions are stored into flash memory, which is non-volatile memory type that data will not lose even if power supply is turned off. We use ATmega 128 as the CPU on our investigate is also due to the speed capabilities that can achieve 16 MHz, low price, and easy to obtain.. 2.2 Data Logger A data logger (also datalogger or data recorder) is an electronic device that records data over time or in relation to location either with a built in instrument or sensor or via external instruments and sensors. Increasingly, but not entirely, they are based on a digital processor (or computer). They generally are small, battery powered, portable, and equipped with a microprocessor, internal memory for data storage, and sensors. Some data loggers interface with a personal computer and utilize software to activate the data logger and view and analyze the collected data, while others have a local interface device (keypad, LCD) and can be used as a stand-alone device. Data loggers vary between general purpose types for a range of measurement applications to Figure 3. Inside of data logger 2.3 Overall Design Model System On the design of the general model, how to work data logger using GPRS communication. Media communication GPRS is a device that can transmit data from the data logger to a computer located at a different location with an internet media connection, the Internet connection using a system GPRS (General Packet Radio Switch). As a whole can be seen in figure 4. To make this system work, data logger need to connect with GPRS modem, which in this paper we using a modem ITEGNO 3800, with firmware IWOW.
Datalogger Application Development using Microcontroller ATMEGA 128 for a Web-Based GPRS Communication-Devi Munandar IV-29 reading the RTC data, set the digital input and digital output, sending data to the PC or GSM modem (if required), and send data to the GPRS modem, block diagram of data logger as described in the following: Figure 4. Overall design model system GPRS modem subsequently ordered by the microcontroller in the data logger to send a string to access HTTP web domain that has been determined. HTTP string in the delivery system, the argument in the HTTP string accepted by file name sql_write.php, which is in the PHP web server, write the file, this PHP will further dividing the variables of time (date and hour), and the variable that contains the value of each channel, then each channel variable is inserted into the table with SQL database command, so that data can be accessed via the web by opening a web page use the browser as usual. 2.4 Design Model Data logger one of the devices in this application is named data logger hardware, from the side component consists of data logger, designed their own separate section in accordance with the needs of the system we want, while other hardware components, such as computers and modems, using existing products in the market. Electronic circuit design, programmable controllers, including: The CPU using ATMega 128, provides six parallel port, one parallel port for programming the data logger, and two serial port (RS-232). Series RTC (Real Time Clock) using IC DS 1307 Power regulator circuit Combination 5 volt dc Driver for the serial port using IC Max 232 data logger using microcontroller ATMega128 is the main processor, the microcontroller has the function of: accessing data from the signal conditioning through an internal ADC, to write data on storage media or MMC, Figure 5. Configuration of data logger Figure 6. Data logger for weather station 2.5 Design Model Applications Interface Software that must be built into this system can be divided into three parts, the existing software on the data logger microcontroller or it is often called firmware, software running on the PC desktop for data logger settings, and application software available on the web server so that data can be accessed through the web. In this paper we just discussed about firmware programming and applications interface base on web. Microcontroller embedded in the data logger, the program begins with an initialization LCD, RTC, and relays, initiate the GPRS include: checking the condition of the GPRS modem and GPRS connection with the operator, at a later stage the microcontroller will read the ADC of each channel and calculate the value in accordance with measurement, measurement data displayed on the lcd, the RTC data is read and then get the data in the year, month, date, hour, minute and second, RTC
IV- 30 The 6 th International Conference on Information & Communication Technology and Systems data is displayed on the LCD, the subsequent flow of the program will check if the minute has changed, if minutes have not changed the program will do step up to the fulfillment of the turn-minute checks according to the declaration of the parameters, if the minutes have been changed to do the writing on the FRAM and memory card, for GPRS settings if enabled, the program will run a regular GPRS, if the error recovery process will be made to re-form initialization. the delivery of data, the program will perform a trigger to send data via GPRS to a web domain and write data into database via a web server, in addition to the microcontroller program can also perform checks if there is demand for processing incoming SMS and automatically answered based on keywords that have been defined, so does the demand for dial-up from base station to station, the last step the program will stop when ordered to shutdown, if not then the program will re-reading the ADC channel, and so on. clients computer that requested via HTTP or web browser. To receive data from the data logger string that contains the measurement data of each channel, created a file with the name of the sql_write.php, existing algorithms in the figure 8. This file will be separated HTTP string into variables of time (date and hour) and we declared 8 channel in this application. sql_write.php file, has a function to enter data into MySQL database. Figure 8. Flow diagram for write data into Database Figure 7. Flow diagram for programmable microcontroller On applications, web-based interface, applications are placed on a web server built with PHP and MySQL, which is an open source tool, this applications have three main functions: 1) receiving data from the data logger HTTP string that contains the data, and 2) storing into the database system (MySQL), and 3) display the data if there are any Figure 9.Flow diagram for view data from database Moreover the application has a sub menu to display the measurement data processing from sensors, this method is done on a web server application, to meet user demand, provided some parameters as input, such as the following parameters: station id, date, month, year, and that the desired display option such as by time, by hour
Datalogger Application Development using Microcontroller ATMEGA 128 for a Web-Based GPRS Communication-Devi Munandar IV-31 and by day, the third such appearance in the container in such a way as to meet the need to analyze the resulting data. On the summary, the data is displayed daily or monthly or annually, the parameters required is a minimum, maximum, and average measurements figure 11, images shown flashes amid signs that marked the location of the data logger in place. when the cursor is directed to a sign, it will display the current measurement data online. Existing channel contains three sensors will display the last measurement data automatically. Figure 12. Daily table of measurement result Figure 10. Flow diagram for summary measurement data 3 RESULT The result obtained in the implementation phase, the data logger using microcontroller ATMega 128 is online monitoring weather system, data logger is connected by using three sensors: rainfall, temperature, and wind speed, from the other side of the interface application which consist of two parts: the first application of a back -end that takes data from sensors measuring rainfall, temperature and wind speed and written into database via GPRS, the second is an application front-end interface to display data in an instant, daily, monthly and annually data. Figure11. Home page online monitoring for weather The measurement result in arranged periodically during 5-minutes, every five minutes, the data logger retrieve data from these three sensors and sent via GPRS modem to the domain web server, the data showed in figure 13 the visible results of daily measurements with 5-minute intervals, each channel to give a response and send data at the interval. Figure 13. Recapitulation of the monthly data In figure 13 showed that measurement data in the summary to see data on each channel parameters, the recapitulation is the result of calculation: minimum, maximum and average, than showed daily recapitulation, can also display summary data monthly or annually. In this work, we also conducted a comparative cost data from dataloger delivery via SMS, GPRS, and Dial-Up, after the entire datalogger system assembled and operated, and send data from the datalogger to the web server with GPRS communications from mobile operators IM3 Home page display applications, the displayed base map of Bangka-Belitung Islands. In
IV- 32 The 6 th International Conference on Information & Communication Technology and Systems Table.1 Comparative table of data transmission costs datalogger via SMS, GPRS, and Dial-Up No Data type SMS (Rp 150/sms) GPRS (Rp 1,1/kb) Dial-up Rp 2000/minute 1. Continuous data Rp 150 Rp 5.5 Rp 2000 (1 record) 2. Daily data Rp 216.000 Rp Rp 4000 3. Monthly data Rp.6.480.0 00 7.920 Rp. 237.600 Rp 120.000 *) costs of sms, gprs, and dial-up, depending on the operator used **) Record interval data for 1 minute from the table above can be taken conclusion that data communications using GPRS costs were lower than using sms or dial-up 4 CONCLUSION AND DISCUSSION This software facility addition to the data logger that uses microcontroller ATMega 128 can increase the utilization of measurement data and performance data logger. Beside ATmega128 has a low-power CMOS 8-bit microcontroller based on the AVR enhanced RISC architecture, ATMega 128 is also equipped facility that is connected to the GPRS modem, which facilitates delivery of data from the sensor through the channels to GPRS connection, to complete the application interface, the measurement of temperature, rain fall, and wind speed can be stored into database and displayed via a web-based applications, using this application can be viewed daily data, monthly, or annually. Using GPRS as data communications, can be seen that the costs were lower than using SMS or dial-up. For the next development expected to be working on multichannel communication using more than two GPRS modem simultaneously. REFERENCES [1] Andi Gutmans, Stig Bakken, Derick Rethans (2005) PHP 5 Power Programming: Prentice Hall. [2] Douglas M. Considine (1993) P.E., Process/Industrial Instruments and Controls Handbook. McGraw-Hill, Inc. [3] Fred Easy (2004) Networking and Internetworking with Microcontrollers. Elsevier, Inc. [4] R. C. V. Macario (1993) Cellular Radio Principles and Design. McGraw-Hill, Inc. [5] Djohar, Syamsi, & Oka Mahendra (2009) Pemanfaatan Layanan SMS Untuk Pengiriman Data Pengukuran Secara Paket: Proceeding SRITI STIMIK Amikom Yogyakarta, 8 August, 2009, Volume 5, pp 87-92 [6] Madgetech, Inc (2009) What Is A Datalogger [Online]. Available at:, http://www.madgetech.com/pdf_files/app_not es/what_is_a_data_logger.pdf [Accessed: 17 April 2010]. [7] WikiPedia The Free Encyclopedia (2010) Data Logger [Online]. Available at: http://en.wikipedia.org/wiki/data_logger [Accessed: 15 June 2010].