This project satisfies a couple things I'd been wanting to try - 1) using PWM on the PIC, and 2) trying my hand at a switching power supply circuit.
I should say that I first tried the Arduino board, but it's C-language front end only allowed a PWM frequency of about 500 Hz. I felt the need for a higher frequency / shorter period. So back to the PIC, and I chose a favorite, the 16F88. It has 18 pins and incorporates ADC, PWM and lots of other good stuff. To make sure I could get the PWM speed I wanted, I used a 20MHz crystal instead of one of the very handy built-in oscillators.
First I worked on learning to get the PIC working in the PWM mode. It didn't take long to be able to produce a "demand" output voltage of good accuracy that I could measure with a DMM and/or see on the scope. I used a simple RC filter on the output pin to convert the pulse train to DC.
PWM is pulse-width modulation. For example, if I set it for 25% output, the output pin will be HIGH for 25% of the selected period and LOW for the remaining 75%, and repeat. Good for power supply voltage regulation. (Similar methods are even used in your digital (CD, MP3) music players to generate audio.)
Now, what about the switching circuit components? I scanned several references (complicated!) and came up with a simple appearing "buck" circuit. The PIC controls a pass transistor that "charges" a series inductor during the ON time, through the load, and when the PIC turns off, the inductor continues to source current through the load with a diode providing the conduction path that opened when the pass transistor turned OFF.
The references indicated that design of PWM circuits is pretty complex and not likely to work with homebrew hacker techniques. I decided to play with my proposed circuit in LTSpice for a while before risking blowing stuff up, since I was pretty clueless. That helped me a lot. I just simulated the PWM pulse drive from the PIC with a square wave source, changing the duty cycle manually until the output voltage was right.
I was using a 20us (microsecond) period, which is the total ON plus OFF time for one cycle. Things were looking good and I was thinking it ought to work, but then I started using LTSpice to look at the dissipation in components such as my transistor. Wow, it was dissipating twice as much as my load. My overall efficiency must have been about 25%. Looking closer, it appeared that the losses occur during switching periods, the rise and fall times. When fully ON or OFF there's no device dissipation, which of course is what makes switching power supplies attractive. Do I somehow have to figure out how to make those rise and fall times smaller? Fortunately, no.
It occurred that my efficiency is related to the number of switching transitions (OFF to ON, ON to OFF) per unit time. So maybe my period is too short. I had just assumed that faster was better. I cranked down the period in my simulation and efficiency improved considerably. I eventually went all the way from 50kHz PWM frequency down to 4.88kHz. So maybe I could have skipped the 20MHz crystal and just used the internal 4MHz oscillator.
One negative is that the peak transistor current gets larger as the ON time stretches out. More inductance can help. My transistor has a rating of 1A continuous and 3A peak and I was trying to hold to that.
Now I'll show the schematic and discuss the component selections-
I originally wanted to use full wave rectified voltage right off the AC line, like PC supplies do. But that would give me about 170VDC and I didn't have a PNP transistor to handle that with margin. My closest shot was the TIP30C, rated 100VDC. So for my experiment I also had to build a power supply of about 50VDC output. I have a good junk box, so no problem.
Next comes the diode, I guess it's a commutating diode. I think it needs to be one of those "fast" diodes used in switching supplies and capable of 2A or more. Junkbox to the rescue again, I have a RHRP860 rated "hyperfast" at 8A and 600V. It's in a TO220 package like my transistor. The cathode of the diode and the collector of the transistor are both on the metal mounting tabs of their packages, so I could bolt both to the same heat sink and board area to make that connection.
Next comes Q2, which switches the main transistor ON and OFF by grounding and opening its base circuit. When this transistor is OFF, it sees the full supply voltage, so I wanted a small transistor that could take fairly high voltage as I look forward to my 170 volt version. The MPSA43 is a small transistor in a TO92 package that can take 300 volts.
Finally the inductor. Books and articles indicate that this can be critical. I picked one from my junk box which seemed to have heavy enough wire and measured 933uH. I have no idea of the intended use although I suspected it was part of a switcher of some kind. I should mention that the inductor should not saturate at maximum current. A recent project of mine was a saturation tester similar to that made by Alan Yates, VK2ZAY.
http://www.vk2zay.net/article/200
I may document mine here one of these days. Anyway, I had tested this inductor and it could go several amps without saturating.
That network of three resistors and two capacitors between the output and the PIC's ADC input does two things. First, it's a /2 voltage divider since 6.3 volts would over-range my PIC's 0 to 5 volt ADC input. And second, it's an RC filter to smooth out any ripple on the output so the PIC gets a consistent average reading.
I lashed everything together, including the power supply, PIC board, switching circuit and a 10 ohm load with a 6.3 volt #44 bulb in parallel. (My setpoint in software is 6.3 volts.) Somewhat to my amazement, the lamp came up to normal brilliance and my DMM measured 6.27 volts. And nothing blew up, smoked, or made scary noises. My homemade sheet metal heat sink got to about 125F near the transistor and diode -- not too bad. I added a second 10 ohm load in parallel to get closer to my desired output of a bit over 1.5A and all was good. Regulation with load changes looks good, and as I ran the input voltage from 35V to 65V the output voltage did not waver.
My PIC software changes the output duty cycle in 5% steps until output voltage gets within 10% of setpoint, then slows to the minimum step of about 0.1%. Updates occur about every 5 milliseconds.
It occurs to me that if I power on the PIC before the big supply, the PIC will run up to maximum duty cycle trying to get to setpoint. Then when the main P/S suddenly comes on, output may go high before the PIC is able to sense the overshoot and run the duty cycle back down. Or maybe not. But I may add another input to give a "power supply voltage normal" signal which would be required before the PIC comes off zero.
Let me show you the drive signal from the PIC, as read at the collector of Q2. When the voltage goes low, it allows base current to flow out of PNP transistor Q1, turning it ON. You can click these pictures to make them larger, BTW.
What's it all for? This one is just an experiment, but one application is in making power supplies for tube type equipment. Both the B+ (high voltage or plate supply) and filament supplies are getting harder to come by for someone without a huge junk box. I'm seeing several approaches. One guy took a 12V to 240V auto inverter and rectified the output to give about 250VDC. Most of us have 12VDC available. But inverters with 240VAC output are not common in the USA. I think using switchers for both the HV and filament voltages could be interesting although I can see that a purist might insist that everything be authentically from the period, including power supplies.
Using such a power supply for filament voltage could have a couple advantages. I recently checked an old tube type power supply and found that my filament voltage which was supposed to be nominally 6.3 volts was actually 6.8 volts. The could be due to having less load on the transformer than it is rated for, but it's partly due to the rise in house line voltage over the years. People still say "one-ten" and "two-twenty", but probably for the last 30 to 40 years, actual house voltages have been 120 and 240 volts. Hard on antique tube gear.
Another value a PIC controlled supply could give would be a "soft start" feature, bringing the filaments up slowly instead of hitting them cold with full voltage.
But if the PIC controlled supply fails, it might destroy some rare tubes it was supposed to protect. In such cases some kind of protection in software or hardware might be advised.
73-
Nick, WA5BDU
3/26/2011
Saturday, March 26, 2011
Monday, March 14, 2011
FT243 crystal grinding
Back in 2006, I was highly impressed by a crystal grinding workshop given at the OzarkCon QRP convention. Unfortunately, I didn't participate directly and missed some of the details. It was impressive though that crystal resonant frequencies were raised much farther than I'd thought possible. Possibly 50 to 100 kHz or more, IIRC.
So now I have a "new" DX-20 and I see that my FT-243 crystal cache includes a couple of worthless (to me) 40 meter crystals on 7073.33 kHz and 7080 kHz, in the data mode area between lower CW segments and a slow speed (usually) segment just below the phone band starting at 7125 kHz. Could I raise these crystal by 40 to 50 kHz for use in that higher CW segment.
Grinding agent? I searched the grocery store and came up with some Comet cleanser and some Colgate toothpaste which include silica in its ingredients. It's a problem that these days, scouring powders want to be "scratch free" and don't include good abrasives in them. I also bought an 8x10 inch piece of glass (Hobby Lobby, for a picture frame) as a working surface. The idea is to wet the glass, add the abrasive agent, and grind your crystal using a figure-8 motion with your finger tip moving the crystal.
Monitoring the frequency? Another cool thing about the OzarkCon workshop was that it included oscillators and frequency counters ... you just cleaned up a crystal in progress, sat it on a ground electrode, and sat a second, weighted electrode on top of it to check the frequency. Much better than re-assembling the whole thing and plugging it into an oscillator having a FT-243 connector. I built an oscillator from Experimental Methods In Radio Frequency Design (EMRFD), figure 4.23. I later changed the top (base to emitter) capacitor from 470p to 220p in hopes of increasing gain and getting a reading if the crystal became reluctant to oscillate.
Above you see the corner of my oscillator with the crystal blank, two electrodes from the FT-243 holder, my own top electrode (made from circuit board material) with the wire attached. To check, I sandwich all four items and clamp with the orange and black clamp (or a clothes pin). Initially I did not use the internal silver colored electrodes, but after I learned that they are machined to contact the crystal on its corners and let the middle section free to vibrate, I started using them in the stack.
Early results - The Comet was OK to use. The toothpaste tended to stick the crystal to the glass so I'd have to pry it loose. I also tried Turtle Wax auto buffing compound. It was very slick and my finger kept slipping off the crystal. None of them ground the crystal fast enough. Doing lots of figure 8s only moved the frequency a few hundred hertz. I also tried some crocus cloth. It discolored the crystal and made it quit oscillating until I ground it some more with abrasive compound.
Better / faster results -
I did some web searches and found Dave's Crystal Grinding Page, where he documented doing a lot of the same stuff I was doing, plus coming up with a better abrasive compound -
http://home.netcom.com/~wa4qal/crystal.htm
The better compound was Dremel Polishing Compound. I went out and got some to try. It's kind of a putty and didn't want to mix with water, instead forming globs and sticking to the crystal. Then I added a few drops of dish washing liquid to the mix and it spread out nicely. This time I was able to move a crystal 15 kHz fairly quickly. I ground on it some more and ... it quit oscillating! (This was before I changed the feedback capacitors, so who knows?). I ground some more to try to bring it back, but no luck.
Next I went to my remaining crystal, ground a while, read the frequency, looking good. Figured out about how many more figure-8s I'd need to reach my target and did about half of that. Checked and ... I've over shot and am in the phone band at 7138 kHz. One crystal dead, one useless to a CW operator. But wait?
Tried the dead crystal in the DX-20 and the good news is that it came to life. The bad news is that it is also at about 7138 kHz.
Someone on the 4SQRP list put me on to Hans Summers' page on what he called crystal "penning", meaning you lower the frequency by painting the crystal with a Sharpie marker. I'd heard of the pencil lead trick before but didn't think it would do 15 kHz.
http://www.hanssummers.com/penning.html
I tried the formerly dead crystal first, but discovered yet another mistake to make. Trying to get the stack of electrodes and crystal aligned and clamped, I broke a corner off the crystal. No more rabbits to pull out of the hat for this one.
Now the remaining crystal. I blacked about 80% of one face and the frequency dropped about 8 kHz. Promising. Did the same on the other face and got right down to the edge of the phone band. I just need a few more kHz. BTW, you have to allow some time, maybe 30 minutes to an hour, for the ink to try or the crystal might not oscillate.
So I fully inked both faces. It didn't want to oscillate even after an hour's worth of drying. The ink looked kind of lumpy, so I polished both faces on a sheet of typing paper. Now it's oscillating on 7122.7 kHz in the DX-20, close to my original target.
So there you have it. Everyone talks about over-shooting, you decide to be careful, but do it anyway. So be more careful -- that's probably better than resorting to "penning".
Another post-script ... another 4SQRP poster said Bon Ami cleanser works well. I'm not sure you can get it in Arkansas, but I'm keeping an eye out.
That's it, happy grinding ...
Nick, WA5BDU
So now I have a "new" DX-20 and I see that my FT-243 crystal cache includes a couple of worthless (to me) 40 meter crystals on 7073.33 kHz and 7080 kHz, in the data mode area between lower CW segments and a slow speed (usually) segment just below the phone band starting at 7125 kHz. Could I raise these crystal by 40 to 50 kHz for use in that higher CW segment.
Grinding agent? I searched the grocery store and came up with some Comet cleanser and some Colgate toothpaste which include silica in its ingredients. It's a problem that these days, scouring powders want to be "scratch free" and don't include good abrasives in them. I also bought an 8x10 inch piece of glass (Hobby Lobby, for a picture frame) as a working surface. The idea is to wet the glass, add the abrasive agent, and grind your crystal using a figure-8 motion with your finger tip moving the crystal.
Monitoring the frequency? Another cool thing about the OzarkCon workshop was that it included oscillators and frequency counters ... you just cleaned up a crystal in progress, sat it on a ground electrode, and sat a second, weighted electrode on top of it to check the frequency. Much better than re-assembling the whole thing and plugging it into an oscillator having a FT-243 connector. I built an oscillator from Experimental Methods In Radio Frequency Design (EMRFD), figure 4.23. I later changed the top (base to emitter) capacitor from 470p to 220p in hopes of increasing gain and getting a reading if the crystal became reluctant to oscillate.
Above you see the corner of my oscillator with the crystal blank, two electrodes from the FT-243 holder, my own top electrode (made from circuit board material) with the wire attached. To check, I sandwich all four items and clamp with the orange and black clamp (or a clothes pin). Initially I did not use the internal silver colored electrodes, but after I learned that they are machined to contact the crystal on its corners and let the middle section free to vibrate, I started using them in the stack.
Early results - The Comet was OK to use. The toothpaste tended to stick the crystal to the glass so I'd have to pry it loose. I also tried Turtle Wax auto buffing compound. It was very slick and my finger kept slipping off the crystal. None of them ground the crystal fast enough. Doing lots of figure 8s only moved the frequency a few hundred hertz. I also tried some crocus cloth. It discolored the crystal and made it quit oscillating until I ground it some more with abrasive compound.
Better / faster results -
I did some web searches and found Dave's Crystal Grinding Page, where he documented doing a lot of the same stuff I was doing, plus coming up with a better abrasive compound -
http://home.netcom.com/~wa4qal/crystal.htm
The better compound was Dremel Polishing Compound. I went out and got some to try. It's kind of a putty and didn't want to mix with water, instead forming globs and sticking to the crystal. Then I added a few drops of dish washing liquid to the mix and it spread out nicely. This time I was able to move a crystal 15 kHz fairly quickly. I ground on it some more and ... it quit oscillating! (This was before I changed the feedback capacitors, so who knows?). I ground some more to try to bring it back, but no luck.
Next I went to my remaining crystal, ground a while, read the frequency, looking good. Figured out about how many more figure-8s I'd need to reach my target and did about half of that. Checked and ... I've over shot and am in the phone band at 7138 kHz. One crystal dead, one useless to a CW operator. But wait?
Tried the dead crystal in the DX-20 and the good news is that it came to life. The bad news is that it is also at about 7138 kHz.
Someone on the 4SQRP list put me on to Hans Summers' page on what he called crystal "penning", meaning you lower the frequency by painting the crystal with a Sharpie marker. I'd heard of the pencil lead trick before but didn't think it would do 15 kHz.
http://www.hanssummers.com/penning.html
I tried the formerly dead crystal first, but discovered yet another mistake to make. Trying to get the stack of electrodes and crystal aligned and clamped, I broke a corner off the crystal. No more rabbits to pull out of the hat for this one.
Now the remaining crystal. I blacked about 80% of one face and the frequency dropped about 8 kHz. Promising. Did the same on the other face and got right down to the edge of the phone band. I just need a few more kHz. BTW, you have to allow some time, maybe 30 minutes to an hour, for the ink to try or the crystal might not oscillate.
So I fully inked both faces. It didn't want to oscillate even after an hour's worth of drying. The ink looked kind of lumpy, so I polished both faces on a sheet of typing paper. Now it's oscillating on 7122.7 kHz in the DX-20, close to my original target.
So there you have it. Everyone talks about over-shooting, you decide to be careful, but do it anyway. So be more careful -- that's probably better than resorting to "penning".
Another post-script ... another 4SQRP poster said Bon Ami cleanser works well. I'm not sure you can get it in Arkansas, but I'm keeping an eye out.
That's it, happy grinding ...
Nick, WA5BDU
Subscribe to:
Posts (Atom)