Simon Game PCBA
THIS PROJECT IS A WORK IN PROGRESS
1.0 Introduction
The original Simon game manufactured by Milton Bradley (now known as Hasbro) is a simple game with several layers of complexity in the hardware and firmware design. I have fond memories of playing this game as a kid with my siblings so this motivated me to recreate the game using more modern hardware.
I wanted my next PCBA project to involve something more complex than the 555 timer board but not be too overwhelming in complexity that I would quit before being done with the project. The Simon game seemed like the perfect fit as it is complex enough to challenge me and the good memories it brings provides the motivation to complete it. In this project, I do not build the entire game as it is sold in the market but rather only manufacture the PCBA for the game and reverse engineer the firmware.
And, rather than using the original design from the manufacturer, my version of the hardware uses an ATMEGA microcontroller along with more modern replacements for the other ICs.
1.1 Project Goals
The goals for this project are:
Improve electrical engineering skills
Improve skills in Altium Designer
Improve skills in C/C++ and firmware development
Improve GitHub knowledge
2.0 Project Overview
Original Simon Game Rules (This might change in our game design)
The Simon game has three game modes:
Single Player – The game generates a sequence of lights and sounds which the player must follow, the sequence grows by one colour every turn and ends when the player makes a mistake or repeats the maximum number of colors in a sequence (which is dependent on the skill level setting)
Multi Player (game 2) – The game begins with Simon displaying a color, the first player must repeat the color and then select another color, subsequent players must enter the current sequence and then add one more, the next player then selects the sequence of colors entered so far and then one more and so on until a player makes a mistake (or a sequence of 31 colors is achieved).
Multi Player (game 3) – This game is identical to game one, however each player owns one or more colors and is responsible for pressing it during the sequence. If a color is incorrectly selected that color is removed from the game and the game continues (with a new color sequence) until only one color is left (the winner)
The game also features 4 skill levels:
Repeat a sequence of 8 colors
Repeat a sequence of 14 colors
Repeat a sequence of 20 colors
Repeat a sequence of 31 colors
To play games 2 and 3 the skill level selector must be in position 4 or the game will end prematurely (this is due to the ‘skill level’ performing the same function in all game modes; in the multi‐player games the maximum sequence number Simon can handle gives the longest game play).
The game hardware consists of 4 coloured lens which, when pressed, operate switches on the circuit board. The colours from top‐left going clockwise are red, blue, yellow and green on the Pocket Simon and green, red, blue and yellow on the full‐size version.
There are 3 push buttons on the game:
Last – Replays the sequence from the last game (only operates when the game is not in progress)
Start – Starts a new game (can be pressed at any time)
Longest – Replays the longest sequence successfully completed since the game was turned on (only operates when the game is not in progress)
There are 2 sliding switches on the game (on the full‐sized game there is an additional on‐off switch which in the pocket version is replaced by a two‐pole game switch):
Game – Off, 1, 2 and 3
Skill – 1, 2, 3 and 4
My version of the Simon game will be simplified. As mentioned, I will only manufacture a simple PCBA and reverse engineer the firmware for the game. As such, the project will consist of two main layers: The hardware and firmware. The following image shows how I visualize the relationship between these two layers: Each layer contains their respective architectures with the firmware layer depending on the hardware layer; to represent this dependency in the image, the firmware layer is placed on top of the hardware layer.
In the following sections both architectures are developed and presented in more detail. As I go along, I will be explaining my thought process and decision making.
3.0 Hardware Architecture and Schematic Design
The Atmega microcontroller is the main component of the hardware. It will receive and output all the signals necessary for the game logistics. The following image shows the high level signal flow to and from the Atmega microcontroller as well as the main components of the hardware architecture.
Brief description of the signal flow and hardware in the architecture:
Signals from the sequence buttons are pressed by the user and directed trough an encoder
The signals travel from the encoder to the microcontroller which determines if the correct sequence of buttons are pressed
The difficulty selection button is pressed by the user to set the difficulty of the game
The programming port helps with the initial programming and bootloader flashing of the Atmega microcontroller
Subsequent programming is done through the USB connector
The USB connector allows direct connection to a PC and the USB to UART hardware allows for proper communication from the PC to microcontroller
The header outputs allow for user specified channels to send or receive signals to and from the microcontroller if additional capability is needed
The LED sequences are the visual cue for the user to interact with the game
The speaker is the audible cue for the user to interact with the game
To power all these hardware components, the PCBA will have two power sources: regulated supply from batteries and USB power when connected to a PC. The following image shows the power tree of the architecture:
The above images should be enough to provide an overview of the architecture for the project. The following section starts getting into the detailed hardware design. The image shows the Top Level page of the hardware schematics:
REPLACE
Power Regulation
Under the PowerRegAndConnectors.SchDoc page, we find the power regulation circuit, the header outputs, and the programming port.
From top left to right under Power Regulation:
The unregulated power comes from three coin cell batteries connected in series and its fed to an LDO for regulation. The three batteries provide a total of 9VDC.
This ensures there is enough voltage for the LDO downstream to properly regulate it to 5VDC
After the coin cell batteries, a Schottky diode is placed for reverse polarity protection and a switch is placed to control the power ON/OFF for the entire game
The forward voltage of the Schottky diode is 0.385 VDC at 0.5A
The LDO regulates the power to 5VDC; its dropout voltage is 0.525 VDC at 0.4A
At the LDO, we dissipate approximately 3VDC with this circuit
My supply voltage for the ICs is 5VDC and the coin cell batteries provide 3VDC each. I could have only used two coin cell batteries but the reason I did not is because I was concerned the LDO would not have enough voltage at its input to properly regulate its output when the batteries started to deplete. The circuit voltage was already marginal after the Schottky voltage drop. In addition, I had already selected the LDO and the Schottky diode for the voltage drop to be minimal and spent several hours searching for those components. Instead of continuing to search for additional components that would allow me to use 6VDC unregulated from two coin cell batteries, adding the third coin cell battery was easier and faster and not that much of a price difference.
IO headers and programming port:
There is not much to explain regarding the headers and programming port. The purpose of the IO headers is to provide an interface to the user in case the nets are needed for additional external functionality. The programming port provides a programming interface for the microcontroller.
Microcontroller Connections
Under the Microcontroller.SchDoc page, we find the connections for the ATMEGA microcontroller.
There aren't many design decisions for the ATMEGA microcontroller that require explaining.
From top left to right:
We have the port nets connected to the IO headers on the previous schematic page
RESETn net is connected to GND through a momentary switch; this is to reset the ATMEGA microcontroller when needed
The ATMEGA microcontroller has a 16MHz external oscillator clock
There is a 1kOhm resistor on both the TX and RX lines that keeps the isolation between the FTDI chip and anything that could be connected on the programming header
According to the ATMEGA datasheet, it is best practice to tie the AREF pin to GND