Mega16 AVR controlled PLL02A SSB project

A forum for the discussion of matters of a technical nature. All such activities are undertaken at the readers discretion and own risk. If you don't know what you are doing, don't blame us if it all goes wrong!
lbcomms
Super Member
Super Member
Posts: 249
Joined: 04 Oct 2015, 08:10
Location: Sydney, Australia

Mega16 AVR controlled PLL02A SSB project

Post by lbcomms » 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.

Image
VCO block rebuilt. Remove epoxy from print side, isolate bad parts, fit new components (circled in red), re-epoxy it. Radio came to life!


Image
Channel switch removed and replaced with 7 wires. Only 7 of the 9 used here as the owner only wanted 99 channels.


Image
One trace cut and then sealed with green nail polish.


Image
All controls cleaned with Deoxit and now work as good as new


Image
To simplify the conversion, the 22P "common anode" LED was swapped for a 22N "common cathode" type


Image
Encoder switch and new LED unit fitted. Encoder switch used as this will give 1-99 in a single range.


Image
Common of the switch and LED linked


Image
Encoder switch and the LED wired up


Image
Encoder switch and LED as seen from the front of the radio


Image
Front chassis plate now back on the radio

Radio now works perfectly, but hard wired to a single channel.

Next post - convert it...

lbcomms
Super Member
Super Member
Posts: 249
Joined: 04 Oct 2015, 08:10
Location: Sydney, Australia

Re: Mega16 AVR controlled PLL02A SSB project

Post by lbcomms » 23 Mar 2017, 14:01

Stage 2 - building and fitting the controller

Image
Pinout of the AVR chip (ATMega16) used. A 5V regulator, the AVR, 3 diodes and a few passives

Image
Unloaded board


Image
Loaded board


Image
Trace side board links


Image
The finished AVR board

Image
AVR board fitted to the radio


Image
Diodes used to link it to "legal" (40 channel) or "export" (99 channel) operation


Image
The finished radio. Ugly brown Photoshop by me to cover up some rude "boy and girl bits" scribble the owner wanted left on it.

Next: How the thing was coded, and how to customise it for yourself. This will be a day or three away, depending on how busy things are at the shop tomorrow...

User avatar
dt307
Radio Addict
Radio Addict
Posts: 993
Joined: 05 Sep 2014, 16:15
Call Sign: 163dt307

Re: Mega16 AVR controlled PLL02A SSB project

Post by dt307 » 24 Mar 2017, 02:15

Many thanks sue will be going through this on Monday when I get a day off and start building it
163dt307-chris




“I fear the day that technology will surpass our human interaction. The world will have a generation of idiots.”
― Albert Einstein

CrazyFin
Super Member
Super Member
Posts: 100
Joined: 08 Jan 2014, 12:12
Location: Stockholm, SWEDEN

Re: Mega16 AVR controlled PLL02A SSB project

Post by CrazyFin » 24 Mar 2017, 14:45

Awesome post!! :o

So clean and nice rebuild and mod. :clap:

Keep up the excellent and educational posting activity Sue! I really enjoy reading all posts about repairs, fault tracing and modding you do.

bigal68
Regular
Regular
Posts: 99
Joined: 08 Dec 2012, 14:30
Call Sign: 26fb806
Location: nr Derby, Derbyshire

Re: Mega16 AVR controlled PLL02A SSB project

Post by bigal68 » 29 Mar 2017, 11:18

Looking forward to the next part Sue. Many thanks for sharing.
Alan 26FB806
----------------------
27.385 LSB, 27.555 USB, 27.78125 FM

Use it or lose it!!!!

lbcomms
Super Member
Super Member
Posts: 249
Joined: 04 Oct 2015, 08:10
Location: Sydney, Australia

Re: Mega16 AVR controlled PLL02A SSB project

Post by lbcomms » 29 Mar 2017, 13:28

Thanks for the comments. I'm just waiting for a couple of people building this to let us know they've got all the parts to build their own version of it. The "free shipping" slow boat from China can take 3 or 4 weeks to arrive.

I've also got a base version of the chassis coming in for repair and conversion the next few weeks sometime - the owner wants an old school Mid / High / Higher (3 banks of 40 channels) mod, so I'll be posting that one here too. Circuit will be almost the same, just minus the encoder switch and the 10K "pullup" resistors on the input pins. The main change will be in the programming.

User avatar
MrWeetabix
Admin
Admin
Posts: 13334
Joined: 26 Aug 2008, 13:34
Call Sign: 26TM175
Location: Tynemouth

Re: Mega16 AVR controlled PLL02A SSB project

Post by MrWeetabix » 29 Mar 2017, 13:48

Can I just add my thanks on behalf of the Admin team. These types of posts are the main reason we're here, to help others in the CB community through sharing knowledge and information, of which this is of the highest standard. It's really appreciated Sue. :clap:
26TM175. OP: Craig. QTH: Tynemouth. Also 163TM175 when mobile in Wales 8)

PO Box: 62 Town: Albrighton City: Wolverhampton Zip: WV7 3WR

TM1 is now on Facebook http://tinyurl.com/TM1onFB || New Tango Mike QSL cards https://tinyurl.com/TM1-NewQSL

User avatar
theEarwigger
Super Member
Super Member
Posts: 398
Joined: 24 Jul 2007, 20:59
Call Sign: M0RZF
Location: Portsmouth
Contact:

Re: Mega16 AVR controlled PLL02A SSB project

Post by theEarwigger » 02 Apr 2017, 09:35

Excellent!

I thought about designing a board to replace the channel switch in older radios with an encoder/micro. The mechanical channel switch is plenty big enough that the PCB can be accommodated. The advantages of this would be:

1. Coverage of any channel combination
2. Easily re-programmed with a modern flash/FRAM/EEPROM micro
3. Adding scanning facility

The main snag being the voltage levels on most old CBs are not 3.3V or 5V.
Years ago I made a veroboard prototype, of which the circuit is attached to this post.

-Rob
scannerCircuit.GIF
You do not have the required permissions to view the files attached to this post.

lbcomms
Super Member
Super Member
Posts: 249
Joined: 04 Oct 2015, 08:10
Location: Sydney, Australia

Re: Mega16 AVR controlled PLL02A SSB project

Post by lbcomms » 02 Apr 2017, 14:46

Why the buffer and the 27C16 EPROM? The programming lines of a parallel PLL chip need almost no current to drive them (a fraction of a milliamp) so I can't see what those two ICs were used for. The PICs can supply 25 to 40mA per I/O pin and the binary output data can be stored in the microcontrollers EEPROM or flash memory (26 bytes needed). We used just resistors between the output pins and the PLL, but those are just there to limit inrush lockups (a PIC or AVR can rise a lot faster than a mechanical channel switch).

Not criticising the design, just curious why it was done that way.

A multiplexed display drive like that can generate noise in the radio from the current changes as the display rapidly turns on and off when it alternates between digits. Increasing the frequency to get rid of the noise can cause other issues like ghosting and reduced brightness. That's why I used static drive, one pin for each segment of the display. No multiplexing = no display noise.

When doing scan mods, some form of lockout control is needed. Otherwise, one channel with a carrier / noise / wannabe DJ will make it stop every time on the one channel you don't want to listen to. On the AVR board I left a three spare I/O pins just for that ("Rx on" sensing, scan on / lockout switch, and "channel locked out" LED). It's part of a future post once the people following this have the basic version up and running OK.

The AVR can operate at 3.3 or 5V, most radios are happy with 5 at the PLL. The notable exception is the MB8719, which needs 8. Also, many displays (the common anode ones) have 8 or 12 volts on them, too high for the AVR. A hex driver (ULN2003 or MC1413) will isolate this and allow it to switch an output up to about 24 volts, more than will ever be needed in this application. It was also part of the next version once they have the basic version up and running OK...

User avatar
theEarwigger
Super Member
Super Member
Posts: 398
Joined: 24 Jul 2007, 20:59
Call Sign: M0RZF
Location: Portsmouth
Contact:

Re: Mega16 AVR controlled PLL02A SSB project

Post by theEarwigger » 02 Apr 2017, 15:13

The circuit was designed to replace a 27C16 EPROM, there is no EPROM used!

This was designed in 2003, when the PIC18 family came out. So the chip is an obsolete one now. The multiplexed display does introduce a small amount of noise to the receiver, but once the antenna is connected, it is swamped. I had to include the level shifter because my PLL runs off 8V. Some types of 27C16 can work upto 8V, so be interfaced directly.

It would be easy to redesign it all onto a small PCB these days. A 5x5cm board from China costs only a few pounds now. The best feature is the encoder I used has a push switch included. So pushing on the channel selector makes it scan. A quick double push locks out a channel, until the power is cycled. IMO scanning ia an essential feature today when there is hardly any activity?
scannerBuilt.jpeg
You do not have the required permissions to view the files attached to this post.

User avatar
Black Spirit
Veteran
Veteran
Posts: 3960
Joined: 16 Mar 2009, 19:30
Location: S.Wales

Re: Mega16 AVR controlled PLL02A SSB project

Post by Black Spirit » 02 Apr 2017, 19:14

Whats the technical term for that green Vero/Perf i have done several combination searches and closest i have found is un tracked stuff [Just holes no tracks]

lbcomms
Super Member
Super Member
Posts: 249
Joined: 04 Oct 2015, 08:10
Location: Sydney, Australia

Re: Mega16 AVR controlled PLL02A SSB project

Post by lbcomms » 02 Apr 2017, 20:31

If single sided (no plated through holes) is OK, just google "green stripboard" and then click on "images". Look for the Aliexpress ones, some of them are the type with a continuous track.

If you want double sided plated through (10 times stronger if what you are making has things like plug in headers) then use a PCB editor like FreePCB or Eagle to make the largest board of this type within the size limit from All PCB. Currently 100 x 100mm (but it often changes).

Then get multiples of 10 made, currently $5 for each pack of 10.

lbcomms
Super Member
Super Member
Posts: 249
Joined: 04 Oct 2015, 08:10
Location: Sydney, Australia

Re: Mega16 AVR controlled PLL02A SSB project

Post by lbcomms » 02 Apr 2017, 20:37

theEarwigger wrote:The circuit was designed to replace a 27C16 EPROM, there is no EPROM used!
Thanks, it's all a lot clearer now. I didn't realise it was such an old design, things have changed a lot in 15 years.

The next version posted here will show how the ULN2003 / MC1413 is added. That will allow it to drive 8V PLLs and 12V LEDs. For now though, it's one step at a time.

User avatar
theEarwigger
Super Member
Super Member
Posts: 398
Joined: 24 Jul 2007, 20:59
Call Sign: M0RZF
Location: Portsmouth
Contact:

Re: Mega16 AVR controlled PLL02A SSB project

Post by theEarwigger » 03 Apr 2017, 16:40

Yes, change in the technology keeps engineers employed!

User avatar
dt307
Radio Addict
Radio Addict
Posts: 993
Joined: 05 Sep 2014, 16:15
Call Sign: 163dt307

Re: Mega16 AVR controlled PLL02A SSB project

Post by dt307 » 04 Apr 2017, 11:41

that soldering looks like art not like a board going in a radio its disgustingly good
163dt307-chris




“I fear the day that technology will surpass our human interaction. The world will have a generation of idiots.”
― Albert Einstein

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest