Skip to the content
PCBKitNew board
2 layers94 × 55 mmAvr basic sbc, the printed circuit board in 3D

An ATmega1284P-based single board computer with composite video output, PS/2 keyboard input, running Tiny BASIC.

Size
94 × 55 mm
Copper layers
2
Thickness
1.6 mm
Parts
38
Nets
58
Pads
163
Tracks, vias
205, 0
Pours
1
Routed
Yes
KiCad
KiCad 9.0 (file 20241229)
Created
7 Mar 2024
Updated
31 Mar 2026

Overview

Avr basic sbc is an open-source printed circuit board by bazsimarkus, from the bazsimarkus/avr-basic-sbc repository on GitHub. It is a 2-layer board of 94 × 55 mm with 38 parts on 58 nets, routed with 205 tracks and 0 vias.

It is built around the ATMEGA1284P-PU, 25LC640-E/P and L7805. Its parts include 9 connectors, 8 resistors, 5 capacitors, 3 ICs and 3 switches. It belongs with the computers and single-board computers and keyboards and input boards and the AVR (ATmega, ATtiny) boards of this library.

Main components

3

README

README.md

AVR-BASIC-SBC Logo

avr-basic-sbc

An ATmega1284P-based single board computer
Composite video output • PS/2 keyboard input • Tiny BASIC interpreter with graphics, sound, GPIO, and serial I/O

AVR-SBC Mainboard Hello World on AVR-SBC


Table of Contents


Overview

I always loved retrocomputing. As a kid I played around with a Commodore 64 - which I still own to this day - and I was always fascinated by the fact that computers are really just embedded systems, just nowadays unimaginably fast ones. This project grew out of that fascination.

The idea is not completely original. Many people have built similar things, and my two biggest inspirations were Jörg Wolfram's AVR ChipBASIC and Juan J. Martínez's DAN64. Neither was quite what I had in mind though - I wanted something simple to use, simple to develop for, and simple to build. A Tiny BASIC based single board computer with composite video output, a PS/2 keyboard, and some GPIO, all on a single through-hole PCB. So I decided to build my own, and here it is.

The AVR-SBC is an ATmega1284P-based single board computer running a Tiny BASIC interpreter. It generates a composite video signal (320×240, PAL) directly from the microcontroller, accepts input from a PS/2 keyboard, has an onboard buzzer for sound, and exposes GPIO pins for interacting with the outside world. There is also an external 25LC640 SPI EEPROM for storing programs and data - I particularly like using it to store bitmaps that can be drawn on the screen. The internal EEPROM of the ATmega1284P is available too, so a typical setup is storing a drawing program in the internal EEPROM and the actual bitmap data in the external one.

The whole thing is built with plain avr-gcc and avrdude. No Arduino framework, no dependencies - just good old C and a bit of assembly where the timing gets tight.

AVR-SBC Mainboard (alternate angle)


Features

  • ATmega1284P running at 16 MHz - 128 KB flash, 16 KB SRAM, 4 KB internal EEPROM
  • Composite video output via RCA jack - 320×240 PAL, generated directly by the MCU
  • PS/2 keyboard input - supports EN (QWERTY), DE (QWERTZ), and HU (QWERTZ) layouts, selectable at compile time
  • Tiny BASIC interpreter - interactive prompt with 40×30 character terminal, blinking cursor, and a nice MS-DOS style 8×8 font
  • Graphics library - pixel, line, rectangle, filled rectangle, circle, filled circle, ellipse, triangle, bitmap drawing, and more
  • Onboard piezo buzzer - TONE, TONEW, NOTONE commands for playing melodies, with a slide switch to disable it
  • External 25LC640 SPI EEPROM (8 KB) - accessible from BASIC via XPOKE, XPEEK, XSAVE, XLOAD, XFORMAT; great for storing bitmaps
  • Internal EEPROM (4 KB) - accessible via EPOKE, EPEEK, ESAVE, ELOAD, EFORMAT
  • GPIO - DWRITE, DREAD, AWRITE, AREAD commands using MightyCore-style pin numbering
  • UART1 serial interface - for uploading programs from a PC via SERLOAD
  • Two onboard LEDs - red power indicator, yellow user-controllable LED on PD6
  • Tactile reset button and power toggle switch
  • 5V regulated power via L7805CV from a standard DC barrel jack
  • No Arduino framework - built entirely with avr-gcc and avrdude
  • Boomerang shields - stackable expansion boards for serial USB and Bluetooth program upload (see Boomerang Shields)
  • SBC Studio - companion Python app for editing, uploading, bitmap conversion, and MIDI-to-BASIC conversion (see SBC Studio)

