PIC Data Logging
I am increasingly using PIC micros for logging data. There are a few obvious approaches for doing this which I discuss below. I usually require portable solutions so I focus on these. PLEASE NOTE: THIS INFORMATION IS PROVIDED WITHOUT WARRANTY AND FOR PERSONAL NON-COMMERCIAL USE ONLY.
Data Memory (EEPROM)
Program Memory (ROM)
External memory chips
SD or MMC cards
(Serial interface to PC)
PIC and C for Beginners (different page)
PIC PROJECTS (different page)
EEPROM - DATA MEMORY
256 bytes: Many PICs have 'flash' memory (the same technology as USB memory sticks and camera/phone cards). Being self-contained it is the easiest to implement. They are a little fiddly to extract and harder to convert/interpret on a PC. The most you will get in the 'mid-range' series is 256 bytes. Although tiny in comparison with PC memory, it is amazing how much can be staored in just 256 records. The 12F683 is the smallest device (8 pins) and there are many larger 16F's. I have some examples on my Pic Projects page.
1024 bytes (1kb): The 18F's go to 1024 bytes but only in 28 pin (eg: 18F2525/2620) or larger.
ROM - PROGRAM MEMORY
4-8kb: PICs have much larger PROGRAM memory (ROM) than DATA memory (EEPROM). It can sometimes be a little trickier to store data in program memory but is otherwise very similar to EEPROM. Only PICs with 'enhanced flash' or 'self-write' are likely to provide this capability. Although 'only' rated at 100,000 writes per address (vs 1,000,000 for EEPROM) this is the same as SD cards so should not normally be a problem. If you want an internal oscillator and ADC channels then the 16F88 has the smallest pin count (18) and largest memory (4096 words). The 16F886 is larger (28 pin), has double the memory (8k) and is easier to write to than the 16F88. Each 'word' is 14 bits stored in 6 and 8 bit registers. So depending on your program size you can probably store 10 times what the other mid-range devices can hold in EEPROM.
~96kb: Again the 18F series offers much more storage space than the 16F's but only in the larger pin sizes. 96kb is about the largest available in their smallest pin size (28). The program memory on the 18F's is 16 bit so is more useable than the 14 bit 16F's.
1mb: External flash-based memory chips have probably been the traditional way of increasing on-board memory. However, they need interface code so are much more complex. Reading them is an extra challenge.
SD and MMC Cards
16mb-8gb+ SD and MMC cards are intended for use in cameras, phones, PDAs etc. They form a convenient medium for storing much more data and are the easiest to read on a PC (eg: files can be csv's or text based). However, they are by far the hardest to implement. The cards allow the use of a protocol (SPI) supported in PICs with just 3 or 4 pins. I have started with the 'micro SD' card as SD's are more common than MMC and this one is the smallest available. I'm currently only using SanDisk cards because they originated the format and provide detailed specifications.
SERIAL COMMS TO PC
Traditional approach to capturing large amounts of data. Data is transferred in real time via a serial port to a PC. Not portable so of less interest to me. However, it is a popular and effective mechanism so worth mentioning.
Top of page
Click on the links below for other pages.
Art of the Possible ¦
Absence of Matter ¦