RPicoG Dice - a Very Easy Electronic Dice Collection for Every RPG Using a Raspberry Pi Pico

by Ziuniccu in Circuits > Microcontrollers

470 Views, 2 Favorites, 0 Comments

RPicoG Dice - a Very Easy Electronic Dice Collection for Every RPG Using a Raspberry Pi Pico

IntroSide.jpg
IntroBottom.jpg
IntroTop.jpg
IntroInside.jpg

Hi, I'm Nico, this is a (maybe) 1 years old project that I decided to make public only now.

At the time I was a lot into DnD and, at the same time, getting into microcontrollers and electronics, so I came up with this: a shakable electronic dice made with a Raspberry Pi Pico, a MPU6050, a rotary encoder, a battery holder and a used candle holder from Muji.

Down here I'll put a video to see the finished work!

Supplies

Raspberry-Pi-Pico-Pinout.jpg
MPU6050 pinout.png
Oled 128x32 pinout.jpg
RotaryEncoder pinout.jpg

Down here I'll put a list of the needed components (just checking the prices on the internet):

  • 1 Raspberry Pi Pico (3.68€);
  • 1 MPU6050 Module (4.49€);
  • 1 Oled i2c SSD1306 128x32 pixel 0.91 pollici (5.33€);
  • 1 Rotary Encoder KY-040 (2.8€);
  • 1 battery holder 2AA with a on/off switch (0.90€);
  • 1 Muji candel box (4.75€) -> Candela in latta - gelsomino e olive | MUJI;
  • Some Female-Female Jumper Cable.

Setup Raspberry Pico

Go right here -> MicroPython - Python for microcontrollers and follow the instructions for the latest uf2 file.

For beginners: download the latest uf2 file (today it's the v1.20.0) and leave it there on an open tab, then plug-in you pico in your pc pressing down the BOOTSEL button, then, finally take the uf2 file and drop it on the usb storage unit that popped up; it should restart automatically and ready to go.

Download Thonny IDE here -> Thonny, Python IDE for beginners for controlling the pico.

Open Thonny with your Pico plugged in and, in the low right corner, select "Raspberry Pi Pico".

Prepare Your Box

I personally preferred to use a drill to make 3 holes in the box:

  1. on the top for the oled screen;
  2. on the left side for the cable of the battery holder;
  3. on the right side (opposite of the battery) for the rotary encoder.

Be very careful about the drill, it can easily slip.

Wire Up Everything!

RPicoG-Dice-pinout (5).png

Unplug your pico from your pc and wire up with some F-F jumper cables every component as you see above in this picture.

The red and black cable on the top right of the pico are for the 2AA holder.

Upload All of the Code on Your Pico

Once you wired up everything, plug-in your pico on your pc and save these 3 file.py into your pico.

VERY IMPORTANT: Save these file as they are called, therefore, save them respectively "main.py", "ssd1306.py" and "imu.py".

After wiring and coding you should test it: plug your pico in your pc OR put some batteries and try turning the encoder up or down, if you want to change section try press the encoder (it has a button built in) and then, when you are down, shake it lightly, it should display every dice and then sum it all up!

Final Step

Finally, take everything and put it in the candle-box and put the oled, the encoder and the battery holder cable in their respective places; if you want you can put the battery holder on the bottom of the box with some tape or patafix to make everything more portable!

And there you go!

I hope you really enjoyed this tutorial!

If you have some advice or comments let me know, I would love to read some!

Thank you all for your time reading this little project of mine! <3

Ziuniccu.