Mega16 AVR controlled PLL02A SSB project
Posted: 23 Mar 2017, 13:57
Microcontroller introduction project - Mega16 AVR into a first gen PLL02A SSB radio
First up, what this is and what this isn't.
It's not a replacement for a "10 meter export" radio that can be bought and with a very simple "conversion" be made to cover 25 to 50 megs, all modes, and 50+ watts. If you want all of those features with minimal effort, head to eBay or an online shop that sell them.
It is a project aimed at people who are comfortable with DIY electronics such as radios, power supplies, and wiring, but don't know much about programmable digital controller ICs (AVR and PIC microcontrollers) and want to know how they work. You'll end up with a usable 99+ channel SSB radio at then end of it, and will be able to learn more by customising it to behave exactly as you want it to function.
First up, some basics. Skip over the next paragraph if you already know this part.
A microcontroller is an IC that has the majority of its pins user definable as to what they do. These pins can de defined as either inputs or outputs, and are referred to from here as "I/O pins" or just "I/O". Depending on the number of I/O pins needed, different chips can be chosen. The smallest are 8 pin devices (6 I/O, power, and ground). The largest conventional devices have 40 pins with about 30 of then being I/O and the remainder having special functions, such as power and ground connections. If you need more than 32 I/O, you'll either have to use "expander port" chips that will give you up to about 150 maximum, or go for a surface mount device with up to 100 or so I/O pins.
The microcontroller used here is an Atmel Mega16, with about 30 usable I/O pins. We need:
9 for the PLL
7 for the tens channel digit (one line for each segment)
7 for the units channel digit (one line for each segment)
2 for the rotary encoder switch
1 for the push to talk monitor (to prevent accidental channel change when transmitting)
1 for the instant channel recall feature
1 to select legal 40 channels only or coverage of 99 channels
That's 28. We've got a couple of spares to add functionality later on.
The AVR microcontrollers operate at 5 volts maximum. Giving them more that that on any pin is asking for an early IC death.
Programming the IC
Unlike earlier programmable chips like EPROMs, microcontrollers are programmed in-circuit, there is no need for an expensive standalone programmer
with a large IC socket in it. AVR chips need just 5 or 6 wires to be connected to a PC USB port:
MOSI (Master Out Serial In)
MISO (Master In Serial Out)
SCK (Serial ClocK)
RST (ReSeT)
VSS (Ground)
VCC (5 volt power, only needed if the radio can't be powered up when programming it)
Don't worry about the meanings of these pins. Just connect them to the matching pin on the USB programming cable and it'll work.
They are shown in pink on the schematic of the AVR (next post in this thread).
The programmer - called a USBASP - is used to connect an AVR to a PC. The USBASP programmer cables are about $5 on eBay with free shipping.
There are a lot of files involved in the programming, but the detail is hidden away. You only need to take notice of two file types.
An AVR can't understand human readable instructions, so a computer program is needed to perform the translation.
The human readable file is known as a "source file" or "source code". This is the file containing all the instructions telling the AVR what to do.
The program that converts this to something the micro understands is called a "compiler". These can be has in several different programming languages.
The compiler reads the source code and uses this to generate a "hex" file. To a human, a hex file is just a random bumnch of letters and numbers, but to the AVR it's a list of things you want it to do.
Finally, a "burner" or "programmer" is used to send the hex file to the AVR.
Some programs combine the compiler and programmer into a single program, known as an "IDE" (Integrated Development Environment).
With these, the user doesn't have to see the hex file. This is a lot friendlier for beginners, but an IDE will cost you a few dollars.
Once the AVR is programmed, the MOSI, MISO, SCK, and RST are no longer needed and disconnected.
Part 1: Fix any issues with the radio
Just like you wouldn't bolt a supercharger onto a barn find Cortina and expect it to work reliably (couldn't resist throwing in a guy analogy, had to suffer thru an episode of "wheeler dealers" at a friends house tonight, sorry!), make sure the radio has no issues first. This chassis is nearly 40 years old. In our case, we didn't have a choice, the radio didn't work. Noisy controls and no transmit or receive. Dead VCO block.
VCO block rebuilt. Remove epoxy from print side, isolate bad parts, fit new components (circled in red), re-epoxy it. Radio came to life!
Channel switch removed and replaced with 7 wires. Only 7 of the 9 used here as the owner only wanted 99 channels.
One trace cut and then sealed with green nail polish.
All controls cleaned with Deoxit and now work as good as new
To simplify the conversion, the 22P "common anode" LED was swapped for a 22N "common cathode" type
Encoder switch and new LED unit fitted. Encoder switch used as this will give 1-99 in a single range.
Common of the switch and LED linked
Encoder switch and the LED wired up
Encoder switch and LED as seen from the front of the radio
Front chassis plate now back on the radio
Radio now works perfectly, but hard wired to a single channel.
Next post - convert it...
First up, what this is and what this isn't.
It's not a replacement for a "10 meter export" radio that can be bought and with a very simple "conversion" be made to cover 25 to 50 megs, all modes, and 50+ watts. If you want all of those features with minimal effort, head to eBay or an online shop that sell them.
It is a project aimed at people who are comfortable with DIY electronics such as radios, power supplies, and wiring, but don't know much about programmable digital controller ICs (AVR and PIC microcontrollers) and want to know how they work. You'll end up with a usable 99+ channel SSB radio at then end of it, and will be able to learn more by customising it to behave exactly as you want it to function.
First up, some basics. Skip over the next paragraph if you already know this part.
A microcontroller is an IC that has the majority of its pins user definable as to what they do. These pins can de defined as either inputs or outputs, and are referred to from here as "I/O pins" or just "I/O". Depending on the number of I/O pins needed, different chips can be chosen. The smallest are 8 pin devices (6 I/O, power, and ground). The largest conventional devices have 40 pins with about 30 of then being I/O and the remainder having special functions, such as power and ground connections. If you need more than 32 I/O, you'll either have to use "expander port" chips that will give you up to about 150 maximum, or go for a surface mount device with up to 100 or so I/O pins.
The microcontroller used here is an Atmel Mega16, with about 30 usable I/O pins. We need:
9 for the PLL
7 for the tens channel digit (one line for each segment)
7 for the units channel digit (one line for each segment)
2 for the rotary encoder switch
1 for the push to talk monitor (to prevent accidental channel change when transmitting)
1 for the instant channel recall feature
1 to select legal 40 channels only or coverage of 99 channels
That's 28. We've got a couple of spares to add functionality later on.
The AVR microcontrollers operate at 5 volts maximum. Giving them more that that on any pin is asking for an early IC death.
Programming the IC
Unlike earlier programmable chips like EPROMs, microcontrollers are programmed in-circuit, there is no need for an expensive standalone programmer
with a large IC socket in it. AVR chips need just 5 or 6 wires to be connected to a PC USB port:
MOSI (Master Out Serial In)
MISO (Master In Serial Out)
SCK (Serial ClocK)
RST (ReSeT)
VSS (Ground)
VCC (5 volt power, only needed if the radio can't be powered up when programming it)
Don't worry about the meanings of these pins. Just connect them to the matching pin on the USB programming cable and it'll work.
They are shown in pink on the schematic of the AVR (next post in this thread).
The programmer - called a USBASP - is used to connect an AVR to a PC. The USBASP programmer cables are about $5 on eBay with free shipping.
There are a lot of files involved in the programming, but the detail is hidden away. You only need to take notice of two file types.
An AVR can't understand human readable instructions, so a computer program is needed to perform the translation.
The human readable file is known as a "source file" or "source code". This is the file containing all the instructions telling the AVR what to do.
The program that converts this to something the micro understands is called a "compiler". These can be has in several different programming languages.
The compiler reads the source code and uses this to generate a "hex" file. To a human, a hex file is just a random bumnch of letters and numbers, but to the AVR it's a list of things you want it to do.
Finally, a "burner" or "programmer" is used to send the hex file to the AVR.
Some programs combine the compiler and programmer into a single program, known as an "IDE" (Integrated Development Environment).
With these, the user doesn't have to see the hex file. This is a lot friendlier for beginners, but an IDE will cost you a few dollars.
Once the AVR is programmed, the MOSI, MISO, SCK, and RST are no longer needed and disconnected.
Part 1: Fix any issues with the radio
Just like you wouldn't bolt a supercharger onto a barn find Cortina and expect it to work reliably (couldn't resist throwing in a guy analogy, had to suffer thru an episode of "wheeler dealers" at a friends house tonight, sorry!), make sure the radio has no issues first. This chassis is nearly 40 years old. In our case, we didn't have a choice, the radio didn't work. Noisy controls and no transmit or receive. Dead VCO block.
VCO block rebuilt. Remove epoxy from print side, isolate bad parts, fit new components (circled in red), re-epoxy it. Radio came to life!
Channel switch removed and replaced with 7 wires. Only 7 of the 9 used here as the owner only wanted 99 channels.
One trace cut and then sealed with green nail polish.
All controls cleaned with Deoxit and now work as good as new
To simplify the conversion, the 22P "common anode" LED was swapped for a 22N "common cathode" type
Encoder switch and new LED unit fitted. Encoder switch used as this will give 1-99 in a single range.
Common of the switch and LED linked
Encoder switch and the LED wired up
Encoder switch and LED as seen from the front of the radio
Front chassis plate now back on the radio
Radio now works perfectly, but hard wired to a single channel.
Next post - convert it...