Friday, October 7, 2011

Sputnik transmitter

For my latest, I've put aside my AVR programming and a few other projects to participate in an activity commemorating the October 4, 1957 launch of Sputnik 1, and with it, the space age. It's the brainchild of the master of archaic radio technology Mike Rainey AA1TJ, whose original post is here:

Mike supplied me with the the two Russian "pencil tubes", a 21.060MHz crystal and a vague instruction to do something with them. I reproduced the transmitter shown in the schematic of the above link to the best of my ability.  Initially, I had trouble getting oscillation, so I reduced the size of the "lower" feedback capacitor to get it to go.  Eventually I got all the way down to 10pF, tormenting the crystal all the way up to 21.065MHz.  I had problems with low output, sometimes less than 100mW and was suspicious of my plate RF chokes so eventually went to a 1k resistor on the oscillator plate and a resonant tank on the amplifier.  That put me up to 200mW.

Here's a picture of it.  The tubes have wire leads which I soldered to a terminal strip. For keying, I did what Michael suggested and keyed the PA plate while leaving the oscillator running.  The little perf board has a TTL reed relay for keying.  By this time I'd already made my power cable for B+ and filament and realized I needed 5V for the relay.  Rather than rebuild that cable, I added the 9V battery and a 78L05.  A little foresight could have been helpful.

On the air!

I got it ready just in time for the October 4th start date.  I was fairly amazed to make four QSOs on a Tuesday afternoon with just 200mW out. They were:

N2JJ in NY
W5RZ 10 miles up the road

N2JJ recorded my simulated 54 year old transmitter on his Droid phone and sent me the audio file!
W5RZ wished me "DSW".
WB8YYY gave me a 238 RST, one of the strangest I've had.

Inspired by this project, I've done a lot of reading on Sputnik.  I remember very well when it was announced on the news in 1957.  We ran out and looked at the sky.

Some of the ideas I and maybe others had weren't really correct.  First, while the exact time of the launch wasn't known (the Soviets were pretty secretive), it was generally known in the US that the Soviets were very close to making their attempt. The US was also pretty close to launching, with an intended satellite launch planned during the IGY (International Geophysical Year) of 1957. It actually succeeded in January 1958.  But the possibly underestimated reaction of the public and media to Sputnik expedited the program a great deal.

Sputnik transmitted on 20 MHz, allowing ham operators and shortwave listeners worldwide to hear its beeps. Michael chose the 21 MHz ham band for our project to get reasonably close. The American satellites transmitted above 100MHz, which required somewhat more exotic receiving equipment to hear.

Friday, August 19, 2011

Barometer - Altimeter

For some reason I've thought for a while that it would be fun to build (or even buy) a barometer.  A friend had this cool military surplus altimeter he put on the seat of his car while driving through the mountains and you could see the elevation go up and down. That was pretty cool.  Barometric pressure is interesting too.  Can you predict a storm by seeing a rapid drop?

So I finally ran across this chip, or sensor on a chip, by Freescale, the MP3H6115A pressure sensor chip. It cost $9.15 from Mouser. The chip is SMT, 8-pin SSOP package.  It has 0.05” pin spacing, but the row-to-row width is wider than SOIC packages, so a different adapter or board pattern is needed.
It has an output of 15 to 115kPa or 2.2 to 16.7 psia. Supply voltage is 2.7 to 3.3 VDC, typically 3.0 VDC.  Output is in ratio to supply voltage, so it must be known and regulated.

In the photo you see I soldered the chip to a little adapter board and glued that to a scrap piece of PC board on which I also mounted a 3.3V regulator.

Only three pins are used: supply, ground, and output. So you just take that output to the ADC input of your micro and Bob's-your-uncle, instant barometer.  Altimeter.  Whatever.

You'll need some floating point routines in the program.  I used my Arduino board which has an ATmega168 MCU, I think.  You program it in C.  I'm trying to expand beyond assembler so this is a good project for me. The formula for pressure from output voltage is:

P = (Vout/Vs +0.095)/0.009 kPa  (Vs is the supply voltage.)

Since the output is in kPa or kilo-Pascals, I did a further conversion to inches of mercury (inHg), more familiar to me.  BTW, normal barometric pressure is about 101.3kPa.

I first just hooked the thing to my DMM and converted voltage readings to inHg with Excel or my calculator.  I pulled up the local airport's data on the web and compared readings.  They were off a bit more than I expected, but then I learned that airports convert their reading to sea level equivalent, making it somewhat higher.  After compensating for the difference between sea level and our airport's altitude of about 380 ft. I was closer.  In the end I did a small fudge factor to get closer yet. I also have access to atmospheric pressure at my friendly local power plant for calibration purposes.

Converting to altitude is more complicated. Rigorous formulas are complex and factor in a number of things like ambient temperature and relative humidity.  I opted for one that was simpler:

Z = (1-(P/29.9247)^0.19)/22.558E-6

Where Z is altitude in meters and P is pressure in inHg.  I converted the result to feet for display.

My display is a 4-digit 7-segment display surplus from a set-top box, BTW.  I like the look of red 7-segment numerals, but it has a few issues:  No decimal point, hard to see in outdoor light, can't make many alphabetic characters.

I make my program display pressure in inHg for about 1.5s, then text approximating "inHg" for 0.75s, then feet altitude for 1.5s and text "ASL" for 0.75s and repeat.

