1-Chip 4-Channel PIC16F886 Data Logger
This project has only a few modifications from the “Single Chip, Four Channel Datalogger” article by Dan Gravatt in the 2008 January Issue of Nuts&Volts (page 42), so I won’t go into much detail.
Below is the schematic. The changes from Dan’s datalogger are that I used the PIC16F886, which is pin-compatible with the PIC 16F876. I also used the PIC’s hardware serial I/O channels (pins 17 and 18) and I added an indicator LED that indicates logging in progress and the log interval (pin 22). The switch sets the mode between logging and writing data over the serial port.
The C data logger code is available here as is a hex file with 1 s log interval. I used the CCS compiler. This makes reading and writing program memory very straight forward with commands like write_program_eeprom( prog_mem_adr, value ) and read_program_eeprom(prog_mem_adr). The 16F886 has 8192 total program flash words. The total time of logging is determined by the delay setting at line 64 of main.c. Use a frequency counter at the indicator LED to set the desired logging interval. If you don’t add any lines to the code, you can increase the memory used for logging by setting START_ADR to the lowest open memory address. You can get this information with, e.g., the PICKit2 programming application or whatever your favorite PIC programmer provides.
Here’s the completed logger with a LM35 temperature sensor (suspended in the foreground) and a 7805 regulator (on the back left corner of the board) with a 9V battery attached.