The Idea and the PCBWay sponsorship
My goal for this project was straightforward: to create a compact and functional gaming console using an ATtiny85 and WS2812 LEDs. The challenge was to maximize functionality within the constraints of the ATtiny85's limited pins, RAM, and Flash memory. To conserve memory, I opted for hardware-based debouncing using capacitors, eliminating the need for software debouncing routines, which would have consumed valuable memory.
I got the PCBs and the printed enclosure sponsored by PCBWay. While the PCBs with the purple finish are definitely a treat to my eyes, I think the real deal is the printed transparent case. The Layer lines are only visible under a certain angle and there are no visible leftovers from support structure. I mean just look at it, it's so beautiful... and certainly better than everything I could have printed at home. Also ordering it was straight forward, even though I was not sure the material would support the snap fit I designed. On the PCBs, I was really surprised to see how well the silkscreen turned out, as some of my images I added are really small.
If you want to check them out you can use my referral link.
Building everything together
All the parts I used I had laying around, besides the PCBs and the enclosure of course. The most expensive one would be the BQ24230 for charging the battery I had conventionally not used in any other project since I bought them. The most pain was to solder in the USB-C connector, but I guess that's the price you have to pay to be able to charge your project with the cable of your phone.
I would have loved to build more than one console at the moment, especially as I have five more PCBs from PCBWay, but unfortunately I didn't had enough LEDs as well as no second BMU.
Features I added in Hardware (no matter if my code uses them)
I added the option to expand the LED strip if the eight LEDs on the PCB aren’t enough (which, to be honest, they usually aren’t for most games). I exposed the output pin of the last RGB LED, along with GND and VCC (which should be between 3.6V and 4.2V). This allows you to add as many LEDs as you want to the game console—at least until the ATtiny's RAM runs out.
Also because playing alone is boring, I added the theoretical possibility to connect two consoles together. At start I wanted to use a two wire protocol like I2C, but for that, I'd either had to get rid of one of my 3 buttons or use the reset pin (PB5) of the attiny, which would have made it really difficult to change the code after it's first uploaded. So I was forced to use only one pin. Because of that, I wasn't able to implement a multi-console game, as I had no idea how to implement a one wire protocol that either works without master or how the consoles could figure out which one should act as master, especially with the limited memory I had to work with. However, this is something I really want to include into this, my PCB already has a picture for pong across 2 consoles. (if anyone knows how to do this, I'd happily accept help, as my software developing skills are not the greatest)
The Code and the features I did indeed add to this project yet (or thought of adding)
For this Project to save as much precious space as possible, I modified Matthias Hertels OneButton Library, so the stuff I don't need like multiple presses or software debouncing don't take up memory. For interfacing the LEDs I used the tinyNeoPixel library, which is specialized in low memory consumption. Also it comes directly with the AtTiny Core, which is needed to program the attiny with Arduino.
I testet my code before uploading it using the wokwi website, the zip of the wokwi project is attached, with all Debug statements I added. Also because for some reason the tinyNeopixel Library is not supported in wokwi, I was forced to use the Adafruit NeoPixel library for simulation.
As the memory is limited, there is no collection of high scores or such...
Read more »