Close
0%
0%

Electronic Mancala++

Updated version of my Electronic Mancala Board that uses a ATtiny3224 microcontroller

Similar projects worth following
117 views
0 followers
This update to the original project adds support for a USB interface (to perhaps maybe interact with a future software application) and upgrades the MCU to an ATtiny3224.

Changes from the original Mancala game include:

  • Change from 5mm through-hole LEDs to SMD-0805 LEDs
  • Addition of a USB interface (via FT230X) to allow future interoperability between the board and a potential PC application
  • Button interface solution has swapped from a scan-matrix to a TCA9535 I2C I/O expander
  • MCU has been switched from a PIC18LF2420 to an ATtiny3224.
  • Smaller footprint PCB with 4-40 threaded holes to allow for more flexible mounting solutions
  • Addition of a 4-position DIP switch to allow for potential of different game modes.

gerbers.zip

Manufacturing files for PCB fabrication

Zip Archive - 466.86 kB - 01/22/2025 at 00:01

Download

EMancala2.pdf

Schematic for Electronic Mancala++

Adobe Portable Document Format - 741.57 kB - 01/12/2025 at 15:56

Preview

  • Update: basic interface code complete

    Zachary Murtishia day ago 0 comments

    I went ahead and soldered the THT components of the boards. I left off the piezo as I didn't really have a use for it. Everything seems to work pretty well.

    I noticed that an 0805 capacitor was accidentally specified in place of an 0603 part for the 100nf decoupling capacitors. It might not be compliant with IPC-A-610, but 0805s definitely can fit on an 0603 landing. I should probably update the BOM to reflect an 0603 part number later, but this is just a hobby project and I can verify that the part is soldered to the pad. Below is a picture of one of these 0805 100nf decoupling caps - this one is for the TLC59116 LED driver I'm using:

    Before I work to port the game code to the ATtiny3224, I went and developed the interfaces required first:

    1. Got an I2C driver working. At first, I wrote my own TWI library and was able to talk to the TLC59116 after porting a library I wrote for the PIC18LF2420 to work with the ATtiny3224 TWI interface. I was able to implement 1-way I2C commands (write), but my attempts at a receive library were not as successful. I ended up consulting this ATtiny 1-series TWI library by bitbanging for help - I discovered I was being overly cautious with my implementation with all my checks of various TWI flags. I ended up importing their TWI library and tweaking some of the write functions to allow repeated writes with only the send byte function (it did not work out of the box so I added checks for both the receive/write complete flags as well as the bus state). I now have a 100 KHz I2C interface that is capable of communicating with both the TLC59116 LED driver and TCA9535 I/O expander.
    2. Wrote a quick USART implementation to allow data exchange through the FT230X. Thankfully, USART wasn't very difficult to get going and I quickly wrote a library for simple I/O over the ATtiny3224 USART interface. As usual, I set it up for a 9600 baud, 8N1 serial scheme. I ended up setting up the receive complete interrupt to allow my debugging to not interfere with the main program loop - that is, I can send messages at any time during program execution and get a reply. Much better than my prototypes where I had blocking USART receive code in the while(1) loop. I'm glad to know that both my FT230X and level shifter implementation work in this application. I have to see what I want to do with this interface, but I'm likely just going to use it for debugging right now.
    3. I realized a little too late that the ATtiny3224 has a default divide-by-6 prescaler for the peripheral clock and wondered why my I2C bus was so slow compared to the value I thought I set (assuming a 20 MHz peripheral clock). Using the ccp_write_io function In the background, my test LED is being toggled every ~1s to test the system tick.provided in the cpufunc header, I was able to reconfigure the main prescaler to divide the main clock by 10 for a clean 2 MHz value to serve as my peripheral clock - sure it's slower than 3.3 MHz, but I like working with a clean number like 2 MHz more.
    4. I set up a simple 1 ms system tick with a Type B timer - the 2 MHz system clock is fed into a divide-by-16 prescaler and compared to a value of 125 to generate this 1ms tick. I will be using this for anything requiring a timing source going forward.
    5. I ended up removing the TCA9535 from the main program loop and moving it to an ISR triggered by the port interrupt vector - the TCA9535 has a pin that is pulled low upon change of its input port to indicate state changes to an MCU. Naturally, I tied this pin to an interrupt on PORTA. Instead of having this I/O expander periodically polled, it is only polled in the ISR upon detection of a falling edge on its assigned pin. It seems to work pretty well!
    6. I have a simple program loaded to test all interfaces/interrupts: press a button and the LED corresponding to it will toggle. I set up two buttons to change the brightness of the LEDs that are on.If I send a message to the board over an 8N1, 9600 baud USB COM port, it will reply with a character...
    Read more »

  • Update: received PCBs

    Zachary Murtishi5 days ago 0 comments

    I've received the PCBs and I'm pleased with the product. So far, everything appears to function. I'm able to detect the FT230X from my ThinkPad and my PICkit 5 can detect the ATtiny3224 through UPDI using MPLAB IPE. I'll start development on the software when I decide that it's a good time to go through the PIC18 code for the original mancala board and port it to this application.

  • Update: Schematic finalized

    Zachary Murtishi01/08/2025 at 01:10 0 comments

    After checking product availability, I made some changes to the schematic:

    • The MCU is now an ATtiny3224. I don't need a lot of GPIO as I am using I2C components to interface with the buttons and LEDs.
    • I've added a piezo and a 2N7002 driver FET for sound effects. I'm going to allow this to be disabled through a rocker switch
    • I've switched the CP2102 to a FT230X. I tend to prefer FTDI's product portfolio and application notes.
    • After some consideration, I've decided to switch everything to run off of 5V (as all chips on this board are 5V-compatible).
      • As a result, I've had to add a 74AHCT1G125 buffer as a level shifter to ensure that the 3.3V UART output from the FT230X can be read by the ATtiny (the ATtiny's Vih is 3.5V @ 5V, which requires level shifting).
    • I've decided to remove the graphic display from the design. I thought it would take away from the goal of the game - to be a simplistic version of electronic mancala.

  • Update: MCU change

    Zachary Murtishi01/05/2025 at 22:00 0 comments

    I decided to downgrade the MCU for this project from a SAM device to an ATtiny3217. I realized I wouldn't need all that much computing power for my effort - after all, I plan on using I2C devices for I/O (buttons, LED, etc.) anyway, so I don't really need a crazy fast CPU.

    Still working on the PCB design for this effort. I'm throwing in a SiLabs CP2102 USB-to-UART bridge to allow for some real-time debugging as the ATtiny3217 does not have native USB support.


View all 4 project logs

Enjoy this project?

Share

Discussions

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates