Due to a mistake on the part of a customer, we wound up with a large number of PIC 18F6520
cpus. He should have gotten the LF version for his application, a body-worn visio-tactile
hearing aid prosthetic for the profoundly deaf infant (whew, but it was a cool thing).
Being cheapskates, we
didn't want all these to go to waste, they are nice chips, and fun to program.
So we laid out a board to make them easy to use in projects around the place.
The idea here is to do the tough part for most hobbyists, eg lay down the SMD
parts, and have a footprint the normal electronics
hobby person can easily handle -- a 40 pin dip. The above also include us -- even
though we can, not everything we do deserves going through the tedium
of laying out and making a dedicated PCB. The motherboard allows for a little
playing around, and in-circuit programming, but is not needed for applications.
We have also done some preliminary work on daughter boards that contain (respectively) EEPROM in bulk, 24 bit a/d converters, and CMOS power boosters that can put out AMPERES when used to boost say, a PWM output from the PIC. This can drive a stepper motor, a speaker, whatever. We have even used an A/D input with a microphone and a PWM output with a speaker to make a tiny class-D PA amplifier. Just a goofy proof of concept, but it DID work well, within the limitations of 10 bits. With two pwm booster circuits, one can get 10v pk-pk outputs...a fair amount of power (30W or so).
Thanks very much to Dale Jorgensen for doing the PCB layout and various other parts of this project, especially the excellent documentation.
We have used these with most of the major toolsets, and favor either the
CCS or HiTech
C compilers for using them. A bit pricey, we know, but they are both very good tools
for this kind of work, and most of the rest of the stuff out there stinks badly by
comparison. HiTech rules for mixed C and ASM when you really need every last cycle
the chip can manage. They had the very best, even amazing, PIC16 compiler for quite
awhile, and are working on a new pic18 version they hope will be as good. We're watching the
beta bug reports before upgrading, however, as it's very pricey.
CCS rules for ease of use, working examples, and easy and very slick hookup to all the interrupts at a very small cycle penalty (using their dispatcher). Both are good at optimization, one maybe a little better than the other, depending on the exact code fed to them. All the other tools we've tried frankly stink bigtime. Some force you into their model, no good if you've got your own (presumably better) one, some aren't even interrupt (thread) safe, or just hard to use and crashy and as far as I'm concerned, someone even owes me my $300 back. So I'd go with either CCS or HiTech. Right now we're using the CCS tool-set and really liking it.
The logger board is complete and can be used standalone. It contains two crystals, one 10MHz for the main clock at either 10 MHz or 40 MHz with the built in PLL, and the other your basic 32768 Hz for real time clock uses. You can also direct the PIC to use this as the main clock in software for very low power modes, where the system draws only a few uA. The board also contains a 2 channel rs-232 converter that in addition to the main function, puts out the +/- 9v it generates so you can use it to power things like low power opamps in your project, which only needs +5v input.
Here are a few of the logger boards, with the version of the Mobo we use to test them
after building them -- this lashup finds all the bad solder joints and so on.
The stakes on the top of the logger board emit the two RS-232 ports on one end, and
some pins we use to drive an LCD display on the other end -- the PIC has more
than the 40 useful pins a DIP header will allow. Just add 5v, your code, and go!
PIC pins tend to be more useful than most micro-controllers. There are regular serial ports,
I2C and SPI, A/D inputs, PWM outputs, comparators that do both analog and interrupts to the CPU,
and most pins can be assigned to more than one function, depending on your needs.
As plain old I/O pins, they put out enough to burn up a normal LED, and as inputs
are CMOS high impedance. We've even used them to switch low level audio (to ground or not)
without having noise problems in good layouts, which this is.
The motivation for doing this, other than pure cheapness was, errrm, cheapness. Doug wanted to use these as data loggers in the Fusion setup, as they are inexpensive to replace should some errant EMP fry one. This has been a problem with the over billion watt pulses we sometimes play with, and a PC is plain old expensive and hasseliferous to replace. Even if we cook one of these, there's a better than even chance that the EEPROM I2C daughter-board still has the data on it, which could be read elsewhere.
Here's a close up picture of both sides of the logger board, and the prototype eeprom board.
You can see the 32 khz xtal on the backside in this photo, and perhaps some of the bypass caps.
Boy, those 0402 smd parts aren't for the faint of heart! We put these down with a Metcal soldering station,
Kester 952 flux, and a stereo microscope...on a coffee-free day. At least the LED on the top was a
602 size. The Metcal soldering station makes this easier than you might think, though. They've really scienced out
things like tip shape for holding just the right amount of solder and no bridging, and perfect temperature
control. The big high density chips are done with a "horse hoof" tip in only a couple of seconds apiece,
they are actually the easiest part to do.
A very expensive tool that even a cheapskate can love once you use
it a little. Pays for itself right away. And yes, we've tried just about everything
else there is for this job, and there is simply no comparison whatever.
The eeprom board was made on our PCB line, which doesn't yet do plated through holes, so Dale put all the chips on one side, and only ran power and ground on the other, soldering through wires where power/ground vias would be. This could obviously be reduced in size later on when we make a layout for a real PCB house. This board gives 64kx8 of byte-writeable eeprom on the I2C bus. The idea is to have it pluggable, like a key-flash drive, so it can be used for much the same set of purposes, only less expensive. I used the same stakes as for the comm and LCD on the logger board, so as to have all using the same connectors, cheapness again.
|Here is an example project using this board. I obtained a very nice Geiger tube from GEO on the Fusor Forum, and needed the rest of the stuff to make a useful counter. I plan to put this in a box and make it portable. It is operating in this picture, counting the alpha rays from a couple of thoriated tungsten welding rods for my TIG welder. HV for the Geiger tube is created with a CCFL inverter from DigiKey, driven via PWM from the PIC using an IRF 7105 as a power amplifier, and regulated using a resistive divider and an A/D input on the PIC. The software is dirt-simple for all this, and I am using one of the RS-232 outputs to stream debug information to HyperTerminal (ugh) on the PC. The LCD is driven directly off one of the stake outputs from the logger board, back-light included as we put power pins on that connector as well as the drive signals. The idea was to make it easy to snatch the logger out of the mobo prototype and put it in a real project with minimal fuss. This is a very nice, sensitive counter using a very thin window that passes even low energy alpha and X rays. It uses two transistors, one as a preamp to drive the PIC (not really needed) and the other an LM395 to direct-drive a small speaker so I can hear the clicks. This makes it easy to instantly notice if the counts are random (natural radioactivity) or not (maybe something produced here that might have 60 Hz hum on it). Got to set yourself up for those Fleming moments in science! Yes, this is very "Hay-Wired" which is all it needs to be for a prototype. "Too fussy wastes man-hours" (Robert Heinlein). This way it's easy to take apart to reuse it all as well.|
|Here's a screen shot of the CCS development environment as used here on this project. Sadly, their nice IDE is a windows-only affair, so this is running on XP. They DO have a Linux compiler and driver for their ICD, so we'll be lashing up something around that pretty soon. Probably not as feature packed but it would avoid having to dual boot. Here you can see on the hyper-terminal screen that I've turned the rotary encoder and pushed the button on it -- all nicely debounced. Most browsers (this is only tested in Firefox/Ubuntu) should show the screen shot full size if you right-click on it and ask for a display. Reducing it made the text unreadable here. You can see why there are separate display outputs for CPS and CPM -- natural radiation is quite random, so you really need some averaging. I am still figuring out what UI I want so I can finish the code and stuff it in a box with some batteries. At a minimum it will be able to store a few measurements in the on-chip eeprom for later upload to a PC. It's just a question of things like "do we estimate the CPM from CPS (or CPH!) in real-time" or not, stuff like that. For portable use, the LCD back-light will be on a push-button to conserve batteries, as this is the major part of the current consumption! The CCFL used is 5v in to 700v out, which we voltage-double and drive at about 3.5v average input to get the 850v DC for the Geiger tube. The simple software regulation loop gives far better regulation than this needs, on the order of 1 volt.|
CPU: PIC 18f6520 @ 40 MHz, but nearly any 64 pin PIC would fit and work, they are nice that way.
I/O: Most pins brought out to 40 dip pins. Both UARTs converted to RS-232 on board and brought out to a seperate 2x5x.1 spacing connector. Most of port E brought out to another top connector for driving LCD's or whatever else you want. Power brought to this connecter as well. I2C and MCLR pullups on board. One red LED also on board. All the other port pins are unencumbered and run to the 40p dip header.
Speeds: CPU can software-select either 10 MHz crystal with or without the 4x PLL, or a 32 KHz one.
Power consumption: Usually 30 mA or so at 5v nominal and full speed, depends on speeds and loads. Can be as low as a few uA for CPU + about 1 mA for the RS-232 converter. Next rev will allow for multiple LCD displays and switching off the RS-232 chip when it is not needed, at the cost of reserving one I/O pin to do that.
You'll want to get the data sheet for the PIC at Microchip. Again, nearly any PIC in this 64p flatpack package will work on this board. Pinouts tend to be interchangeable enough. Since we don't regulate the power on board, lower voltage ones should work fine. The RS-232 chip is rated down to 3 volts.
Stay tuned -- more to come. I'd originally done this for my own uses, and perhaps some of the people on the Fusor forum, at least the few who don't think of this stuff as "rocket science" or "not worth the time and effort". Here these will be used to log data from and control parts of the Fusion setup, the solar power stuff, the weather station, burgler alarm, and whatever else I can think of. Turning the cheap-but-effective single speed spot welder I got at Harbor Freight into a more useful timed-pulse (for preheat and post-anneal) machine just came to mind...
There is a chance we will product-ize this and hopefully find someone to make and sell them for us. We don't like being in the hardware business ourselves; we prefer to write outstanding software for great platforms. Do you hear me PaulB, JackM? Be a nice little product for ya'll, or a good basis. Else I will open-source the whole thing soon.
Coulter's Smithing Home
Here's how to contact us: