Home‎ > ‎Sergey's Projects‎ > ‎

Analog Data Logger

Introduction

Some measurements require periodic acquisition and logging of an analog data, for example a weather parameters measurement.
My father asked me to build a simple Analog Data Logger for his experiments with water heating devices. It seems that several commercial analog data loggers are available, but they are quite expensive, and often limited by number of inputs or by a length of recording interval.

Hardware

The "heart" of my Analog Data Logger is Microchip PIC16F88 microcontroller. It also uses 1Mbit 24LC1024 SPI flash for data storage, and MAX232 (or compatible) IC for interfacing with RS232.

PIC16F88 provides one 10bit ADC, which can be multiplexed to one of 7 analog inputs. It also includes and internal frequency generator (clock), and logic for RS232 and SPI interfaces. These features, together with low price and great power efficiency make PIC16F88 an ideal choice for this project.

The main difference of 24LC1024 from a generic SPI device, is a possibility to perform byte write operation without erasing data first. It should be possible to use other SPI devices, or probably even and SD or MMC flash card instead, but the device will had to be erased before usage.

MAX232 is used to interface with computer's RS232 (aka serial) port, for programming Analog Data Logger, data downloading, etc. I noticed that it is most power hungry component of the system, so in the second version I made a separate RS232 adapter, which is not connected to a data logger during normal operation. It also makes possible to connect Analog Data Logger directly to CMOS-level I/O, for example to one of the serial ports found in Linksys WRT54GL routers (with a little software tweaking this will allow to control Analog Data Logger remotely).

Because of PIC16F88 implementation (probably designers' desire to save some I/O pins) it's not possible to work with SPI and RS232 simultaneously, so the Analog Data Logger switches between these modes when needed, e.g. when downloading the data, using a method described here.

A photo prototype version, with some thermoresistors connected to it:


Firmware

The firmware is written completely in PIC assembly language. I tried to experiment with C, using SDCC compiler, but it had some apparent problems, especially then program size crossed 4K page boundary.

Following functions are supported in the firmware:
  • Timekeeping
  • Configuration - data acquisition interval, usage of reference voltage
  • Print ADC readings - performs ADC and prints output for all 7 analog inputs once
  • Poll ADC -  continuously reads ADC and outputs obtained values
  • Start / stop logging commands, also can be controlled by a hardware switch
  • Dump the content of SPI - Prints the log in user readable, comma separated, format
  • Download the content of SPI - Downloads the log to the computer, using XMODEM protocol
  • Erase SPI - completely delete data from SPI device
Normally, when starting logging process, the Analog Data Logger writes a log in the first unused space on SPI device. A header is written first, which allows to distinguish new log from the previous one. When the end of device is reached, the write process is continued from the beginning of the device (something like cycle buffering).

ċ
Project.pdf
(76k)
Sergey Kiselev,
Jul 27, 2010, 8:54 PM
ċ
analog-2.1.tar.gz
(129k)
Sergey Kiselev,
Sep 5, 2008, 12:24 AM
ą
Sergey Kiselev,
Mar 12, 2009, 6:34 AM
ċ
analog_data_logger.sch
(134k)
Sergey Kiselev,
Sep 5, 2008, 12:25 AM
ċ
analog_data_logger_v1.sch
(137k)
Sergey Kiselev,
Sep 5, 2008, 12:25 AM
ċ
analog_data_logger_v2.sch
(137k)
Sergey Kiselev,
Sep 5, 2008, 12:25 AM
ċ
analog_data_logger_v3.sch
(138k)
Sergey Kiselev,
Mar 12, 2009, 6:33 AM
ą
Sergey Kiselev,
Mar 12, 2009, 6:34 AM
Comments