Digital dice solves a silly problem where I keep throwing dice off the table, ok ok it solves no problem and I just wanted to play with a Pico Pi and write some MicroPython :D Besides the sillyness, I really wanted to have digital dice. I thought it would be a cool project that I could actually use when playing Catan.
Conceptual Thinking
There are a few options I looked at, I included the research if applicable so I dont have to go snorkel in the future if I decide to tinker.
I2C 16x2 LCD Display ❌
Pico Pi with I2C 16x2 LCD Display Module (PCF8574)
- This screen is cool but its meant for longer text so will keep it for another project
- Drivers for I2C 16x2 LCD Display
- NerdCave - Raspberry Pi Pico Tutorial: 16x2 LCD I2C Micropython
2 Digit Alphanumeric LED Display ❌
Pico Pi with 2 Digit Alphanumeric LED Display:
- This screen is really cool but the cheap ones I can find with a simple pinout (ie: CLK, DIO, GND, 5V) and chip like a TM1637 are all 4 digit displays so I thought that would look funny
- Cool example from a larger 8 digit display
Arduino with any screen ❌
- I dont really know how to code in C and C++ programming languages (Embedded C) so yeah na
- Arduino docs on how to toggle LEDs
NE555 Chip ❌
- There are super cheap kits that come with everything you need but I wont get to do any coding
- DIY Electronic Dice Kit LED
Pico Pi with LEDs ✅
- MicroPython is super easy to write
- Raspberry Pi Pico SC0915 Microcontrollers Board are real cheap
- The board has enough digital pins and I have heaps of LEDs & Resisters
Pico Pi with LEDs
With Pico Pi with LEDs
as the best path I did some conceptual whiteboarding to think about the physical layout, how many pins I needed to use ect. The NE555 chip kit also gave me a better idea on the layout.
I then made up some test LED with inline resisters, there is a bit math to figure out what resister to use. I physically soldered one to the board to test.
I then used a Pi4 Raspberry Pi OS and Thonny IDE adapting their examples to test blinking the LED. After that worked I soldered and made up the rest.
I then completed the code and tested that worked, the complete code is here https://github.com/carlpaton/PicoPiHoon/blob/main/Pi%20Pico/Dice/main.py
I then added a button, updated the code and printed a quick box (the design is prototype so I didnt upload the STL)
I powered it with 4 old AAA batteries connected in series, I need to draw up a better box, future Carls problem :D