Inspiration
“Simon says” is a golden game to start a IoT device communicating with Wi-Fi chips. This is a game provides students with hand-on experience in both circuit design and programming. Inspired by a single “Simon says” game, we decided to build a game set project including more games for you and your friends to play. During the pandemic, friends meet each other less frequently, we wish this small game set can make reunions happen again between old friends even with a far distance.
What it does
This is a game set including three simple but interesting games: “Simon says”, “Tic-tac-toe” and “Number guess”. Two players can determine their moves via a keypad and communicate through the Wi-Fi connection. “Simon says” is popular game for the beginner level IoT devices. The basic rule for this game is that you should repeat the moves from the last round and add an extra move for the other player to repeat in the next round. Two players take turns alternately. At first, one player presses a random button as a start. Next the other player should reproduce what the first player pressed and add another press for the first player. The player who makes the first mistake loses the game. “Tic-tac-toe” is a classic game played on a 3x3 keyboard region. Two players make their move with different colors (red and blue) in turns. The first player to get 3 of his color in a row in any directions(up, down, or diagonally) is the winner. When all 9 squares are full, the game is over. “Number guess” is a game for two players to guess a number between 0-100. First, the player 1 generate a random number, then the player 2 gives his first guess through the keypad. Next the player 1 indicates the correctness of the answer by doing some gesture through the gesture sensor. A DOWN gesture (a swipe from the top to the bottom) suggests the answer is smaller than the correct number and vice versa. The judgement result will be displayed by the different keypad colors. In the next attempt, the player 2 should give his second guess based on the clue given by the player 1. The game ends until the player 2 gives the correct answer.
How we built it
The whole task can be divided into two parts to make the game set work: hardware circuit design and software programming with SAMW25 microcontroller. Hardware Circuit Design: • Power management design to realize 5V and 3.3V power tails.
• Search components and replay any out-of-order components to ensure all components in the BOM are available.
• Based on the power management circuit and components’ prototypes circuit, build schematic in Altium.
• Draw footprints and build PCB based on the schematic in Altium.
• Send our project to manufacturer.
Software Programming: • Write bootloader code to read the binary file in SD-card, erase the precious firmware and write the new firmware code.
• Build Cli thread to receive and show messages from the command line.
• Build UI thread to receive any message from the user interface (mostly the keypad).
• Build Wi-Fi thread to communicate between different players and cloud through different topics.
• Build control thread to control the whole process.
• Most threads are built in the state machine.
• Deploy Node-Red on IBM Cloud. Most the judgement process in finished on the cloud.
Challenges we ran into
From the hardware perspective, when drawing the PCB layout from the schematic, we need to consider not only the circuit correctness but also the connecter position for the external connection, the relative position of different modules for a more convenient power arrangement as well as many other detailed layout issues. To arrange the components and make them pass every check before sending to the manufacturer is the first challenge we encountered. From the software perspective, compared with a single “Simon says” game, our game set have more games which means there are much more interaction between players. Therefore, the amount of message and topics we need to publish or subscribe also increases. The state machine to make these things happen in an accurate order also becomes more complicated. Meanwhile, it is our first time to use Red-node to program, it also took us some time and energy to get used to the new programming environment and language. What’s more, programming with IoT device is different from just a microcontroller, we need to think things from a more lower-level, like consider memory issues for the bootloader.
Accomplishments that we're proud of
We made 3 different games and we can talk to our friends with the IOT device.
What we learned
• Search and select available and suitable components online.
• Power management design with different voltage tails.
• Design a normative schematic with full functionality in Altium.
• Design PCB layout with full manufacture feasibility and functional correctness.
• Program with the bootloader.
• Program the IoT devices with many peripherals and make them communicate successfully.
• Use Node-Red to realize the message transportation with the Cloud.
What's next for A Plus
• Add more games into the game set.
• Debug these games
• Add some sensors like the distance sensor or speaker to make the game more interesting.
• Modify the user interface like the OLED screen to enhance the game experience.
• Add a online chat function to realize instant messaging between two players.
Log in or sign up for Devpost to join the conversation.