Hardware

Main Board

The AVR-SBC is a fully through-hole PCB, which was a deliberate choice - it makes it easy to solder by hand and easy to modify. The board is revision v1.2. Versions v1.0 and v1.1 were non-working prototypes that got soldered, debugged, and eventually thrown away. The third one worked, and it has been working reliably ever since.

The heart of the board is the ATmega1284P in a DIP-40 socket, running off a 16 MHz HC49-U crystal. Power comes in through a standard 2.1mm DC barrel jack and is regulated to 5V by an L7805CV linear regulator. There are two LEDs - a red power indicator and a yellow user-controllable one on PD6. A tactile button handles reset, a toggle switch controls power, and a slide switch can disconnect the buzzer if you get tired of the beeping.

Video goes out through an RCA jack. The PS/2 keyboard connector is a right-angle Mini-DIN. There is also an external 25LC640 SPI EEPROM in a DIP-8 socket, and a 2×5 USBasp ISP programming header.

AVR-SBC Mainboard


Schematic

AVR-BASIC-SBC Schematic

The full KiCad project including schematic, PCB, and Gerber files is available in the schematic/ folder.


Bill of Materials

ReferenceQtyValue / Part
U11ATmega1284P-P (DIP-40)
U21L7805CV - 5V linear regulator (TO-220)
U3125LC640 - SPI EEPROM 8KB (DIP-8)
Y1116 MHz crystal (HC49-U)
BZ11Buzzer (polarized, 1201 footprint)
C1, C2222 pF - crystal load capacitors
C313.3 µF electrolytic
C411 µF electrolytic
C514.7 µF electrolytic
D11LED 5mm RED - power indicator
D21LED 5mm YELLOW - user LED (PD6)
R1, R5, R6310 kΩ
R2, R3, R7, R84470 Ω
R411 kΩ
S11Tactile button 6×6mm - reset
S21Toggle switch 7×7mm - power
S31Slide switch - buzzer on/off
J11DC barrel jack 2.1mm (DC-005)
J21PS/2 keyboard connector (Mini-DIN 6)
J31RCA video jack
J4-J74Pin headers - Port B, A, C, D GPIO
J812×5 pin header - USBasp ISP
J912×4 pin header - power output

Pin Mapping

The firmware uses MightyCore-style pin numbering for the ATmega1284P, which is also what the BASIC DWRITE, DREAD, AWRITE, and AREAD commands expect.

PinPortFunctionAvailable?
0PB0PS/2 keyboard clock✗ reserved
1-3PB1-PB3GPIO (J4)✓
4-7PB4-PB7SPI - EEPROM /CS, MOSI, MISO, SCKshared
8PD0PS/2 keyboard data✗ reserved
9PD1UART1 TX✓
10PD2UART1 RX✓
11-12PD3-PD4GPIO (J7)✓
13PD5Video sync output✗ reserved
14PD6Yellow LED✓
15PD7Buzzer / OC2A✓
16-23PC0-PC7GPIO (J6) - fully free✓
24-30PA0-PA6GPIO (J5) - exposed on header, but see note⚠ see note
31PA7Video data output✗ reserved

Note on PORTA: The high-resolution line rendering routine writes pixel data to the entire PORTA register using the AVR OUT instruction (1 cycle, cycle-exact timing). This means the whole port is effectively owned by the video system at runtime. The pins are physically accessible on the J5 header, but using them as GPIO will corrupt the video output. PORTC is the recommended alternative for free GPIO pins.


Firmware

Architecture

The firmware is pure C (and one assembly file), built with avr-gcc and flashed with avrdude. No Arduino framework, no HAL, no magic. Everything is wired up by hand.

The three hardware timers are each assigned a dedicated role and they all have to coexist without stepping on each other, which was honestly one of the trickier parts of getting this running:

TimerRole
Timer01 ms system tick (CTC mode) - used by DELAY and the tone duration counter
Timer1Composite video sync and scanline generation
Timer2Tone output on OC2A / PD7 - drives the buzzer via TONE / TONEW

Memory is tight. The ATmega1284P has 16 KB of SRAM, and between the 9600-byte framebuffer (320×240 ÷ 8) and the 5500-byte BASIC program buffer, there is not much room left. It works, but there is not a lot of headroom to play with.


Graphics & Video

The video output is the part I am most proud of - and the part that gave me the most trouble.

I originally used the Arduino TVout library like most similar projects do. It works, but the resolution is limited and I never really liked how it looked. I wanted 320×240, so I decided to write my own graphics library. That turned out to be a good decision, but it had consequences.

