Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
967d543
Revert to first revision of PCB
danboid Oct 4, 2025
fda3304
Move U3 slightly to fix a thermal relief error
danboid Oct 4, 2025
3246eda
Add extra labels to front silkscreen
danboid Oct 4, 2025
77c275c
Add version number to front silkscreen
danboid Oct 4, 2025
a7d22d8
Add M2 mount holes
danboid Oct 4, 2025
075283f
Add buttons to silkscreen
danboid Oct 4, 2025
f709e05
Add Linux build script for ATtiny404 code
danboid Oct 4, 2025
386719f
Use -O3 option for Linux build script to match VisualC project build …
danboid Oct 4, 2025
49959db
Round off PCB corners
danboid Oct 4, 2025
07a9dfe
Update build script to remove old build files before building
danboid Oct 6, 2025
9db7ab8
Add main.hex controller firmware
danboid Oct 6, 2025
d5a5f6d
Add programming and wiring instructions to README
danboid Oct 6, 2025
e9a4cf1
Second revision of silkscreen
danboid Oct 7, 2025
5c9a82c
Update README
danboid Oct 7, 2025
b7791f4
Add gerbers zip file for v1.0
danboid Oct 7, 2025
a507d83
Add DigiKey BOM
danboid Oct 9, 2025
c1dc331
Change avrdude example command in README to use usbtiny config
danboid Oct 23, 2025
d95c76e
Add Arduino project files
danboid Nov 11, 2025
742dd46
Add tested avrdude instructions and UPDI wiring images
danboid Nov 30, 2025
3f62096
Add instructions for finding correct serial device
danboid Nov 30, 2025
93959a3
Add note about required PCB components for programming the ATtiny
danboid Nov 30, 2025
32c6cff
Remove link to old OSHpark board
danboid Dec 3, 2025
6d4fe84
Rename MD connector pinout image
danboid Dec 3, 2025
f2e0aa4
Add csv BOM
danboid Dec 3, 2025
826f574
Add credits
danboid Dec 3, 2025
f84779a
Update README to note the Spectrum Next is compatible
danboid Dec 27, 2025
440b918
Update README with a photo of a wired joystick and buttons
danboid Dec 27, 2025
e18c318
Remove duplicate connector image
danboid Feb 3, 2026
ad83391
Add Manufacturer and Manufacturer Product Number columns to BOM files
danboid Feb 3, 2026
30fb2c5
Add disclaimer to README
danboid Feb 3, 2026
1da7d40
Move images into images subdir
danboid Feb 3, 2026
962a242
Tweak build script
danboid Feb 3, 2026
3667c48
Remove duplicate images from root dir
danboid Feb 3, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file not shown.
8 changes: 8 additions & 0 deletions 6button-MegaDrive-controller-PCB-DigiKey-BOM.csv
Comment thread
danboid marked this conversation as resolved.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Digi-Key Part Number,Quantity,Reference,Value,Manufacturer,Manufacturer Product Number,Description,Datasheet
478-KGM21NR71H104KTCT-ND,10,"C1,C2,C3",0.1u,KYOCERA AVX,KGM21NR71H104KT,CAP CER 0.1UF 50V X7R 0805 – Only 3 needed but cheaper to buy 10 than 3,~
A122908-ND,1,J1,CONN HEADER VERT 14POS 2.54MM,TE Connectivity AMP Connectors,826632-7,"Connector Header Through Hole 14 position 0.100"" (2.54mm)",~
2057-PH1-09-UA-ND,1,J2,CONN HEADER VERT 9POS 2.54MM,Adam Tech,PH1-09-UA,"Connector Header Through Hole 9 position 0.100"" (2.54mm)",~
2057-BHR-06-VUA-ND,1,J3,CONN HEADER VERT 6POS 2.54MM,Adam Tech,BHR-06-VUA,"Connector Header Through Hole 6 position 0.100"" (2.54mm)",~
A102341CT-ND,12,"R1,R2,R3,R4,R5,R6,R7,R8,R9,R10,R11,R12",75k,TE Connectivity Passive Product,CPF0805B75KE1,"75 kOhms ±0.1% 0.1W, 1/10W Chip Resistor 0805 (2012 Metric) Thin Film",~
296-CD74HC257M96CT-ND,2,"U1,U3",74HC257,Texas Instruments,CD74HC257M96,Multiplexer 4 x 2:1 16-SOIC,http://www.ti.com/lit/gpn/sn74LS257
ATTINY404-SSNRCT-ND,1,U2,ATTINY404-SSNR,Microchip Technology,ATTINY404-SSNR,"AVR tinyAVR™ 0, Functional Safety (FuSa) Microcontroller IC 8-Bit 20MHz 4KB (4K x 8) FLASH 14-SOIC",http://ww1.microchip.com/downloads/en/DeviceDoc/50002687A.pdf
Binary file added 6button-MegaDrive-controller-PCB-DigiKey-BOM.xlsx
Comment thread
danboid marked this conversation as resolved.
Binary file not shown.
65 changes: 53 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,61 @@
# genesis_6button
Simple PCB + ATTiny404 code for a 6-button mega drive controller.
# Six button Sega Mega Drive / Genesis controller board

