The MAD
project is based on a pcb with an ATtiny406/ATtiny1606 and a Matrix LED Display. It can be used to display data sent over SPI
or UART
. The display also implements a small amount of characters from the ASCII table and also has internal space (EEPROM
) for 16 special characters that can be programmed.
Experience | Level |
---|---|
Soldering | |
Mechanical | |
Software |
Type | File | Description |
---|---|---|
Schematic | pdf / cadlab | Schematic files |
Board | pdf / cadlab | Board file |
Drill | Drill file | |
Gerber | zip / tar | Gerber/Drill files |
Housing, PCB | zip / tar | Housing and PCB (STEP) files |
Firmware | zip / tar | Firmware for ATtiny406/ATtiny1606 (Display) |
Firmware (demo) | zip / tar | Test application(s) for ATmega16a |
There are two parts of the hardware. The pcb and the housing of the MAD
. 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.
The MAD
is powerd with 5V
from an external source. With Jumper JP1
bridged the MAD
can be programmed over UPDI. To enable UART
mode the SS (CS)
Pin must be held low (more details on the dataflow diagram) otherwise the SPI
mode is enabled. In UART
mode only one display can be driven. The SI
pin gets TXD
and the SO
pin gets RXD
. The firmware for the display can be downloaded (see the download section).
Register | Value |
---|---|
WDTCFG |
0x00 |
BODCFG |
0x00 |
OSCCFG |
0x02 |
TCD0CFG |
0x00 |
SYSCFG0 |
0xF5 |
SYSCFG1 |
0x00 |
APPEND |
0x00 |
BOOTEND |
0x00 |
To setup
SW1
asRESET
(PA0
) it is necessary to change theSYSCFG0
-FUSE of theATtiny406/ATtiny1606
. WARNING: To reset thePA0
pin toUPDI
mode a12V
impulse is necessary to program the FUSES again.
The display software can be controlled by SPI
or UART
. The interfaces are displayed in the dataflow diagram. There is a demo software to use the display directly over spi
(MAD_Test
) or a library
(MAD_LIB
).
To send characters to the display over UART
connect an USB/UART converter to the PC and make a bridge beween GND
and SS (CS)
before powering up the display. Start a terminal software on the computer (e.g. Teraterm) and setup the following settings:
Name | Value |
---|---|
PORT | COM? |
BAUD | 9600 |
DATABITS | 8 |
PARITY | NONE |
STOPBITS | 1 |
FLOWCTRL | NONE |
# +---------------------+ +---------------------+
# | MAD - Display | | |
# +-+-+ +-+-+ | +-----------------+ |
# | 1 | VCC VCC | 1 +-------+ +----------+ | | TeraTerm | |
# | 2 | UPDI UPDI | 2 | | | U +---+---+ | | ~~~~~~~~ | |
# | 3 | SI SO | 3 +-----+ | | S | USB |--+ | ~~~~~ | |
# | 4 | SCK SCK | 4 | | | | B +---+---+ | | ~~~~~~~~~~~~ | |
# | 5 | SS (CS) SS | 5 +--+ | | | / | | | | |
# +--+ 6 | GND GND | 6 +--+ | | | U | | +-----------------+ |
# | +-+-+ +-+-+ | | +-+-+ A | | |
# | +---------------------+ | +--+VCC| R | | Computer |
# | +----+TxD| T | | |
# | |RxD| +------+ +---------------------+
# +---------------------------------------+GND| |5V/3V3|
# +-+-+ +------+
# +----+-----+
The firmware
itself contains some demos how to use the display over spi
. The demo software itself is written for an ATmega16A. To test the display a connection to the spi
pins between the display and the ATmega16Ais necessary.
# ~------------+ +---------------------+
# ~ | | MAD - Display |
# ~ A +-+-+ +-+-+ +-+-+
# ~ T [7] | P +- SCK -+ | 1 | VCC VCC | 1 |
# ~ M | O | \ | 2 | UPDI UPDI | 2 |
# ~ E | R +- MOSI --\----+ 3 | SI SO | 3 |
# ~ G | T +-- SS -+ +---+ 4 | SCK SCK | 4 |
# ~ A | B | +------+ 5 | SS (CS) SS | 5 |
# ~ | | | 6 | GND GND | 6 |
# ~ 1 | | +-+-+ +-+-+
# ~ 6 [0] | | | |
# ~ A +-+-+ +---------------------+
# ~ |
# ~~~~~~~~~~~~~~
To control the display through SPI
the bus of the master needs the following setup:
Parameter | Value | Description |
---|---|---|
Clock | < 1Mhz | Bus clock speed should not exceed this value |
Direction | MSB | MSB needs to be transmitted first |
Polarity | Rising | Polarity of clock is rising _/ |
Phase | Rising | Data is valid when clock is rising _/ |
Detail can be found here
# SPI display transmission
# _ SS _
# \________________________________________________________________________________________________/
# SCK
# __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __
# ___/1 \__/2 \__/3 \__/4 \__/5 \__/6 \__/7 \__/8 \__/9 \__/10\__/11\__/12\__/13\__/14\__/15\__/16\___
# MOSI
# __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __
# __/C \__/T \__/R \__/L \__/B \__/Y \__/T \__/E \__/D \__/A \__/T \__/A \__/B \__/Y \__/T \__/E \____
# \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/ \__/
# [7 : 0] [7 : 0]
To enable a bit it needs to be set to on (
Control-Byte | Data-Bit(s) | Description |
---|---|---|
0x00 |
0xXX |
No operation |
0x01 |
[4:0] |
ROW1 LEDs |
... | ... | ... |
0x07 |
[4:0] |
ROW7 LEDs |
0x08 |
[6:0] |
Show ASCII character on display |
0x10 |
0xXX |
Clear buffer |
0x1F |
[0] |
Enable display |
0x20 |
0xXX |
Copy EEPROM address (0) to display |
... | ... | ... |
0x2F |
0xXX |
Copy EEPROM address (15) to display |
0x30 |
0xXX |
Copy Display content to EEPROM address (0) |
... | ... | ... |
0x3F |
0xXX |
Copy Display content to EEPROM address (15) |
0xF0 |
0xXX |
Display refresh rate LOW byte |
0xF1 |
0xXX |
Display refresh rate HIGH byte |
0xFF |
0xXX |
RESET the SPI queue |
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
#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 | |
ATmega16A | Microchip ATmega16A 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