Close
0%
0%

TinyCADE

A wallet-sized, Arduino-compatible 8-bit game system packing a grayscale OLED, a chiptune synthesizer and SD card support

Public Chat
Similar projects worth following
I started working on this device during the summer holiday of the previous year, after I have done some brainstorming for a cool PCB project. Since then, TinyCADE went through 4 iterations, from an ATtiny85 and a 0.96" OLED on a perfboard powered by AAA batteries to a late prototype, almost ready for production!

This project would not have existed today without the support of JLCPCB, who sponsored the manufacturing process of the PCBs. You can order high-quality PCBs from https://jlcpcb.com/RAT

TinyCADE is a small handheld game console having the AVR128DB64 microcontroller at its heart. The device is intended to be used by, but not limited to retro gaming enthusiasts, programmers, students, makers, pretty much everyone who enjoys playing and sharing games inspired from the 8-bit era.

First prototype
It all started with an ATtiny85 (upper-left) connected to a CD4021 shift register (right) for reading the buttons' state, a tiny SSD1306 OLED screen and a 47C16 2Kb SRAM IC (middle-left) for storing the framebuffer.

Moreover, I have also made a breadboard extension board which breaks out the debug and unused GPIO pins of the microcontrollers and the power supply rails, essentially turning the TinyCADE into an Arduino-compatible development board!

TinyCADE with Extension Backpack
A render of the assembled device with the Extension Backpack inserted, featuring the production versions of the PCBs which I still have to order and assemble. I am intending to use a polycarbonate enclosure with an aluminum backplate and 3D printed buttons in the final version.

Specifications:

  • AVR128DB64 8-bit microcontroller running at 24Mhz (overclockable up to 32Mhz). It has 16Kb SRAM, 128Kb flash and 0.5Kb of EEPROM. This is the main microcontroller, which the games will run on.
  • A small chiptune synthesizer written in AVR assembly, running on an ATtiny1614 microcontroller at 20Mhz. It can mix up to 8 channels of individual amplitude and waveform (square, triangle, sawtooth, noise) at 44.1Khz, as well as apply ADSR envelope, vibrato, arpeggio and slide effects at 100hz, making use of every single clock cycle. The audio signal is fed into a small class D audio amplifier, through the DAC pin. The main microcontroller communicates with the synth via UART.
  • 1.6 inch 128x64, 4 bits per pixel grayscale OLED
  • 8 tactile buttons + 2 side buttons (power and reset)
  • RGB LED
  • 600mAh Li-Po battery charged via the MCP73831 IC
  • Power management and time keeping via an ATtiny212 microcontroller. It receives commands and sends battery data to the AVR128DB64 via UART.
  • 1.5W speaker
  • MicroSD card support (SDHC), allowing to load different flash files onto the AVR128DB64 without the need of a computer
  • USB Type-C port for charging the battery and communicating with the main MCU via the FT232RL IC
  • Arduino IDE compatibility, many thanks to DxCore by SpenceKonde (https://github.com/SpenceKonde/DxCore)

Here is a small demo of TinyCADE playing a portion of the "Dancing Polish Cow" meme song. The song is stored as a MIDI file on the computer and is sent to the device through USB, using a sketch written in Processing. Enjoy it!

Feel free to give me some feedback or send me an email at dumitru12cosmin@gmail.com :)

Also, please check out the project's Instagram page for more cool stuff: https://www.instagram.com/tinycade_official

Stay tuned for more updates!

  • TinyCADE receives a PCB upgrade and a prototype 3D-printed enclosure

    Cosmin Dumitru02/08/2022 at 21:11 0 comments

    To be honest, the previous TinyCADE PCB was not too good: the extension board was attached via a standard 40 contacts, 1.27mm pitch pin header which wore out after a few dozen cycles and was quite unreliable, a humming sound was constantly present in the speaker (as a bonus, the brighter the OLED, the louder the sound), the ATtiny212 microcontroller (responsible for power management and timekeeping) would hang unexpectedly when communicating with the AVR128DB64 via I2C (details at the end of the log) and the component layout was quite messy. I really hated it.

    I received the PCBs for the latest TinyCADE iteration for free about 2 months ago, from JLCPCB through their Student Sponsorship Program (https://jlcpcb.com/RAT) and after a lot of soldering it looked like I managed to fix all of the problems mentioned above. I decided to celebrate by offering TinyCADE a 3D-printed, spray-painted enclosure and buttons (the same model as in the renders) using PLA (that's what I've had at the moment).

    Also, I have been working on an Arduino library for TinyCADE. Check out the GitHub link on the project page. I will also publish the power management microcontroller and synth source code when the project is finished.

    TinyCADE displaying a small tile map. I can't wait to have that polycarbonate enclosure!

    The PCB "remaster"

    After redesigning the whole PCB using better practices, all the speaker humming was gone. Only a faint white noise can be heard by sticking my ear onto the speaker. Also, I modified the BOM to have IC's with better availability because of the global chip shortage.

    The bottom copper layer of the previous iteration
    The previous TinyCADE iteration.
    Messy stuff. A busy city can be seen on the left, and a desert on the right. Let's not talk about the mounting holes and the ground plane :)
    The current iteration
    The bottom copper layer of the current TinyCADE iteration. Now with Molex PicoBlade connectors for the speaker and battery!

    Also, I replaced the Extension Backpack connectors with these bad boys from Harwin: the M55-6104042R and M55-7104042R. Here is how the real TinyCADE looks, apart from the renders:

    Low-profile tactile switches go brrr. These things are only 0.5mm in height and sound great with button caps!

    What's going on with the ATtiny212?

    This tiny, but mighty microcontroller with just 128 bytes of SRAM, 2Kb of flash and 64 bytes of EEPROM acts as a power manager. When TinyCADE is turned off it enters power down mode, bringing the total current consumption down to a few μA. Only the PIT interrupt of the internal RTC fires up every 1 second for incrementing a 32-bit integer which acts like a timestamp.

    When the power button is pressed, a pin change interrupt is fired and the 5V boost converter is enabled, having the role of the main power supply of the device (PAM2401 IC), powering the 3.3V regulator and the +14V boost converter for driving the OLED. During the time when TinyCADE is on, it "listens" for commands formerly received via I2C, monitors the battery voltage and if it falls below a hardcoded threshold, the the 5V boost converter is disabled and the ATtiny enters power down mode to help protect the battery, which also has a PCM including over-discharge protection.

    The I2C problem

    In the previous iteration, the ATtiny212 was acting as a slave, while having the AVR128DB64 as a master on the I2C bus. The problem is that the master power supply was dependent to the 5V boost converter, while the slave was always powered up from the LiPo battery. Also, 10k resistors were used on the SDA and SCL pins for pulling the lines up to 3.3V, which had the same problem. This led to more checks to be done, while also increasing the already large I2C implementation footprint on the small 2Kb flash memory of the ATtiny.

    Also, the AVR128DB64 had to keep polling the ATtiny to check if the device is about to shutdown, causing overhead to the main application.

    In the current version, the ATtiny212 communicates with the AVR128DB64 via USART, using a...

    Read more »

View project log

Enjoy this project?

Share

Discussions

Ale o co chodzi wrote 12/05/2023 at 17:54 point

no yoistick and to less RAM

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates