3 min read

Creating a digital dice with an M5Core

Creating a digital dice with an M5Core

Our eldest daughter Janne loves this game called Bunny Hop. This is a game where you take turns drawing cards and advancing the number of squares on them. There is a lot of mayhem going on while you advance your Bunny towards the end.

This is a great game, with one big frustration: those cards. Why not a simple dice? #firstworldproblems.

Nothing a bit of hacking can’t solve. Earlier last week, I ordered a new development board: the M5Core. That’s an ESP32 (so WiFi, Bluetooth, and a 32-bit dual-core processor) combined with a 320x240px touchscreen, some buttons, a speaker, and an SD card slot for around 30 euros.

The M5Core is a beauty. It looks much better than anything you can make yourself. There’s no soldering and no wires. Everything is modular, and they offer a lot of click-on modules like a battery, GPS, or the Faces plate, which combines battery and extra expansion space. Just click and go.

If you want to tinker but don’t want to solder or hassle around with breadboards and a thousand wires, this is really great. And it’s very reasonably priced: the M5Core costs 30 euros, the Faces plate with rechargeable battery 11 euros and the dial (with 6 RGB LEDs) 10 euros. That’s reasonably cheap for what you get.

But I started with a problem: replacing those infuriating cards. M5Core to the rescue!

Making

I scanned the cards with an old scanner:

Cut them out in Photoshop and resized to the razor-sharp 320×240:

Then I fired up the Arduino IDE. I used the big rotary knob because it’s easy for children’s hands, I used it. The code is here:

https://github.com/TimBroddin/m5core-bunny-hop

Remarks:

  • The SDK that M5Stack created (and the countless examples) is great. This makes developing on their kit really very simple.
  • Getting the images in there was easy because the screen can write JPEG directly, and M5Stack provided a handy script to convert jpeg into an array buffer. Given the 1MB storage capacity of the ESP32, this is a lifesaver.
  • I could have used the touchscreen instead of the button, but something tactile makes it feel so much more fun.

The result

Spending 50 euros on a digital dice is overkill. But my daughter loves it and wants to play the game whenever possible.


There is also a successor to the M5Core: the M5Core2, which adds a microphone and RTC, among other things.

Another fine product is the M5Paper, which combines an ESP32 with an e-ink display and a built-in battery.