Tuesday, July 9, 2019

Arduino Keyer Analyzer



Every ham who programs MCUs and enjoys CW will probably do a keyer or two over time. My first was on the 6502 contained within my Atari 800 back in 1987.

We all know the basic ratios and WPM calculations, but there's a lot of other stuff involved in the logic of keyers. They aren't all the same - we have iambic, Ultimatic, Modes A & B and other variations.

Even if you have the above characteristics nailed down, there are still some subtleties hidden within the black box. For example, if you are sending a string of dits, how long do you have to release the paddle after the last dit before another one latches in?

I was working on programming a keyer and decided to put it on hold long enough to take on another programming project - to create a gizmo that would connect to a keyer's paddle input and keyed line output and make the timing measurements to answer my questions.

It determines dot, dash and space times in milliseconds and reports ratios and WPM. It determines logic type Ultimatic and iambic Mode A or B. It determines and reports the point at which another element latches in. It finds the delay between paddle closure and TX keyed line closure and measures the first dit to see if it is shortened. It will also send a string the user inputs on the tested keyer.

In reality, several of the attributes of a keyer can be determined just by playing with it for a bit, but others require a device such as this one.

To keep it as simple as possible, I/O is via a serial terminal screen such as the one integral with the Arduino IDE. Nothing more than an Arduino is required. The device is powered by the USB connection. I also incorporated an option for the device to report results in Morse (via your own keyer!), so the serial terminal would not be required.

An issue does arise when you want to test the keyer built in to your transceiver, since you don't have access to its keyed line out port. I dealt with this by making a little circuit to sample the RF from the transceiver while it transmits into a dummy load.

What about compatibility of the voltage level from the keyer's paddle jack to the Arduino? Well, I don't want to exceed 5 V input so I checked several keyers and they all passed the test. Here are some examples:


Keyer                                    Volts
K3                                         5.0 V
WA5BDU                             5.0 V   
Super CMOS II                    4.5 V
FT-991A                               3.3 V
Winkeyer 10                         5.0 V  
K3NG Arduino                    5.0 V


The "WA5BDU" is my Arduino keyer. I also tested the KX3 and the ATS-3 QRP transceiver and they were OK too.

Here's the menu which appears on the terminal screen:

WA5BDU Keyer Analyzer V1.0

Select:

   0 - Verify functionality
   1 - Timings, speed, ratios
   2 - Check Iambic & Ultimatic operation
   3 - Check Mode A or B
   4 - Check time for same element latch
   5 - Dot paddle open/close
   6 - Dash paddle open/close
   7 - Send PARIS for WPM
         * - Send serial port text

Here are some outputs from various requests from the menu:

Key Out idle state: HIGH
Dot length ms is 61
Dash length ms is 181
Space length ms is 61
1st dot length ms is 61
Speed: 19.7
Dot Ratio: 1.0
Dash Ratio: 3.0
Time to close TX line ms is 14
Time to get off paddle is 47
This is 77% of a space.
Speed using PARIS: 19.7


  The above are responses to menu items 1, 4 and 7.

Below is a table of results for various keyers I tested:

Keyer
Dot-R
Dash-R
Iambic
Mode
Latch wait
DLY to TX
WPM_20
WA5BDU
1.0
3.0
YES
B
53%
0 ms
19.7
WinKey 10
1.0
3.0
YES
A
98%
1 ms
**
Super CMOS II
1.0
3.0
YES
B
102%
9 ms
19.9
ATS-3
1.2
3.5
YES
B
98%
1 ms
19.3
FT-991A
1.0
3.0
YES
B
73%
17 ms
19.5
K3 (QSK)
1.0
3.0
YES
B
79%
121 ms
19.6
K3 (Semi)
1.1
3.1
YES
B
81%
13 ms
19.6
KX3 (Semi)
0.8
2.7
YES
B
76%
14 ms
20.8
K3NG Arduino
1.0
1.0
YES
B
102%
15 ms
19.9
K3NG U-Mode
1.0
3.0
NO
A
100%
15 ms
19.9
PK-Basic
1.0
2.9
YES
B
100%
6 ms
20

Below is my schematic for the keyer analyzer. There's not much to it until you add the circuit for sampling a transmitter's output.



So there it is. If you'd like to try it, an Arduino can be had for around $3 to $8 and my software is free to you. I've also written a manual for the thing with a great deal more detail. I've got the manual and the source code available in this shared Dropbox folder:

https://www.dropbox.com/sh/rsa4bb0ekdf69q0/AACfWsGcNrRTZgxEP4WOQyyAa?dl=0

I hope you enjoyed reading about it and possibly even trying it.

73,

Nick, WA5BDU

Friday, March 15, 2019

