The GAP project is based on a pcb with an ATmega3208/ATmega4808 and is extended with two Matrix LED Displays. It can be used as controller for games and graphical things. The GAP has 8 buttons (1 Cross [4], A & B [2], Select [1] and Start [1]), 4 LEDs, a potentiometer to control the volume and a built in UPDI programmer for the pad itself and the connected displays. Data for displays is sent over SPI. The GAP also implements a battery controller for LiPo Batteries. They can be charged over USB. The battery can drive the system for about ~5 hours. There is also a TWI interface to load games from an EEPROM into the system.
| Experience | Level |
|---|---|
| Soldering | |
| Mechanical | |
| Software |
| Type | File | Description |
|---|---|---|
| Schematic | pdf / cadlab | Schematic files |
| Board | pdf / cadlab | Board file |
| Drill | Drill file | |
| PCB | zip / tar | KiCAD/Gerber/BoM/Drill files |
| Mechanical | zip / tar | FreeCAD/Housing and PCB (STEP) files |
| Display Firmware | zip / tar | Firmware for ATtiny406/ATtiny1606 (Display) |
| Demo Firmware | zip / tar | Test application for ATmega3208/ATmega4808 |
There are two parts of the hardware. The pcb (GAP + 2xMAD) and the housing. The pcb is created with KiCAD and the housing with FreeCAD. The software is programmed with Microchip (Atmel) Studio. All files are built with github actions so that they are ready for a production environment. The housing is printed with a 3D-printer (Dremel 3D40).
The circuit board is populated on both sides (Top, Bottom). The best way for soldering the SMD components is within a vapor phase soldering system and for the THT components with a standard soldering system.
The housing has a tolerance of 0.2mm on each side of the case. So the pcb should fit perfectly in the housing. The tolerance can be modified with FreeCAD in the Parameter Spreadsheet.
For programming the GAP is necessary to power the system with 5V over the USB jack. The GAP has an integrated UPDI programmer and a pin to select the programming device (Pad or Display). With Jumper J3/J4 bridged the UPDI programmer is enabled. To program the Pad it is necessary to set the Jumper JP2 between the pins 2-3. If jumper JP2 is set between 1-2 the MAD display(s) can be programmed (set the jumper JP1 at the display that should be programmed). The firmware for the pad/display can be downloaded (see the download section).
# +---+---+---+---+---+---+
# +---+ 1 | 2 | 3 | 4 | 5 | 6 +---+
# | +---+---+---+---+---+---+ D |
# | S I |
# | U O S |
# | V P S G P |
# | C D C S N L |
# | C I K S D A |
# +-+---+ S Y |
# (*) -> | JP1 | I |
# +-+---+---+---+---+---+---+---+ 2 |
# +---+ 1 | 2 | 3 | 4 | 5 | 6 +---+
# +-+-+-+-+-+-+-+-+-+-+-+-+
# | | | | | |
# +-+-+-+-+-+-+-+-+-+-+-+-+
# +---+ 1 | 2 | 3 | 4 | 5 | 6 +---+
# | +---+---+---+---+---+---+ D |
# | S I |
# | U O S |
# | V P S G P |
# | C D C S N L |
# | C I K S D A |
# +-+---+ S Y |
# (*) -> | JP1 | I |
# +-+---+---+---+---+---+---+---+ 1 |
# +---+ 1 | 2 | 3 | 4 | 5 | 6 +---+
# +-+-+-+-+-+-+-+-+-+-+-+-+
# | | | | | |
# +-+-+-+-+-+-+-+-+-+-+-+-+
# +---+ 1 | 2 | 3 | 4 | 5 | 6 +---+
# | +---+---+---+---+---+---+ |
# | V U M S S |
# | C P O C S |
# | C D K |
# | I +--+-+
# | | J + ---+ Program selected (*) MAD
# | G | P +---+ ---+
# | A | 1 +---+ Program GAP
# | M +--+-+
# | E |
# | P |
# | A SW 11 |
# | D U +---+---+ |
# | P | X | X | |
# | D | X | X | |
# | I | | | |
# | +---+---+ |
# | +---+ |
# | +-------+ | U | |
# +-+ TWI +-----------+ S +-----+
# +-+++++-+ | B |
# +-+-+
# |
# |
# +-------------+---------+
# | |
# | +-------------------+ |
# | | AVR-Dude/TeraTerm | |
# | | ~~~~~~~~ | |
# | | ~~~~~ | |
# | | ~~~~~~~~~~~~ | |
# | | | |
# | +-------------------+ |
# | |
# | Computer |
# | |
# +-----------------------+| Register | Value |
|---|---|
APPEND |
0x00 |
BODCFG |
0x00 |
BOOTEND |
0x00 |
OSCCFG |
0x02 |
SYSCFG0 |
0xCC |
SYSCFG1 |
0x00 |
WDTCFG |
0x00 |
It is necessary to press the reset button during
avr-dudeis running! Otherwise theUPDIprogramming does not work. Remove JumperJ3/J4after programming.
# With ATmega3208 !PORT
avrdude.exe -c serialupdi -p m3208 -b 57600 -P COM? -U flash:w:"/path/to/file.hex":a -U eeprom:w:"/path/to/file.eep":a -v
# With ATmega4808 !PORT
avrdude.exe -c serialupdi -p m4808 -b 57600 -P COM? -U flash:w:"/path/to/file.hex":a -U eeprom:w:"/path/to/file.eep":a -v# With ATtiny406 !PORT
avrdude.exe -c serialupdi -p t406 -b 57600 -P COM? -U flash:w:"/path/to/file.hex":a -U eeprom:w:"/path/to/file.eep":a -v
# With ATtiny1606 !PORT
avrdude.exe -c serialupdi -p t1606 -b 57600 -P COM? -U flash:w:"/path/to/file.hex":a -U eeprom:w:"/path/to/file.eep":a -vThe gamepad can be controlled with different libraries to read the input, set the output and control the data on display. An overview of the interfaces are displayed in the dataflow diagram. There is a demo software that is using the libraries to setup and control the gamepad and display (GAP_LIB) and a simple game (GAP_GAME).
With the attached demo library (MAD_LIB) it is quiet easy to use the display. To setup the matrix display library some defines needs to be adjusted.
// Setup the number of displays that are cascaded in matrix.h
#ifndef MATRIX_DISPLAYS
#define MATRIX_DISPLAYS 2
#endif#include "../lib/matrix/matrix.h"
int main(void)
{
matrix_init();
matrix_reset();
_delay_ms(MATRIX_RESET_RECOVERY_TIME_MS);
matrix_enable();
matrix_char(1, 'A');
_delay_ms(1000);
matrix_char(2, 'B');
matrix_frame(buffer);
// ...
}| Type | Link | Description |
|---|---|---|
| ATtiny406 | ATtiny microcontroller | |
| ATtiny1606 | ATtiny microcontroller | |
| ATmega3208 | Microchip ATmega Datasheet | |
| ATmega4808 | Microchip ATmega Datasheet | |
| TA20-11SRWA | Dot Matrix Dispaly | |
| Atmel ICE | Atmel ICE datasheet | |
| UPDI | web | UPDI-Adapter with AVR-Dude |
| Microchip Studio | web | Download page for Microchip Studio |
| KiCAD | web | KiCAD project page |
| FreeCAD | web | FreeCAD project page |
| TeraTerm | web | Terminal software for UART |
R. GAECHTER




