Close

Code and a case

A project log for Tiny2048

A pocket sized RGB LED version of the 2048 game

davidDavid 08/11/2024 at 16:190 Comments
Assembled Tiny2048
A photograph of the assembled Tiny2048 with a game running


I got the code written and a case designed this weekend, so this is now a playable game!

The code is Arduino based, and written using PlatformIO. I've implimented all the rules listed on the wikipedia page for 2048 with tilt-based input for the controls. Getting the input right was a challenge and it took me a few attempts to come up with something that felt consistent and intuitive. I've ended up with a very rudimentry gesture detector, which requires the game to be held level between turns. This prevents accidental inputs and allows the player to be intentional with their input. It's not perfect but it does the job and there's plenty of room for tweaking later down the line.


Using colours to represent values also turned out to be a little tricky. I've had to be careful to try and make sure that each colour used is sufficiently unique so that different tile values don't get confused. I've got a set that works alright right now but I might come back to this and experiment with things like changing brightness or animated effects to make them even easier to tell apart.


The case was designed in Onshape. I have mixed feelings about this as I usually try to stick to open source tools as much as possible so that my projects don't run the risk of becoming locked behind a paywall, and so that they are as accessible as possible. I have to say though, Onshape was a breath of fresh air compared to the battles I seem to have with FreeCAD. I was able to design and print the case, and I'm really pleased with how well the snap-fit rim I used works.

Tiny2048 case exploded view
A screenshot of the Tiny2048 case in Onshape

This project is largely done now, I will probably keep tweaking it over the next couple of weeks, and I'll definitely be using the boards for some other projects in the future - The esp32 means there's plenty of scope for internet-enabled blinking things. I'm also going to have some clear cases made as PCBWay reached out and kindly offered some free resin printing to me. I'll post a review of this service once these arrive as it's something I've been meaning to try for a while and I think the clear case will look really good. 


In the meantime here's a video demoing the game being played (with some cheesy music to cover up my breathing!) It's hard to capture the vibrancy of the LEDs on camera but it honestly looks great in person!

Discussions