70 W eBay MOSFET HF Amplifier

I'd been working on my phasing receiver for about four years and decided it was time to team it with a TX section so I could make some QSOs and say "RIG HR IS HOMEBREW", a goal I'd had for some time. Not a QRP rig this time, but something in the 50 to 100 W range. I'd already taken a step in that direction by building a little Class E amplifier for 40 and 20 meters using three TO92 MOSFETs and supposed to produce 5 Watts out. (Lotsa luck on that ...) That could be my driver.

OK enough preliminaries. I read about the eBay amp on one of my ham mailing lists and I thought at the price, why not give it a shot?


I paid $18.57 ppd for it. It's said to be a class AB linear amplifier for SSB AM CW FM power amplifier for low-power radio power connection and suitable for FT-817 KX3 other small power stations.

It's basically a "bag-o-parts" and a circuit board. No schematic, no instructions. But you can find lots of stuff on the web, fortunately. Your fellow hams always helping out.



Here's what I got in the parcel from China. The board seems to have good quality. The parts look OK too - tubes for the one-turn transformer windings, ferrites, insulators for the TO220 parts, including shoulder washers.  And in my case, some SMT parts were pre-soldered. A nice bonus. The MOSFETs have had their part numbers removed. Ham community says IRF-530.

The board has some parts that you break out and use for the ends of the toroids, to solder the tubes that extend through the binocular balun holes to. This leaves two rectangular openings. The smaller ones are where the MOSFETs mount and bolt to the heat sink below. The larger one is where the big ferrite cores for the output transformer go. 

Finding some info ...

I found some very useful info on the web, including a YouTube video or two.

OE1CGS has some really good info, including a PDF he put together on the amplifier, some of which has been translated into English.

http://www.oe1cgs.at/50w-hf-verstaerker/

Finding a decent schematic can be difficult. You may find that some look good initially but lack sufficient resolution to read part numbers and values with confidence. I eventually did find a pretty good one.

Here's another good page on the amp, with measurements and good photos from DK9JC:

https://www.dk9jc.de/blog/equipment/142-diy-kits-70w-ssb-linear-hf-power-amplifier-ft-817-kx2-kx3

PD7MAA has more good info, Lowpass filter design info, a schematic and more good photos:

http://pa-11019.blogspot.com/2016/11/diy-kits-70w-ssb-linear-hf-power.html

Some discussion of the circuit ...

The circuit is fairly standard. It includes some frills like a regulator and pot to set the bias voltage / idling current. And a switch-around relay that feeds the antenna around the amp to the driver when 12 V is not applied, and through the amplifier when it is. There is a 2-pin header labeled PTT that when closed turns on a small PNP transistor which feeds the bias regulator and also feeds 12 V to the relay. The MOSFET drains are always connected to the 12 V line. I keep a shorting jumper across the PTT pins.

The MOSFETs have 150 ohm feedback resistors from drain to gate through blocking capacitors. Except mine were not 150 ohms as shown on the schematic. Was this a design decision, or did they just run out of 150 ohm resistors?  Who knows? Mine are 100 Ω. 

One thing that seemed to be something of a glaring omission was the lack of any kind of swamping resistors on the input to set a constant resistive load to the driver. I initially used my KX3 with ATU to try to get a good match but after reading comments and suggested resistor values from OE1CGS, I added the resistor (21 Ω). It's across the secondary of the input transformer. After that, my driver was looking at a much better SWR.

Some notes on building & testing ...

My building notes are exhaustive (tedious?) so I'll try to hit the high points. Of course, fit up the pieces and understand how they go together before soldering anything. The photos on various blogs I found to be helpful for that purpose. I copied some down to my own folder.

One thing to be careful of - the tabs of the two MOSFETs are head-to-head and there needs to be a gap between them or there will be a short. Keep that in mind. Maybe stick a little insulating shim like a piece of toothpick between them before soldering. 

And of course, the board is designed to sit on top of the heat sink and the MOSFETs bolt directly to it, with insulators. It's important to have full contact area and tight hardware. I think a few folks thought they'd test very briefly with no heat sink and blew their MOSFETs.

Since my board came with the voltage regulator components pre-mounted, I hooked up 12 V before putting anything else on the board and verified that it was working and that I could vary the voltage with the little pot.

After mounting all the parts, I wanted to set the bias. Even with no drive, I felt that I needed to hook up a load to the output in case of self-oscillation. Or maybe to prevent it. And 50 Ω across the input isn't a bad idea either. Another good safety practice might be a switch or hand key across the PTT pins in case the circuit runs away and you want to shut the bias off quickly.

The schematic shows 2.7 V bias. Most people find that too low. Adjusting it until the MOSFETs are carrying a little drain current is a good idea.

