Build Your Own Escape Game Artefacts! Part 4
Have you ever wanted to build your own escape game artefacts using low voltage electronics? Look no further! In the upcoming months, look out for a short series of articles on how you can approach creating small, but effective artefacts for your own game designs.
In part 3, we created real code out of our pseudocode and placed it into our IDE. Part 4 will involve testing both the code and the connections between the Arduino Uno and the TM1637 timer component.
You Will Need
1x Arduino Uno (or open-source copy)
1x Arduino Uno USB connector
A laptop or desktop computer
A download of the Arduino IDE
A power adapter for the Arduino Uno (see part 1 for guidance)
4x male to female dupont cables (1x red, 1x black, 1x yellow, 1x blue)
1x TM1637 4-digit, 7-segment display timer – (Look here for examples)
- We have planned our objective:
We want to code a timer that counts down from 60:00 minutes to 00:00 minutes.
- We have designed our coding workspace (IDE) to have 4 functions or ‘containers’.
Library, Display, void setup() and void loop().
- We have written our code in the workspace.
Next, we will connect our hardware components, power up and test the artefact!
Setting Up The Hardware
Go ahead and use your dupont cables to connect the Arduino Uno and the TM1637 display timer like so.
Red – 5V -> VCC
Black – GND -> GND
Yellow – Pin 2 -> CLK
Blue – Pin 3 -> DIO
Make sure the dupont cables are snug when connecting. Next, take your USB connector and connect the one end to the Arduino Uno and the other into your computer. The power on should light up on the Arduino Uno; the computer may take a few minutes to download any required drivers, and should let you know when it is done.
Testing The Code
Open up your IDE with your code from part 3, and go to
Tools > Board > Arduino/Genuino Uno
Tools > Port > COMx (Arduino/Genuino Uno) – The x will be a number of the Arduino’s choice.
Next, click the tick button, right below the file option. This will check the code for any errors.
If you have any errors, you will need to troubleshoot them. Two good starts to this would be:
- Checking that your code is identical to that presented in part 3.
- Pasting the error description into google and see if any of the forums have already answered/resolved the issue you have.
Should the code be error free, it should show a message starting
Sketch uses x bytes (x%) of program storage…
Once you see that message, go ahead and click the right-pointing arrow button, next to the tick button. This will transfer the code to the Arduino Uno and subsequently, the TM1637 display timer.
Should this be successful, the TM1637 timer should light up and start counting down!
Testing The Countdown
One other thing I suggest testing, is if the countdown stays at 00:00, when counted down entirely; ie: no further counting, or no counting up for that matter!
There are two ways you can do this. The easiest but far longest way is to wait until the timer has counted down from 60:00 then check its status. The better way is to temporarily change the timeLimit to 10 seconds, then check. How to do that however, I’ll leave for you to figure out.
Remember, if anything isn’t doing what it should be doing, try my two suggestions for troubleshooting above.
Testing The Power Adapter
Whilst the USB connection powers the Arduino Uno perfectly well, it is highly unpractical to have the artefact permanently connected to a potentially large and bulky computer. Here would be a good time to plug your power adapter (remember to take out the USB connection!) into the Arduino Uno and see if the desired results are the same.
End Of Part 4
At its most basic (but certainly useable), you have your escape game countdown timer artefact programmed and working! Nicely done! Part 5 will look at bonus features you can add to the countdown timer for further usability.
Thanks for reading and see you next time!
[…] part 4, we have our basic countdown timer product. Part 5 will look at potential bonus features you can […]