Building the PIC-EL III
Over the past few days I've been building a PIC-EL III kit. Well, actually a beta of a kit. Since it is a beta, the build hasn't been as quick as it may be. I've been going step by step carefully analyzing everything to be sure that nothing could be done a little better before the kit goes into production.
Background
So, what is a PIC-EL? (Pronounced like pickle). Well, long story. Back around a million years ago I raised the possibility on QRP-L, a mailing list for amateur radio operators who use low power, of a course on the Microchip PIC microcontroller. There was a lot of interest in the PIC at the time, and QRP-L is thick with people who like to build. There was a surprising amount of interest, so I agreed to try to put together a course. The process of one ham teaching another is called "Elmering", and there were already a few courses on building radios called Elmer 101, Elmer 201, etc. To position this course in a place where I could potentially come up with some others that were related and perhaps had similar numbers, I decided to call this one Elmer 160.
One problem with something like this is getting some PICs and perhaps circuits to test into the hands of the students. George Heron, N2APB, of the American QRP Club suggested that perhaps the club could put together a kit to go along with the course.
This sounded like an ideal solution, although I had some concerns. To be accepted, the resulting kit had to be inexpensive. Back then the first printed circuit board for a kit was pretty expensive, so you needed to have a pretty good sized market to get the cost down. My math went something like this: There were at the time about 600,000 amateurs in the U.S., only a small fraction of whom are actually active. Of that number, only a tiny fraction are QRPers. Of that smaller group, only a very few build, and fewer still design what they build. An even smaller fraction of those are going to want to design a computer into their radio. Of those, how many wold be willing to invest in the time to take the course? Maybe two? OK, I had gotten perhaps 50 emails from folks who said they would be interested, but I expected only a few of those would actually follow through.
So naturally, I was concerned about being able to get enough people to make the kit worthwhile for the club. George recruited Craig Johnson, AA0ZZ, to actually do the detailed design, and Joe Everhart to consult. I recruited Earl Morris, N8ERO to consult as well. As the board design developed the board got more and more complex, and the thought of an inexpensive board, and one that could sell a reasonable number, began to look more and more like a pipe dream.
Well, I underestimated the appetite for kits, Craig's amazing ability to design all sorts of things into a tight space, and George's incredible ability to get deals on parts. The original board sold for $35, a little higher than the $25 I thought we needed, but still well within the reach of most experimenters, especially since similar commercial boards sold for well over $100.
The price convinced me that we would probably not recover the initial outlay, I figured maybe we would sell 25 or 50 of them, we needed close to 100 to break even. At somewhere around 700 boards the volunteers who were assembling the kits cried uncle, and the kit was taken off the market. By now the course was becoming well known not only by QRPers, but even by microcontroller professionals. There was still huge demand, but the folks stuffing parts into bags were fried.
Craig updated the design to reflect newer parts and got Kanga U.S. to produce the kits commercially. This continued for a while until Kanga got hit by a big flood, from which they are just now recovering. At the higher, commercial, price the PIC-EL II did quite well, though. It seems that the appetite for this little board, and the course, is not yet sated.
The PIC-EL includes a PIC programmer as well as an experimental circuit. The programmer is of the classic "Tait" style, which means there is tons of open source software available to use it. The one downside of the Tait style programmers is that they require an actual serial port. Because of the way the port is used, a USB to serial converter will not work. This caused us to consider a USB connection on the initial PIC-EL. However, USB programmers are an entirely different animal, requiring proprietary software. Furthermore, at the time, USB driver chips were very expensive, and a USB connection would have more than doubled the price.
Since that time, Microchip has come out with a line of PICs that include not only the USB driver, but all the other bits associated with USB, and all this for a couple of bucks. Further, a couple of Microchip programmers have provided a "standard" way of communicating with a USB programmer, so while still proprietary, since it is widely used and comes from the manufacturer of the PIC, it answers many of the issues around USB. Craig decided it was time to do a USB version, with the programmer almost a clone of Microchip's PICkit 2.
The Kit
Craig did the design, I assume some prototyping, and asked me if I would build the beta of the kit and see what I thought. The "beta" that arrived was pretty similar to the sorts of kits frequently produced by the various QRP clubs. It showed up in the typical, "Express Mail" size box, with a circuit board, a couple of bags of parts, a CD, and some instructions.
One significant upgrade to the original PIC-EL was the inclusion of a 2x16 character backlit LCD. The very first PIC-ELs had a 1x8 display which was soon replaced by a 1x16. The PIC-EL II had a 2x16, but the backlight is a new addition.
The board was extremely high quality for a beta, but that does reflect the state of the PCB art these days. In contrast to a few years ago when the first PCB in a run could cost hundreds of dollars, and prototype boards weren't masked or screened, this board is very heavy, has a high quality mask, and is fully silk screened on the component side.
The general layout is very similar to the original PIC-EL, with the power supply on the upper left, the programmer to the left, the LCD to the bottom right, a place for a DDS daughtercard on the right, buttons and LEDs on the lower left, and a BNC connector for RF on the upper right. The new additions are the PIC18F2550 as part of the programmer (which handles the USB port as well as the programming duties) and a ZIF socket for the PIC under test.
Building
The first step in the instructions was to install the 11 test points. These are nothing more than loops of wire at strategic locations so that a test probe can be easily hooked into the circuit. Craig suggested that paper clips might give a little more rigidity. I didn't really care for this idea, since paper clips can be terribly difficult to solder, and instead opted for the heaviest copper wire I could fit in the holes.
Unfortunately, the wire I decided to use was scavenged from some old coax. It was fairly well oxidized and was reluctant to take solder. I had hoped to tin it nicely so that the resulting test points wouldn't also oxidize quickly, but even after bathing the wire in flux I found it difficult to get the nice even tinning job I had been hoping for. Nonetheless, I eventually got the test points installed, all eleven of them. The result was far from beautiful but reasonably functional.
The next step was to install the 5 volt regulator and associated parts. This is a fairly straightforward business. The instructions install some parts and then test, and as in many kits, the builder is advised to check for 5 volts on the 5 volt test point as soon as the regulator circuitry was in place.
This is a pretty typical test for a lot of kits. It can usually come early in the build, helps the builder get a little confidence, and can prevent a runaway regulator from destroying parts to be added later. Well, imagine my disappointment when the test point for the +5 supply showed no voltage.
I began following traces, a little tricky since I had no Gerbers, but I had taken good pictures of the front and back of the board and the traces could be followed on the pictures with the exception of a couple of places where things are crowded and the silk screen hides some of the traces. I concluded that there was no way the +5 could get from the regulator to the test point. I decided to try the other way and trace from the test point back to the regulator. After this trace, and some noodling over the schematic, I concluded not only couldn't the +5 and the test point get together, but they shouldn't!
Well, after a few emails back and forth with Craig, it turns out that he had made a change to the foil and the test point wasn't where it was supposed to be. A later test had a similar result.
The rest of the build was pretty straightforward. As a through hole kit, and a relatively simple one at that, there really isn't a lot of complexity. The only slightly tricky bit was that the crystals needed to be separated from the board a little bit. This is pretty common, though, and my strategy has always been to put a toothpick under the crystal before soldering. The 2550's crystal was already crowded in a bit by it's capacitors and the 2550's socket, but it was still possible to get a toothpick in there.
The other slightly tricky bit is the socket for the DDS daughtercard. This is a 90 degree SIP socket that needs to be somewhat above the board to allow for the components on the daughtercard to clear the circuit board. Fortunately I had both a DDS-30 and a DDS-60, but actually getting the socket to stay put during soldering was a little annoying.
The Diagnostic
Included in the kit was a PIC16F628A with a diagnostic program loaded. The diagnostic blinks LEDs, plays a scale on the speaker, reads the encoder, etc. In short, it pretty well tests all aspects of the board.
The program cycles through a menu of 8 tests, pressing PB3 when an item is displayed executes that test. Some tests are fairly obvious; for the LED test you watch the LEDs flash, for the speaker test you hear a scale. Others require you to do something; the pushbutton test requires you to press buttons, the encoder test to twist the encoder. The DDS tests require not only do you install a DDS daughtercard, but also tune your radio to the neighborhood of 7.04 MHz and listen for the beeps.
All of these initial diagnostics went without incident, although I would have liked to see the display be a little brighter (more about that later).
Programming the PIC
In the Elmer 160 course, we have been using software called FPP to program the PIC. Later, many users moved to WinPIC, as after service pack 2, FPP became horribly difficult to install on XP. In addition, while FPP would only deal with a handful of different PICs, WinPIC could program most of the interesting parts. These programs, however, expect a Tait style programmer. The PIC-EL III with its USB interface needs another strategy.
Craig included Microchip's PICkit2V2 on the CD. This is a pretty competent replacement for WinPIC and works very similarly.
One tricky bit about PICkit2V2 though, the PIC-EL needs to be connected and powered when the program is started.
Although the menu choices are different, and the window looks different, the process of using PICkit2V2 is really no different than FPP or WinPIC; load the hex file you want to write to the PIC, flip the RUN/PGM switch on the PIC-EL to PGM, tell the program to write to the PIC, and flip the switch back.
There were a couple of surprises, though. First, it is fast. It happens I have been using USB programmers for a while, but I have tended to use them on PICs with very large memory. Just because of the boards I happen to be testing, I tend to use serial port programmers on PICs with smaller memory, like the PICs the PIC-EL is intended to use. The first time I programmed a PIC with PICkit2V2 I was sure it didn't work. The result was almost instant.
The other surprise was the device support. The programmer on the PIC-EL is basically a clone of Microchip's PICkit 2, and PICkit2V2 thinks it is talking to a PICkit 2. The PICkit 2 is almost identical, hardware wise, to Microchip's ICD2. However, the PICkit 2 is $35, the ICD 2 $150. There is a big difference in the level of support provided, but the obvious differentiation is the parts supported. Within MPLAB, Microchip's integrated development environment, the ICD 2 supports almost every PIC made. The PICkit 2, in contrast, supports only selected parts. I was therefore quite surprised to see PICkit2V2 provide support for almost every possible PIC.
Once having convinced myself that the programmer part worked, I now wanted to see how it went with MPLAB. Programming inside MPLAB is quite nice. One simply builds the hex file and clicks on the program icon on the toolbar (the yellow page with the arrow pointing toward the chip). When using the ICD 2 and a properly designed circuit, one merely clicks the release from reset button to start the application running. Since the PIC-EL has a physical switch, it is necessary to flip the physical switch, the same as when using PICkit2V2, but it is still a convenience to not have to switch to another program.
I had MPLAB 7.60 installed, but of the 18 pin parts that one might use in a PIC-EL, only the PIC16F88 was supported with PICkit 2. I went ahead and installed MPLAB 8.10, something that had been on my to-do list for a couple of months. 8.10 supported most of the PICs that someone might want to use. Unfortunately, the PIC16F84A, the one we have chosen to use for the Elmer 160 course, was conspicuously absent. That wasn't a huge surprise. The 84A is an old, almost obsolete part. Almost any other PIC is more capable and cheaper. However, the 84A's simplicity makes it the best choice for someone just getting his head around microcontroller. So students won't be able to take advantage of programming from inside MPLAB, but PICkit2V2 works just fine, and process-wide, is similar to FPP.
An Interesting Adventure
The other day I got an email from an old friend in Germany who retired shortly before I did. He said the main thing he misses is the technical challenges.
Well, I seem to find plenty of technical challenges, and this little board provided an adventure that was challenging, educational and just plain fun.
Earlier I mentioned that I wasn't entirely happy with the display. At some point I noticed that the display brightened when I placed my finger near the connections on the LCD. Poking around some more, I found that getting near the pins of Q9 caused the display to brighten even more.
This kind of behavior is often the result of a cold solder joint, so I went through, several times, and hit any suspicious joints with a bit more solder, tried wiggling things, tapping things, generally finding no clues as to what could be causing this behavior.
I tend to chat on the radio with Earl, N8ERO, about these sorts of things, and as I got more frustrated I emailed Craig, AA0ZZ, and included Mert, W0UFO in our conversations. It was Earl who really picked up on the issue, and it isn't terribly obvious. The gate of Q9 is floating!
If you look at the schematic above, it doesn't look floating, but a diode won't conduct in the forward direction until after you get over a barrier voltage. This voltage happens to be quite high for an LED, in this case, about 1.6 volts. The MOSFET is pretty switch-like, but my MOSFET was apparently soft, so small changes in the gate voltage resulted in fairly large changes in the +5 supply to the circuit. Since the gate is at a very high impedance, it is likely to be influenced by things around it.
But wait! There's more.
It turns out that an LED will actually generate a small current when exposed to light. This current is small, on the order of a few microamps, and in most cases is insignificant. But the gate of a FET is extremely high impedance, so this little bit of current can actually drive the gate of the FET as high as a volt or so. In addition to my hand capacitance affecting the circuit, when I moved my hand toward the LCD, I was shading the LED from the room light.
All that was required to fix it was to provide a DC path to ground to drain the charge off the MOSFET. A 1 meg resistor works in most cases, although something like 10K is probably a better choice. A very bright light can influence the voltage with the 1 meg, as shown in the video.
Summary
All in all, this turns out to be a very nice board. I was able to provide Craig with a number of nit-picks which will be included in the production version. It is also amazing how much fun these things can provide to geeks like me!