A homebrew Microcontroller development board

Among AVR microcontrollers, the most popular ‘goto’ chip has been the atmega328. This is the part that drives the Arduino Uno and Nano boards, plus a lot of various clones from Adafruit, Sparkfun, and various Chinese suppliers. As the 28 pin DIP part is configured on the UNO, it has 20 available I/O pins (there are two extra analog input pins available on the 32 pin SMT parts). If you were to use the internal oscillator you would gain two more pins, and one more if you didn’t need the reset pin. However, that would require that you use a high voltage programmer, and no boot strap loader.

The new AVR128Dx-28 device has 21 available I/O pins when its internal oscillator is used. You lose two pins, if you want to use either the 32khz or high frequency crystal oscillators, and four pins if you need both. You can gain one input pin by not enabling the reset line, this loses you the bootstrap, but you can still use the UDPI programmer. The crystal oscillator isn’t needed with this part, even without calibration the built in oscillator is factory tuned well enough to provide an accurate enough frequency to provide a USART serial clock, even at the fastest common baud rates (such as 115 or 250 khz). About the only time you would need an external crystal would be to use the device as a real time of day clock.

The AVR128Dx series is now supported by the Arduino DXcore add on (https://github.com/SpenceKonde/DxCore/blob/master/megaavr/libraries/Wire/src/Wire.cpp) developed by SpenceKonde. This core supports all of the AVRxxxDx devices (16,32,64, and 128K flash sizes, DA and DB families, and 28,32,48, and 64 pin devices). I decided to work with the AVR128DB-28 device, as it makes a good replacement for the atmega328 used in the Arduino UNO.

Development board, RS232 serial adapter, Atmel ICE programmer with adapter cable

Shown above is my setup. I soldered a 28 pin socket to one of AdaFruit’s 1/2 sized breadboard PCB’s and added some connections for externals. I’m using an Atmel ICE (now a MC ICE ? ) with an adapter from the 20 pin 50m cable connector to a 3 pin female plug to hook to my board. Also visible is a homebrew RS232 to TTL adapter (there is a max3223 level converter inside the heat shrink covered pc board).

The dev board

Here is a close up of the dev board. On the lower left is a common 7805 voltage regulator with two bypass capacitors, and a reset push button switch. The connector to the right of that is for an optical rotary encoder. Then there is a 6 pin female connector (with one pin blocked with solder as a ‘key’). This is for the USART serial connection, two of the pins are power and ground, and one is for the DSR connection that goes to the controller Reset pin via a 0.1 uf capacitor. Below the USART connection is a 3 pin male socket for the UPDI programmer. This was used initially to test the board, and then to ‘burn’ a bootloader into the flash. Now I can program the controller vial a serial connection with the Arduino IDE.. To the right are two sets of I/O connections. There are 3 pins for GP IO functions, and four sets of 4 pin connectors for I2C devices. (power, ground, SDA and SCL). I can hook up to four I2C devices here. There are two 10K ohm pull up resistors on the bottom side of the board. Finally there are two sets of connections on the top of the board, one has 7 GP IO pins and the other has 5 (with matching ground connections). The GP IO pins are not yet assigned, they will be application specific.

My intent is to use this board to control a QRP ham transceiver using an Si5351 as a VFO. The frequency display will be a seven or fourteen segment LED display with 8 digits, using an HT33K16 LED matrix controller (Adafruit breakout board). I will also have a 12 switch ‘keypad’ interfaced via an I2C IO expander chip. Relays to switch band filters in and out will be controlled via another I2C IO expander. The available GP IO on the controller will be used for A/D input to accept PTT and Key input, CW tone output, and CW carrier injection control. A built in CW keyer will also be provided in software. The available second USART serial connection could be used to talk to a Teensy-4 processor that could be used as a DSP for I/Q demodulation and transmit modulation in a software defined radio. The plan would be to use the Si5351 to generate the required I and Q phase split local oscillator for the second mixer, and the vfo for the first mixer. The rig would have a 45 mhz first IF (up conversion) and a 15-20 khz second IF (down conversion). The first roofing filter would use a surplus 45 mhz cell phone IF filter.

In future posts I will describe the HT33K16 based display boards, the optical encoder, and the key pad switch interfaces. Clearly, I2C is a good way to expand the utility of a microcontroller with limited I/O connections. The avr128Dx-28 devices are a bit strange. They have lots of flash and sram space, and a good range of built in peripherals (not all of which can be used at the same time). A controller with only 28 pins and 128k of flash is interesting. It will make a very good upgrade for the UNO!

New AVR’s … Part 2

Some time ago, I wrote a blog entry on the new AVR chips that MicroChip had introduced. Since then, they’ve added a new “family” the AVRxxxDByy family (xxxx being flash memory size of 32 ,64,or 128 and yy being the package pin count of 28, 32, 48 or 64 pins). I just received some sample parts of the “DB” family, though I actually purchased most of them from Mouser, the 64 pin parts are currently sold out, but I had gotten a pair of them some months back AS a free sample for the asking, all in the 128K flash size. (I always buy the largest memory size I can for my experiments, later if I actually were to design and sell a project, I’d use the smallest size that my code would fit in.)

These new parts can’t be programed with my old Atmel tools. Top to bottom and left to right you can see my AVR-ISPmkII, AVR-JTAGmkII, AdaFruit USB-Tiny ISP, and AVR Dragon programmers. None of these includes the UPDI programming interface, and all of these tools are no longer in production. They still work for the older AVR parts.

My collection of old AVR programmers.

More recently, I’ve acquired both anAtmel-ICE, and a PicKit4 progrmmer/debugger. While the Atmel-ICE was developed by Atmel (before they were purchased by MicroChip) to work with AVR and SAMD series microcontrollers, and the PicKit4 was created by MicroChip for their PIC series micro’s, upgrades in their firmware now enable both of them to be used with most all microcontrollers made by the combined company. I’ve tried programming both the atMega4809-40 and the AVR128DB28 with both of these programmers, and they both work fine. I’ve used both the MPLAB-XIDE and Arduino development suites, both also work fine with both programmers. Below you can see the avr128DB28 being programmed by the Atmel-ICE.

Breadboard with atMega4809 and AVR128DB28.

The Atmel-ICE is available in several different kits. You can buy the bare PC board for about $75, about the same price as the PicKit4. The bare PC doesn’t come with any cables, you’ll have to buy those separately. You can 3D print a case for the board, several designs are posted on thingiverse. The cable kits that are available for the Atmel-ICE (or come in the more expensive tool bundles) are somewhat fragile and not ideal for breadboard use (but fine for the dev boards from MicroChip). I made my own programming cable using a 10 conductor 50mil cable from AdaFruit, breadboard cable adapters from Adafruit, and a 6 conductor 100 mil cable. The wiring on the 6 pin cable is compatible with all of the matching programming interfaces supported by AVR processors.
The PicKit4 comes with only a USB cable, the end user will have to make their own interface cable to connect the programmer with the target processor.

Here is the source code for my first test of the AVR128DB28: Just a simple blinking led script, which is the “hello world” first program for microcontrollers.

#define F_CPU 25000000UL
#define <avr/io.h>
#define <util/delay.h>

int main(void) {
/*initialization of the clock and LED output port bit */
_PROTECTED_WRITE(CLKCTRL.MCLKCTRLA, 3); //external clock or crystal
_PROTECTED_WRITE(CLKCTRL.MCLKCTRLB, 0); //no divider
_PROTECTED_WRITE(CLKCTRL.XOSCHFCTRLA,0xC1); //enable external xtal osc
PORTA.DIRSET = 0x80;
/* My application code */
while (1) {
_delay_ms(1000); //wait a second
PORTA.OUTTGL = 0x80; //flip output bit
//next two lines were deleted, not needed when using the OUTTGL function, but were in the Arduino
//sketch using the digitalWrite() function with on and off variants.
// _delay_ms(1000); //wait another second
// PORTA.OUTTGL = 0x80; //flip bit again
}
}

This was compiled using MPLAB-XIDE. Note that the max clock speed for the AVR-DB series is 24mhz, but I had some 25mhz crystals in the junkbox. So I’m slightly overclocking the part. It works fine (others have tried clocks up to 48mhz with the extended temp range parts, though mine is the industrial temp range that is rated for lower temperatures. What’s one mhz among friends?)

The _delay_ms() function in avr_libc that comes with the MicroChip compiler (probably GCC based) seems to use the value of F_CPU to calculate the length of timing loops. A similar function in the Arduino tools has a series of #ifdef …#else blocks for a number of clock frequency choices, but 25mhz isn’t one of them. I didn’t get an error or warning when I specified the ‘bastard’ clock rate (by editing boards.txt), but the blink rate of the LED was totally wrong! I didn’t post the Arduino sketch code I used, but it was almost exactly the same as above, except that the code for setting the clock was done behind the scenes in the Arduino library init code. So, for now, if I use the Arduino I’ll have to either lie about the clock speed (use the 25mhz crystal but set it for 24mhz), or use a slower 20mhz crystal.

Nothing exciting to see yet, except that I have the tools to put code on these chips.

Coffee or Tea?

I remember as a kid my parents taking the family to the local Chinese restaurant. With every meal they served an endless pot of tea, and small cups to drink it in. I’d keep refilling my cup during the meal, and always put huge amounts of sugar into the cup to drown out the slight bitter taste of the tea. What I ended up with was a very sugary, hot beverage.

I’d drink tea at home (mostly when I was sick). Like most families we bought Lipton tea bags. Lipton isn’t your “gourmet” tea (more like gourmand). It’s pretty much of a low grade British origin, nothing to write home about. Later in life, I’d discover better varieties of tea, such as Earl Grey (favorite of John Luc Picard), green matcha (used by the Japanese in their tea ceremony), oolong (very nice Chinese tea, a teabag of this is good for more than a single cup), green, black, and white teas. White tea has the least caffeine, good for an early evening drink without keeping you awake at night.

Then in the ’90’s I started working at Coulter in Miami. Coulter is the inventor of the famous ‘Coulter Counter’, a device that counts particles suspended in a fluid. It’s primarily used in medical work to count blood cells, a task that was once performed by a lab technician using a microscope. Coulter was located in Hialeah Fl, also known as ‘Little Havana’ due to the Cuban immigrants that live there. Most of the factory workers are Hispanic, and around 10am every day they took a Cuban Coffee break. Cuban coffee is made sorta like espresso, but with LOTS of sugar. I soon became addicted to the stuff, it was the first coffee of any kind that I’ve ever had.

Sometimes I’d order a cup of black coffee with a meal when I ate out. Not as strong as the Cuban espresso, but I had acquired the taste. I wanted to be able to make something similar to the Cuban at home, but I didn’t want to spend the bucks on an espresso machine. Then I discovered the Moca pot.

Sometimes known as an Italian Coffee pot, the Moca pot is a pressure coffee brewer like the true espresso machine. It doesn’t use nearly as high a pressure, brewing with forced hot water rather than steam. The pot consists of three pieces: the bottom is the water boiler, it has a safety valve that will vent open if the steam pressure gets too high. Above this is the coffee funnel – filter. It has small holes in the bottom to allow the water to seep up into the coffee. The funnel sits on top of the boiler. The top of the pot is where the coffee is pushed up into though a tall ‘straw’. The top screws onto the boiler just above the funnel. It has a spout for pouring.

While many people use espresso ground coffee in the Moca pot, it actually is intended for something between ‘fine drip’ grind and espresso in size. The so-called Cuban espresso coffee (Pilon) sold in the yellow, black and red ‘bricks’ is actually a bit courser ground than true espresso, and is perfect for use in the Moca pot. These days I buy ‘bulk’ organic coffee from shops like Whole Foods, and set the store grinder in the middle between ‘fine’ and ‘espresso’. It works perfectly.

I found a stainless steel ‘2 cup’ moca pot on ebay. It’s a Chinese knock off of the original Italian brand, but works fine. The size of a Moca pot is given in demitasse’ cups, NOT 8 oz cups!!!! My favorite way to drink the strong coffee from the Moca pot is with some ‘milk’. I add equal amounts of plant based ‘milk’ and coffee. I usually use either Soy or Almond milk rather than the kind that comes from a cow. I heat the 1/2 cup of milk in the microwave first, then ‘froth’ it using a battery operated frother (a wire spring that spins). This gives me one cup of ‘latte’. You can use real milk of course. I don’t know if I’m lactose intolerance (I don’t think so, but as you age you can develop this). I also add about one teaspoon of sugar to the coffee. Just enough sweetness to taste.

Much cheaper than a trip to Starbucks, and it tastes good. Enjoy!

Longtime no see … Cad Software

I’ve been away for awhile, mostly due to personal/family reasons. However, I’ve been working on several projects, one of which is a QRP transceiver that I’ve been evolving. The first thing I needed to do was to come up with the basic design, and capture the schematics. For simple projects we can resort to the old fashioned pencil and paper draftsmen approach. However, we would still like to have a better archive solution than a file cabinet with envelope folders in a drawer, certainly not while we have our computer! Rather than drawing our schematics on paper, and then scanning them into image files, why not bite the bullet and learn some CAD? The advantage of computer aided design, is that you can go from schematics to printed circuit boards using the CAD software, and then order boards from one of many low cost offshore circuit board houses. But which cad software?

At the top of the heap is Altium. This is a professional package, designed for big projects. The professional Altium packages are subscription based, and are priced monthly. Clearly for ham maker hobby use this isn’t for us. However Altium DOES have their Circuit Maker package. This is a cloud based application that is free for use. I’m not sure if the PC resident portion of the package will work on Linux directly or under WINE. However, running Windows 10 inside of Virtual Box is one solution. (I have a Windows install under Virtual Box on my computer running Kubuntu, I currently use this for iTunes, and a few other applications). I haven’t looked into the Altium Circuit Maker, but on the surface it looks interesting.

The long time favorite PC Cad Software is EagleCad. This is still available at no cost, but the “Freeware” version is limited to the board size, layers, and number of schematic pages per project. Still, I did design my first circuit board using Eagle. Both Adafruit and Sparkfun design their boards using the ‘pro’ versions of Eagle and they publish their cad files on their websites for their open source boards. Eagle is a good way to learn CAD, and the software runs on Windows, Linux, and Mac.

Finally, there is KiCad. KiCad is a totally open source package, and runs on all platforms. In the past few years (since version 4 came out) KiCad has become more mainstream, with many parts vendors and component makers now providing KiCad design libraries for the parts they sell. While the user IDE is different in many ways from both Eagle and Altium, KiCad is easy to learn. Many PC board houses now directly support KiCad, without the need to create Gerber files (which you CAN do in KiCad). The software is now in version 5, with version 6 due out later this year, or early next.

I’ve used KiCad on and off after Eagle changed their sales model and raised prices. I was using the freeware version of Eagle, but the cost (back then) of upgrading was still reasonable for hobby use. Not so much today! To give you an idea of what you can do in KiCad schematic capture, I’ve attached the schematic of my in progress NanoBitX transceiver IF module below. (I will present a full write up of this project once I get things working).

KiCad comes with a library of basic parts, and many contributed library symbols. It is also easy to create your own. In the schematic below, I’ve designed symbols for the ERA-1 amplifiers, NE602 mixer IC’s, 74HC4053 fet switches, IF crystal filters, MC1350 IF amplifier, toroid transformer, and coax/shielded wire. Symbols for some of these were available either in the supplied library, or on line, but they didn’t fit in with my circuit flow. For example, the NE602 symbol I created shows the separate mixer and oscillator portions, and the pin placements follow the signal flow NOT the package outline. My symbol for the 74HC4053 is divided into 4 blocks (a,b,c,&d) with separate symbols for each of the three switches and the power/enable pins. Also, I’ve shown the switches with NO and NC contacts to make the signal flow more obvious. There wasn’t any symbol (that I could find) to show a coaxial cable line, so I drew one.

Schematic of NanoBitx IF module, done in Kicad

The IF amplifier block has a 45mhz bilateral gain block, second mixer (from 45mhz to 10.7 mhz), 10.7mhz crystal filter, receiver IF amplifier (10.7mhz) with AGC, receiver product detector, and microphone pre-amplifier. The block is bilateral (functions in different directions during receive and transmit), and the product detector also functions as the transmitter balanced modulator.

More on the NanoBitX to come, hopefully in the near future. 73’s for now.

Yet more new AVRs

In a previous blog I mentioned the new atmega4809 and AVR128DA parts. Well, it seems I missed two other new families, the AVR128DB and AVR128DD series. I’ve requested some engineering samples of the AVR128DB64, and will attempt to solder one to a breadboard adapter. Will update on that later…..

The AVRxxxDB family is very similar to the DA but adds an external HF crystal oscillator (up to 32mhz), a level translator for one of the ports (so if you run the chip at 3.3volts it will be able to interface with 5v logic), and some OP amp stages that can be used as buffer amps for the A/D input, or D/A output. Only the 64 pin 128k flash variant is currently available, the rest of the variants will be shipping some time late this year, or early next year (I’m guessing).

The AVRxxDD family is a cut down version of the DB with less memory, and is only available in low pin count packages. It’s another option for those who would otherwise turn to the atTiny line of microcontrollers. The DD’s will be available in SMT 14, 20, 28, and 32 pin packages, as well as a 28 pin DIP (300 mil) package. These parts were recently announced, but are not yet available, even as samples.

No, I’m not associated with Microchip, but I’ve been following their AVR family having used these parts for years. I have also looked at the SAMD family of ARM Cortex M devices for use in ham projects. These microcontrollers offer much in memory size and processor speed, but they are much more complex than the AVR line. Except for DSP (SDR) applications, there is simply no need to go 32 bits, and the 8 bit AVR solution is usually the preferred option. The new SAMD parts did have a cost vs feature advantage over the older atMega devices, but the newest AVR parts, which are spin offs from the ‘failed’ Atmel Xmega offerings have caught up to the ARM Cortex M devices in this regard.

I had wondered if the sale of Atmel to Microchip would spell the end of the AVR. I guess I shouldn’t have worried, the product line seems to be in good hands.

Cameras

I bought my first camera around 1977. Upon the advise of my father, and a fellow ham, I decided upon a Nikon FE 35mm SLR. I bought it at 47th Street Photo in NYC. Back then, the camera makers didn’t offer a bundle with a ‘kit’ lens included, the camera bodies and lenses were sold separately. Nikon had recently come out with their introductory model, the Nikon “EM”, along with the ‘Series E’ lenses. These were low cost entry level equipment, using a lot of plastic instead of metal in their construction. The series E lenses had good glass, no serious compromises here, they lacked the coupling shoe, so they would only work with the newer ‘AI’ cameras (which the ‘FE’ was). 47th Street Photo offered a kit bundle with the FE, which included the series E 50mm F1.8 lens, a cleaning brush with air bulb, a battery for the camera, and a roll of film.

A few years later, Nikon introduced their model FA camera that featured some advanced metering modes (‘matrix’ metering, and programmed automation). This camera looked like a nice upgrade from the FE, and I eventually bought one when a local camera store had them on sale. My FE was a black body, but the FE that was on sale had a silver body. You’d think that the silver body cameras would be more in demand, and command a higher price, but most professional photographers prefer the black body cameras, and those are the more expensive models.

I slowly added to my lens collection, getting the Nikon 70-210 F4 series E zoom telephoto, and the 105mm F2.8 ‘Micro’ lens with the matching extension ring. This latter lens is a close focusing lens that closes down to F32 for greater depth of field. It was the perfect lens for photographing model railroad layouts. I also had my fathers Nikkor 28mm f2.8 wide angle lens on a semi-permanent loan. He rarely ever used it, so he let me hold on to it for my own use. I returned it to him years later after I sold off my Nikon equipment.

Auto focusing 35mm SLRs came out in the mid to late 1980’s, and was standard equipment by the 1990’s. Auto focus cameras required getting a new set of AF lenses, but the older manual focus lenses would work on the newer AF cameras, without auto focus. I resisted upgrading to an AF camera as I had a nice selection of non AF lenses, and could not justify the expense of starting from scratch. I could focus the camera rather quickly, and accurately enough not to need the auto focus feature, though I could see where it would come in handy.

The 21st century marked the beginning of the decline for film with the introduction of digital cameras that were no longer ‘toys’. I went through two Olympus ‘point and shoot’ digital cameras, the first with a 1 megapixel sensor, and the second a two mega pixel. The latter camera had a zoom lens. They were small cameras that could fit in the pocket, yet produced decent images in strong light. They did suffer with high magnification, and low light conditions due to their small sensors and low resolution. I later bought an Olympus C5050, a small 5 megapixel camera. I also got a telephoto adapter lens to fit the camera, and an external flash. The image quality was now good enough to replace my film SLR’s for many occasions. This camera made it obvious to me that digital was the future of photography.

I wanted to get one of the new digital SLR’s to replace my Nikons, but again this would mean getting new lenses. In 2008, Sony had purchased Minolta’s camera line, which included their Maximum DSLR cameras. There were many Minolta auto focus lenses from their older film cameras which fit their digital camera bodies, and would also fit the new cameras that Sony was now selling. I could find a suitable used Minolta auto focus zoom telephoto lens to fit the 10 megapixel Sony A200 camera cheaper than one for Nikon’s similarly priced entry level DSLR. A kit bundle including the A200 and a wide angle to portrait zoom lens fit my budget after selling my two Nikon bodies and lenses. (I still regret selling my 105 F2.8 Micro Nikkor though). I also found a used Minolta flash that would work in semi-automatic or manual mode with the Sony A200.

The A200 served me well for a few years while my daughters were in the High School marching band. However digital camera technology was quickly advancing with the newer cameras having faster auto focus, and higher resolution sensors. Olympus had introduced their 4/3 sensor equipment at the time I had bough the A200, and now they had morphed that into the mirror less Micro 4/3 system.

Panasonic was a partner with Olympus, selling their own brand of cameras. They were now selling a DSLR like mirror less body, the G1, and a hybrid video / still version, the GH1. Both were introduced at 12 mega pixels. I was impressed with the light weight and small size of these cameras, enough to trade in the Sony for the Panasonic Lumix G3 when it came out. Now at 16 mega pixels, the G3 was lighter and easier to carry then the larger APSC sized DSLRs. At this time I had ‘discovered’ KEH, and their cache of used equipment. I was able to find a 40-200mm Panasonic zoom telephoto and an Olympus flash that would work with the G3. Due to the smaller sensor, and the resulting 2:1 ‘crop factor’, the 200mm telephoto will give the same magnification as a 400mm lens on a ‘full frame’ 35mm camera.

I’ve just recently upgraded to a Panasonic Lumix G85 camera. While still a 16 mega pixel camera, it now has in body image stabilization (the G3 relied on image stabilization built into the lens), 4K video, a better image processor, and weather sealing. The newer camera is a bit larger and heavier than the older one, but it has a better grip. I also replaced the 18-42mm zoom lens that came with the G3 with the current 12-60mm zoom.
The newer lens is weather sealed, and has a longer zoom range. The in body image stabilization will work with older manual focus lenses mounted on the camera. My old Spiratone 400mm F6.3 manual telephoto lens works on this camera, with an effective 800mm focal length. I also have the matching 2x telephoto adapter for this lens, which gives an effective 1600mm focal length with the 2x crop factor. The cameras image stabilization enabled me to shoot photos of airplanes in route to the Fort Lauderdale airport hand held at 1600mm with this lens!

The transition from film to digital has been an evolutionary process. Along the way, we’ve seen the shift from photographers using a large collection of fixed focal length prime lenses to a small set (1-3) of zoom lenses. In the early days of zoom optics, the breed was considered inferior to a fixed focal length lens, but today this isn’t a concern. With optics now designed by computer ray tracing techniques, lens design is today more of a science than a black art.

Another change has been the shift to variable apertures on zooms, instead of a fixed F stop during the focal length change. This is a cost cutting ‘feature’, allowing for sharp optics at a price range within a beginners budget. Today, many of the kit lenses have a higher minimum F stop than what we used in the film era. The common 50mm prime kit lens sold with a film camera was usually an F1.8 or F2, today the zoom sold with most cameras opens up no wider than F3.5, and that at the widest zoom setting. The reason for this is once again price, but with the higher ISO settings available on digital cameras (ASA 1600 or higher vs 400 on film) the need for a fast prime lens isn’t as great.

Still there is one drawback, today’s slower lenses mounted on an APSC or Micro 4/3 sensor sized camera don’t have the narrow depth of field that one could get in the film era. You need a fast lens to blur the background. To get the effect given by an F1.8 lens on a full frame camera when using Micro 4/3, you’ll have to find a suitable F1.2 (or faster!) lens. There are some manual F0.95 prime lenses being made today for Micro 4/3 for those needing the narrow depth of field, but they come at a cost! Still, except for this one case, lenses for Micro 4/3 are usually less expensive then their full frame equivalents.

One nice thing about Micro 4/3, is the ability to mount old manual lenses with an adapter. This is why I’m kicking myself for selling that 105mm F2.8 micro Nikkor! I could use it for close up photography. I did manage to find a ‘bargain’ grade 55mm F3.5 micro Nikkor at KEH. With the 2x crop factor the lens does give me the same magnification as the 105mm did on my full frame 35mm film camera, and I don’t need the speed. (I usually shot the 105mm at F32 back in the day.) Lens adapters for M4/3 are made to fit almost every lens made by Nikon, Canon, etc. Some of the older auto focus lenses can even auto focus on M4/3 with a suitable adapter, though this will be on a case by case for specific cameras and lenses.

A special kind of lens adapter is one having built in optics to lengthen or shorten the effective focal length of the adapted lens. An adapter that reduces the effective focal length will also reduce the effective F stop as far as depth of field is concerned. Except for the high price of these adapters, this is a solution to the availability of fast primes to get the desired background blur.

Background blur is one feature advantage of full frame cameras over Micro 4/3 and APSC sensor cameras. Another feather in the hat for full frame is low light performance. Both M4/3 and APSC seem to have peaked at the 20-25 mega pixel plateau while Full frame cameras can reach 45-60 mega pixels. However, both the Nikon Z5 and Z6, and the Panasonic S5, S1, and S1H are only 24 mega pixels. Why? To maximize low light performance. Full frame sensors at this pixel density have larger pixel cells to capture more light per pixel. Unless you are shooting an image that will be blown up to a wall sized mural you don’t need more than about 25 mega pixels.

Both Nikon and Panasonic are now making full frame mirror less cameras. Their first ventures into this product have been at the high end professional level. Both have recently introduced new lower cost cameras closer to the entry level category. The Nikon Z5 body is priced at $1400, while Panasonic’s S5 lists for $1999. While both of these are far less expensive than earlier full frame offerings from these makes, they are still about double what I’d want to spend on a new camera body. Also lenses for both the Nikon Z mount, and Panasonic’s L mount, are still quite expensive. Perhaps in a few more years we will see true entry level product in the full frame mirror less camera market.
Until then, I’ll stick with my current camera. At the 16 mega pixel level I probably have a little better low light performance than the newer 20 mega pixel M4/3 cameras (Panasonic G95 and G9), and more than enough resolution for what my needs.

Using the new AVR chips

I’ve been playing around with the MicroChip AVR128DA48 Curiosity Nano board for a few weeks now. This is a development board for the AVRxxxDAnn family (xxx is the size of the flash rom, 16k,32k,64k, and 128k, nn is the pin count, 28,32,48 and 64).

These devices are available in 28pin DIP, SOIC and SSOP, and 32, 48, and 64 pin VQFN and TQFP packages. The SMT packages have pin spacing of 1.27mm to 0.4mm depending on the package size. The 1.27mm spaced SOIC, 0.8mm spaced TQFP, and maybe the 0.65mm spaced SSOP are not too hard to hand solder, however the 0.5mm spaced TQFP (48 and 64 pin packages) are better soldered using paste applied with a stencil and a hot air station than by hand with a soldering iron. (Digikey carries stencils for various sized SMT IC footprints.) Still, it CAN be done if you have a good magnifier, a very narrow tipped soldering iron, and 0.2mm (or thinner!) solder wire. SMT to DIP adapter boards for these parts are available, look for ones with a good solder mask layer between the pins, and either gold or tin plating on the pads. A steady hand is also required!

I purchased some extra chips in the 32 and 48 pin TQFP packages. I’ve soldered 100 pin 0.5mm packages before (Atmega2560) so I have some hope of being able to work with these. I’ve also ordered some stencils and solder paste, just in case!

In addition to the AVR128DA parts, I’ve ordered some of the ATmega4808/4809 parts in both 32 pin TQFP, and 40 pin DIP packages. The ATmega4809PF is an interesting throwback. Housed in a 40pin DIP package (and available for $2.02 in single pieces), it’s ideal for bread boarding. Cheaper than the ATmega1284, and with more features, this may be the ‘goto’ part for most QRP rig front panels. This part is actually using the same die as the 48 pin TQFP/QFN parts, with 8 of the port pins not connected. Microchip recommends disabling the unused port pins in software to save power. BTW, the Arduino Nano Every which uses the ATmega4809 is advertised to run at 20mhz, but it really is clocked at the 16mhz rate out of the box. You’ll have to reflash the boot loader (or the fuses) to get it to go at the 20mhz rate.

The 32 pin ATmega4808-AU is the same size as the ATmega328p used on the Arduino Uno, with 50% more flash memory, and more I/O. It’s also cheaper, and should be considered for any application where you’re currently using the older AVR.

The AVR128DA family has some advantages over the ATmega480x family. The internal clock oscillator can be synchronized against an external 32khz crystal, which is also used as an RTC clock source. The ‘480X family also has the external crystal oscillator for use as an RTC, but no built in automatic clock synch for the HF main oscillator. Max clock frequencies for the ‘DA family goes up to 24mhz, selectable under software control.  Also the available 64 pin package provides a few more Usarts, A/D inputs, as well as more I/O pins.

The ‘480x family runs at either 16 or 20 mhz, selected by a fuse bit in flash. There are software configurable clock dividers, but the base frequency can’t be changed under program control.

You have two choices of how to write code for these parts, either use the Arduino IDE, or ‘bare metal’ C/C++ code. I’ve used the Arduino IDE in the past to create rapid prototypes for AVR based projects as a contract software engineer.   Often, I’ve been criticized for doing this, other software engineers have pointed out that Arduino is for hobbyist’s, and isn’t suitable for production work. For the most part, I’d say ‘Balderdash!”. The Arduino platform is really C++ and a collection of libraries and macros. It uses the GNU GCC compiler and binary tools, along with the GNU C library. You do have to bend over backwards a bit to save the resulting binary and linker outputs which are deleted whenever the IDE is closed. One thing that the Arduino framework brings to the table is a set of routines that enable the programmer to do single bit manipulation of I/O pins without having to know about the port structure. The pinMode()digitalWrite(), and digitalRead() functions make use of a pin to port lookup, and then perform the necessary read/modify write using bit masks to isolate the single port pins. However, doing this yourself directly isn’t difficult, and will result in faster code operation than letting the framework perform a lot of extra work under the hood.  We’ll look at this a bit later.

The port structure of the older Atmega AVR’s consisted of just three registers for each port. For example, considering PORTA, there was the PORTA, DDRA, and PINA registers. PORTA is the output register for the port, each bit corresponding to one of the I/O bits in the port. Setting a bit places a high on the output pin. setting a zero places a low on that pin (assuming the pin direction has been set to output). The DDRA register controls the direction of each bit, a zero makes the port pin an input, a one sets it as an output. Writing a one to the PORTn register when the DDRn register has set that pin to an input will activate the internal pull up, a zero will disable the pull up. Finally, there is the PINn register. This is where we read the input of the port pin. If the PIN direction is set to OUTPUT, then the PINn register will reflect the state of the output, if the direction is input, the PIN register will reflect the actual signal level present on the port hardware pin.

The new AVR processors have the port structure first defined on the XMEGA AVR’s about a decade ago. We now have more registers, and they are logically defined in a C structure. So we have PORTn.DIR (the DDR register), PORTn.DIRSET (register to set the direction to output on a pin), PORTnDIRCLR (register to clear the direction to input on a pin), and PORTn.DIRTGL (register to toggle or switch the direction on a pin).

Similarly we now have the PORTn.OUT, PORTn.OUTSET, PORTn.OUTCLR, and PORTn.OUTTGL registers for outputting to a pin.

Input is via the PORTn.IN registers, and we have also have the PORTn.INTFLAGS, PORTn.PORTCTRL, PORTn.PINCONFIG registers. These latter registers have the interrupt flags, hardware slew control, and pin control (invert, pullup, and interrupt sense options). There are also a few other registers that allow configuration of multiple port bits at a time.

Finally, there are the VPORT registers. There a four of these for each port, DIR,OUT, IN, and INTFLAGS. The VPORT registers allow accessing the ports in I/O space instead of data space. This means using the IN, OUT, SBI and CBI instructions, instead of LD and ST. If you use the VPORT register names the GCC compiler can optimize the generated code to make use of the faster instructions. However, if you are not writing your code purely in assembler, the optimizations of using the VPORT registers may not buy you that much.

Now that we’ve seen how the port structure logic has changed, we can see how to program the ports to act the same way as the Arduino ports. Lets assume bit 0 on PORTA is an output and bit 1 on PORTB will be an input. This might be the same as having IO pin 0 on the Arduino as an output, and IO pin 9 as an input. Instead of writing in the Arduino framework:

pinMode(9,INPUT);
pinMode(0,OUTPUT);
digitalWrite(0, digitalRead(9)); //echo state of pin 0 onto pin 9

 

We can write the following C/C++ code:

PORTA.DIRSET = 0x01; //set bit 0 of porta as output
PORTB.DIRCLR = 0x02; //set bit 1of portb as input

//if PORTB bit 1 is true then set PORTA bit 0
if(PORTB.IN & 0x02) PORTA.OUTSET = 1;
//else clear PORTA bit 0
else PORTA.OUTCLR = 1; 

Note that we must keep track of the ports and bits assigned for each I/O function, while on the Arduino we need only concern ourselves with the absolute pin numbers. However, what you don’t see in the Arduino code is all of the lookup and decoding that the framework must do to act on the required ports and pins, along with masking off the unused bits. There will be MUCH more code generated by the Arduino functions shown than the raw metal coding. Yes, there is one less line of source code in the Arduino version than in our bare metal version. But ours will run MUCH faster and take up less flash space!

Another wrinkle with these parts is the portmux. Rather than hard wiring each of the internal interfaces to specific pins, the portmux allows reassigning them to available pins. This is done by having two or three alternate choices for the Usart, SPI, I2C and Timer output pins. Actually, it’s not possible to make use of ALL of the interface options, as there are fewer available pins than pin functions. It’s the portmux feature that allows you to decide which functions you will be using. Those who have designed systems using any of the ARM micro controllers will be familiar with the portmux feature. Note that the A/D and D/A devices ARE hard wired to specific pins on the part, and are NOT routed via the portmux. The pins used by the analog subsystems can still be used for digital I/O, provided that the analog inputs attached to them are not selected (just as with the older AVR parts).

Right now there are two Arduino boards using the ATmega4809 parts, the Nano Every, and the new Uno Wifi. There is a third party Arduino board package that supports all of the “bare metal” ATmega480x parts (MegacoreX), and a new package for the AVRxxxDA parts has just been released as well (DxCore). Both are still in beta version, functional, but probably with some bugs. Both will support a boot loader, but the use of an external programmer is recommended instead. At the moment, the Arduino IDE supports 3 different programmers (via AVRDude), the Microchip mEDBG which is the embedded UPDI programmer supplied with various Microchip/Atmel dev boards AND the Arduino Nano Every. It also supports the jtag2UPDI, which is a modified Arduino that emulates the UPDI programmer protocol, and the Atmel-ICE in UPDI mode.

For programming these parts using ‘bare metal’ C/C++, you will need the latest version of AVR-GCC with support for the parts. The best way to get this set up on your PC would be to install either Atmel Studio, or MPLAB-X IDE. Atmel Studio only runs on Windows, while MPLAB-X IDE is available for Windows, Mac, and Linux. Both support several Microchip programmers, the SPARK, PicKit4, and the Atmel ICE.

I’ve mentioned the available programmers briefly in my last post.

The Microchip SPARK is a bare board programmer module. It doesn’t come with the required USB cable, or the target cable, you will have to buy the first, and make up the second. Still, the SPARK cost’s only $25, and MicroChip does offer a $10 off coupon for it from time to time. You can download an STL file to 3D print an enclosure for the SPARK from Thingiverse.

The PicKit4 is Microchips’s latest programmer. It will support almost every device that they make, and this includes the PIC, dsPIC, AVR, and SAM families of micro controllers. It costs about $60, and comes with a USB cable.

The Atmel ICE also supports just about every device made by Atmel. It has separate connectors for SAM and AVR devices. Recent firmware updates allow the Atmel ICE to also program and debug PIC parts too. The bare board (no cables) costs about $60. A 3D printable enclosure designs can be downloaded from thingiverse. The basic kit comes in an enclosure, and includes the USB cable, and a suitable target cable for AVR devices. This costs about $100. The full kit includes an additional cable and adapter set for programming SAM devices, this costs $140. If you want to go with the Atmel ICE, I’d recommend buying the bare board, and 3D print your own enclosure for it. It uses a standard micro USB cable, which you probably already own. You can make a target cable by getting a SWD debugger ribbon cable, a 6 pin ISP ribbon cable, and breakout boards for the SWD and ISP connectors. All available from Adafruit.

I have both the Pickit4 and the Atmel ICE, if I was just starting out with these devices and didn’t have a programmer, I’d probably get the SPARK.

Writing bare metal code from scratch can be a bit daunting, at least getting started. Atmel has an online tool called AtmelStart, that will generate a project framework that will get you started. You can import the generated project into either Atmel Studio, or MPLAB-X. You can also just use the provided makefile to build the code using either the GNU tools, or the IAR professional tools.

AtmelStart has you select the development board, or microcontroller chip that you are using, and then pick which interface drivers you wish for it to create. In most cases you are given a choice of interrupt driven, or polling drivers. The Usart serial drivers can be configured to interface with the GCC printf() I/O streams. I’d recommend selecting at least the USART and TWI (I2C) drivers if you intend to use those functions. You can also have AtmelStart build the clock configuration code, this will remove some additional head scratching the first time you try using one of these new parts. I’d probably not bother with configuring the port initialization with AtmelStart. The code it generated required some modification for my use, and I think I did a better job setting this part up from scratch than the framework did.

You should also search the Microchip website for project code examples. I found some very good examples for I2C, and RTC code there.

I’ll be showing some of my example code in a later post. All of my project code will be put up on Github when ready. Right now, I’m experimenting with getting a GLCD driver working, along with a rotary encoder driven menu system, and an Si5351 synthesizer.

New AVR Micro Controllers (part 1)

It seems that many amateur radio projects these days include at least one micro controller in the mix of parts. One of these chips plus some software can eliminate a lot of discrete logic as well as simplify the hardware design of a rig’s front panel by eliminating lots of switches and knobs (replacing them with menu items in the software).

Micro controllers are basically a single chip micro computer containing a microprocessor, read only program memory, random access data memory, and peripheral interfaces (such as timers, A/D converters, serial interfaces such as SPI, I2C, and Usart). Years ago, it would have taken several separate parts to perform the same function. About 40 years ago, I built a micro controller for a ham radio repeater controller and CW ID’er. It used five IC’s including an 8085 microprocessor, 8155 RAM-Timer-I/O, 2716 eprom, plus a 74373 latch, and a 7404 inverter (for the CS logic on the 8155). I could have replaced that 7404 with two resistors and a transistor (but at about the same cost).

One of the first single chip micro controllers was the Intel 8048, followed a few years later by the 8051. Both of these used the Harvard class architecture (as most current micro controllers do), where the program address space is separate from the data-I/O space. These early processors had masked ROM for the program storage, which had to be programmed at the factory during the manufacture of the chips. Intel did sell an EPROM version of the part for software development, but it was quite expensive and required a VERY expensive programming tool (Dataio eprom “burner”). These chips could be used with an external EPROM to hold the program code, but this took 12 of the available I/O port pins away, and required two extra IC’s. Even so, there were 12 available I/O lines left, and you could add an external 8255 I/O expander if you needed more.  At least you could program your own EPROMs with a home brew programmer (à la Byte magazine, Steve Ciarcia).

Another early micro controller was the PIC. This was introduced by Microchip after they had purchased part of General Instrument Semiconductor. The original PIC design was for an intelligent I/O processor for the GI CP1600 16 bit microprocessor series. The original PIC used a highly simplified RISC architecture, and wasn’t very suitable for supporting high level languages such as ‘C’. Some of the current 8 bit PIC controllers (especially the PIC18 series), work well with such compilers, but the PIC12 and PIC16 series, which are closer to the original, are still best programmed in assembler.

A later introduction was the AVR micro controller series by Atmel. The original AVR micro controller was pin compatible with the 8051, including the external bus. The AVR is also a Harvard class RISC architecture, like the 8051. Atmel however worked closely with IAR and GNU to craft an instruction set that would work well with a high level language compiler, so most of the AVR’s can be programmed in ‘C’ or ‘C++’ with little loss in code efficiency. There is even a port of the GNU GCC compiler and binary tools that support the AVR. The AVR micro controller was also chosen by both the Wiring and Arduino line of DIY controller boards that are popular with Makers. The RepRap project based the controller for the early DIY 3D printers on the Arduino.

For the past few years, there has been a bit of a debate among Hams and Makers as to which micro controllers were ‘best’, the PICs or the AVR’s. Their lower cost and simple instruction set are points in the favor or PICs, making them suitable for building them into projects. Atmel’s AVR was somewhat better supported with ‘free’ open sourced assemblers and compilers. Atmel also provided low cost JTAG debugging tools that worked with the GNU software.  You can still get clones of these early JTAG devices on ebay that will work with some of the older (but still available) atmega series AVRs.

Recently, Atmel and Microchip joined forces by introducing support for each other’s micro controllers in their development tools. Microchip eventually purchased Atmel, and today support for the two lines of micro controllers has become even more connected. Originally the development IDE’s offered by both companies were only supported under the Windows operating system on PC’s, however Microchip’s new MPLAB X IDE is available for Windows, Mac, and Linux.

Which brings me to the topic of this post, the latest version of the Microchip line of AVR micro controllers. I hope the rest of this post doesn’t sound like a sales pitch for Microchip, as that certainly isn’t my intention!

Even though both former rivals had introduced 32 bit controllers (PIC32, AVR32, and SAM 32 bit ARM), there hasn’t been a falloff of interest in the older 8 bit controllers. While the ‘bang per buck’ is much greater for the new ARM based devices, the development cost is somewhat higher as is the learning curve. Unless you really need the greater ‘horsepower’, using an ARM processor is somewhat overkill, though it does provide some ‘future proofing’ for your project. Also the ARM Cortex M4 and M7 series even have DSP instructions, making them suitable for software defined radio projects.

What Microchip has done with the new AVR’s is to borrow some of the advanced features that Atmel attempted to introduce with their Xmega AVRs (sadly, the Xmega line has been mostly unsuccessful in the market place). They’ve kept the 5 volt power ability with this new line while allowing them to run at reduced voltage. In fact, the AVR-Dx series can run on anything from 1.8 – 5 volts AT FULL clock speeds!

The new AVR processor families are the ‘megaTiny0’, ‘megaTiny1’, ‘Mega0’, and ‘AVR-Dx’ series. All have the expanded port register set from the Xmega family, as well as many of the peripherals introduced with them. The AVR-Dx series has the bandwidth of the A/D converter increased from 10 to 12 bits, and if two channels are run in ‘differential’ mode the precision can be software enhanced to an effective 13-14 bits.
The new Tiny series are available with up to 16kb of program space in 8,14,20 and 24 pin packages. These will be of interest to those running out of room in their CW keyer projects based on the older attiny85 part.
The atmega0 series are available in 28,32,40, and 48 pin packages, with up to 48kb of program space. The new Arduino Nano Every is based on the atmega4809. This part is even available in a 40 pin DIP package, perfect for bread boarding! These parts run at up to 20mhz clock speeds.
The AVR-Dx series is available in 28, 32, 48, and 64 pin packages, and up to 128kb of program space, at up to 24mhz clock speeds.  It’s available in a 28 pin DIP package (same size as the atmega328). Wow!, a 128kb replacement for the Arduino Uno!

Microchip has some low cost development boards available for these parts. The ones most hams will be interested in are the ‘Curiosity Nano’ boards for the atmega4809, and the AVR128DA48 parts. Both of these fit in regular breadboards, and have a built in hardware programmer / debugger. They are priced at about $15 each (plus shipping), available direct from Microchip, Mouser, or Digikey.
They can be used with a free download of MPLAB X IDE and the MC8 compiler from Microchip. The MC8 compiler can be upgraded (license purchase) to generate more optimized code, but the free version, based on GNU GCC is still quite good. You can also use the GNU avr-gcc tool by downloading the new header files that support these parts from Microchip.
Another useful tool is the ‘Atmel Start’ web page ( https://start.atmel.com/). This is an online code generator that will construct a project skeleton for you that can be imported into the MPLABX IDE. It will create several header and source files based on the processor chip or development board you select, as well as code for the peripherals you pick to use.

If you want to make your own bread board development setup with a bare chip (28 pin DIP AVR128DA28, or 40 pin DIP atmega4809), you will need a programmer. Here you have a choice of three from Microchip. The least expensive is their ‘SNAP’ programmer (About $25, but sometimes put on sale by Microchip for $15), the Pickit 4 (about $60), or the Atmel ICE ( $60 – $140 depending on options). All three of these will support programming and debugging on PIC, AVR, and SAM (ARM) devices. The SNAP doesn’t support some older versions of Microchips portfolio, but it will support the newest parts (a firmware upgrade via MPLAB X might be required).

I’ve started working with the AVR128DA48 Curiosity Nano. I hope to get it working with a 192×64 graphical LCD, and an Si5351 frequency synthesizer. I’ll post details on this as soon as I get some code written and debugged (which will be posted in github).

The 52 year old project (Part 2)

In a previous post I described the QRP transceiver project found in an old QST magazine.  I had bought that issue at a radio store while I was studying for my Novice license, and still had it stashed away in my library even after moving five times.

The prototype as described by W6DMK (sadly, now a SK) was built in a rather unique project box (no longer available) which allowed the top, bottom and side panels to be removed for access to the internal chassis or circuit board.  The front and rear panels attached to the internal chassis.  In a previous post, I described how to build a similar type of enclosure from printed circuit board material using an old one gallon paint thinner can as the outside.  However, I found a ‘used’ 7″x5″x3″ Bud or LMB minibox in the junk box, the same size as the enclosure used in the article.

This mini box is of the type made from pieces of sheet metal, each bent into a U shape such that the two nest into and around each other to form the enclosure.  The larger ‘outer’ part would become the bottom chassis part, and the smaller ‘inner’ part the upper ‘lid’ part of the enclosure.  Both of these parts had a few holes already drilled into them from its previous use.  The bottom had three holes in what would be the back panel.  Two of these were drilled out larger to accept a 1/4″ phone jack (for the key), and an SO-239 coax connector for the antenna.  The third hole was just the right size for a Phono jack that would be used for the +12 volt power input.

The top of the box had quite a few holes of various sizes.  These were filled in with JB Weld metallic epoxy.  I first cover the inside of the holes with a piece of metal foil (I used copper foil, but aluminum ‘duct tape’, or heavy duty baking aluminum foil attached with epoxy will also work.  The foil is pressed down with a burnishing tool to remove any bubbles.  The epoxy is then mixed up and applied to the outside.  A putty knife or an old credit card is used to apply a thin layer over the holes, attempting to keep any voids forming in the surface.  It takes the JB weld about 24 hours to harden enough to be sanded.  This is done using medium grade sandpaper wrapped around a small chunk of 2×4.  The surface is sanded down until only the epoxy filling the hole remains.  If there are any voids in the epoxy fill, a second layer is applied, and again sanded, this time with a finer grade of sandpaper.  If necessary (usually only for very large holes) a third application of JB weld is applied.

After the holes had been filled in, I drilled any additional holes required for my use.  Then it was time to paint.  The surfaces of the box were rubbed with extra fine grade steel wool, and then wiped clean with vinegar (a mild acid which helps the paint to stick).  If the box is to be painted a dark color,  I would first spray on a light primer coat.  I used white paint for this on the inside top part which was later painted a flat black.  The bottom chassis was painted white, two coats were used.

Here is how the chassis box came out (I actually did this several months ago):

The labels are made with a Brother P-touch label printer.

P1030040

I mentioned in my last post that I was entering the schematics into Kicad.  I have made some changes to the original circuit, mostly to use parts I already have, instead of parts that are no longer available.  The VFO and BFO circuits were the first to be built and tested.  While the QST prototype was constructed on a single large circuit board (the author didn’t provide a PC artwork, but pointed out that his first prototype was built on a vector board), I prefer to divide up the circuitry into smaller modules which can be tested on the workbench and then built into the finished rig.  This is how Charley Morris ZL2CTM builds the rigs he features on his YouTube channel.  He builds small modules onto strip type vector board, and then solders these modules onto a larger un-etched piece of PC board material.  This is what I intend to do.

VFO-BFO

VFO-BFO  (pdf download)

The VFO and BFO circuit schematics are shown above.

P1030039Here is the VFO.  The two transistor circuit is built onto a small piece of vector board which is soldered to the rest of the parts attached to the back of the VFO tuning capacitor.  This 365pf TRF type variable is mounted to the front panel by two threaded spacers.  The VFO is quite stable, it only drifted a few tens of Hertz during an hour of being powered up.

P1030036

The BFO is built on another small bit of vector board.  Wiring and parts are on both sides of the board.  You can see the small wire ‘feet’ that will be used to solder the board to the main PC ‘chassis’.  The wire feet hold the board above the PC ground plane so it won’t short out to it.  Sockets were used for the HC-49U crystal and transistor.  This will allow me to try several crystals to find one that will match the two in the receiver IF filter.

keyer

keyer (pdf download)

The transmitter keyer circuit is shown here.  The original used a Germanium PNP transistor to key the +12 volt power to the transmitter.  I’ve converted that to use 2N2905 Si transistors, and I’ve added a switch for the RX +12v as well.  I intend to use a diode signal switch between the antenna and the receiver front end to provide for QSK.  I tried to use the transmitter power switch as a logic inverter for the receiver power switch, but there was too much collector to base feed though from the RX switch that appeared on the TX power line, it would not go below 2 volts on key up!  I therefore added a third transistor to the circuit.

P1030035

Here you can see the construction of the keyer switch.  This time I used a pad cutter to create ‘islands’ of copper on a small piece of circuit board.  The cutter was purchased from Harbor Freight.  It is sold as a spot welder cutter.  By overlapping cuts, I can create islands smaller than the size of the cutter.

AF-Amp_Sidetone

AF-Amp_Sidetone (pdf download)

Finally, here is the receiver final audio stage, and transmitter sidetone.  The original QST version used an unijunction transistor oscillator for the sidetone generator.  These devices are now as rare as hen’s teeth, so I substituted a two transistor multi-vibrator circuit.  The transistors are old Germanium devices salvaged long ago from some surplus computer circuit boards (maybe from old IBM 360’s, who knows!).  I added a volume control to the sidetone, something that was missing from the original.

P1030034

Again the pad cutter method was used, this time with a home made cutter made from a hex cap head bolt.  To make this cutter I drilled out the cap head of the bolt to make the walls thinner, and then cut 4 ‘teeth’ into it with a Dremel cutoff wheel.  While this type of pad cutter worked, it doesn’t stay sharp long, and soon starts to rip the copper leaving just large holes  instead of islands (you can see two of these failures in the photo).   The HF tool works better, but makes larger islands.

The Keyer switch and the audio board will both be mounted with double sticky tape to the rear and front panels respectively.

Next, I’ll get to work on the receiver circuity.  With the receiver working, this project will really come to life!

 

 

Something old is new again

recently dug out the April 1968 issue of QST from my bookshelf.   Hard to believe I’ve had that issue for over 52 years.  The cover story was on building an electronic keyer using what was then ‘state of the art’ RTL logic circuits.  The article included a printed circuit board layout for those wishing to etch their own.  I’m sure the circuit would perform well today (though it’s missing all of the modern features such as message memories, adjustable weighting, etc), but I don’t know if the IC’s used can still be found.  I suppose one could convert the logic to use available 74 series TTL or CMOS circuits if one really wanted to build the thing (would have to re-layout the PC though).

The first article in the issue was for a QRP CW transceiver for 40 meters.  It was all solid state using discrete transistors and diodes.  Most of the parts are still available (mostly 2N3904 and 2N3906 silicon transistors), though the few germanium PNP and the one unijunction transistor will be unobtainum today.  Still it looked like an interesting build, and I knew I had the older hard to get parts in the junkbox (365pf TRF capacitor and slug tuned coils).

The crystals called for in the BFO and IF filter are available in HC49/u microprocessor clock frequencies, and I have some in the junk box.  I will substitute modern ceramic trimmer caps for the old style compression mica units called for a half century ago.  There are better RF power transistors available today then the ones used in the article, and I’ll re-design that part of the circuit to eliminate the compression trimmer tuned Pi network tank circuit, and use toroid ferrite transformers along with a two or three section LPF instead.  I’m leaning towards an IRF-510 MOSFET in the final, a single transistor will put out more power than the 2N2195 the author used.  I’ll also replace the germanium PNP transistor used in the T/R switch (keying) circuit with a P-ch MOSFET.  The uni-junction audio sidetone oscillator will also go by the wayside, here I’ll probably use an 555 IC, which is almost as long in the tooth as the UJT.

The original rig didn’t have any switching logic for transmit / receive, the antenna connected to both the receiver input and transmitter output.  This worked since the receiver was lightly coupled to the transmitter tank at a high impedance point via a small (10pf) capacitor, and at the 1 watt power level there wasn’t enough RF fed back to blow out the receiver RF transistor.  I will add some diode switching in the signal path, and will switch the receiver power off during transmit.  It should be possible to obtain very good QSK.

It quickly occurred to me that this little rig would also work fine on 30 meters, which might actually be the better band.  If I replace the 5 mhz crystals with 8 mhz ones the circuit will cover the 30 meter band without changing the VFO.  The 5th harmonic of the 2.0-2.3 mhz VFO does fall into the 10mhz band, but it shouldn’t cause any birdies as the actual mixer products seem to just miss the band “by that much”.   I’ll have to use T38-6 cores instead of the T38-2’s to modify the rig for 10.1 mhz.  If I build everything but the VFO, audio amp, sidetone oscillator, and T/R switching logic  on one circuit board, I could try out both versions with the same setup.

I’m working on the new schematics now, and I’m teaching myself how to use KiCad in the process.  I’ll post the schematics here in a later post, and will also provide a link to my Github where I’ll have the KiCad files.   If anyone wants to duplicate my folly, they will find that except for the J.W. Miller slug tuned ceramic coil form,  TRF 365pf tuning cap, and vernier dial in the VFO all of the parts will be ones you can actually buy today.  I am keeping the PNP germanium transistor in the AF output stage to drive a pair of ancient magnetic headphones, but I’ll show how to use an LM386 instead to drive your iPod or cell phone earbuds.  You’ll have to deal with ebay for the VFO parts.