How to choose a PIC, specific Project in mind... - Page 1
Forum section: electronics / general

author: kolbep
author_rank: Frequent Contributor
timestamp: June 03, 2014, 07:55:33 pm
content: Hi All,I am just looking for your help (and suggestions)I want to build a 'Universal Logger'.Basically a PIC Micro, that can log to a text file on a FAT formatted SD Card.A USB interface on the pic would be nice to connect to the PC for configuration, etc, but I could always use the UART, or a FTDI usb to UART conversion.Also, Preferrably built in RTC, although might go for external one if it works out cheaper.Low Power for battery use would be good.Once I have the basics down, then I can tailor the program depending on what I want to Log, etcHave a few 1 Wire Temperature Sensors logged at 5 minute intervals.orHave it log all the pin states for a Port, and if any pins change state, timestamp and record the new value.orLog Current / Voltage / Power at certain times, etc.As I say, once I have the basics down, then all i have to do is make up 'shields' and change the coding (or add functions that can be selected via a sort of menu, etc).The main problem that I am having is figuring out what PIC I need.For Development, I need to have a Through Hole DIP for breadboarding, but later may want to do a SMT board.I prefer to use C18 with some libraries (eg ADC Lib, XLCD, etc)I have checked the Microchip MDDFS (Memory Disk Drive File System) Library specs for memory requirements, and it has the following for the C18'sCode:PROGDATAR/O 252031886Write Enabled173660Format Enabled 73940Total Bytes 499631886Kbytes502So If I am doing this right, for Read Only + Writing + Formatting, I will need 50KB Programming Memory, and 2 KB Data Memory.Then I will need the space for the other LIBS and my own coding.Oh, and it will also need to be compatible with a Pickit 2, 'cos that is the only programmer that I can afford at the moment..Anybody have suggestions on which pic to use. I have tried their parametric search, but the vast amount of options makes my head spin, and makes it hard to choose.Much, Much Appreciated for all your suggestions and input.P

author: mariush
author_rank: Super Contributor
timestamp: June 03, 2014, 09:23:39 pm
content: That library is huge.You can use* FatFS :http://elm-chan.org/fsw/ff/00index_e.htmlor* PetiteFS :http://elm-chan.org/fsw/ff/00index_p.htmlPetiteFS is optimized for 8bit microcontrollers and is much lighter (2-4KB program, 44 bytes ram + stack) but it has some limitations you may not care about ( Single volume and Single file , File write function with some restrictions).You can talk to SD cards using SPI, probably all pic chips have it. So this isn't an issue, you don't need to look for something special.Lots of documentation about SD Cards, SPI, FatFS here:http://blog.silabs.com/2013/02/07/how-to-interface-an-sd-card-with-fat-file-system-using-spi/http://www.engineersgarage.com/embedded/avr-microcontroller-projects/sd-card-interfacing-projecthttp://www.dharmanitech.com/2009/01/sd-card-interfacing-with-atmega8-fat32.htmlUSB ... it's probably more expensive but I would personally go with external USB to serial chip, instead of using a PIC with built in USB. The built in USB requires space for the code needed to run it, you're limited to certain oscillators, it makes everything less flexible for you.You may also be unable to flash some of these newer PICs with the Pickit 2.Leave the usb separate, use a usb to uart, that means your PIC will only need to have one UART and one SPI available at same time (or just uart, you could bit bang spi but why...). This will also allow you to leave the usb chip running all time while your pic can switch frequencies, go to sleep between measurements, and you don't have to worry about the usb part, that's taken care of the separate chip.Few PIC mcus have rtc inside and the oscillators aren't accurate enough to not have some drift in time.. they're about +/- 3%I would look at something like PIC16F1516 or PIC16F1519 (or one in between):16F1516 :http://www.digikey.com/product-detail/en/PIC16F1516-I%2FSP/PIC16F1516-I%2FSP-ND/265136416F1519 :http://www.digikey.com/product-detail/en/PIC16F1519-I%2FP/PIC16F1519-I%2FP-ND/2651374They have 512 bytes of ram, lots of flash memory (7 or 16 k x 14bit ) so you have plenty of room for fat library + menus + whatever you want, and lots of pins for sensors or whatever you want to put on it.I've used the 16f1519 in a project recently and it was a pleasure to work with it, not having to care about how much flash memory my code is going to use.The 1516 is about 1.5$ if you buy 10.. Cheapest with usb pic18f14k50 at 2.4$ if you get 10...http://www.digikey.com/product-detail/en/PIC18F14K50-I%2FP/PIC18F14K50-I%2FP-ND/1999470and remember you'd also need oscillator for it and you only have 8KB of flash memory (need flash for usb library and fatfs library so really 8kb is little)

author: nctnico
author_rank: Super Contributor
timestamp: June 03, 2014, 09:25:43 pm
content: Why a PIC? Look at the LPC1114 from NXP for example. That can be programmed over a serial (USB) port using Flashmagic (free!) and has a free C compiler (LPCExpresso or GCC + Eclipse). This is a complete module ready to go:http://www.ebay.com/itm/Z111xP-New-ARM-Cortex-M0-Core-Module-LPC1114-Development-/310708342484Hook an SD card to the SPI port and use FatFs (http://elm-chan.org/fsw/ff/00index_e.html) to handle the filesystem on the SD card. Fatfs is pretty straightforward to use and works reliable (I did some stress tests myself).

author: zapta
author_rank: Super Contributor
timestamp: June 04, 2014, 05:21:19 am
content: Quote from: nctnico on June 03, 2014, 09:25:43 pmIs the Z111xP board open sourced? Is it possible to clone its design into custom PCB's? Where is the schematic, bootloader, etc?

author: kolbep
author_rank: Frequent Contributor
timestamp: June 04, 2014, 06:19:43 am
content: Without trying to start a uC war, the reason I want to use a PIC is because that is the Micro that I know the best (been using it since EPE Magazine had their first PIC tutorial years and years ago.), and can use quite easily. Thanks for the smaller libs. I will see, maybe I can squeeze it into the PIC18LF2420 that I have the most experience with.P

author: nctnico
author_rank: Super Contributor
timestamp: June 04, 2014, 11:09:04 am
content: Quote from: zapta on June 04, 2014, 05:21:19 amThe design is pretty simple: a 3.3V regulator, an FTDI USB/serial converter and a microcontroller. The bootloader comes standard with the microcontroller when you buy it from NXP. There is nothing to open source about it.

author: dannyf
author_rank: Super Contributor
timestamp: June 04, 2014, 11:22:02 am
content: QuoteSounds like a reason NOT to use a PIC: you already know it. Time to learn something else.