One curious result I noticed initially was that the display would show 380 feet for a while, then jump to 350 feet, alternating between the two.  I finally realized that this is the limitation of my 10 bit ADC.  One part in 1024 is equivalent to about 30 feet of elevation here in Russellville.  I tricked my way out of that a bit by putting in an averaging routine that uses the average of 5 readings taken over a 5 second period.  Now I get smoother changes and some artificial interpolation but my response time to a step change has been reduced to the 5 seconds it takes to fill the buffer.

Today I gave it a trial run in the Miata to the top of Mt. Nebo.  My local elevation is 380 feet.  When I got to the sign at the top of the mountain saying "Elevation 1800 feet", my altimeter was displaying 1749 ASL.  So, pretty good.  

BTW, I looked at a week's worth of barometic data and saw that the equivalent elevation change between the high and low readings was 186 feet.  So I might reasonably expect extremes to make my altitude reading off by up to +/- 93 feet if I haven't entered any compensation.

Will this project ever make it into a box with a dedicated MCU chip?  Maybe.

The answer to that question is YES. In fact, I'd forgotten I started the thing on the Arduino. But the final version uses a bare ATmega chip programmed in AVR-GCC.  Also that 7-segment display looked great but was a current hog do I went with a regular Hitachi type dot matrix LCD. Still red.

Updated 2/22/2018

Saturday, March 26, 2011

PIC powered filaments - my first PWR / switching project.

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.

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.


Nick, WA5BDU

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 -

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.

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

Sunday, January 2, 2011

2-tube regenerative receiver

I built this regenerative receiver in the summer of 2010 after Dayton.  I'd built a simple transistor regen previously, but wanted to try a more serious version using tubes.  Calling it a 2-tube receiver is a little misleading since the two tubes are dual section types (tetrode and triode).  So it's more like a 4-tube radio.  This allows some isolation between the antenna and the regen stage and from detector to audio stages.
The design is by David Newkirk WJ1Z and appears in the September 1992 QST and in the ARRL book "QRP Power". I used the suggested method of obtaining B+ by connecting a couple of 240 to 24 VAC transformers back to back. This gave me 120 volts to 12 volts and back to 120 volts, but now isolated from ground (house system neutral), which is why you do this. I wound up with 110 VDC B+, a little low because my transfomers designed for 240 VAC but used at 120 VAC have more impedance than a 120 VAC transformer would.  No big deal.  Also the clever regulator using a neon bulb wouldn't work because it doesn't fire that low.  But I found that it wasn't needed as my voltage was steady.  I used a separate 120 to 12 volt transformer for the filaments.
I didn't make many changes from the design of the article, the main one change being the tuning range.  The design is for about a 2 MHz range to include some SW BC plus 40 meters.  I wasn't interested in SW BC and wanted the better tuning rate and better stability I'd get by restricting the range.  I changed the frequency determining capacitors to give me a range of 6900 kHz to 7350 kHz. The main tuning is reasonably smooth and the fine / bandspread tuning allows getting the desired note on CW and tuning in understandable SSB.
The claims made in the article proved to be accurate.  I don't see any hand capacity effects and the regeneration control is smooth.  There's a little more stuff to fiddle with, but really the use of this receiver is not much more fussy than that of the S-40A sitting behind it as I write this.  The RF attenuator at the input is quite useful when overly strong signals tend to make the signal "tear" or "block", if you know what I mean.  Just back off on the RF control and everything is fine again.  I find that I can pretty much "set and forget" the regen control, although optimizing for selectivity and sensitivity might be useful for weak signal work.
I built the receiver on a big chassis to give me plenty of room and I'm glad I did that.  I did have some issues with stability and microphonics initially, before I narrowed the tuning range.  I also put the tank toroid and several associated capacitors on a perf board and rigidly mounted it, plus made some connecting wiring in the frequency determining areas more heavy and provided more sturdy mounting points. Also "potted" the toroid with hot glue. All that helped a great deal.
I considered adding another tube so I'd have enough audio to drive a speaker.  But it drives my modern low-Z phones really well and if I want a speaker, I plug in some totally incongruous little powered MP3 / cell phone speakers by LG which do a great job.
The white triangles around the main tuning knob indicate 50 kHz steps from 7000 up.  I've replaced them with slightly less ugly but definitely less ambiguous labels showing 50 kHz points from 7000 through 7250 kHz.
There you have it - another project to check off my list: a tube type, good performing regenerative receiver.

Nick, WA5BDU
January 2, 2011

I got an actual comment (!) suggesting a photo of the wiring under the chassis would be useful.  I'd considered that initially and now I'm going to add one-

There you have it.  Of interest, I think is the little perf board left of the fine tuning capacitor.  I added this to stabilize things.  It's mounted solidly with four standoffs, not something I'd normally do.  It contains the toroid and several frequency range setting caps including one trimmer.  Note heavy wire leaving this board to solid tie points also added in the interest of stability. The main tuning capacitor is smaller than the one for fine tuning and is visible above the perf board.
Otherwise, the schematic was interesting with it's use of multiple stages of R-C filtering in the B+ and screen voltage sections.  So you see lots of electrolytics.  Center left is the "70 volt" audio transformer used to match audio amplifier section down to modern, relatively low impedance phones or earbuds. In the lower right corner is the input or antenna trimmer capacitor and its associated ferrite toroid inductor just inward from it. The capacitor is screw adjusted from the top side through a hole.  It's pretty much set and forget though, so didn't need to be accessible.