We seek to understand and document all radio transmissions, legal and otherwise, as part of the radio listening hobby. We do not encourage any radio operations contrary to regulations. Always consult with the appropriate authorities if you have questions concerning what is permissable in your locale.

Author Topic: C based Class E RTTY with Crystal pulling  (Read 1068 times)

Offline Zazzle

  • Full Member
  • ***
  • Posts: 184
  • Berlin, Germany
  • Longing for distant places
    • AOL Instant Messenger - Ask+via+PM
    • Yahoo Instant Messenger - Ask+via+PM
    • View Profile
C based Class E RTTY with Crystal pulling
« on: April 10, 2018, 1323 UTC »

I prefer to keep it simple, especially with the kind projects I do (which might be busted, stolen or vandalised). Therefore I was looking for a simple (regarding hardware and also software) way to run RTTY. Here's a funny thing I tried and which works like a charm. Lets share that!

Most modern Microcontrollers (AVR, PIC, STM, etc.) come with multiple hardware functions. UART, IC, USB you name it. Also PWM! The awesome things about those hardware functions are, that they run CPU independent and don't consume computing time.
We play with the PWM unit here. Many controllers also provide clock multiplication. This means that a PWM frequency higher than the CPU (master) clock can be archieved. Some fancy controllers even support adjustable PWM and uneven frequencies, which allows to generate a lot of handy frequencies from a fixed source.

Here's where it gets interesting. Since the divider or multiplication is set to a fixed value, the PWM frequency follows the master clock frequency. If the master clock frequency changes, so will the PWM frequency. Hmm! Let's abuse this!

Crystals can be pulled by adding a variable capacitor into its path. Which means it's frequency can be adjusted up to a few kHz. That's done with a mechanical variable capacitor. But it can also be done with electrical variable capacitors (diodes, a VARIAC).

For RTTY we need a frequency shift of a few Hz, i.e. 170. That's doable with a small change of the capacity. The idea is to manipulate the master clock frequency in the pattern of a RTTY-Signal. Software on the controller generates the proper timing for RTTY (Baud speed) by turning an I/O-Pin on and off. The +5V from the I/O-Pin is feed to a VARIAC (Variable Capacitor Diode) which in return pulls the master crystal (frequency). A hardware PWM output generates the carrier frequency. Since the PWM frequency depends on the master frequency, it chances along with it. In respect to the ratio between master- and PWM frequency.

For example:
  • Require PWM duty cycle: 50%
  • An Attiny25 needs at least 4 clock cycles to make the PWM unit run 50% dt in CTC-Mode.
  • We want 4MHz for our beacon.
  • Therefore, we need a 16MHz crystal. That provides us with 4MHz PWM.
  • At 4MHz we need an offset of 170Hz for RTTY. Since the radio is 4 (16MHz Master Clock / 4MHz PWM), we need to adjust the manipulation loop in a way it grants a frequency shift of 4 x 170Hz = 680Hz.

First of all: which oscillator pin should be used for this trick depends on the Microcontroller used. Also, whether the frequency (when key'ed) should go up or down. Have some workbench-testing to get known to your controller. Also, don't overdo the pulling. When introducing too much bypass capacity to the internal oscillator it might stop and freeze. Imagine you climbed all up the Kilimandscharo on your Africa vacation - all wasted from carrying also a 100W solar module and Battery - only to learn that you overdid it and your baby stopped working as soon as you're back home. ;p
  • 1) XTAL may 2-8 times larger than desired frequency. Depends on the used Microcontroller. Read about it's H/W PWM unit and features.
  • 2) Is usually the same as C1 (see data sheet of the Microcontroller). It is required to provide minimal capacitive load to the oscillator circuit. Can also be replaced with a mechanical cap to obtain the desired target frequency on one end.
  • 3) Can be either a classical VARIAC or maybe also some standard diode. All diodes have a VARIAC behavior. Which diode can be used depends on the junction capacity and how far it can be adjusted. Tuning voltage is also a factor. Tinker a bit with it and gain some practial experience. Its also possible to  parallel Diodes.

Also: it's important that all rails (+5V logic and others that are used for tuning) are high stable and decoupled properly.

Kind greetings,
Trans-/Receivers: JRC NRD-525,  ICOM IC-R72,  YAESU VR-5000,  YAESU FT-897D
Antennas: 80M Halfwave Dipole,  40m Inverted-V,  5/8λ Groundplane,  20M Longwire,  misc. UHF/VHF Scanner Antennas.

Offline Josh

  • DXing Phenomena
  • *******
  • Posts: 4094
    • View Profile
Re: C based Class E RTTY with Crystal pulling
« Reply #1 on: April 10, 2018, 1759 UTC »
We do not encourage any radio operations contrary to regulations.