I tried various values of idling current, up to 120 mA or so, but eventually set on about 30 mA total current. The relay coil draws about 42 mA at 12 VDC, so subtract that off of the total reading from the supply. Or adjust bias to minimum, note the current, then increase until current increases by 30 mA. My bias voltage was 3.41 VDC at 30 mA total MOSFET current. Setting current higher might be OK but think about dissipation. 

For full power testing, a good dummy load is a good idea, since there's no SWR protection here. A way to monitor power - RF probe, power/SWR meter or oscilloscope is desirable.

A way to control the drive power is good too as gain varies on different bands. Maybe a 1 W output TX could be a good starting point. I think testing without an LPF into a dummy load is fine. Jumper across the LPF - using the supplied 0.1" pin headers.

I would not recommend going key down for longer than a few seconds, maybe 5 maximum until you know where you stand. I have a cheap Harbor Freight IR thermometer that I'd point at the transistor bodies and get a relative idea of how much they warmed up from a few seconds key down, and then to be sure they'd cooled down before doing another key down session. Feeling the heat sink is not a good way to see how things are going, in my opinion.


Some deviations in what was supplied and other info ...
  • MOSFET numbers are sanded off. Unknown P/N. I ordered 10 IRF530N from eBay.
  • Feedback power resistors are 100 Ω, not 150 Ω.
  • R1, R2 and R3 are 3900 Ω, not 10 kΩ.
  • R7 is 200 Ω, not 1 kΩ.
  • Pot VR1 (or VR3) not marked but measured and calculated as 785 Ω. Possibly a nominal 1 kΩ.
  • Some bloggers said adjust bias to 3.7 VDC, not 2.7 VDC. I used 3.41 VDC. It probably varies. With 3.7 VDC, my drain current "took off".

Results ...


With 1 W input:

BAND
SWR
WATTS
80
1.2
61.1
40
1.5
45
30
1.4
25.3
20
1.4
16.2


Of course I can get more power by increasing the drive on the higher bands. This is without a LPF, but I noted on 40 meters that power didn't decrease noticeably when I added the LPF.

On the air ...

So far I've just used it on 40. My Class E transmitter puts out too much power on 40 (4.2 W) and not enough (2.3 W) on 20!  So I built an attenuator for 40 meters to give 1.2 W drive. With that and a 13.0 VDC supply, I'm putting out a hair over 50 W. I'm a bit afraid to try for 70 W until I get more experience with it.

I lashed everything together with my homebrew phasing receiver, keyer and T/R switch and started making contacts. It's a lot of fun, as I expected. I've had some fairly long QSOs and some strings of contest QSOs with no performance issues. I put an antenna tuner in line and make sure the SWR is as flat as possible before transmitting.

BTW, the driver for the Class E section is my Si570 synthesizer, which also is used with the receiver. I had to add to the software to have it do the CW offset shift on key-down. I'll need other features (RIT, for example) shortly. But I'm getting off-topic ...

MOSFET failures ...

Everyone has them. I've had them twice. Once was cause by "human error" - I created a short with the lash-up of parallel resistors used for my 21 Ω swamping resistor. The second time it was simple over-heating, I think. Key-down too long and/or mounting hardware for the TO220 tabs not tight enough.



Here's a photo of it mounted on its over-sized heat sink, with LPF on the left and input attenuator below. The blue resistors are the feedback resistors. The gray ones in parallel with a smaller blue form the 21 Ω added swamping resistor. I hope to replace that with one properly sized resistor eventually.


Here's the schematic I downloaded from the PD7MAA site. It may not be hi-rez enough to build by as shown here, but I just want to give an overall view of the thing.

Some more about heat sinking and thermal issues ...

A large heat sink is a plus, but no matter how big yours is, a lot of heat has to flow through a small contact area to keep the MOSFETs from failing. Solid contact, good thermal conductivity through the insulator and adequate bolting force are necessary.

I was reading part 2 of WA2EBY’s popular MOSFET amplifier article in QST of April 1999. He noted that even with proper heat sinking techniques, his amplifier might exceed the maximum allowable temperature for the MOSFETs if it were held key-down for more than five seconds. However, he was able to send a string of continuous dits without overheating. So it's on the edge and if the duty cycle is kept withing typical ham CW/SSB values it will do OK.  I hope.

Final thoughts ...

Well, for my eighteen dollars and change, I think I got a decent little project and learning experience. I need to do more with it of course, and integrate it better into this theoretical transceiver I'm constructing.

Is it homebrew?  We worry about such things. Well - it's a nice board and bag of parts, but you get to find a schematic, fix a design flaw or two, build one or more LPFs, decide how to drive it, blow up some MOSFETs and learn from the experience.  So I guess it might qualify.