Decoding time station signals (DCF77 etc.) with a microcontroller

By Peter Baier (DK7IH)

Abstract

This article shows how to apply a off-the-shelf time signal receiver to a microcontroller, refers about the signal coding and describes the necessary software written in “embedded C”.

Hardware

Receiver modules are available through various vendors on the internet, a respective search pattern could be this one.

Time signal transmitters

In the LF bands there are a handful (at least) of stations available that provide a standardized time signal based on the time markers produced by high accuracy atomic clocks. In central Europe DCF77 is the a well known time signal station for radio controlled clocks and watches.

The call sign “DCF77” originates from “D” which is for “Deutschland” (Germany), “C” stands for LF and “F” is for the proximity for Frankfurt/Main. DCF77’s output power is about 50kW of which about 30kW are transmitted into the atmosphere. You can see the station’s facilities on Google Maps.

Other transmitters are sited in the UK, USA, Japan etc:

  • DCF77 (Germany) in Mainflingen in Hessen
  • MSF (UK) in Anthorn
  • JJY (Japan)
  • WWV (USA) in Fort Collins, Colorado
  • WWVH (USA) in Hawaii
  • BPC (China) in Shangqiu (Source)

DCF77 is intended for reception within a range of max. 2000km, thus it covers most of the central of Europe. Ground wave propagation is possible within a radius of about 600km from Frankfurt, sky wave might reach up to between 2000 to 2500km. But even greater distances occasionally have been reported.

Other stations transmit on lower frequencies, MSF for example (from Northern England) on 60 kHz. Some of the off-the-shelf available receiver modules are capable of alternating the reception frequency by soldering the on-board clock crystal (32768 kHz) to another terminal on the PCB.

Signal structure of DCF77

DCF77 uses amplitude modulation (AM). The signals amplitude is reduced down to about 15% of its nominal power thus defining 2 different states:

  • Full amplitude
  • Reduced amplitude

Therefore binary information can be coded. Usually with the off-the-shelf receivers available on the market you will find a “low” signal when the transmitters amplitude is “high” and vice versa. Every second one pulse is transmitted. There is one exception: The last second of every minute this pulse is cancelled marking the beginning of the next minute. A pulse’s length defines the “1” or “0” state of the respective bit. This makes the signal that you can see with the receivers output pin:

DCF77 signal structure a handed over by the receiver
DCF77 signal structure as put out by the receiver

This receiver output makes decoding easy because this output signal can be fed directly to a digital pin of the microcontroller.

As mentioned before, the gap (missing bit 59) between bit 58 and bit 0 is the marker for a new minute to start. If pause length is longer than, let’s say 1200ms, you can deduce the next minute is starting right now. The transmitter always transmits the following minute, so if you have read 58 bits completely, this represents the data of the current minute.

The single bits have got the following representations:

DCF77 bit coding
DCF77 bit coding

There are two “weird” things to be mentioned:

  • Where a two-digit number has to be transmitted, the decade comes first, then the unity position follows, each of them binary coded. Both digits thus are transmitted individually!
  • Byte order is LSB first!

The Software

The code is written in “Embedded C” (GNU CC)  and can be downloaded from my Github repo.

Algorithms

Timing and measuring pulse length

For this software, where time lapse decoding is applied, precise timing is mandatory. This software uses an ATmega8-MCU clocked with an external oscillator (crystal) f=16MHz. There is an interrupt routine that increases a counter every millisecond so the the duration of a pulse can be measured precisely.

Timer setup for the ATmega8 (f.clock=16MHz) for a 1ms counter rate:

//Timer 2 as counter for 1 millisecond fclock = 8MHz
OCR2 = 62;
TCCR2 |= (1 << WGM21); // Set to CTC Mode
TIMSK |= (1 << OCIE2); //Set interrupt on compare match
TCCR2 |= (1 << CS21)|(1 << CS22); // set prescaler to 256

Timer 2 (an 8-Bit timer) is used in CTC (Clear Timer on Compare Mode). OCR2 register defines the maximum value in the timer register. The timer increase per time unit is defined by the prescaler in TCCR2, dividing clock rate by 256 in this case. With a system clock of 16.000.000/s divided by 256 the timer is theoretically increased 62500 times per second. When counting to 62 this is done in about 0.00099 seconds which is equivalent nearly to 1ms. This degree of precision is suffice for what we intend to do.

If the value of 62 has been reached, an interrupt is triggered and the respective interrupt service routine is called once. This routine increases a milliseconds counter by one:

ISR (TIMER2_COMP_vect)
{
    ms++; 
}

With this setting it is possible to decode the timing of the incoming signals very exactly. This is done inside a loop structure, first the loop waits for a pause of a length to be measured. Afterwards, when a bit present, the software takes the “hi”- time of the pulse an decides if this represents a “1” or a “0”.

First all the 58 bits are recorded and stored into an integer array of appropriate length, later the parity checks are performed to estimate the likelihood of a valid signal. With this very simple kind of check it it absolutely possible that there is a faulty result that could not be detected.

Parity checking

A simple way of checking plausibility of data is included by doing a parity check:

int get_parity(int b[], int sta, int end)
{
    int t0, n = 0;

    for(t0 = sta; t0 < end + 1; t0++)
    {
        if(b[t0])
        {
            n++;
        } 
    }

    if((n / 2) * 2 == n)
    {
        return 0; //even parity
    }
    else 
    {
        return 1; //odd parity
    }
}



The number of “1”s in a specific part of the data stream, defined by “start” and “end” are counted. If the number is even, the function returns “0” which stands for “Even parity” and vice versa.

If you need higher security for error-free receive operation, plausibility checks should also be included. In my software, because I live about 150km from Frankfurt and therefore have sufficient field strength all over the day and night, I did not apply functions for enhanced error checking.

The receiver’s signal subsequently is fed into PB0 port, a LED connected to PD0 provides an optical indicator if the signal level is OK. You should see a 1 second clock rate here with pulses of two different lengths.

The software takes advantage an OLED display with TWI connection (SDA, SCL) and uses SH1106-chipset/driver to display all the data on screen:

With this OLED it is a good idea to dislocate the antenna from the display a little bit and use a parallel electrolytic capacitor for the VDD/GND connection of the display because the electromagnetic noise generated by the OLED can disturb the receiver. BTW: The angle between the antenna and the station that you are going to receive should be approx. 90°.

Thanks for watching!

Peter (DK7IH)

A 433MHz RC unit for large scale model train locos (RFM12B)

by Peter Baier (DK7IH)

After years of indoor model-railroading I have started building a medium-sized garden railroad this spring after having completely redesigned our garden by removing trees and therefore getting space for the railroad layout. Normally model trains are track-powerd. For outdoor operation this is not the best idea because due to weathering tracks’ metal surface (usually made from brass) covers with oxide and needs regular cleaning before operation.

An alternative to avoid conductivity problems is for example using live steam locos. If you additionally want to run diesel model locos, electrical power is the best idea since there are no so small working diesel engines.

Abstract

The following article describes a radio control unit that can control an electrically powered large scale model loco. It uses ready made breakout board containing ISM rf modules with a lot of built in functions. One of them is the RFM12B made by HOPE RF electronics in this case operating on the 433MHz ISM radio frequency band. Other bands (395, 868, 915 MHz) are possible by choosing an appropriate version of the module. Also a fully working software in “embedded C” code is supplied, programmed particularly for AVR microcontrollers.

Multiple locos can be addressed by choosing a respective ID byte in transmitted string.

The RFM12B

RFM12B is a ready made break out module that carries an Si4421 chip by SiliconLabs. It is available either for 315, 433, 868 and 915 MHz operation. VDD is 3.6V max., 3V is recommended by the manufacturer. The unit can work either as a transmitter or a receiver. Configuration is done by software.

Hardware

The PC boards for the various radio frequency bands are the same, the only difference is found in the output filters. These are tuned for the respective band the module has been designed for. The RFM12B is about being sold out, the successor is called RFM69CW which is pin compatible but software has to be altered slightly.

There are (or have been) two versions available: An SMD type board (2mm pitch) and a DIP board (2.54mm/1″ pitch):

Source: HopeRF datasheet

The Basics

The RFM12B supports two major modes of operation:

  • High level data communication using a FIFO (first in-first out) function block included in the chip’s MCU.
  • An FSK mode that can be used to transfer digital “raw” data.

For this RC circuit I have used the FSK mode together with the UART series communication module integrated in the AVR controller.

Loco motor is driven by a pulse-width-modulation (PWM) circuit whose signal is  derived from one of the ATmega’s PWM output (OCR1A). A 2-stage driver made from simple NPN-transistors powers the electrical engine. Power MOS-FETs are not an alternative here instead you use types that provide full power through Source-Drain even with lo Gate voltage (3.3V approx.).

How the RFM12B communicates with your micro (MCU)

The communication between internal Si4421 and external microcontroller is established via an SPI interface. You can either use the integrated functions from the MCU that you have at hand (I am using AVR controllers, here an ATmega328P is applied), or you can write your own code for a simple SPI interface. If you use internal SPI functions within the AVR controller, keep in mind that this mainly is an 8-bit communication structure wheres with the RFM12B you need 16-bit (or more) transfer. This my solution:

int spi_send_word(unsigned short txdata)
{
  int t1 = 0;
  int r = 0;

  PORTD &= ~(NSEL);
  _delay_us(TWAIT); 

  //Send ID byte to define register
  for(t1 = 15; t1 >= 0; t1--)
  {
        PORTD &= ~(SCK); 
        _delay_us(TWAIT);

        if((1 << t1) & txdata)
        {
            PORTD |= SDI; 
        }
        else
        {
            PORTD &= ~(SDI);
        }
        _delay_us(TWAIT); 

        PORTD |= SCK; 
        _delay_us(TWAIT); 

        if(PIND & SDO)
        { 
            r += (1 << t1);
        } 
        PORTD &= ~(SCK); 
        _delay_us(TWAIT); 
    }
    PORTD |= NSEL; 
    return r;
}

The data format used for exchanging data between the MCUs is not very complicated. In most cases 16 bits of data have to be transferred via the four SPI lines. The first bits (varying from command to command) are a CMD  identification sequence, the remaining bits are intended for further specification of the respective command. See datasheet for details!

SPI uses 4 lines. These lines are:

  • nSEL: Active low for marking ongoing SPI communication
  • SCK: SPI clock signal, lo to hi when data is present
  • SDI: Data from External MCU to RFM12B
  • SDO: Data received from RFM12B

The remaining line applied is the FSK/DATA/nFFS line, that transfers “raw” data exchanged between the two boards.

The timing diagram is SPI standard:

Software

For using the RFM12B ISM TRX module an initialization sequence is required. For the special purpose of this project this is:

 //Init Si4421
spi_send_word(0x8017); //NO FIFO => !EL,!EF,433band,12.0pF (1. Configuration Setting Command)
spi_send_word(0x8239); // !er,!ebb,ET,ES,EX,!eb,!ew,DC, FIFO (2. Power Management Command)
spi_send_word(0xA640); //434MHz freq. definition (n=1600) (3. Frequency Setting Command)
spi_send_word(0xC647); //4.8kbps (4. Data Rate Command)
spi_send_word(0x94A0); //VDI,FAST,134kHz,0dBm,-103dBm (5. Receiver Control Command)
spi_send_word(0xC2AC); //AL,!ml,DIG,DQD4 (6. Data Filter Command)
spi_send_word(0xC483); //@PWR,NO RSTRIC,!st,!fi,OE,EN (10. AFC Command) 
spi_send_word(0x9820); // !mp,45kHz,MAX OUT*/ (11. TX Configuration Control Command)
spi_send_word(0xCC77); //OB1,OB0, LPX,!ddy,DDIT,BW0 (12. PLL Setting Command)
spi_send_word(0xE000); //NOT USED (14. Wake-Up Timer Command)
spi_send_word(0xC800); //NOT USED (15. Low Duty-Cycle Command)
spi_send_word(0xC040); //1.66MHz,2.2V (16. Low Battery Detector and Microcontroller Clock Divider Command) 

_delay_ms(500);
spi_send_word(0x8208); // Turn on crystal
rfm12b_setfreq((433.92-430.0)/0.0025);
rfm12b_setbandwidth(4, 1, 4); // 200kHz band width, -6dB gain, DRSSI threshold: -79dBm 
rfm12b_setbaud(19200); // 19200 baud
rfm12b_setpower(4, 6); // 1mW output power, 120kHz frequency shift

The full code can be loaded down from my Github repositry.

For defining transmitter or receiver in a specific application some lines more of code are required, you can find the in the code on my Github repo. (See “Software section” in this post later!)

Multiple receivers with one transmitter

This RC system allows up to 26 different receivers to be controlled with one transmitter. This is due to the data format used. Codes are transmitted as ASCII strings with binary data for start (Chr(2)), end (Chr(3)) and checksum of the transferred string.

Example: A string can look like this:

[2]A S=128[cs][3]
  • [2] binary 2 marks the begin
  • “A” determines the loco ID in the range A…Z
  • “S=” sets the Speed
  • “128” is the respective numeric value coded in ASCII (range 0..255)
  • [cs] is a one byte value (binary) representing the checksum
  • [3] binary 3 marks the end of the string

The Receiver

For both, transmitter and receiver, the schematic is nearly the same. We start with the receiver unit:

The RFM12B is connected via the 4 SPI lines to the MCU. The outputs are:

  • The PWM out (OCR1A)
  • A relay for forward/reverse operation of the loco
  • A LED that indicates reception of a valid signal

There is an OLED display that can be ignored when the unit works fine. During development I have displayed data with that unit to check if all the functions are OK. You don’t need it for your loco instead you want the driver to watch TV when driving the machine. 😉

The circuit is equipped with a 4.8V battery pack that powers the loco’s motor and the circuit. Due to the fact that the digital equipment is restricted to 3.6 V max. voltage, this is decreased by a 3V or 3.3 V voltage regulator.

An antenna of appropriate length (about 17cm, 5 inches for 433MHZ ISM band usage) is required for maximum range.

The Transmitter

The circuit differs from the receiver’s slightly. No motor driver is installed, instead a linear variable resistor for speed control has been integrated:

The speed controller operates “center off”, the necessary calculations are done in the receiver when decoding the speed setting which is a numeric variable (n) between 0 and 255. If you have the controller in center position (n=128) the loco stops.

As you can see the UART lines RxD and TXD match to the FSK line of the RFM12B board respectively.

Software

The software is written in “embedded C” using the GNU CC for AVR microcontrollers. All necessary functions are included in one file. The code consists of two parts of C source, one for the transmitter and one for the receiver unit. You can access these on my Github repo:

https://github.com/DK7IH/433MHz_ISM_RC

The software also includes error checking and fail-safe routines. A checksum is built up from transferred data and in case of error (signal loss or heavy radio interference) the loco’s motor is stopped immediately.

Hints

The receiver is very sensitive to interference caused by the motor brushes. Thus a radio frequency blocking capacitor is mandatory very close to the motor. Even if there is error checking capability in the software, a severe amount of interfering noise can reduce range substantially. If problems persist it is also recommended to add two radio frequency chokes in series very close to the motor’s terminals which will eventually solve the problem. As I found out, the amount of noise is very much depending on the motor model you have in use. Thus, experimenting a little bit might be necessary if you have the possibility to do so which mainly should apply with scratch-built locos.

Happy running! 🙂

Vy 73 de Peter (DK7IH)

 

 

 

A mid-power portable/handheld SSB transceiver for 14MHz

Chapter 1: General design and oscillator circuits (This posting)

Chapter 2: Receiver (coming soon)

Chapter 3: Transmitter (coming soon)

Chapter 4: Cabinet, frequency counter, antenna etc. (coming soon)

Chapter 5: Final remakrs (coming soon)

This radio also is some sort of “rebuilt”.  in 2015 I developed a handheld transceiver with about 5 watts of output power capable for use in the 20-meter-band (Link). The idea was great for hiking, traveling and cycling tours. But the output power was slightly inferior particularly when using a shortened rod antenna. Also was the battery pack too small to provide sufficient energy for longer operation. These shortcomings had to be overcome because spring and summer season are approaching and I intend doing much outdoor activities in upcoming warmer weather conditions.

The design thus had to meet the following requirements:

  • Output power set in the range of 10 to 20 watts pep.
  • Powered by rechargeable batteries of sufficient capacity
  • Size must be as compact as possible under the given technical data mentioned before
  • The rig has to provide a rugged design for outdoor and field use.
  • An antenna holder should be integrated into the cabinet to enable the operator to use a rod antenna in the field.

These expectations lead to the following design guidelines:

  1. Four stage transmitter with driver and final stage in push-pull mode.
  2. A set of 11 nickel-metal-hydride solderable AA cells with the possibility to charge while mounted in the radio (no need to open cabinet for recharging process).
  3. Size of about a vintage CB hand held transceiver of the 70s.
  4. Construction made of aluminum sheet metal and aluminum bars (equal leg structural angle).

For energy saving purposes I decided not to use any microcontroller or digital equipment. The radio is based completely on analog technology except from a ready made frequency counter purchased in the late 80s in the last century. The  counter has been added because the main oscillator (VFO) is varactor tuned and this does not allow to use a simple frequency readout that would be possible when using (for example) a vernier reduction drive.

Mid-power SSB transceiver for 14MHz - DK7IH 2021
Mid-power SSB transceiver for 14MHz – DK7IH 2021
Mid-power SSB transceiver for 14MHz - DK7IH 2021
Mid-power SSB transceiver for 14MHz – DK7IH 2021

The Oscillators

This time we will start with the oscillator sections. As standrd with radios that use one interfrequency we use 2 oscillator: A VFO for main tuning and an LO for providing interfrequency range signals to produce SSB signal for transmit mode and to demodulate received signals.

The VFO

I am running out of vernier drives. 😉 Two most practical main solutions that remain for setting the frequency in a VFO are either a permeabiilty tuning (by inserting some ferro- or diamagnetic metal into the coil and thus changing inductance) or by making use of a varactor. Because the first method involves a lot of mechanical challenges to ensure stable operation and therefore has been considered not being achiveale the decicion was to use a varactor tuned VFO.

The VFO is Colpitts type:

Varactor tuned VFO 5 to 5.35 MHz - DK7IH 2021
Varactor tuned VFO 5 to 5.35 MHz – DK7IH 2021

Design hints:

  1. Main coil is made of 50 turns of 0.2mm enameled wire on a T-37-2 toroidal core. I used the Colpitts design this time because without a tapped coil (as required for the Hartley design) experimenting is easier when to determine the exact number of turns.
  2. The varactor is a MV104 type (purchased via ebay). This one is used as tuning device in AM radios or so and works fine because it provides high capacity swing with low DC voltage span.
  3. The “fine art” of building this oscillator is to spread the 10 turns of the helipot so exactly that the full band from 5.00 to 5.35 MHz is coveren and wasting any space (except from 1 or 2 kHz for each edge) is avoided. The possibilities you have are modifying the two resistors (2.2k and 150 ohms), changing the number of turns in the coil ans, at last, changing the capacitors (27pF) and setting the trimmer value properly at last.
  4. Fixed capacitors in the first stage of the VFO should be polystyrene (best choice) or NP0. Polystyrene caps, according to my findings, inherit contrary temperature coefficient compared to the material of the coil (iron powder), therefore excellent frequency stability of this oscillator is achieved. In practical the oscillator needs 1 or 2 minutes to warm up and subsequently drifts with some 10 kHz per hour.

To my consideration it is not necessary to install the VFO into a separate cabinet or shielding because it is, as mentioned before, absolutely stable concerning frequency. But, as you guys all know, it is not the best idea to place it right next to the final RF amplifier stage ;-).

The Local Oscillator

This oscillator also is a Colpitts one. Two crystals (9001.5 kHz and 8998.5kHz) are switched by a two position switch in the front panel. The oscillator is followed by 1 amplifier stage putting out about 1 Vpp.

Local oscillator - DK7IH 2021
Local oscillator – DK7IH 2021

(To be continued…)

Thanks for watching! Peter (DK7IH)

 

Revising the “Lean Design Transceiver”

 

Front panel view of "Lean Design Transceiver" Ver. 2 by DK7IH
Front panel view of “Lean Design Transceiver” Ver. 2 by DK7IH

The “Lean Design Transceiver” has been a project to build a simplified but effective 100% analog SSB QRP transceiver with minimum effort. The radio worked fine but there is never anything that can not be improved.

So, this transceiver, originally built in 2018, also has been scheduled for a revision. The problems were minor,  mainly on the mechanical side of the design. I have then used a veroboard to connect the front and the rear panel. Later I found this to be inferior under the aspect of ruggedness particularly for a VFO-controlled radio because of problems concerning mechanical stability. Now there is a 2mm aluminum plate carrying the circuit boards which makes the rig much more withstanding to mechanical forces.

Mainly the transmitter section also had to undergo certain changes. The previous version contained a 3-stage amplifier with 4 watts PEP output, I decided to switch to a 4-stage design with about 10 Watts PEP out. To save space for this the new concept the radio has been designed using SMD parts where ever possible.

Last, the basic design using the two NE612 mixers either for receive or transmit mode has been perpetuated. But the switching from RX to TX mode now has been transferred from formerly using two relays for reversing the signal path to one relay changing signals (VFO and LO) at the mixers and simultaneously keeping signal path direction.

The VFO also has been simplified, now it is one oscillator-stage and one buffer amplifier.

Reused have been front and rear panel, cabinet, Vernierdrive and other non-crucial components.

The circuit (Click for full size!):

Circuit explanation

Mixer 1, the SSB-Filter, the IF amplifier and mixer 2 make up the core of the radio. Mixer 1 is either receiver mixer or the double sideband generator (DSB), mixer 2 serves as product detector or transmit mixer. Mixer 1 also has been equipped with a circuit for optimizing carrier suppression. With optimized settings of the LO frequency and the 10k pot carrier in best position carrier suppression will be in the range of 45 to 50 dB.

The newly introduced signal relay supplies the VFO and the LO signals to the appropriate mixer depending on wether the radio is currently in receive or transmit operation. In comparison to the previous design this step saved the use of 1 relay.

The IF amplifier has been integrated into the AGC supply voltage chain. When in receive mode the AGC is variable depending on the input signal from the product detector (as well as the rx preamp stage). Rx gain swing in the range of 50 to 60 dB which can cope even with very strong signals. On transmit there it is always on full AGC voltage supplied to the IF amplifier to ensure maximum transmitter output.

On mixer 1 both signals (audio frequency and receive’s radio frequency) are fed into one mixer input (PIN 1 o f the NE612). Signal paths are separated by a low capacity (100pF) that prevents audio frequency flowing into the rf chain and a 1k resistor prevents low Z radio frequency from going into the microphone circuit.

The electret microphone output is high enough, so that (together with the IF amplifier) enough gain is achieved to fully drive the transmitter.

The VFO

Please note that to avoid excess frequency drift some countermeasures have to be taken in the VFO control stage. As indicted in the schematic a combination of polystyrene and NP0 capacitors has been used. The polystyrene capacitors show a reverse temperature behavior in comparison to the coil so that temperature influences are compensated to a certain degree. After 10 minutes of “warm up” the VFO should be settled and only drift some 50 Hz per hour which is suffice for SSB operation.

Receiver

The input stage has been more or less the same like in the predecessor of the radio. A simple prefilter circuit with a low Z end (leading to the 50Ohm-antenna) and a high Z end leading to gate 1 of the dual-gate MOSFET transistor.

After that stage a double circuit filter has been applied providing more selectivity for strong out-of-band-signals. Problems related to unwanted in-band signals causing IMD3-problems have never been encountered even when signals levels where high on the 14MHz-band.

Transmitter

To optimize IMD3-performance and output a 4-stage-design has been used. All transistors are bipolar semiconductors stripped from old CB-radios. The spectrum analyzer screen shows the output with 10 watts PEP applied by a two-tone-signal:

Transmitter spectrum of "Lean Design Transceiver" Ver. 2 by DK7IH
Transmitter spectrum of “Lean Design Transceiver” Ver. 2 by DK7IH

Mechanics

Two veroboards (the 1st 6 by 8 cm and the 2nd 3 by 7 centimeters) carry the whole radio. They are seperated by a sheet metal made of aluminum to avoid stray energy from the power amplifier section into the preamplifier stages.

The larger one of the boards (right part of the picture) holds the mixers, SSB-filter, if amplifier, AGC, the receiver section plus the first 3 stages of the transmitter. The smaller board contains the final radio frequency amplifier and the T/R-relay:

Interior view of "Lean Design Transceiver" Ver. 2 by DK7IH
Interior view of “Lean Design Transceiver” Ver. 2 by DK7IH

On the air

It is really surprising what can be done with about 8 to 10 watts PEP in an SSB-signal from such a simple radio. Contacts with all over Europe are performed with high reliability when condx are up (as they currently are). A Moscow-based SDR returned the picture of a two-tone-signal transmitted:

The frequency is slighty drifting upwards due to the fact that warm-up has not been finished yet when the experiment was done.

All in all I have revised another radio optimizing its construction and performance. I think I’m a little bit  “Monsieur jamais content” 😉

Vy 73 de Peter (DK7IH)

 

 

 

 

 

 

Re-engineering my 1st “Shirt-pocket” transceiver

When the project of building a very small transceiver was accomplished 4 years ago, I still lacked lots of skills in setting up electronic circuits using SMD technology. The radio’s craftmanship  had been more or less defective to a certain degree (there were still lots of things to learn when using SMDs on Veroboards), the inside looked comparatively  “messy” and the performance was not sited in the premium league. Particularly the receiver was prone to IMD problems when signals on the band were strong. But because I liked the outer appearance of the radio a total revision of the inside had to be performed.

The major changes that were used to improve the radio are:

  • Usage of a Si5351 clock oscillator as VFO and LO instead of an Xtal controlled LO and AD9835 as VFO,
  • Only one SSB filter (off-the-shelf made) instead of 2 ladder filters,
  • Dual-Gate MOSFET as 1st mixer (instead of SA612),
  • 2SC2078 as push-pull pair in the final TX stage,
  • All SMD components are now mounted to the underside of the board,
  • TBA820M instead of bipolar equipped push-pull audio amplifier,
  • Cabinet size has been enlarged slightly (about plus 0.5 cm in length),
  • Proper cabling instead of “spaghetti” arrangement,
  • Copper band has been used to improve radio frequency grounding.

Things that were not changed are frequency layout (14 MHz), the ATMega328P microcontroller (MCU) and cabinet size etc.

DK7IH 1st
DK7IH 1st “Shirt pocket transceiver” Rev. 1 – Front panel

Even if the changes to the previous version are minor, I had to revise the schematic nearly completely (High resolution schematic):

The radio consists of 3 sections:

  • Control unit (MCU, Si5351 oscillator, 1306 OLED and related stuff
  • Receiver
  • Transmitter

Receiver improvements

In the receiver I changed the NE612 into a dual gate MOSFET mixer stage because I found out that the IMD3 was causing problems in the evenings when high signal levels were present. The dual gate MOSFET mixer turned out to be more stable in respect to  high signal levels. With the Si5351 being able to produce about 3 Vpp. of rf energy the mixer could be fed with an appropriate signal level.

The MC1350 had been removed because the simplicity of the AGC that section that could also be simplified because only one type of AGC voltage had to be produced. Remember: The dual gate MOSFET and the MC1350 have reverse AGC characteristics, thus an AGC that controls both types of amplifiers has to produce two types of AGC voltage. One rising and one falling when signal levels increase in the receiver.

Transmitter improvements

The microphone amplifier was not necessary because an electret microphone outputs enough audio frequency voltage to drive the NE612 mixer directly. An intermediate amplifier with bipolar transistor amplifies between the SSB filter and the TX mixer pushes the signal to an appropriate level, thus enough energy always is present in the first transmitter stages.

The remaining transmitter has been not changed, only the final amplifier transistors have been replaced with a pair of 2SC2078 (2SC1957 in previous version). Transmit power is now 6 watts (when DC is 13.2 volts from my QRP battery package).

Output spectrum is as follows (Pout = 5W PEP)

micro26_output_spectrum_5w_pep

T/R switch

Based on a discussion with WA2MZE here on my blog I tried to minimize physical expansions of a P-channel MOSFET based T/R switch. The basic design can be found here, only two P-channel switching MOSFETs are used.

The circuit is so simple, it fits on a piece of Veroboard just 1 square centimeter in size and put into a piece of heat shrink tubing. After connected to the 12V system it was stored behind the front panel:

DK7IH 1st "Shirt pocket transceiver" Rev. 1 - T/R switch
DK7IH 1st “Shirt pocket transceiver” Rev. 1 – T/R switch

The inside has also been straightened (please, don’t say its is still messy! 😉 ):

DK7IH 1st "Shirt pocket transceiver" Rev. 1 - Inside view top side
DK7IH 1st “Shirt pocket transceiver” Rev. 1 – Inside view top side

Under the Si5351 breakout the audio amp is hidden. I think available space has been used to the maximum and component density of the board is OK. 😉

Here a view to the underside where all the small SMD components have been placed:

DK7IH 1st "Shirt pocket transceiver" Rev. 1 - Inside view rear side
DK7IH 1st “Shirt pocket transceiver” Rev. 1 – Inside view rear side

Front panel labeling

Times are getting harder because I’m running short in these adhesive letters that are not available today anymore. An alternative had to be found. Initial tests with the so called “toner transfer method” had been frustrating, but I have found the idea to use labels for laser printers that are cheap and allow individual front panel design.

Here the steps in brief to get a first class front panel labeling:

Step 1: Buy self-adhesive transparency film for laser printers.

Step 2: Scan your front panel using a flat bed scanner:

front-panel-0

Step 3: Cut the image and work out your front panel. Then enhance the borders of the items you want to label later:

front-panel-2

Step 4: Eliminate the background by using the “cut” tool:

front-panel-3

Step 5: Put the labels into the right places and later cut out the borders of the items you have just labelled:

front-panel-4

front-panel-5

Step 6: Now you are nearly ready to print but one step must be done: Measure the size of your front panel and bring the picture exactly to this size. If you are lucky (like I was) the picture is in the right dimensions. If you are not, you can copy the picture to a text processing software and adjust the size of picture exactly. Make 4 or 5 five copies on the same sheet and print it out with your laser printer.

Step 7: Clean your front board with grain alcohol and fix one copy of the laser print taking the precise  position of the label.

Step 8: Cut the holes and other culverts with a sharp cutter knife or scalpel.

Step 9: Be happy because of having made a top quality front panel!

Mechanical construction

Like its predecessor the radio has been mounted into a U-shaped frame of aluminum. Height is 3 centimeters, thickness of the sheet metal is 1 mm. The front panel has been attached with angle plates also made from alu and fixed with M2 screws. This makes a rugged mounting frame for the veroboard and the additional mechanical structures like sockets for antenna, DC supply and headphone.

To finish the cabinet, a base and a top cover from 0.5 mm aluminum sheets have been bent exactly. Precision is now improved because I started a new method: Before bending the sheet metal I cut a wooden block using a precise buzz saw. In this case case exactly 74 millimeters wide (7 centimeters from the inside, plus 2×1 millimeters for the thickness of the mounting frame and another 2 millimeters of space you need because of the minimum bending radius that is required for the metal sheet. Using this method the cover exactly fits onto the mounting frame.

So, that’s the story of another revision of my radios. Thanks for watching!

73 de  Peter (DK7IH)

 

 

 

 

 

 

“Gimme Five” reloaded – A compact 5 band QRP SSB transceiver in SMD technology – TRANSMITTER spectrum analysis

Abstract

The 10 watts peak envelope power linear transmitter for single sideband operation will be examined.

Test conditions are: 10 watt pep on every band, rf line terminated with 50 ohm dummy load, input audio two-tone signal identically applied for each measurement.

Measurements have been taken with RIGOL DSA815 spectrum analyzer, RIGOL DS1054 digital oscilloscope and Goldstar DS7040 analog oscilloscope.

Measurements (Graphical presentation)

For the 5 radio frequency bands the spectral analysis show the following results:

DK7IH 5 band QRP SSB transceiver 2020 - Spectral analysis of output signal (audio two-tone modulated) 80m
DK7IH 5 band QRP SSB transceiver 2020 – Spectral analysis of output signal (audio two-tone modulated) 80m
DK7IH 5 band QRP SSB transceiver 2020 - Spectral analysis of output signal (audio two-tone modulated) 40m
DK7IH 5 band QRP SSB transceiver 2020 – Spectral analysis of output signal (audio two-tone modulated) 40m
DK7IH 5 band QRP SSB transceiver 2020 - Spectral analysis of output signal (audio two-tone modulated) 20m
DK7IH 5 band QRP SSB transceiver 2020 – Spectral analysis of output signal (audio two-tone modulated) 20m
DK7IH 5 band QRP SSB transceiver 2020 - Spectral analysis of output signal (audio two-tone modulated) 17m
DK7IH 5 band QRP SSB transceiver 2020 – Spectral analysis of output signal (audio two-tone modulated) 17m
DK7IH 5 band QRP SSB transceiver 2020 - Spectral analysis of output signal (audio two-tone modulated)
DK7IH 5 band QRP SSB transceiver 2020 – Spectral analysis of output signal (audio two-tone modulated)

Results

IMD3 on the 80, 40, 20 and 17 meter bands are quite acceptable, for 15 meters there is still some room for improvement. ;-))

Voltage examination

Even it is not spectrum analysis a voltage graph should also be discussed. The signal is shown for 14.200 MHz modulated with a dual-tone signal. Horizontal division is 10 volts per grid line:

DK7IH 5 band QRP SSB transceiver 2020 - Dual tone modulation on 14 2 MHz - Vertical division is 10 volts
DK7IH 5 band QRP SSB transceiver 2020 – Dual tone modulation on 14 2 MHz – Vertical division is 10 volts

vy 73 de Peter

“Gimme Five” reloaded – A compact 5 band QRP SSB transceiver in SMD technology – Practical TRANSMITTER setup

Abstract

This article will describe some design ideas that might be helpful in case the objective is building a medium power (i. e. 10 to 20 watts pep) radio frequency amplifier using a very compact design

The whole final amplifier for the broadband linear transmitter had to be packed into an area whose size is  5 by 11 centimeters.with approximately 2.5 centimeters in depth.

Because of limited space the power amplifier module had to be stacked using pin headers and connecting them with appropriate means. This effort resulted in two layers of circuitry:

  • The transformers for in- and output, the bias circuit and the radio frequency choke for the DC power line
  • The two power transistors (2SC1969)

Also a heat sink had to be planned.

Practical design of a compact medium power QRP RF linear amplifier

A large heat sink of aluminum covers the area of the underside of the transceiver:

DK7IH Multiband QRP Transceiver for 5 Bands 2020 - Final heat sink
DK7IH Multiband QRP Transceiver for 5 Bands 2020 – Final heat sink

When removed, access to the power amplifier section is possible:

DK7IH Multiband QRP Transceiver for 5 Bands 2020 - Power amplifier section of QRP SSB multiband transceiver
DK7IH Multiband QRP Transceiver for 5 Bands 2020 – Power amplifier section of QRP SSB multiband transceiver

When removing the thick aluminum block containing the screw’s holes we see a support construction that holds the connecting block and the final transistors in place. Here also the temperature sensor (KTY81-110) can be spotted, attached and the rear side. This aluminum structure is the only thermal connection between the small sheet metal holding the transistors and the heat sink. But it turned out that temperature of the pa transistors rarely rises above 50°C even when long test periods are performed for adjusting the amplifier. So, this idea has proved to be a mechanical, thermal and electronically good arrangement.

DK7IH Multiband QRP Transceiver for 5 Bands 2020 - Power transistors (2SC1969)
DK7IH Multiband QRP Transceiver for 5 Bands 2020 – Power transistors (2SC1969)

Between the pair of 2SC1969s the biassing diodes are visible which control the current for the current regulating transistor sited under the input transformer. Thermal contact is ensured by  positioning the transistors extremely close to the diodes.

When removed, we can see the transistors mounted to a very small part of veroboard and connected to the “main board” with a row of socket strips.

DK7IH Multiband QRP Transceiver for 5 Bands 2020 - Power transistors (2SC1969) on separate veroboard
DK7IH Multiband QRP Transceiver for 5 Bands 2020 – Power transistors (2SC1969) on separate veroboard

Underneath we see the output transformer made up of 2 stacks having 3 toroids FT37-43 glued together with 2 component glue.:

DK7IH Multiband QRP Transceiver for 5 Bands 2020 - Full PA assembly
DK7IH Multiband QRP Transceiver for 5 Bands 2020 – Full PA assembly

Because of limited space the connection to the low pass filter board is done with hookup wire. With just a length of 2.5 centimeters this is not a real problem.

The five band switch relays are connected to 5 separate veroboards (which makes changes of e filter very fast) containing each one filter for one band. Every veroboard is held in place by 2 small bolts with M2 specification. Between the veroboards small brass tubing pieces can be observed which serve as “shielded” lines for the longer leads going to the end of a respective filter. Inside the tube there is another piece of 1.1 mm diameter PVC insulated hookup wire.

Color coding of the various bands is unique over the whole transceiver.

Very far on the left side the transmit-receive relay has been positioned. This one only is for switching the antenna socket between transmitter and receiver. DC switching is done with small p-channel MOSFETs sited behind the LCD display and will be discussed later.

So, that’s all for today, thanks for watching! 😉

73 de Peter (DK7IH)

 

“Gimme Five” reloaded – A compact 5 band QRP SSB transceiver in SMD technology – THE TRANSMITTER

Abstract

The transmitter for this transceiver is designed to deliver a peak envelope power (PEP) of 10 watts on all bands from 80 to 15 meters. Due to its purpose (SSB amplification) it is a linear amplifier.

The circuit is equipped with 5 stages where the first one is a gain control stage containing a dual gate MOSFET whose gate 2 is controlled by a gain voltage from a digital-to-analog-converter (DAC), an MCP4725, and preset by values manually stored in the microntroller (MCU). This allows the user to compensate the decreasing gain when higher frequencies are used. The remaining stages are equipped with bipolar transistors.

The audio input stage of this transmitter uses a off-the-shelf designed integrated circuit  (SSM2166 by Analog Devices) which is a microphone compressor for computer applications.

The DSB-generator succeeding the compressor is an integrated mixer of the AN612 type.

Afterwards the TX mixer section (NE612 active Gilbert Cell mixer) follows. After being processed by the band pass filter (BPF) the five stages of the transmitter push the filtered signal to the designed final power level:

  • Gain control stage (40673 dual gate MOSFET)
  • 1st amplifier (2N2222)
  • Predriver (2SC2314)
  • Driver stage (2x2SC2078)
  • Final power amplifier (2x 2SC1969)

Audio stage and double sideband generator (DSB) and TX Mixer

This unit is designed for usage with an electrete microphone. Supply voltage is generated in a chain of 2 series switched 3.3k resistors, a 4.7V zener diode and a blocking capacitor. Following is an integrated circuite (IC), the SSM2166, which is a microphone amplifier and compressor circuit.

An AN612 integrated mixer forms the DSB generator in this circuit. There is no potentiometer for carrier suppression, in general carrier suppression of >45dB can be achieved with this simple circuit.

The resulting DSB signal is fed into the SSB filter that is placed in the receiver section. Usage of shielded cable with high shielding capacity is mandatory here for interconnecting the filter to the transmitter circuit. Even if stray coupling in high level radio frequency energy is not a severe issue on the interfrequency branch of the transmitter.

TX mixer is an NE612 with balanced output. This measure which will result in some extra dB concerning output gain.

DK7IH Multiband QRP Transceiver for 5 Bands 2020 - Microphone compressor, DSB generator and TX mixer
DK7IH Multiband QRP Transceiver for 5 Bands 2020 – Microphone compressor, DSB generator and TX mixer (Click for full size picture)

Power amplifier strip

A lot of introductory research had been done on a multi band QRP power transmitter with 10 watts of pep power when building the experimental 6 band transceiver. The general issue for a broadband power amplifier is the gain difference that occurs when band switching is applied. 3dB gain loss per octave is the rule of the thumb that is stated in lieterature and has proven to be correct under practical examinations..

An easy and reliable way to compensate this common gain loss, can be achieved using a programmable gain set stage at the entrance of the transmitter chain. This onset here is achieved by using a dual gate MOSFET transistor whose gate 2 is controlled directly via an I2C programmable digital-analog-converter (DAC). This DAC (MCP4725) is 12 bit wide, thus software in the MCU allows the user to set the gain in 4096 steps via the controls and store this value in the MUC’s EEPROM. After each band switch the respective value is recalled and subsequently sets the stage’s gain.

The amplifier strip presented here includes 2 push-pull stages as driver and final power amplifier. In contrast to the 6-band transmitter there is no “in-between” low-pass-filter.

