Introduction
This project is focused on designing and making our own USBasp that can be used for In-Circuit Programming of Atmel AVR Microcontrollers. This project / programmer is compatible with many Atmega series microcontrollers with 5V Logic. The project is opensourced by Thomas Fischl. The below design is based upon his work and contribution. The idea for this version of USBasp is to design it with THT components and still keep a small form factor. In this particular varient the ISP connector is a 6 Pin Connector that sits directly on Arduino Boards like Arduino UNO, MEGA, Nano and many other Atmega Development Boards. The USB interface is an USB Micro B Connector that supports any Micro USB Cable.
The main advantages of using an USBasp are:
- It saves flash memory that is consumed by bootloader
- Execution of the main program starts immediately after the MCU is powered on, there is no bootloader lag
- The Serial USB connection to Arduino is free for serial communication all the time
Prerequisite
For this project, it is good to have basic knowledge of PCB designing and soldering components. This is not a very difficult project to do. A basic understanding of electronics is also benefitial to identify components and correctly assemble them.
Hardware bill of materials
Below is the list of materials that I have used for the project. It is highly encouraged to buy them directly from the link below or add them to cart.
- Soldering Station / Soldering Iron
- Soldering Flux
- Soldering Wire
- PCB Helping Hands
- Multimeter
- 4.7uf Capacitor x 1
- 100nf Capacitor x 1
- 22pf Capacitor x 2
- 3.6v Zener Diode x 2
- Micro USB B Connector x 1
- 3mm LED x 2
- 330Ω Resistor x 1
- Male 2.54mm Header Connector x 1
- Atmega 8 TQFP32 x 1
- 12Mhz Crystal Oscillator x 1
Software bill of materials
- KiCad
- Zadig USB Driver Installer
- AVRDUDE supports USBasp since version 5.2.
Hardware description
AVR Atmega8
The ATmega8 is a low-power CMOS 8-bit microcontroller based on the AVR RISC architecture. By executing powerful instructions in a single clock cycle, the ATmega8 achieves throughputs approaching 1 MIPS per MHz, allowing the system designer to optimize power consumption versus processing speed.
The ATmega8 provides the following features: 8K bytes of In-System Programmable Flash with Read-While-Write capabilities, 512 bytes of EEPROM, 1K byte of SRAM, 23 general purpose I/O lines, 32 general purpose working registers, three flexible Timer/Counters with compare modes, internal and external interrupts, a serial programmable USART, a byte oriented Twowire Serial Interface, a 6-channel ADC (eight channels in TQFP and QFN/MLF packages) with 10-bit accuracy, a programmable Watchdog Timer with Internal Oscillator, an SPI serial port, and five software selectable power saving modes. The Idle mode stops the CPU while allowing
the SRAM, Timer/Counters, SPI port, and interrupt system to continue functioning.
3D Render of USBasp 3D Render of USBasp
Software description
KiCad
KiCad (pronounced “Key-CAD”) is a free software suite for electronic design automation (EDA). It facilitates the design of schematics for electronic circuits and their conversion to PCB designs. It features an integrated environment for schematic capture and PCB layout design and also has tools within the package to create a bill of materials, artwork, Gerber files, and 3D views of the PCB and its components.
Zadig
Zadig is a Windows application that installs generic USB drivers, such as WinUSB, libusb-win32/libusb0.sys or libusbK, to helps access USB devices.
It can be especially useful for cases where:
- need to access a device using a libusb-based application
- need to upgrade a generic USB driver
- need to access a device using WinUSB
Note: “libusb-based” above means an application that uses either libusb, libusb-win32 or libusbK.
AVRDUDE
AVRDUDE is a utility to download/upload/manipulate the ROM and EEPROM contents of AVR microcontrollers using the in-system programming technique (ISP).
It has a command line interface for downloading and uploading features / binary (including handling fuse bytes). Supports a wide range of programming hardware, from cheap ISP plugs that connect the AVR’s ISP interface directly to a computer’s parallel port (no additional circuitry) or serial port (some additional circuitry needed), more advanced ISP adapters using a buffer/driver chip (like a 74HC373), up to (more complex) serially connected programmers like AVR910-style ISP devices, the Atmel STK500 board, and the Atmel JTAG ICE mkII. Most popular adapters come pre-defined, adding a new parallel-port adapter is as simple as editing a configuration file (no recompilation needed).
AVRDUDE also supports USBasp as a programming device.
The programming guide and usage is covered in a different article. The firmware attached have prebuilt binaries that can be flashed to Atmega8 to start the working.
Schematic Design
The below schematic is simple and doesn’t involve any complex circuitry. First the schematic is designed in KiCad. The files are available for download at the end of the page.
The major components of the USBasp design are Atmega8 microcontroller, USB Connector and ISP Connector.
As Atmega8 do not have any dedicated USB peripheral Pin PD2,PB0,PB1 are bit banged to emulate USB Communication. Original design involves 10 pin ISP connector with two pin for UART Tx and Rx but that is hardly used so in this schematic those two pins are removed and a 6 pin ISP is used.
PCB Layout
The PCB Layout is completely designed in KiCad. A 3D view / render of the PCB is also available in KiCad. The USBasp programmer is designed to improve usability, reduce footprint and aesthetics.
USBasp : In-Circuit Programmer for Atmel AVR MCU PCB Layout Raytraced Render of USBasp In-Circuit Programmer for Atmel AVR MCU Raytraced Render of USBasp In-Circuit Programmer for Atmel AVR MCU
Conclusion
This particular project brings out learning about PCB design, component choices, cost of product, planning and many more. Best thing about this project is it encourages DIY and Maker culture which is an amazing thing by itself. I encourage everyone to do this project and make your own Modules and Boards for their projects.
Scope of Improvement
I have mentioned this project as v1.0 as there are so many things to improve in this project. One of the main improvements that can be done is to use all SMD Components to further reduce the formfactor, reverse polarity protection, etc.
Download
Thanks for reading this project, I highly appreciate your time and effort.
2 Comments
mvs sarma vu3zmv · February 15, 2023 at 6:31 pm
Thanks Arnab, for such nice github. i need small support.
recently i replaced a damaged atmega8a on my usbasp programmer board.
later i was unable to progress loading usbasp firmware . upgrade would not work.
the usb socket not recognised.
pleaqse try to show me a way. thanks
\
sarma vu3zmmv
S das · May 15, 2023 at 11:41 pm
Please suggest how to solve chip enable program error.
Thanks in advance