The line rendering function - render_scanline() in render_line.S - has to output one pixel every single clock cycle to hit 320 pixels per line at 16 MHz. There is simply no way to do that in C. Even a tight loop has overhead that breaks the timing. So I wrote it in AVR assembly, fully unrolled, 40 bytes × 8 bits per byte, outputting each pixel with a single OUT instruction directly to PORTA. No loop, no branches, just 320 consecutive OUT and LSL pairs.

The downside is that OUT writes to the entire port at once. That means PORTA is permanently reserved by the video system at runtime - the pins are physically on the J5 header, but you cannot use them as GPIO without corrupting the video output. PORTC has 8 fully free pins (J6) and is the recommended alternative. I never found a way around this limitation at 320×240, so I left it as-is. Ideas are welcome.

The graphics library (graphics.c) supports:

  • Pixels, lines (Bresenham), horizontal and vertical lines
  • Rectangles, filled rectangles, rounded rectangles
  • Circles, filled circles, ellipses, filled ellipses
  • Triangles, filled triangles
  • Bitmap drawing from RAM or PROGMEM
  • 8×8 font character rendering (MS-DOS style)
  • Three draw modes: SET, CLEAR, XOR

The text terminal layer (text.c) sits on top of the graphics library and provides a 40×30 character terminal with scrolling, wrap-around, and a blinking cursor.


Tiny BASIC Interpreter

The firmware is almost a direct port of TinyBASIC, originally written by Gordon Brandly as 68000 Tiny Basic, then ported to C by Michael Field as Arduino Basic, and further developed by Scott Lawrence as TinyBasicPlus. I adapted it to be fully AVR C based - no Arduino framework anywhere.

On startup, the board displays a splash screen with the firmware version and available memory, then drops into the interactive > prompt.

AVR-SBC Boot Screen

The BASIC command set includes everything you would expect, plus a bunch of hardware-specific extensions:

Core Commands
CommandDescriptionExample
PRINT expr, expr, ...Prints expressions (strings or numbers) to the screen. Items separated by ,. End with ; to suppress newline. ? is a shorthand alias.PRINT "HELLO", X
INPUT varPrompts the user with ? and reads a numeric value into variable var (A-Z).INPUT A
LET var = exprAssigns the value of an expression to a variable (A-Z). The LET keyword is optional.LET X = 42 or X = 42
IF expr THEN statementEvaluates expression; if non-zero, executes the statement after THEN. THEN is optional. Relational operators: =, <>, !=, <, >, <=, >=.IF X > 10 THEN PRINT "BIG"
GOTO exprJumps to the line number given by the expression.GOTO 100
GOSUB exprCalls the subroutine at the given line number, pushing a return address onto the stack.GOSUB 500
RETURNReturns from the most recent GOSUB call.RETURN
FOR var = expr TO expr [STEP expr]Begins a counting loop. Variable iterates from start to end value. STEP defaults to 1 if omitted.FOR I = 1 TO 10 STEP 2
NEXT varAdvances the FOR loop variable and branches back if the loop has not finished.NEXT I
ENDStops program execution and returns to the prompt.END
STOPSame as END - stops program execution.STOP
REM textComment line; everything after REM (or ') is ignored.REM THIS IS A COMMENT
Program Management
CommandDescriptionExample
RUNExecutes the stored program from the first line.RUN
LIST [linenum]Lists the stored program. If a line number is given, listing starts from that line.LIST or LIST 100
NEWErases the stored program from memory.NEW
LOADLoads a program (stub - unimplemented on this platform).LOAD
SAVESaves a program (stub - unimplemented on this platform).SAVE
CHAINLoads a program and auto-runs it after loading (stub - unimplemented on this platform).CHAIN
MEMPrints the number of free BASIC program bytes and EEPROM usage statistics.MEM
BYEExits the BASIC interpreter.BYE
GPIO
CommandDescriptionExample
DWRITE pin, valueSets a digital GPIO pin HIGH or LOW. Value can be HIGH/HI, LOW/LO, or a numeric expression (0/1). Uses MightyCore pin numbering.DWRITE 14, 1
AWRITE pin, valueWrites an analog (PWM) value to a GPIO pin. Same syntax as DWRITE.AWRITE 14, 128
DREAD(pin)Function - reads a digital pin and returns 1 (HIGH) or 0 (LOW). Enables the internal pull-up resistor.X = DREAD(16)
AREAD(pin)Function - reads an analog value (0-1023) from an ADC pin (pins 24-30 only).X = AREAD(24)
Graphics
CommandDescriptionExample
DRAWPIX x, y, cDraws a single pixel at (x, y) with draw mode c (0=clear, 1=set, 2=xor).DRAWPIX 160, 120, 1
DRAWLINE x0, y0, x1, y1, cDraws a line from (x0, y0) to (x1, y1) with draw mode c.DRAWLINE 0, 0, 319, 239, 1
DRAWRECT x, y, w, h, c, fDraws a rectangle at (x, y) with width w and height h. Outline uses draw mode c, fill uses draw mode f. Use -1 for f to draw outline only.DRAWRECT 10, 10, 50, 30, 1, 1
DRAWCIRC cx, cy, r, c, fDraws a circle centered at (cx, cy) with radius r. Outline uses draw mode c, fill uses draw mode f. Use -1 for f to draw outline only.DRAWCIRC 160, 120, 40, 1, 0
DRAWCHAR x, y, charDraws a single 8×8 character at pixel position (x, y). The character is the literal next character in the source.DRAWCHAR 10, 10, A
GETPIX x, yPrints the pixel value (0 or 1) at position (x, y) to the screen.GETPIX 100, 50
CLSClears the entire screen and resets the text cursor.CLS
Sound
CommandDescriptionExample
TONE freq, durationStarts playing a tone at freq Hz for duration ms on the buzzer. Execution continues immediately.TONE 440, 500
TONEW freq, durationPlays a tone at freq Hz for duration ms and waits until the tone finishes before continuing.TONEW 440, 500
NOTONEImmediately stops any tone currently playing.NOTONE
Timing
CommandDescriptionExample
DELAY exprPauses execution for the given number of milliseconds. Breakable with ESC or Ctrl-C.DELAY 1000
Internal EEPROM (4 KB)
CommandDescriptionExample
ESAVESaves the current program to internal EEPROM.ESAVE
ELOADLoads a program from internal EEPROM into RAM.ELOAD
ELISTLists the contents of the internal EEPROM to the screen.ELIST
EFORMATErases the entire internal EEPROM (fills with zeros).EFORMAT
EPOKE value, addrWrites value (byte) to internal EEPROM at address addr.EPOKE 65, 0
EPEEK var, addrReads a byte from internal EEPROM at address addr into variable var (A-Z).EPEEK A, 0
External EEPROM (8 KB - 25LC640)
CommandDescriptionExample
XSAVESaves the current program to external SPI EEPROM.XSAVE
XLOADLoads a program from external EEPROM into RAM.XLOAD
XLISTLists the contents of the external EEPROM to the screen.XLIST
XFORMATErases the entire external EEPROM (fills with zeros).XFORMAT
XPOKE value, addrWrites value (byte) to external EEPROM at address addr.XPOKE 65, 0
XPEEK var, addrReads a byte from external EEPROM at address addr into variable var (A-Z).XPEEK A, 0
Serial (UART1)
CommandDescriptionExample
SEROPENOpens UART1 at 9600 baud for serial communication.SEROPEN
SERCLOSECloses UART1.SERCLOSE
SERPRINT expr, expr, ...Sends expressions (strings or numbers) over UART1. Same syntax as PRINT.SERPRINT "HELLO"
SERREADReads and displays characters from UART1 until a newline or 5-second timeout.SERREAD
SERLOADLoads a BASIC program from UART1 into RAM (used for PC upload via SBC Studio).SERLOAD
Miscellaneous
CommandDescriptionExample
INKEY varNon-blocking keyboard read. Stores the ASCII value of the pressed key into variable var (A-Z), or 0 if no key is pressed.INKEY K
RSEED exprSeeds the random number generator with the given value.RSEED 42
POKE addr, valueWrites value (byte) to RAM address addr within the BASIC memory buffer.POKE 0, 65
PEEK(addr)Function - reads a byte from RAM address addr within the BASIC memory buffer.X = PEEK(0)
ABS(expr)Function - returns the absolute value of the expression.X = ABS(-5)
RND(expr)Function - returns a random integer from 0 to expr-1.X = RND(100)
Operators
OperatorDescription
+, -, *, /Arithmetic: addition, subtraction, multiplication, integer division
=, <>, !=, <, >, <=, >=Relational operators (return 1 if true, 0 if false)
-exprUnary negation
(expr)Parentheses for grouping
Notes:
  • Line numbers are required for stored programs (e.g. 10, 20, 30). Direct commands can be typed without a line number.
  • Variables: single uppercase letters A-Z, 16-bit signed integers (-32768 to 32767)
  • Strings in double or single quotes: "HELLO" or 'HELLO'
  • Multiple statements per line separated by : - e.g. 10 A=1 : B=2 : PRINT A+B
  • Screen resolution: 320×240 pixels (x: 0-319, y: 0-239)
  • Program RAM: 5500 bytes total
  • Break execution at any time with ESC or Ctrl-C

Building & Flashing

Requirements: avr-gcc, avr-libc, avrdude, and make. On Windows, WinAVR or Microchip Studio works fine. On Linux/macOS, install from your package manager.

bash
# Build with default US/English keyboard layout
make

# Build with German QWERTZ layout
make KB_LAYOUT=DE

# Build with Hungarian QWERTZ layout
make KB_LAYOUT=HU

# Flash via USBasp programmer
make flash

# Show flash / SRAM / EEPROM usage
make size

The Makefile also exposes feature flags if you want to disable subsystems:

bash
# Build without tone support (frees Timer2)
make FEAT_TONES=0

# Build without external EEPROM support
make FEAT_XEEPROM=0

Flashing is done via the 2×5 USBasp ISP header (J8). One important thing to be aware of: the 5V pin on the ISP header is not connected. The board must be powered through the DC barrel jack before you can flash it. This was a conscious decision on v1.2 to avoid back-feeding the microcontroller through the programmer.

The default programmer in the Makefile is usbasp. If you use something else, change the -c usbasp flag in the flash target accordingly.


Boomerang Shields

After a while, connecting an FTDI USB-serial cable to PD2 and PD3 every time I wanted to upload a program got old really fast. So I opened KiCad again and designed a small stackable expansion board - the Boomerang Shield.

Why boomerang? Because of the shape. It has cutouts for the crystal and capacitors, and it follows the contour of the pin headers on the main board. I didn't mean for it to look like a boomerang, it just happened that way. I didn't want to redesign it - this is already the third revision of the main board - so the name stuck.

The shields use the same 2.54mm pin headers as the main board and stack directly on top. Pin headers are also broken out on the shield itself so GPIO access is not lost.


Serial Boomerang Shield

Serial Boomerang Shield (bottom view)

The serial boomerang shield is the official one. It carries a CP2102 USB-to-serial bridge module, connects to UART1 (PD2/PD3) of the AVR-SBC, and exposes a micro-USB connector. That's it - but now I can just leave it sitting on top of the board and upload programs with a single cable. Much better.

Serial Boomerang Shield stacked on AVR-SBC

The KiCad project, schematic, and Gerber files for the serial boomerang shield are in the boomerang-shields/serial-boomerang-shield/ folder. There is also an empty boomerang shield template in boomerang-shields/empty-boomerang-shield-template/ if you want to design your own expansion.

Serial Boomerang Shield


Bluetooth Boomerang Shield (perfboard prototype)

Once I had the serial shield working, I started thinking about what else could plug into the same spot. The CP2102 module and an HC-06 Bluetooth Classic module have a very similar pinout - both are essentially a UART bridge. So I quickly wired one up on a perfboard with the same pin header footprint as the serial shield, plugged it in, and it worked.

Bluetooth Boomerang Shield (perfboard prototype)

When the HC-06 is paired with a PC, it shows up as a virtual COM port via Bluetooth Classic SPP - exactly the same as the USB cable. That means I can upload BASIC programs to the AVR-SBC completely wirelessly. Which is, honestly, pretty amazing for a board built around an 8-bit microcontroller.

There is no official PCB design for the Bluetooth boomerang yet - it lives on a perfboard prototype for now. If I ever design it properly, I would probably use a better module, something like a Würth Elektronik Proteus-IV, a Skoll-I, or an ESP32-based module.


Seven Segment Display Extension (perfboard prototype)

I also soldered together a small perfboard circuit with a seven segment display that stacks on top of the boomerang shield.

Seven Segment Extension Board

So at one point I had three layers: AVR-SBC → Serial Boomerang Shield → Seven Segment Extension. There is a BASIC example for it in the examples/ folder.

All three boards stacked

Like the Bluetooth shield, this one never got an official PCB design. It remains a perfboard prototype.


SBC Studio

SBC Studio is a companion Python application for the AVR-SBC. It started as a simple serial uploader - basically just a way to type programs into the board really fast over UART1 without having to sit at a PS/2 keyboard. Over time it grew into something more, so I gave it a proper name.

SBC Studio screenshot

It requires Python 3 with pyserial. The bitmap tools also need Pillow, and the MIDI converter needs pretty_midi. Everything else is standard library.

bash
pip install pyserial Pillow pretty_midi
python sbc-studio.py

The source is in pc-tools/sbc-studio/.


Code Editor & Serial Upload

The main window is a lightweight .bas file editor with syntax highlighting, line numbers, tab support, find & replace, and undo/redo. It is nothing fancy, but it is comfortable enough for writing and editing Tiny BASIC programs.

The serial upload works by opening UART1 at 9600 baud and sending the program character by character - essentially simulating someone typing it in at the > prompt, just very fast. To upload, select your COM port from the toolbar, open or write a .bas file, and hit upload. The board receives it line by line exactly as if you had typed it yourself.

The keyboard layout for the PS/2 side (EN/DE/HU) is selected at firmware compile time, but the upload always goes through serial so the layout doesn't matter there.


Bitmap Editor & Loader

This was a fun one to build. The Bitmap Editor takes any image file and converts it to a 128×64 monochrome bitmap suitable for the AVR-SBC screen. It has options for scaling, centering, dithering (Floyd-Steinberg), threshold control, rotation, flip, and background colour. The output is a standard 1-bit .bmp file.

The Bitmap Loader then uploads that .bmp to the AVR-SBC's external 25LC640 EEPROM via serial, using XPOKE commands split into batches. Once uploaded, a small BASIC program reads the bitmap back out with XPEEK and draws it pixel by pixel with DRAWPIX.

Bitmap viewer running on the AVR-SBC

I included two examples in pc-tools/sbc-studio/sbc-studio-output/bitmap-editor/ - a photo of our dog and a flower.

The reason I like this so much is that the external EEPROM fits a 128×64 bitmap very comfortably, and you never have to take the chip out of the socket to reprogram it. Everything goes over serial.


MIDI to BAS Converter

At some point I realised that the TONEW command - which plays a tone at a given frequency and waits for it to finish - maps almost perfectly onto MIDI note data. So I built a converter that takes a single-track .mid file, extracts the notes, calculates frequencies and durations, and outputs a .bas file full of TONEW and DELAY statements that the AVR-SBC can play on its onboard buzzer.

The output is capped at around 5300 bytes to fit the BASIC program buffer. It is not going to replace a proper audio system, but hearing Für Elise come out of a piezo buzzer on a board you built yourself is genuinely satisfying. Two examples are included in pc-tools/sbc-studio/sbc-studio-output/midi-to-bas-converter/ - Für Elise and Ode to Joy.


BASIC Examples

Once the board was up and running I could finally sit down and actually write some programs for it in Tiny BASIC. The examples are all in the examples/ folder. They cover a bit of everything - games, graphics demos, sound, and hardware I/O.

All of them can be typed in at the > prompt directly, or uploaded from a PC using SBC Studio.


Hello World

The simplest possible start. The PRINT command outputs text to the screen.

basic
PRINT "HELLO"

Hello World on AVR-SBC


Graphics Demos

The graphics library makes it easy to draw shapes directly from BASIC. These examples show off what the 320×240 display can do.

FileDescription
ConcentricCircles.basDraws concentric circles filling the screen
RandomRectangles.basFills the screen with randomly placed rectangles
Spirograph.basSpirograph-style pattern using lines and loops
StarField.basScrolling star field effect
BouncingBall.basA ball bouncing around the screen

Graphics demo running on AVR-SBC


Games

A few simple games that show off keyboard input, random numbers, and the graphics commands together.

FileDescription
EatTheTargets.basMove a cursor around the screen and eat targets
GuessTheNumber.basClassic guess the number game with hints
SlotMachine.basAn ASCII slot machine

Sound Examples

These use the TONE and TONEW commands to play melodies on the onboard buzzer. The MIDI converter in SBC Studio was used to generate the two classical pieces.

FileDescription
CMajorPiano.basPlays a C major scale using the keyboard
MelodyPlayer.basA simple melody player
furelise.bas (generated)Für Elise - in pc-tools/sbc-studio/sbc-studio-output/midi-to-bas-converter/
odetojoy.bas (generated)Ode to Joy - in pc-tools/sbc-studio/sbc-studio-output/midi-to-bas-converter/

Hardware I/O Examples

These examples interact with the GPIO pins and show how DWRITE, DREAD, and the EEPROM commands work in practice.

FileDescription
BlinkLED.basBlinks the onboard yellow LED on PD6 using DWRITE
SevenSegmentDisplay.basDrives a seven segment display connected to PORTC

Blink LED example running on AVR-SBC


Known Limitations & Future Ideas

The board works, and it works reliably. But it is not perfect, and I know exactly where the rough edges are.


Hardware

Decoupling capacitors - when I designed the board I was quite casual with component choices, and I skipped the per-chip decoupling capacitors. There are bulk capacitors for the microcontroller and the L7805CV, but they are not following the reference design. If I were to redesign the board I would definitely add proper decoupling caps on every supply pin.

No reverse polarity protection - the DC input has no protection diode. Plugging in the barrel jack the wrong way around will likely kill the board. A simple series diode or a P-channel MOSFET would fix this.

No Schottky diode on the ISP header - to prevent back-feeding the microcontroller through the programmer's VCC pin, I simply left the 5V pin on the ISP header unconnected. It works, but a proper Schottky diode would be a cleaner solution. As it stands, the board must always be powered through the DC barrel jack when programming.

PORTA reserved by the video system - as described in the Firmware section, the cycle-exact line rendering routine writes to the entire PORTA register using the AVR OUT instruction. This means PA0-PA6 cannot be used as GPIO without corrupting the video output, even though the pins are physically accessible on the J5 header. Getting 320×240 resolution with proper timing while also making PORTA available as GPIO is an unsolved problem for this project. If you have an idea, I would love to hear it.


Software & Features

Boomerang shields without official PCBs - the Bluetooth boomerang and the seven segment extension board are both perfboard prototypes. They work great but there are no KiCad files for them. At some point I would like to design proper PCBs for both - and when I do, I would probably swap the HC-06 for something more modern, like a Würth Elektronik Proteus-IV, a Skoll-I, or an ESP32-based module.

Single-track MIDI only - the MIDI to BAS converter in SBC Studio only handles single-track MIDI files. Multi-track files are not supported, which rules out a lot of MIDI content. Since the buzzer is monophonic anyway this is not a huge loss, but smarter track selection would be a nice improvement.

Auto-run from EEPROM - the firmware supports an ENABLE_EAUTORUN flag that automatically runs the program stored in internal EEPROM on boot, without showing the > prompt first. This is disabled by default but could be useful for standalone appliance-style deployments.


Personal Notes

I started this project many years ago, then stopped, then restarted, then had a long pause. Many versions of KiCad were released in the meantime. AI systems started developing and becoming more and more advanced. And this project was still just there, waiting on a shelf somewhere between the other unfinished things. But occasionally when I came back to it, it made me very happy and I found it genuinely challenging.

Before this project I was usually defaulting to just using the Arduino framework - like the TVout-based firmware also did, and like many similar projects still do. But during this project I realized that with the power of real C and assembly you can get much further. Writing the line renderer in assembly, getting the timing right across three timers, squeezing everything into 16 KB of SRAM - none of that would have happened if I had stayed in Arduino land. So it was definitely a nice learning experience about myself too. Now there is no going back. Even the simplest things I do in low level C, and I have become really interested in assembly as well.

I am glad I have this project. I can't wait to see what the future brings with it - I am sure it will be exciting. And knowing myself, I will probably abandon it for a while again, and then one day come back and find something new to add. The hardware stays the same.


Inspirations & Credits

Inspiration Projects

This project would not exist without these two:

  • Jörg Wolfram - AVR ChipBASIC The project that first showed me this kind of thing was possible on an AVR microcontroller.

  • Juan J. Martínez - DAN64 A beautifully executed AVR-based home computer that was a big influence on the direction of this project.


Tiny BASIC Lineage

The firmware interpreter is based on a long chain of ports and adaptations:

  • Gordon Brandly - original 68000 Tiny Basic
  • Michael Field - ported to C as Arduino Basic
  • Scott Lawrence - extended and maintained as TinyBasicPlus

The AVR-SBC version is a bare-metal port of TinyBasicPlus, adapted for the ATmega1284P with no Arduino framework and extended with graphics, sound, EEPROM, and serial commands.


Tools & Libraries


AVR-BASIC-SBC
Built with ❤️ and an 8-bit microcontroller

Parts

38
QtyValueFootprintReferences
4470RStockLib:R_470_Axial_DIN0207R2, R3, R7, R8
4MountingHole_3.2mm_M3_DIN965MountingHole:MountingHole_3.2mm_M3_DIN965MH1, MH2, MH3, MH4
310kStockLib:R_10k_Axial_DIN0207R1, R5, R6
222pFCapacitor_THT:C_Rect_L4.6mm_W2.0mm_P2.50mm_MKS02_FKP02C1, C2
2LOGOLOGOG2, GRAPHICS2
10.1uFCapacitor_THT:CP_Radial_D6.3mm_P2.50mmC4
10.33uFCapacitor_THT:CP_Radial_D6.3mm_P2.50mmC3
116 MHzCrystal:Crystal_HC49-U_VerticalY1
11kStockLib:R_1k_Axial_DIN0207R4
125LC640Package_DIP:DIP-8_W7.62mmU3
14.7uFCapacitor_THT:CP_Radial_D6.3mm_P2.50mmC5
1ATmega1284P-PPackage_DIP:DIP-40_W15.24mmU1
1Button TACT 6x6mmStockLib:Button TACT 6x6mmS1
1Buzzer 1201StockLib:Buzzer 1201BZ1
1DC-005 Power JackStockLib:DC-005 Power JackJ1
1L7805Package_TO_SOT_THT:TO-220-3_VerticalU2
1LED 5mm REDStockLib:LED_D5.0mm_REDD1
1LED 5mm YELLOWStockLib:LED_D5.0mm_YELLOWD2
1PS/2 keyboard portStockLib:PS2-connector-keyboardJ2
1Port AConnector_PinHeader_2.54mm:PinHeader_1x07_P2.54mm_VerticalJ5
1Port BConnector_PinHeader_2.54mm:PinHeader_1x07_P2.54mm_VerticalJ4
1Port CConnector_PinHeader_2.54mm:PinHeader_1x08_P2.54mm_VerticalJ6
1Port DConnector_PinHeader_2.54mm:PinHeader_1x06_P2.54mm_VerticalJ7
1Power output headerConnector_PinHeader_2.54mm:PinHeader_2x04_P2.54mm_VerticalJ9
1RCA Video JackStockLib:RCA Video JackJ3
1Slide Switch SS12D00StockLib:Slide Switch SS12D00S3
1Toggle Switch 7x7mmStockLib:Toggle Switch 7x7mmS2
1USBasp headerConnector_PinHeader_2.54mm:PinHeader_2x05_P2.54mm_VerticalJ8

Questions

How big is the Avr basic sbc PCB?

It measures 94 × 55 mm and has 2 copper layers, 1.6 mm thick.

What parts does the Avr basic sbc use?

38 parts, built around the ATMEGA1284P-PU, 25LC640-E/P and L7805. The full list of its parts is on this page, with links to each part's symbol and footprint where PCBKit's library has them.

Where can I download the Avr basic sbc KiCad files?

From the bazsimarkus/avr-basic-sbc repository on GitHub, at the commit this page was made from: the board is schematic/avr-basic-sbc.kicad_pcb and its schematic boomerang-shields/emtpy-boomerang-shield-template/emtpy-boomerang-shield-template.kicad_sch. PCBKit opens the board in the browser, with nothing to install.

Can I use the Avr basic sbc design in my own project?

Its repository states no licence, so its author keeps all rights: ask bazsimarkus before reusing the design.

More from bazsimarkus/avr-basic-sbc

1
  • 2 layers78 × 55 mmEmtpy boomerang shield template, the printed circuit board in 3D

    Emtpy boomerang shield template

    bazsimarkus/avr-basic-sbc

    An ATmega1284P-based single board computer with composite video output, PS/2 keyboard input, running Tiny BASIC.

    11 parts

Similar boards

  • 2 layers85 × 94.5 mmDigital voltages ps, the printed circuit board in 3D

    Digital voltages ps

    zachrjt/digital-voltages-ps

    Fixed 3.3V and 5V voltage power supply with voltage and current readout

    79 parts2
  • 2 layers130 × 105 mmMb02a1, the printed circuit board in 3D

    Mb02a1

    GOS2022/Hardware

    Last updated: 2025-07-04 (c) 2025, Ahmed Gazar

    100 partsMIT
  • 2 layersGlider mcu, the printed circuit board in 3D

    Glider mcu

    house4hack/nrf-glider

    Glider using NRF24L01

    11 parts
  • 2 layers151 × 131 mmRnvm marge, the printed circuit board in 3D

    Rnvm marge

    kitspace-test-repos/kicad6-file-collection

    228 partsMIT
  • 2 layers229.9 × 111.8 mmAvr colorvideo, the printed circuit board in 3D

    Avr colorvideo

    74hc595/Amethyst

    8-bit ATmega1284 retro computer

    148 parts306BSD-3-Clause
  • 2 layers71.6 × 65.8 mm1541-rebuild, the printed circuit board in 3D

    1541-rebuild

    ThKattanek/1541-rebuild

    Ersetzt den Analogteil einer Floppy 1541 oder 1541-II durch ein µC.

    20 parts49GPL-2.0
  • 2 layers80 × 64.7 mmKeyman64, the printed circuit board in 3D

    Keyman64

    hbekel/keyman64

    programmable C64 keyboard interceptor and hardware control system

    33 parts18GPL-3.0
  • 2 layers95.3 × 36.8 mmV4-atmega1284p, the printed circuit board in 3D

    V4-atmega1284p

    FreeAndFair/v4

    The DemTech Kiosk Voting System.

    27 parts3