All coil data is stated in the schematic. Pig nose cores are used in the final amp stages.

DK7IH Multiband QRP Transceiver for 5 Bands 2020 - Final power amplifier stages
DK7IH Multiband QRP Transceiver for 5 Bands 2020 – Final power amplifier stages (Full size picture)

After the power amplifier the circuit terminates with the final low pass filter section. Simple 5 element filters are used.

When setting up the circuit on a PCB or veroboard keep in mind that the 15m filter section  should be placed in the closest position to the input/output connector  to save lead length! Or to say in other words: Reverse the filter order in the schematic!

DK7IH Multiband QRP Transceiver for 5 Bands 2020 - Final Low Pass Filter Section
DK7IH Multiband QRP Transceiver for 5 Bands 2020 – Final Low Pass Filter Section

Vy 73 de Peter (DK7IH) and thanks for watching!

“Gimme Five” reloaded – A compact 5 band QRP SSB transceiver in SMD technology – NEW BAND LAYOUT

Sorry for having deferred the description of the transmitter. The recent days I have been concerned with a new frequency layout for the transceiver. I found that the 17m-band could be an interesting topic because when tuning on internet based SDR pages the last days I saw many strong signals appearing. This might be due to the fact that sun is higher now in the northern hemisphere and conditions will even be better with solar cycle #25 now about being to commence.

Based on these considerations I changed the band plan for the 5-band radio: 10m band has been removed, instead 17m has been added.

The new band layout now is 80m-40m-20m-17m-15m.

Here are the respective values for coils installed into the band pass filters (BPF) and the layout for the final low pass filter (LPF).

DK7IH Multiband QRP Transceiver for 5 Bands 2020 - Coil data
DK7IH Multiband QRP Transceiver for 5 Bands 2020 – Coil data

Hint: Inductance for the BPF coils have been measured with (probably) excess error ratio. Thus calculations are resulting in a different resonant frequency for the LCs when using Thompson’s formula!

Currently some additional tests with the the transmitter are pending, but full description will follow the next days. So, stay tuned! 😉

73 de Peter (DK7IH)

“Gimme Five” reloaded – A compact 5 band QRP SSB transceiver in SMD technology – THE RECEIVER

Introductory article of this project

This is some sort like “Copy & Paste”, a useful mean if you want to create a doctorate, like the former German Minister of Defense Mr Guttenberg once did. 😉 I don’t want to achieve a doctorate but the receiver of this radio is more or less the same I have constructed for the Midi6-transcevier. So I just copied the schematics and put down the changes in this paper.

DK7IH Multiband QRP Transceiver for 5 Bands 2020 - THE RECEIVER
DK7IH Multiband QRP Transceiver for 5 Bands 2020 – THE RECEIVER

To see a full sized picture of the RECEIVER, please click here!

Starting the tour on the left you can see the band switch unit, beginning with a BCD decoder that converts a 3-bit pattern created by the MCU into a 5 line decimal output. The ULN2003 then is a driver designed for motor controls but it is very useful as a relay driver as well. Integrated clamp diodes and open collector circuit make it practical as a driver circuit for this unit.

Next is the band pass filter section. I still use relays for switching the respective filter because I found that it is the best way to keep unwanted signals low from passing the filter, provided you use relays that can serve this purpose., Here signal relays TQ2-12V by Panasonic have been applied. Coils are small TOKO style coil formers with 5.1 mm (2×2.54mm i. e. 2×0.1″) pin spacing.

RF preamp is equipped with a dual gate MOSFET like the BF900 or so. The “AGC” this time is to be manually, just connect the AGC input (which now is an “MGC” to say it correctly!) of the stage to a 10kOhm variable resistor allowing a voltage swing between 0 and 12 V and this will lead to a preamp stage with gain control in the range of 25dB. This variable resistor is to mounted into the front panel, just to be concise.

The receiver’s mixer is an SL6440 which has great IMD3 performance (about 30dB) and has been used instead of diode ring mixer. Some dBs of gain are achieved as well but not the amount you can expect from an SA602.

In practical terms the ic really proves what the manufacturer promises. On 40m e. g. with a large doublet antenna no IMD products are audible even when strong broadcast station are next to the amateur radio band. A really worthy trial with this receiver!

Due to the fact that the following SSB filter is used for the transmitter also, another signal relay switches the filter between the receiver and the transmitter branch.

An MAV-11 monolithic amplifier follows the filter to lift the signal a little bit.

Next the MC1350 video amp is installed to do the major amplification with the interfrequency signal. It is gain controlled by the AGC circuit on the right side of the schematic. Gain is minimum if AGC input is around 7V or higher.

The product detector is a dual gate MOSFET which is only there because this one has a slight amount of gain and does not consume much space on the tiny boards.

The audio preamp stage is also very simple, just a bipolar transistor with negative feedback applied via a large resistor (390k) also biassing the unit to an appropriate value.

The audio main amp here is not an ic (like the inevitable LM386 e. g.) but it is a push-pull arrangement using 3 bipolar transistors. The stage that enhances the voltage is designed with a BC547, the stage that is bound for current amplification uses a pair of complementary transistors (BD137 -NPN- and BD 138 -PNP-). Audio power is about 1 Watt which is suffice for a small radio.

AGC uses an operational amplifier, any type like the LM358 will work great. The LM358 contains two identical amplifier stages. The first is used to bring the audio signal to a certain level, then rectifying this voltage and subsequently bringing it into a time constant consisting of a charged capacity (2.2uF) and a discharging resistor (3.3M), The circuit has very fast response, so there is no annoying “plopp” when a strong signal breaks in) and the decay is very soft.

The second stage just works as an instrumentation amplifier putting out up to 12V to control the input of the MC1350 at PIN5.

To end this article let’s have a look at the practical setup of the receiver:

mini5_qrp_ssb_trx_dk7ih_receiver_close_up_2

Click to enlarge!

Vy 73 de Peter (DK7IH)