Wire Touch Game using Arduino in Assembly

This game was the semester project for my second year course Microprocessors. This project required students to create the wire touch game known as the Challenge of Mekon. This was to be designed using the Arduino, ATmega328P microcontroller and assembly code. my submission for the project uses interrupts for buttons, timer and touching the wire, which activates the red button and increments the score by two. Furthermore, the Binary to Decimal Converter (BDC) chip was used for the 7-segment displays. Other features include the frequency of the speaker sound constantly increasing as the score increases, an orange light goes on when the score goes over ten and a delay of 0.5s is being used to avoid unintended wire touches due to detection being too sensitive (know as debouncing).

Here are some of the block diagrams I used in the report for this project:

Fig. 1: Main game logic
Fig. 2: Score,LED and sound logic
Fig. 3: button logic

Below is the circuit diagram for the project I made for my report. I did this after I finally figured out how to wire up everything correctly, meaning it was not a guide for me, but more a guide for future reference or if other people interested in microcontrollers want to create a similar project.

Fig. 4: Circuit diagram using the free online application TinkerCad (super useful tool). Note that the gray wire represents the wire loop of the game.


Close up of the actual circuitry of my project. From left to right: the arduino Uno (in background),the stop and start buttons, the touch and over-ten LEDs, the tens BDC, the 7-segment displays, the ones BDC, and the speaker (out of picture)

Challenges Experienced and Overcome

  1. Learning how the BDC worked was fairly easy, but wiring up a 1K resistor for every LED on the two 7-segment displays took a lot of fiddly wiring. I solved this by taking pictures of the correct wiring I had done in case I had to break everything apart and re-wire it in the future.
  2. Learning about the correct interrupts, IVT- We had done many labs before this project, but finally I had to apply what I had learned in this project. I had to work with changing frequencies, the wires touching and multiple interrupts occuring at once to name a few. This learning was sped up by using the official Data Sheet for the Atmega 328p chip (use this religiously) and constant communication with classmates doing the same project.
  3. Making the pitch increase – This invloved setting the OCR2B register to 150 and decrementing it by one every time the player touched the wire. The calcualtion of 150 was the result of the equation focnxPWN = (fclk_I/O)/(n*256) = (fclk_I/O)/(prescalar*desiredFreq) = (fclk_I/O)/(256*desiredFreq) found on the Datasheet.
  4. Making the casing of the game – I was dreading this part and I though it would be low point of the project. However, one of my friends had thick wire, wood and a router (a hand tool or power tool that one uses to hollow out an area in wood). This allowed me to to create, along with blue spray paint, a farily strong and impressive stand and housing for my project.
  5. Debouncing – For those unfamiliar, debouncing is the removal of unwanted false triggers in the input of a circuit. This was done using a 0,5s register delay (as opposed to a timer delay) when the player touched the wire in the game. Debouncing was also done physically by sanding down the game wire with sandpaper, as wire bought from a store often has a thin plastic coating on it, to increase longevity.
  6. Score in the game – This was by far the most complicated aspect of the coding part of the game. Some features include:
    • Ensuring the score stay correct when both the tens and ones displays change
    • Displaying the orange LED when going over a multiple of ten, and then turning it off again
    • Capping the game score at 99 to avoid unwanted symbols in the two displays (see Fig. 6 below)
Fig. 5: The score code in assembly
Fig. 6: Weird numbers after 9 avoided using the assembly code

7. TinkerCad – The clock was ticking for writing the report as my friends and I were all so focused on making the actual project. After first starting in MultiSim, and then trying LucidChart, I was then recommended using TinkerCad by our Engineering group chat. This free online application proved very quick and easy to use and I would highly recommend it (see Fig. 4).

Myself (left) and Blake (right) working on various stages of our porject in the garage. Awesome backdrop, right?!

Tips for future projects

  1. Indent your code from the labels above them – this will make the code much easier to read (see Fig. 5)
  2. Use “;_____________” to seperate code blocks (see Fig. 5). Note that “;” indicates a comment in assembly
  3.  Define register names using .DEF, this makes it much easier to understand what the code is doing
  4. Work together with classmates, it is much less mentally taxing if a bunch of you are struggling with understanding certain concepts and applications. You don’t have to an intellectual hero for everything. Ask for help!
  5. Have a friend with a router and spray paint if you want to make your project look super!
The game and blue routed wood stand in action!   


This project was a hard, yet very enjoyable project. I learned a lot about Assembly, the Arduino Uno and how to make real projects come to life. For the future, I would want to start the project earlier than I did, but it was a busy time of the year. I hope you have learned something from reading this and inspired you to make your own Wire Touch Game or similar Arduino project. Good luck and I’ll see you in the next post!

Two students bending wires for the project. These are my friends Tori Bench (left) and Blake Denham (right), who proved indispensable for this project. Thanks guys!