This is a KiCad project for a board and accompanying ATTiny404 code to implement a replacement for the custom chip in the 6-button mega drive/genesis controller.
This repository contains a KiCad project for a six button Sega Mega Drive / Genesis controller board as well as ATTiny404 micro controller code to implement a replacement for the 6 button Sega Mega Drive controller's custom chip. This board is also compatible with the ZX Spectrum Next and its clones.

**Note: the `main` HEAD is not necessarily tested! Tested revisions of the board+firmware will be tagged**

Latest tested fab here: https://oshpark.com/shared_projects/aK2wBkfg
## How do I program the controller?

Currently there is a 14-pin dual row header used for the buttons because I was unaware of the brook 20 pin header at the time. I might add that pinout to future boards.
**DISCLAIMER: This project is provided "as is" for educational purposes only. The authors shall not be held liable for any damage to equipment, data loss, or personal injury incurred through the assembly or use of this project. Proceed at your own risk.**

The ATtiny404 uses UPDI (Unified Program and Debug Interface) for programming, not ISP like older AVR MCUs.

There are several ways to program the ATtiny404 but probably the most affordable way is to use **avrdude** with a USB serial adapter. serialupdi mode has been supported by **avrdude** since v7.

You will need the following:

* A USB serial adapter such as the [FTDI FT232](https://www.amazon.co.uk/dp/B07BBPX8B8)
* A 4.7 KOhm resistor. A resistor in the range of 3.3K to 10KOhm should be fine if you don't have a 4.7KOhm resistor.
* 5x female to female jumper (DuPont) wires.

The +5V and GND headers are wired directly from the serial adapter to the UPDI header. You must create a "Y" jumper cable that connects both the RX and TX pins on your serial adapter to the single UPDI pin on the controller PCB.

The UPDI pin is the bottom left UPDI header pin that has the square footprint in this schematic screenshot. The resistor needs to be connected to the TX wire of your Y cable. Ensure that your serial adapter voltage selection header is set to 5V.
Comment thread
danboid marked this conversation as resolved.

![UPDI header schematic](images/UPDI-header-pinout.png)

![USB serial to UPDI header wiring](images/UPDI-wiring.jpg)

You should only need to have the ATtiny and the UPDI header soldered to the PCB to program it.

Once you have the board connected as shown above, you can program the firmware under Linux using:

```
avrdude -p t404 -c serialupdi -P /dev/ttyUSB0 -U flash:w:main.hex
```

Or under Windows:

```
C 1 | 2 Z
B 3 | 4 Y
A 5 | 6 X
LEFT 7 | 8 GND
RIGHT 9 | 10 GND
DOWN 11 | 12 MODE
UP 13 | 14 START
avrdude.exe -p t404 -c serialupdi -P COM6 -U flash:w:main.hex
```

Make sure you set the serial port device correctly by checking **dmesg** output under Linux or **Device Manager** under Windows.

## Building a joystick

The cable is connected to the J2 header using this pinout:

![Mega Drive controller cable pinout](images/Mega-Drive-connector-pinout.jpg)

Pin 1 on J2 and all of the chips is marked on the PCB silkscreen with a small white dot to the side of pin 1.

Here's photo of this board wired up to a Sanwa clone joystick and housed within a 3D printed [Uzebox fightstick](https://uzebox.org/wiki/Joystick) case:

![Sanwa joystick in Uzebox fightstick case](images/Wired--MD-controller.jpg)

## Credits

Schematic and ATtiny code by [R.F.Merrill](https://github.com/rfmerrill)

Silkscreen and documentation by [Dan MacDonald](https://github.com/danboid/)
16 changes: 16 additions & 0 deletions atmel_studio/genesis_6button/build.sh
Comment thread
danboid marked this conversation as resolved.
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash
# This is a script to build the 6 button Mega Drive controller PCB firmware.
# You need avr-gcc version 8 or later and avr-libc installed to build this code.

# Exit on error, unset variables, catch errors behind a pipe
set -euo pipefail

# Move to the directory where the script is located
cd "$(dirname "$0")"

# Remove previous build, if it exists.
rm -f main.elf main.hex

# Build controller firmware.
avr-gcc -mmcu=attiny404 -O3 -Wall -Wextra main.c -o main.elf
avr-objcopy -O ihex -R .eeprom main.elf main.hex
31 changes: 31 additions & 0 deletions atmel_studio/genesis_6button/main.hex
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
:1000000019C028C027C026C025C024C023C022C0D4
:1000100021C020C020C01EC01DC01CC01BC01AC0F3
:1000200019C018C017C016C015C014C013C012C024
:1000300011C010C011241FBECFEFCDBFDFE3DEBF64
:100040002FE3A0E0BFE301C01D92A130B207E1F7AA
:1000500015D0C4C0D5CF8F931F9280E0182E80E1B9
:1000600080930B0A1092000A81E08093003F109267
:1000700020040C980F981F908F91189588ED84BFDD
:1000800081E08093610080E98093000480911504F1
:10009000886080931504F894109220040C980F98AF
:1000A000109224047894000000000000000000007A
:1000B0000000000000000000000000000000000040
:1000C0000000000000000000000000000000000030
:1000D0000000000000008091080485FFFFCF80E150
:1000E00040E25EE421E03FE0F894109220040C9896
:1000F0000F98109224047894000000000000000083
:10010000000000001199FECF000000000000000078
:1001100000000000119BFECF1092003F1092000AD9
:100120001092200A1092210A8093010A4093280A13
:100130005093290A80930A0A2093000A00000000C5
:1001400000000000000000001199FECF9091003FD8
:100150009111CACF00000000000000000000000064
:10016000119BFECF9091003F9111BECF0000000087
:1001700000000000000000001199FECFF8940F9AD3
:10018000309320040C9A78949091003F9111ACCF59
:10019000000000000000000000000000119BFECFE6
:1001A000F894109220040F9830932404789490913E
:1001B000003F911199CF00000000000000000000F6
:1001C00000001199FECFF8940F9A309320040C98F8
:1001D00078949091003F9115E1F386CFF894FFCF8A
:00000001FF
Binary file added images/Mega-Drive-connector-pinout.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/UPDI-header-pinout.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/UPDI-wiring.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/Wired--MD-controller.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
52 changes: 0 additions & 52 deletions kicad/genesis_6button/genesis_6button-cache.lib
Original file line number Diff line number Diff line change
Expand Up @@ -144,23 +144,6 @@ X Pin_9 9 -200 -100 150 R 50 50 1 1 P
ENDDRAW
ENDDEF
#
# Connector_TestPoint
#
DEF Connector_TestPoint TP 0 30 N N 1 F N
F0 "TP" 0 270 50 H V C CNN
F1 "Connector_TestPoint" 0 200 50 H V C CNN
F2 "" 200 0 50 H I C CNN
F3 "" 200 0 50 H I C CNN
$FPLIST
Pin*
Test*
$ENDFPLIST
DRAW
C 0 130 30 0 1 0 N
X 1 1 0 0 100 U 50 50 1 1 P
ENDDRAW
ENDDEF
#
# Device_C
#
DEF Device_C C 0 10 N Y 1 F N
Expand All @@ -179,26 +162,6 @@ X ~ 2 0 -150 110 U 50 50 1 1 P
ENDDRAW
ENDDEF
#
# Device_CP
#
DEF Device_CP C 0 10 N Y 1 F N
F0 "C" 25 100 50 H V L CNN
F1 "Device_CP" 25 -100 50 H V L CNN
F2 "" 38 -150 50 H I C CNN
F3 "" 0 0 50 H I C CNN
$FPLIST
CP_*
$ENDFPLIST
DRAW
S -90 20 90 40 0 1 0 N
S 90 -20 -90 -40 0 1 0 F
P 2 0 1 0 -70 90 -30 90 N
P 2 0 1 0 -50 110 -50 70 N
X ~ 1 0 150 110 D 50 50 1 1 P
X ~ 2 0 -150 110 U 50 50 1 1 P
ENDDRAW
ENDDEF
#
# Device_R
#
DEF Device_R R 0 0 N Y 1 F N
Expand Down Expand Up @@ -246,21 +209,6 @@ X PB0 9 -600 400 100 R 50 50 1 1 T
ENDDRAW
ENDDEF
#
# Mechanical_MountingHole
#
DEF Mechanical_MountingHole H 0 40 Y Y 1 F N
F0 "H" 0 200 50 H V C CNN
F1 "Mechanical_MountingHole" 0 125 50 H V C CNN
F2 "" 0 0 50 H I C CNN
F3 "" 0 0 50 H I C CNN
$FPLIST
MountingHole*
$ENDFPLIST
DRAW
C 0 0 50 0 1 50 N
ENDDRAW
ENDDEF
#
# power_+5V
#
DEF power_+5V #PWR 0 0 Y Y 1 F P
Expand Down
Loading