AVR Programmer W/High Voltage

by JonMackey in Circuits > Arduino

4317 Views, 8 Favorites, 0 Comments

AVR Programmer W/High Voltage

AVR Programmer v1.5.jpeg
AVR Programmer v1.5 annotated.jpg

This is my first Instructable. The board I designed is an AVR Programmer. The board combines the functions of 4 separate prototype boards I’ve built in the last few years:

- A High Voltage AVR programmer, primarily used on ATtiny devices to set fuses when the reset line is used for I/O.

- Arduino as ISP, 5V and 3v3 (counts as two of the functions)

- NOR Flash EEPROM programmer (quickly copies from an SD card to NOR Flash)

The board uses common AMS1117 LDO voltage regulators to get 5V and 3v3. The high voltage function requires 12V. For this I used a MT3608 DC-DC step-up converter. The mcu runs at 16MHz, 5V. Level shifting for anything requiring 3v3 is accomplished using a LVC125A. The LVC125A is what you find on a lot of the SD card modules. The mcu is an ATmega328pb. The ATMega328pb is nearly the same as the more common ATMega328p except that it has 4 more I/O pins in the same size package.

This board is version 1.5. New features in this latest version:
- a usb serial interface.
- resettable poly fuses.
- LED function indicators below the function selection buttons.
- a switch to control serial reset by disconnecting DTR from the USB serial chip.
- a MOSFET to completely remove power from the DC-DC 12V when it's not in use.

The board has the option of adding an AT24Cxxx I2C serial EEPROM and there's a 5 pin I2C JST-XH-05 connector (GND/5V/SCL/SDA/INT1) for connecting I2C devices.

One of the more complicated aspects of this project was how to load all of the functions/sketches onto the board. The easiest method would have been to simply download a sketch whenever I needed to change functions. Another method would have been to combine all of the sketches. I decided against both of these methods. The combine method would have made it difficult to integrate any changes made to the original source sketches. The combine method also has the problem that the amount of SRAM available wasn’t sufficient without rewriting and digging into the libraries and sketches used, again a maintenance issue.

The method I chose was to write an application named AVRMultiSketch that works with the Arduino IDE to load the sketches into flash by shifting their memory locations. The sketch sources aren’t modified in any way. They run on the board as if they’re the only sketch. How this works is described in detail on the open source GitHub readme for AVRMultiSketch. See https://github.com/JonMackey/AVRMultiSketch for more details. This repository also contains the sketches I used/wrote/modified, which can be used individually.

To switch between sketches the board has four buttons: Reset, and buttons labeled 0,1,2. On power-up or reset, if you do nothing the last function selected is run. If you hold down one of the numbered buttons you’re selecting a sketch/function. The sketch becomes the selected sketch. White LEDs below each of the function buttons are illuminated to reflect the current selection.

Currently the board only hosts 3 sketches, but it could host a few more. In that case, assuming only 3 bits/numbered buttons, it could host up to 7 by holding down more than one button.

The schematic is enclosed in the next step.

A minimal support bracket is available on thingiverse. See https://www.thingiverse.com/thing:3279087

The board for version 1.5 is shared on PCBWay. See https://www.pcbway.com/project/shareproject/AVR_P...

Contact me if you'd like an assembled and tested board.

​Instructions for Assembling the Board

AVR Programmer v1.5 Angle.jpeg

Instructions for assembling the board (or almost any small board) follows.

If you already know how to build an SMD board, skip to step 13.

Gather Parts

Discrete Parts.jpeg
Parts.jpg

I start by taping a piece of paper to the worktable with labels for all of the very small parts (resistors, capacitors, LEDs). Avoid placing capacitors and LEDs next to each other. If they mix, it may be hard to tell them apart.

I then populate the paper with these parts. Around the edge I add the other, easy to identify parts.

(Note that I use this same piece of paper for other boards I've designed, so only a few of the locations in the photo have parts next to/on the labels)

Mount the Board

Mounting Board.jpeg
Mount Board.jpeg

Using a small piece of wood as a mounting block, I wedge the PCB board between two pieces of scrap prototype board. The prototype boards are held to the mounting block with double stick tape (no tape on the PCB itself). I like using wood for the mounting block because it’s naturally non-conductive/antistatic. Also it’s easy to move it around as needed when placing parts.

Apply Solder Paste

Solder Paste.jpeg
Board with paste.jpeg

Apply solder paste to the SMD pads, leaving any through hole pads bare. Being right handed, I generally work from top left to bottom right to minimize the chances of smearing the solder paste that I’ve already applied. If you do smear the paste, use a lint free wipe such as those for removing makeup. Avoid using a Kleenex/tissue. Controlling the amount of paste applied to each pad is something you get the hang of through trial and error. You just want a tiny dab on each pad. The size of the dab is relative to the size and shape of the pad (roughly 50-80% coverage). When in doubt, use less. For pins that are close together, like the LVC125A TSSOP package I mentioned earlier, you apply a very thin strip across all of the pads rather than attempt to apply a separate dab to each each of these very narrow pads. When the solder is melted, the solder mask will cause the solder to migrate to the pad, kind of like how water won’t stick to an oily surface. The solder will bead or move to an area with an exposed pad.

I use a low melting point solder paste (137C Melting Point) The second photo is the v1.3 board and the type of solder paste I use.

Place the SMD Parts

Place SMD Parts.jpeg

Place the SMD parts. I do this from top left to bottom right, although it doesn’t make much difference other than you’re less likely to miss a part. The parts are placed using electronics tweezers. I prefer the tweezer with a curved end. Pick up a part, turn the mounting block if needed, then place the part. Give each part a light tap to ensure that it’s sitting flat on the board. When placing a part I use two hands to aid in precise placement. When placing a square mcu, pick it up diagonally from opposite corners.

Inspect the board to make sure any polarized capacitors are in the correct position, and all chips are oriented correctly.

Time for the Hot Air Gun

Heat Gun.jpeg

I use a low temperature solder paste. For my model gun, I have the temperature set to 275C, airflow set to 7. Hold the gun perpendicular to the board at about 4cm above the board. The solder around the first parts takes a while to start melting. Don’t be tempted to speed things up by moving the gun close to the board. This generally results in blowing the parts around. Once the solder melts, move on to the next overlapping section of the board. Work your way all around the board.

I use a YAOGONG 858D SMD Hot Air Gun. (On Amazon for less than $40.) The package includes 3 nozzles. I use the largest (8mm) nozzle. This model/style is made or sold by several vendors. I’ve seen ratings all over the place. This gun has worked flawlessly for me.

Reinforce If Needed

Reinforce.jpeg
Extra solder on SD Card slot.jpeg

If the board has a surface mounted SD card connector or surface mounted audio jack, etc., apply extra wire solder to the pads used to attach its housing to the board. I’ve found that solder paste alone isn’t generally strong enough to secure these parts reliably.

Cleaning/removing the SMD Flux

SMD Cleaning.jpeg
After SMD Cleaning.jpeg

The solder paste I use is advertised as being “no clean”. You do need to clean the board, it looks much better and it will remove any small beads of solder on the board. Using latex, nitrile, or rubber gloves in a well ventilated space, pour a small amount of Flux Remover into a small ceramic or stainless steel dish. Reseal the flux remover bottle. Using a stiff brush, dab the brush in the flux remover and scrub an area of the board. Repeat till you’ve entirely scrubbed the board surface. I use a gun cleaning brush for this purpose. The bristles are stiffer than most tooth brushes.

Place and Solder All of the Trough Hole Parts

Through Hole Parts.jpeg
Through Hole Back.jpeg

After the flux remover has evaporated off the board, place and solder all of the trough hole parts, shortest to tallest, one at a time.

Flush Cut Through Hole Pins

Through Hole Clipped.jpeg

Using a flush cutter plier, trim the through hole pins on the underside of the board. Doing this makes removing the flux residue easier.

Reheat Through Hole Pins After Clipping

Through Hole Reheat.jpeg

For a nice appearance, reheat the solder on the through hole pins after clipping. This removes the shear marks left by the flush cutter.

Remove the Through Hole Flux

Through Hole Cleaned.jpeg

Using the same cleaning method as before, clean the back of the board.

Apply Power to the Board

Main.jpeg

Apply power to the board (6 to 12V). If nothing fries, measure 5V, 3v3, and 12V. 5V and 3v3 can be measured from the large tab on the two regulator chips. 12V can be measured from R3, the end of the resistor closest to the board bottom left (the power jack is top left).

Load the Bootloader

Setting Fuses and Bootloader.jpeg

From the Arduino IDE Tools menu, select the Board and other options for the mcu being targeted.

On my board designs I almost always have an ICSP connector. If you don’t have an Arduino as ISP or some other ICSP programmer, you can build one on a breadboard for the purpose of downloading the bootloader to the programmer board. Select Arduino as ISP from the programmer menu item, then select burn bootloader. In addition to downloading the bootloader, this will also correctly set the fuses. In the photo, the board on the left is the target. The board on the right is the ISP.

Load the Multi Sketch

MultiSketchLoading.jpeg
AVRMultiSketch.png
MultiSketchLoad.png

Follow the instructions on my GitHub repository for AVRMultiSketch to load the multi sketch into flash via the serial port on the board. The GitHub AVRMultiSketch repository contains all of the sketches shown in the photo. Even if you don't plan to build the board, you may find the NOR Flash Hex Copier and the AVR High Voltage sketches useful.

Done

Accessories3.jpeg
Accessories1.jpeg
Accessories2.jpeg
ATtiny84 in ICSP.jpeg
ATtiny84 in High Voltage slot.jpeg
ATtiny85 adapter.jpeg
Loading NOR Flash.jpg

I've also designed a few adapter boards when using unmounted chips, such as when breadboarding.

- ATtiny85 ICSP adapter. Used to program a ATtiny85 standalone.

- ATtiny84 to ATtiny85. This is used for both high voltage programming and connected to the ATtiny85 ICSP adapter.

- NOR Flash adapter.

To see some of my other designs, visit https://www.thingiverse.com/JMadison/designs

Previous Version 1.3

644pa.jpeg
328pb.jpeg

The above are photos of version 1.3. Version 1.3 doesn't have USB Serial, resettable fuses and function indicator LEDs. One version 1.3 variant uses an ATmega644pa (or 1284P)

If you’re interested in building version 1.3, send me a message (rather than adding a comment.)