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.
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:
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: