The CPO1 – Code Practice Oscillator

This site is no longer updated. Please see my new website at



cpo1I needed a code practice oscillator to improve my skill with a straight key. An internet search turned up schematics, kits, and many links to eBay.

I had already decided I wanted to build one so I searched for circuits and kits. I found many that were based on a 555 IC, producing a square wave audio tone. I find a square wave harsh and unpleasant to listen to so I narrowed the search to circuits and kits that produced a sine wave audio tone.

After quite a bit of research and some experimenting, I came up with this schematic:schematic-cpo1

This circuit satisfies several of the criteria I had for the CPO I wanted.

  1. It produces a sine wave audio tone using a twin-t oscillator.
  2. The tone is adjustable.
  3. Power is supplied by an on-board 9 Volt battery.
  4. The unit is self contained, there are no off board connections to make (except an optional speaker).

Since it’s the first Code Practice Oscillator I’ve ever created, I call it the CPO1.

I’ve drawn the schematic to show the three main parts of the circuit. From left to right they are the twin-t oscillator (Q1), the buffer (Q2), and the amplifier (U1),

The twin-t oscillator circuit, based around a 2N3904 (Q1), creates the sine wave audio tone. Q1 is stabilized and held out of oscillation by the 1k resistor (R7). To key the oscillator the emitter of Q1 is shorted to ground through C5. There is a trimmer in the high pass portion of the twin-t notch filter that allows the frequency of the tone to be varied between about 550Hz and 1100Hz. For Morse code copy I prefer a tone in the neighborhood 750Hz.

I have noticed a bit of distortion in the audio tone generated by the twin-t. Maybe the values in the notch filter need to be optimized.  If I do another version I’ll look at that aspect more closely. For now, it gets the job done.

The signal from the twin-t oscillator is fed into another 2N3904 (Q2), which is configured as an emitter follower. Q2 buffers the signal going into the volume control pot. The buffer is intended to prevent changes in tone as the volume is adjusted. With the buffer in place there is still a slight, measurable, shift in the audio frequency as the volume pot is adjusted but I was unable to detect it audibly.

The buffered signal from Q2 is amplified by the NJM386 (similar to the LM386) amplifier IC. I chose the NJM386 because TI has shut down their fab factories for DIP ICs and the 8 pin DIP version of the LM386 is no longer produced. I wanted to stay with through hole devices on this design to make it easier for folks to build one for their own use.

The output of the amplifier connects to a 3.5mm stereo jack and a couple of pads on the PCB for speaker connections.

The circuit is powered by a 9 Volt battery. There is a polarity protection diode on board since I have a habit of fumbling with the battery connector when connecting 9 Volt batteries and I don’t always have the power switch in the off position.

One of the features I desired for my CPO was to have a unitized design. I wanted the power source, I/O, and all the controls located on one PC board so I didn’t have to have wires running to jacks or controls or have to put it in an enclosure to keep it all neat. The one exception I made was that I added some connections for an external speaker. I normally use headphones (apparently others in my household don’t appreciate hearing 750Hz sine wave audio tones). Adding the speaker connections was “free” so I put them on the PC board. If a speaker is attached, it is silenced when headphones are plugged in.

One other thing I did was to add several test points throughout the circuit. They are handy for troubleshooting but in addition, they provide convenient connection points for an oscilloscope probe so the signal can be examined at several key points.

After using the CPO1 for a while I thought maybe there was room for one more kit out there and maybe, just maybe, I could become wealthy selling code practice oscillators. To that end I’ve created a manual and put together a kit of parts.

For now, I have the kits listed on eBay here:  CPO1 Code Practice Oscillator on eBay
(all the kits I had have been sold, I’ll have more available around the middle of February, 2016)

Update March 9, 2016:
The PC Boards have been delayed.

The manual can be downloaded here: CPO1 Code Practice Oscillator Manual

If you decide to build one of these or have any questions, you can contact me at


Micronta 22-207 Multimeter Mess

Today I uncovered a multimeter I forgot I had.  A Micronta 22-207.  Specification wise, it’s a pretty nice VOM.


I acquired this meter several years ago from a gentleman I used to work with.  The only issue he said it had was that it “didn’t work in Amps.”

Apparently he had placed the selector switch in the 10A position, stuck the probes in a 110VAC wall receptacle, and enjoyed a loud pop and some smoke. I remember asking why. He said he wanted to measure the Amps in his house. My reply was probably something along the lines of “Oh.”

Anyway, I bought it from him thinking it could be repaired. I asked one of the techs in the lab to take a look at it. He found one burnt/exploded resistor. He didn’t have an exact replacement for the broken .91 Ohm resistor so he wired a couple of values he did have in series to get .94 Ohms. Close enough. I used it once or twice then moved across country a couple of times.

So back to the present. I found the thing while looking for another thing and I decided to add it to my bench. The first thought I had was that I hoped I had removed the batteries before storing it away.

I had not.

corroded_batteryThis is what alkaline batteries are up to when you give them fifteen years in a closet.

Leaving batteries in a device while it’s in storage is a dumb thing to do. Somewhat akin to setting a multimeter to the 10A setting and sticking the probes into a 110V wall receptacle.

I did, however, manage to get the battery compartment and battery contacts cleaned up. I removed the contacts and put them in a bowl of white vinegar for about 15 minutes. The corrosion was gone. They were still rusted looking but I was hopeful that a little 800 grit wet/dry emery cloth might finish the job, so I set them aside.










I needed to replace the blown resistor bodge mentioned above so I begin to clean up the solder pads after pulling out the resistors. During that process  I noticed more corrosion on the selector switch, so I pulled it apart.

contactsNo problem. I’ll go to work on the PCB contacts with a little vinegar and a cotton swab while the contact fingers have a vinegar soak. I started by removing the two screws that held the group of 3 contact fingers to the housing. That didn’t go so well.

broken_contactsThe corrosion from the leaking battery had almost disintegrated the contact fingers. They fell apart as soon as I touched them.

I know this is an anti-climatic ending but I need to give some thought on how I’ll replace these contact fingers. Maybe laser cutting if I can find a place that cuts metal and that can cut the type of metal that would be appropriate for these contacts. They look like they could be beryllium-copper. I don’t know if anyone works with that material anymore. I certainly doubt anyone will laser cut it. Maybe some 1/2 hard nickel-silver.

I’ll update if a solution presents itself. For now it is getting packed up (no batteries) and placed back on the shelf.


Mounting A 16×2 LCD

Character LCD modules based on the HD44780 display controller, and its equivalents, are popular for DIY projects and are available for low cost at eBay and other places.

Here are the cutouts I’ve been using for the 16 character LCD modules I buy from eBay.

graphic of cutour dimensions for lcd modules

Figure 1 – Cutouts for typical 16 column LCD modules

I’ve created a PDF document that provides these templates scaled 1:1.
You can download it here:
Mounting Templates for 16 Column LCD Displays

Cut out the template you want to use, align and tape it to your panel. Use the center-marks to locate the center-punch for the hole centers.

I’ve used these templates successfully with both 16×1 and 16×2 LCD modules. Your display may or may not work with them so beware.

It’s important that you set your printer’s scaling to 100% before you print the PDF. If your printer is set to “fit to page” or some other setting then the hole locations on the printout will be wrong and you will ruin your panel or enclosure. Use the dimensions provided on the PDF to check the scaling.

Make sure the dimensions of your display match these templates before you start drilling and cutting.

I find template -B- to be easier to fabricate. Figure 2 shows the front of the frequency counter I use with my OHR100A. It uses the cutout with the rounded ends (template B).


Figure 2 – Frequency counter showing display cutout

After center-punching all the holes I used a step drill to cut the 12.7mm (1/2-inch) holes at either end and cut across with a nibbler tool. I then used a mill cut file to clean up the top and bottom of the opening and make them tangent with the 12.7mm holes.

The filing operation is the most time consuming. Take your time. Remember that a mill file cuts only on the forward stroke. Don’t drag it back and forth like a saw. Keep the file clean with a wire brush.

Filing metal is an art and can be a zen like experience. To be successful, be the file.

One last thing – be aware of the conductors on the back of the LCD module you are using. You may need to use nylon washers under the nuts.

Here is a collection of 16 column LCD modules I gathered to show the issue:

Figure 3 - Conductors that may short to mounting hardware

Figure 3 – Conductors that may short to mounting hardware

As you can see there is no standard layout for these inexpensive LCDs. Don’t rely on the soldermask to act as an insulator. If you do you are going to have a bad time.


gerbv – Getting Started with a Gerber File Viewer

After trying several options for viewing Gerber files for PCB layouts I settled on gerbv. It’s open source, free, and does not require any registration.

The Windows installer and source code are available here.  If you’re using Linux you can either download the source code and build it yourself or check your distribution’s add/remove software repository.  I don’t know what is involved in getting it running on a Mac.

When gerbv starts you will see a window similar to Figure 1.

image of gerbv at startup

Figure 1

Your first instinct is going to be to click on the folder icon in the toolbar to load your Gerber files. Don’t. That function is for loading a previously saved gerbv project. If you have the application running, hover over the icons to see the tooltips that tell you what each one does.

Notice there is a button with a large PLUS (+) sign on it in the lower left corner of the gerbv window. Pressing that button will bring forth gerbv’s  file dialog. Navigate into the folder containing your Gerber files and, using [ctrl] and/or [shift], select multiple files to view and click the OPEN button. Gerbv does not care about the extensions as long as the files contain valid gerber data.

Once your files are loaded gerbv should look similar to Figure 2.

image of gerbv with files loaded

Figure 2

Here’s a few things you might want to play with (from the Main menu):

View->Rendering->High Quality
View->Best Fit
Tools -> Measure Tool

Note the check boxes next to each layer in the leftmost pane. Use those to toggle individual layers on and off.


Viewing your Gerber plots prior to sending them for fabrication can often uncover problems that were missed while doing the PCB layout. Better that you find any issues now than to wait for your boards to come back from fab.