Design Intent
I have a soft voice, and tend to under-modulate when I am transmitting. This is especially problematic when using single side band on a noisy High Frequency circuit. So I have borrowed this idea from a commercial HF radio company (which I am told originally borrowed it from NASA): send a short tone or beep at the end of your transmission to signify to the other party that you have finished talking.
There are many roger beep circuits available on the net which I could have copied, but where's the fun in that? Also, I wanted the following features:
- A really clean tone, not a harsh square-wave.
- A really small circuit, to fit into most small hand microphones.
- A simple way of disabling the beep if required.
- A low noise circuit - no oscillators unnecessarily disrupting reception .
So out came the ATTINY-85. A truly remarkable 8 bit microcontroller in a SOIC8 chip.
Hardware Design
Did i mention I wanted a low parts count? The TINY-85 does pretty much all of the work here. All inputs are interrupt driven, and the output is a PWM signal based on a sine-wave look-up table. Some extra effort has been made to ensure the PWM is started and stopped at a "zero crossing" point within the sine wave, thus ensuring minimum audio artifacts or clicks are generated. The PWM output is then filtered with a simple R-C circuit and superimposed onto the microphone audio.
The TINY-85 has an on-board RC oscillator, as well as some E2PROM which holds the Enable/Disable state even after a power cycle.
Aggressive use of power-down modes keeps things quiet during receive too. The pin-change interrupt feature of the TINY-85 is used to wake it up from power down mode.
Software Design
This would have to be one of the simplest (and most fun) projects I've ever worked on. The ATTINY-85 is a joy to use, and packed full of features. It's often overlooked as a "serious microcontroller" due to its low pin count, but I found it ideal for this project, for the following reasons:
- Pin-Change interrupts.
- 2 Timers.
- Built-in clock.
- PLL multiplier.
- some EEPROM for NV parameter storage.
- Deep Sleep modes.
The code uses sine look-up table to drive a Pulse Width Modulator to generate a reasonably pure sinewave output.
Only minimal filtering is then required to give that nice clean tone.
The sinewave lookup table is simplicity itself:
//------------------------------------------------------
// Sinewave Lookup Table
//
// y = 91*(0.5+0.5*cos(2*pi*n/N)
// N = 32, n:{0..31}
//
// Forced into FLASH space to conserve RAM
//------------------------------------------------------
prog_uchar sinetable[] PROGMEM = {0,2,8,18,31,46,65,84,104,125,144,163,
178,191,201,207,209,207,201,191,178,163,144,125,105,84,65,46,31,18,8,2};
All that is required of the micro is to wake up on a Push To Talk (PTT) switch interrupt and hold down the PTT line to the radio. Once the microphone PTT switch is released, generate the beep, release radio PTT and go back to sleep.
A simple and fun project for a rainy day
And here's what it sounds like "on the air":