Thinking Too Much

Posted by: Dave Vandenbout 6 years ago


This is how things get out of hand...

I was making a clone of my hard drive to keep at my sister's place. (I do this in case my ex-wife ever decides to come by and burn my house down.) As I'm sitting there doing other things, I notice the computer reboot while there's still two minutes to go on the cloning countdown timer.

"That's weird.", I thought, "That's probably not a good thing."

Sure enough, trying to boot from either drive produced an "OS not found" error. Everything was still on the drives, they just wouldn't boot. So I tried the standard things: Windows recovery disk, rebuild the MBR, rebuild the boot sector, etc. Eventually the cloned drive started to boot, but I wasn't real comfortable with that since the cloning hadn't entirely completed. And the original drive still wouldn't boot.

Since I'd been using Windows XP, I figured this was a sign to finally upgrade to Windows 7. I knew I would have some compatibility problems - particularly with my Strobe XP200 scanner that I use to scan my business records - but I was going to have to do it eventually so it might as well be now.

I got Windows 7 up and running and transferred all my files. Sure enough, the Strobe gave me a problem: the hardware worked fine, but the PaperPort version 9 software that organizes all the scanned images wouldn't work. I decided not to buy the newest version from Nuance for $200 since I already knew they had removed some of the more useful features (to me) of the software. Instead, I booted from my cloned drive and used my old version of PaperPort to translate all their proprietary .max scan files into PDFs. Then I brought the PDFs over to Windows 7 and used the Windows Explorer thumbnail view and file preview features to replicate 90% of the features I used in PaperPort. After that, I figured I had all my Windows 7 issues resolved.

So I was happy until I started the Microchip MPLAB IDE, recompiled my source for the XuDL data logging board, and then found I couldn't flash the PIC chip because my ICD 2 programmer wasn't being detected.

"That's weird.", I thought, "That's probably not a good thing."

An upgrade to the newest software didn't help, so I went looking on forums for compatibility problems between Windows 7 and MPLAB. That's where I found out that only the ICD 2 with a part number of P/N 10-00397 supports 64-bit drivers. I turned over my ICD 2 and saw P/N 10-00319. Doh!

Now, I could have solved this problem (as well as the PaperPort problem) by running the program on Windows XP inside of VirtualPC. But VirtualPC takes a bit of time to come up and the whole point of having a Windows 7 machine with 8 GB of memory is to do things fast. So I decided to upgrade my Microchip programmer. I looked at a newer ICD 2 or ICD 3, but they were nearly $200. I settled on a PICkit 3 for $45 and an RJ-11-to-ICSP adapter for $10. Hopefully, those will replace the functionality of my old ICD 2.

While I was on the Mouser site ordering the PICkit 3, I decided I needed to purchase a variety of 0603 resistors. (I might as well amortize my shipping costs over as many items as possible.) I have a lot of the larger 0805 resistors, but my new designs are using the smaller 0603 and I don't have many around for when I'm prototyping. But there are 168 different resistor values, so which ones should I get to have a reasonable assortment for most of my needs? By soldering resistors on top of each other, could I use a small set of resistance values in parallel to synthesize values in the entire set? If so, what are the best resistances to use that will get me closest to each of the standard resistances?

I fiddled around with the problem by hand for a while, hoping that a closed-form solution would pop out. No such luck. But I did have one insight: whatever the best resistors were for a given decade range of resistance, they would be scaled by a power of ten in every other decade range. So if a 160Ω resistor is built with a parallel combination of a 240Ω, 620Ω and 2.4KΩ resistors, then a 1.6KΩ resistor would be built with 2.4KΩ, 6.2KΩ and 24KΩ resistors. (I figured that I wouldn't want to solder more than three resistors on top of each other.)  I came up with a Python program to compute the best resistor values as follows:

  1. Select three values from the 24 root resistor values and replicate these in each of the seven decade ranges of resistance. For example, if 1.2Ω, 6.8Ω and 8.2Ω were selected, then 21 resistor values would be generated: 1.2Ω, 6.8Ω, 8.2Ω, 12Ω, 68Ω, 82Ω, 120Ω, 680Ω, 820Ω, ... , 1.2MΩ, 6.8MΩ, 8.2MΩ.
  2. Synthesize all possible resistance values that can be created by paralleling up to three of the 21 resistance values.
  3. For each of the 168 standard resistance values, find its closest match in the list of synthesized resistances, calculate the percentage of the mismatch, square it, and add it to the total error for the entire set.
  4. Repeat the preceding steps for every possible combination of three root resistor values. Then select the combination that has the lowest total error.

After running the Python program for a few minutes, the best resistor values that popped out were 2.4Ω, 6.2Ω, 9.1Ω, ..., 2.4MΩ, 6.2MΩ and 9.1MΩ. Here's a graph of the percentage errors for all the standard resistor values w.r.t. their closest, synthesized values:

The synthesized values are all within ±4% of the standard values until you get into the megaohm range. Then things get a bit hinky because there aren't any larger resistances that can be used to trim down the synthesized values. Still, it's not bad: using only 21 resistor values I can synthesize 159 of the 168 standard values to within ±4%. A strip of 100 Panasonic 1% 0603 resistors costs $1, so the total cost is $21.

So, did I buy them? No way! You can buy kits with a wide range of resistors for as little as $40. It just isn't worth the effort of stacking and soldering resistors to save $20.

So why did I waste a bunch of time doing this academic exercise? Because once I'd asked the question, I couldn't unask it. It's like seeing a hole in the ground and then digging all the dirt out of it even though you know the rabbit has long since left the vicinity. Because I just had to know.

Currently unrated


  • There are currently no comments

New Comment

required (not published)

Recent Posts






RSS / Atom