OK, I admit it: Drawing schematics is not among my favourite hobbies. 😉 But it’s a must if you run an amateur radio blog. 😉 Sadly, I sometimes make mistakes. And I appreciate that attentive readers sometimes find the things I’ve lost sight of. Two minor changes thus had to be made in the schematic of my portable handheld rig for 14 MHz: REF pins at the AD9835 are now connected correctly to ground and the ATMega328 is now correctly power supplied. Thanks to Hellmuth, DF7VX, for his annotations!
One of the main advantages when you replace an LC-controlled VFO by a DDS-System is, aside from frequency stability, the possibility to control your VFO(s) by software. When designing my handheld QRP-rig I intenionally left the 2 ports for RS232-communication at the ATMega328 unused.
I always had in mind that I might one day setup a computer control so that the radio can be controlled by a PC. This is handy when you use the rig as a station transceiver in your home shack.
OK, let’s go to the whole story. First the hardware.
This is an easy chapter: You just have to connect the TxD and RxD pins of the microcontroller to a level changer like the well-known MAX232 chip by Maxim. This one converts the 0..5 volts level of the Atmega328 to +/- 12V of a PC’s RS232 interface. Browse the web for applications, you will find a lot. This is my one:
Power supply of the interface is powered by the RS232 connector. No external supply is needed. Instead of line 7 (RTS) you can also use line 4 (DTR). That’s the hardware that is required.
Software consists of two parts. First we want to look at the program modules realized in the QRP-radio.
Programming the ATmega328 for communication with a PC
All ATmegas have got functionality for universal asynchronous receiver transmitter (UART, sometimes called USART if synchronous communication functions are also implemented). This device is capable of working a large variety of baud rates for universal serial communication.
UART has to be initialized for transmitting, receiving, for appropriate comm parameters etc. The respective function looks like this and has to be called before the first data exchange can take place:
The parameter uartval must be calculated by a given formula and sets the baud rate depending on clock speed used by the MUC. Here is an overview for all baud rates and lots of clock speeds. For 8 MHz clock speed and 19200 baud I use the value of 25.
uart_init(25); //19200 Baud
Note that the output pin TxD does not have to be configured as an output. This is automatically done when you use this pin for communication. Best practise is to call it in main() function before entering the infinite loop.
Next we want to see two subroutines that deal with transmitting signals. First one is just designed to send a single character. The second routine uses this one to transmit complete strings.
Making the UART receive
UART of ATmega328 has one register that stores any received value: The UDR0-register. This one can be read by polling the register regularly or by entering an interrupt (signal) routine that is only executed when a signal is received. The last choice is the way I prefer. If you want to do this, be sure that global interrupt flag is enabled by stating
at the beginning of your main() function!
Here ist the routine that reads the UDR0-register when a character is received. Two global variables are declared first:
char rx_buf ;
The first variable stores the received byte(s), the second one is a counter that is increased each time a character is received.
If there is a combination of CR and LF detected the received data will be checked what the user wants the software to do. Afterwards the receive buffer will be cleared. Two other functions are neccessary for this:
exec_command() uses the received characters to execute specific commands in the radio trasmitted by the user at the PC. clear_rx_buf() sets rx_buf variable to zero again and initializes the counter with 0.
How this function works:
Commands are combinations of two letters and maybe a parameter. If the first letter is an “S” a SET-command is performed. Something in the transceiver will be changed. If there is a “G”, a reading operation has been received and the requested data will be sent to the PC.
Examples: “SQ14256000” stands for “Set QRG 14.256 MHz”. “SVA” switches to internal VFOA of the radio (“Set VFO A“). “GF” is a “Get Frequency”-command and sends the frequency of the current VFO to the PC as a string. Therefore the function lng2str() has been created. This function manipulates a char-pointer given as a parameter to convert a numeric value to a *char pointer. Notice that therefore there is no return value. String data will be written to the given pointer adress.
These were the things neccessary in the radio’s software to ensure communication with a PC host. Now we want to examine the PC software.
The PC software for the computer aided tuning
The code is written in the very old version Visual Basic 5. VB is still functionable, by the way 😉 . And it is not very complicated. All that you have to do is to pass the codes for the desired functions to the radio via the serial port. For first tests I used a simple terminal program and typed the codes by hand.
The more comfortable things with my software are functions that make tuning, changing frequencies and above all DX-clustering, possible by just a click. The user interface is pretty simple:
A complete package in ZIP-file format can be downloadad from here. Please notice that the file is named qrpcat.zi_ due to the fact that ZIP extension are not allowed on the server. So please rename the file as qrpcat.zip before processing it!
I have to admit that I’m not the big enthusiast for clusters. I prefer to listen to the band. But it was interesting to achieve a direct transfer from a cluster reported frequency directly into the transceiver. Besides I learned a lot about the principles of these systems the last two days.
The basics first. In brief: DX-clusters form a worldwide net of servers exchanging data. This means that one DX station that is put into one cluster server is transferred immediately to the others. The servers use the TELNET protocol which is a simple text-only communication protocol. Therefore cluster messages are in text form.
In my Visual Basic application I use the WINSOCK-control to establish a communication between my computer and the cluster server.
WINSOCK is a universal control available in Microsoft Windows software (for VB and C++ as far as I know). The routines presented here are very simple and not 100% fool-proof. They are more for learning, even if they work well.
First thing you have do is to connect to a DX cluster. This requires a server name only. No password is neccessary for the one given in the server statement:
Private Sub cmdTNConnect_Click()
If wskTN.State = sckClosed Then wskTN.RemotePort = 23 wskTN.RemoteHost = "n7od.pentux.net" wskTN.Connect End If
It’s very simple and merely to show you how it works. There is no error checking because I don’t want to confuse you. Use a push button to activate the code!
Normally the cluster responds with a “welcome” message to this opening . By the end of the message you must enter your callsign. Use this function to transfer the requested data:
Private Sub cmdSendTN_Click() If wskTN.State = sckConnected Then wskTN.SendData txtSendTN & vbCrLf End If End Sub
txtSendTN is the text field the data is read from. Put your call in there! sckConnected is defined in a library and states that you are connected to the server.
So, this is all that had to be done to connect you to the server and to send some basic data. Now you just have to lean back and read the DX data that is transferred from the cluster host. To get this into a string variable, you have to use the DataArrival-method of the WINSOCK control. Some globals have to be declared first:
Global strTNRcvd As String
Private Sub wskTN_DataArrival(ByVal bytesTotal As Long) Dim strData As String Dim strResult As String wskTN.GetData strData strTNRcvd = strTNRcvd & strData If InStr(1, strData, vbCrLf) > 0 Then lstDX.Additem strTNRcvd strTNRcvd = "" End If End Sub
Instead of lstDX.Additem strTNRcvd just do something useful with the received information. In my software I filter the frequency (only stations on the 20 meter band are interesting for my radio), extract the callsign and put this combination into the list of favourites. Just load down the ZIP file and see on your own.
So, that is all so far about the project “The QRP transceiver goes software defined”. If you have any questions, don’t hesitate to mail me: peter.rachow(at)web.de.
73 and thanks for reading!
Recently I had a lot of new ideas for my QRP SSB handheld radio. When starting to program the first changes to my old software, I found out that the ATmega8 had become too small concerning flash size. The program became too large for 8kb memory size. The only thing I could do was to use another MCU that was PIN-compatible and did not require lots of code changes.
ATMEL has got the ATmega48, ATmega88, ATmega168, ATmega328(P)-series on the market. These are also, like the ATmega8, controllers packed in 28-pin-DIL-package. Above all, they are PIN-compatibel to the ATmega8. I decided to use an ATmega328 to update my radio. This MCU provides 32kB of FLASH memory which is more than enough for my application.
Some slight code alternations also had to be done, because some register names have been changed and the SLEEP-method had to be slightly revised. What I deeply regretted was the fact that I couldn’t use my old YAAP-ISP software anymore because it’s much too old and does not support this controller. But AVRDUDE works fine. These were the main obstacles that I had to deal with. After 2 or 3 hours of programming the software job was done. The ATmega328P does a perfect job in my transceiver. Full code will be presented by the end of this article.
Important: The ATmega328P reaches the customer with the factory setting of an 8MHz rate for its main clock. But there is a fuse that divides this clock rate by the factor of 8. This one is activated by factory also. So, your MCU performs like an old ATmega8 with factory default set if this fuse is not changed. Goto this website and find out the correct fuse settings for you MCU. AVRDUDE needs this command line to achieve the correct settings:
-U lfuse:w:0xe2:m -U hfuse:w:0xd9:m -U efuse:w:0xff:m
If you want to use my software for your own project, I will give you a brief description of how the software works and what features it has got (so far). So, first, here’s the completely revised schematic of the transceiver. You are particulary recommended to have a closer look at the AD9835/ATmega328 VFO unit!
Major modifcations: I now use a debouncing circuit for the 5 switches that the operator uses to control the radio. Some MCU ports have been changed compared with older versions of the radio. Some switches have got multiple functions now depending on which part of the software/menu you are currently using.
Watch this picture:
The controls are:
VFO: You can now select from 12 VFOs. Pressing this button switches to the next VFO in rising order. Once you’ve reached the last VFO the run starts with VFOA again.
FUNC: Leads you to a set of submenus where you can
- store a frequency to the current VFO
- SCAN the band starting from the current frequency either up or down (tuning step ist the last step that you used when tuning)
- SCAN the VFOs with possibiliy to skip any VFO during the scan isperformed
- Put the MCU into SLEEP-mode to reduce noise to a maximum
STEP: Sets the tuning step (1, 5, 10, 50, 100, 500, 1000, 5000 Hz). 10Hz tuning step is restored 1 second after the last tuning is finished.
Tune UP/DOWN lets you alter the frequency according to current tuning step.
Let’s go into the FUNC menu. After pressing this button you are asked if you want to store the current frequency to the current VFO:
Saving a frequency into a VFO storage place
“STOR A?” means that you can save the frequency displayed to VFOA. Just press the “STEP (Y)” button. If you don’t want to to do this, press “FUNC (N)” which is read as “NO”.
Scanning the band
Next question is “SCN QRG?”. “SCN” abbrieviates “SCAN”. If you press now either the UP or DOWN button the scan starts. Tuning step applied is the last step that you’ve set before you entered this function. The reset that is automatically performed to 10Hz tuning shift will not affect the tuning step since it has not been manually set. If you don’t want to scan, just press “FUNC (N)”.
Scanning the VFOs
Afterwards you can go to a scanning procedure thru the VFOs. Answering “SCN VFO?” with “yes” will scan each VFO and leave the receiving frequency set for 4 seconds until the next VFO is switched. If you want a certain VFO to be skipped (e. g. if there is noise or an unwanted station), just press the”VFO”-button while the VFO is active. In the next round this VFO will be ignored.
The software allows you to choose different frequencies for transmit and receive. In other words: You can work split with this radio.
The receiving frequency alway is that of the VFO currently used. The transmit frequency can be selected with this function.
“Split?” must be answered with the “STEP (Y)”-button if you wish to activate this option. In the next step you must select a VFO that you want to use as transmit frequency. Use UP or DOWN-key to alter the selected VFO. Confirm your choice with the “STEP (Y)”-button. If you wish to abort, press “FUNC (N)”.
If you want to switch off SPLIT-mode enter the FUNC-Menu again. Select “Split” and then, when asked to select the TX VFO, press “FUNC (N)”.
Ultimate noise reduction: Putting the MCU to sleep
Last question is if you want to put the MCU to SLEEPMODE. Even if the MCU does not produce any disturbing noise (at least in my rig) it can be uesful to switch the off completely. Answer the respective question with”STEP (Y)” the MCU is now switched off. Pressing either UP or DOWN tuning button will wake up the MCU again.
So, here’s the latest version of my code. See you soon and thanks for reading. 73 de Peter (DK7IH)
When I started to recognize that going outside with a small handheld QRP SSB transceiver for the 20 meter band is more than just a test to find out doesn’t work at all, I conceived a more rugged mounting for the partable rod antenna. Due to the fact that this antenna (which now is about 220 centimeters long) exerts significant leverage to the BNC connector and thus to the cabinet of my transceiver. After 3 or 4 periods of outdoor usage I found that it had cut the front panel with the BNC socket from the transceiver’s inner cabinet frame. F…! (F…-word censored!)
The objective of a practical solution was to keep away excessive leverage force from the transceiver. The most practical way to solve this problem was to construct a simple mounting frame that could bear the force without leading it to the radio:
The holder is made of 0.8 mm Aluminium in u-shaped form where the radio fits in. The rig’s cabinet screws hinder the TRX from falling outside, a Velcro® strip fixes the radio inside the frame. On the backside of the frame I’ve attached a piece of aluminium pipe where the base of the antenna fits in. That’s all:
Easy and practical. That’s the way it’s got to be!
Annotation: I once again revised the antenna. The matching circuit was abolished. I now simply use a larger coil of about 55 turns of 1 mm diameter enameled wire on an 8.5 mm diameter PVC rod. Works great. Standing wave ratio is 1.1 to 1! 😉
73 de Peter (DK7IH)
(C) 2015 by Peter Rachow
Recently I have revised the rod antenna for my handheld QRP SBB transceiver. The main objective was to simplify the matching circuit. As I’ve pointed out before in the antenna article, one of the major problems with shortened antennas is the low feed point impedance. The first version of the antenna matcher used a capacitor and a coil to form part of a PI-filter. This new circuit uses an autotransformer made of a linear coil.
The tap is at about 1/4th of the total windings which transforms the feed point impedance of about 10 ohms to the coxial cable with 50 ohms. A 5 meter wire acting as the second part of the dipole should be used to increase performance of the rod antenna. All dimension concerning antenna length have remained unaltered, please see respective article!
For my handheld QRP transceiver I have developed a rod antenna for outdoor use when cycling or hiking. In this article I’ll first give the reader some basic considerations on shortened antennas and afterwards the pracital consequences of these.
A full-sized vertical antenna usually has got a length of a quarter wavelength. Some special constructions of a 1/2, 5/8 wavelength and others are also commonly known. But for a rod antenna the basic construction is a 1/4 wavelength based circuit. Full-size 1/4 wavelength antennas that have the correct length (1/4 multiplied by 0.95 shortening factor) have got a feed point impedance of between 40 to 50 ohms. So they can be directly connected to a 50 ohm coaxial cable. The problem: For 14 MHz this antenna would have an overall length of about 5 meters. Not very appropriate for a handheld transceiver except you were Arnold Schwarzenegger.. 😉
When the mechanical length of an antenna is shorter than 1/4 of the wavelength that it is desired for, a mismatch can be obeserved. The antenna not longer is resonant to the operating frequency. An additional capacitive reactance appears. This must be compensated by an inductive reactance. Therefore shortened antennas have an integrated coil either at the bottom (bottom loading coil), anywhere in the middle (center loading coil) or top (top loading coil).
Another problem must be faced: Feed point impedance is usually much lower than for a full size antenna. Sometimes only between 10 and 15 ohms. Thus some sort of impedance matching circuit must be integrated, too,
Last, degree of effiency will also decrease. So, don’t expect too much from a shortened antenna!
To sum up the things that have been mentioned before: We have to face 2 general electrical problems with short antennas:
- A correct loading coil must be found, and
- proper impedance matching must be performed.
Into my antenna I integrated 2 loading coils. One at the bottom to serve as an impedance matcher and one slightly below the center to compensate capacitive reactance.
The antenna is mounted to a standard male BNC-connector.
Mechanical deimensions and coil data:
Bottom coil (L2):
L2, the bottom coil, is 50 turns of 1 mm diameter enameled wire wound on a 8mm diameter plastc tubing from the local hardware store. From the bottom end of L2 a 120 pF capacitor is lead to the ground potential of the BNC plug. This, together with L2 sets up low pass filter serving as an impedance matcher.
Edit: Another impedance matching circuit I’ve described here.
The plastic tubing used for L1 and L2 is hollow. Into this tubing a 6mm diameter aluminium rod fits in exactly. The length of the rod between the two coils is 45 cm. Following is another piece of the plastic tubing carriyng L1.
Center coil (L1): L1 is 45 windings of 0.6 mm diameter enameled wire.
The top rod of the antenna is a telescopic antenna with an overall length of 120 cm that can be bought on the internet. It’s outer diameter is also 6 mm, so it also fits into the plastic rod.
Here are the pictures to make clearer how the antenna is constructed:
To increase the usually low degree of efficiency of such an antenna I have manufactured a sort of “counterpoise” that represents the 2nd part of a dipole : A 5 meter long insulated cable with a large crocodile clip that is clipped to the ground potential of the metal BNC connector.
Edit: In the meanwhile I have used this rod antenna for 14 MHz / 20 meters several times during outdoor activities. What I’d never have believed: I could make lots of QSOs with it! Particularly if you are in a high place (e. g. on a look-out) you can work distances of about 1000 to 3000 kilometers right with 4 watts out of your hands. Provided the station you’re answering is strong. Then there is a realistic chance that he might hear you with reasonable signal strengh.
by Peter Rachow (DK7IH) => Zur deutschen Version dieses Artikels
Notice: Read about the software for this DDS-controlled transceiver here:
I have really been satisfied with my last QRP SSB rig. It performs very fine. But I wanted a transceiver still a little bit smaller. And it should be easier to set up the rig if you are outside to make quick QSOs. This and the fact that I came across a larger bunch of 9.832 MHz crystals which I thought could be an ideal basis for a ladder filter made me plan an even more compact rig for 20 m compared to the last one. Particularly for portable operation on holiday or when I am outdoor with my bicycle or hiking, I wanted a self-containing transceiver with on-board battery. So here it is…
- Monoband SSB-Transceiver for 20 Meters/14 MHz.
- Output: 4 to 5 Watts PEP
- Frequency generation: DDS with AD9835 and ATMega8, LCD 2×8 Characters.
- Transmitter: SSB Modulator for USB or LSB: NE602/SA612, 4-Pole-Ladder-Filter, TX-Mixer, NE602/SA612, Power amplifer: 3 stages, push-pull-final with 2 x 2SC2078.
- Receiver: Singe conversion superhet, RF preamp with Dual-Gate MOSFET, RX-Mixer with NE602/SA612, 4-Pole-Ladder-Filter, Passive product detector, AF preamp, AF final amp with LM386. (See improved AGC circuit here!)
- Built-in battery pack, also connectable to external power supply, 10-LED-bargraph-display for S and RF strength readout.
The size is about that of those older CB handhelds from the late 70s. It is abt. 18 cm long, 7 cm wide and 4.5 cm high. But don’ ask me for weight. 😉
The transceiver has, as mentioned before, a power output of 4 to 5 watts rf pep which I found sufficient for making contacts worldwide. Transmit power mainly depends on the respective power supply you use. The radio can be run either on an integrated 12 V dc rechargeable battery (1Ah, composed of 10 AAA cells) or by connecting an external dc power supply of up to 14 volts. A three-position switch allows the user to select either internal or external power supply or completely switch the rig off.
Thus the little radio is very versatile for all kinds of portable operation. The antenna is connected via a standard bnc connector. I also designed a rod antenna that you can use if there is no possibility to erect a larger aerial. I have to admit that having a qso with the small handheld antenna ist a pretty ambitious. 😉 But in recent “The King of Spain”-Contest I could work with the rod antenna from a high place over a dozen stations.
With my delta loop the rig is absolutely amazing. During the recent weeks I worked (among others) the following prefixes:
SM, EA, F, 9A, 4X, LZ, I, SV9, J79, J49, JW9, S56, CY0, P40, G, YO, OH, W1, UA9, TA, PA, S57, GU, EK3, OX
And this all was done, except from the contact to P40FN, with 4 to 5 watts pep. Only for the QSO to Aruba I had to use the 60 watt linear amplifier. The pile-up was too hard. 😉
Basic design ideas:
To make the rig not too bulky I used a “sandwich construction” in an aluminium frame. The radio mainly consists of three layers:
- The RF and AF unit (mainboard)
- The battery-, AGC/Meter- and switching unit
- The display and push-button unit
The RF unit:
On board here you can find the DDS-VFO, the whole receiver and transmitter circuits (including power amp), SSB modulator and demodulator.
The battery and AGC/Meter and switching unit:
This board is equipped with a set of 10 rechargeable batteries (1.2 volts each), the relay for transmit/receive switching and the LED-S/RF-meter circuit (LM3915) plus the AGC device. Above this section there is another layer which keeps the 2×8 line LCD, the up/down control switches for tuning (there is no rotator tuning knob), a button for setting the tuning frequency step, selecting the VFO (4 VFOs and 2 split VFOs are software defined) etc. It is integrated in an extra housing mounted on top of the cabinet an connected via some cables. The controls are simple push-buttons. With one of these the microcontroller can be set into sleepmode to reduce the radio’s noise down to a minimum. The 1 inch loudspeaker is also mounted in here.
The circuitry itself is standard QRP design with the “usual suspects”. See the schematic to learn more:
The front panel looks like this:
Details are to be discussed in my next posting on this blog. Thanks for watching! 73 de Peter (DK7IH)
(C) 2015 Peter Rachow