This project builds a simple "wire game" using handmade base and wire-path, and Micro:bit with the pins connected to the wire and probe, when there is a touch, it warns a sound and counts the amounts of touches, programmed by MakeCode blocks. Goals:
Consolidate knowledge of digital signals, use "digital read pin..." to get digital signal input from pin
Consolidate digital signal input tricks of pulling up/down resistor, try a "software" solution
Consolidate variable understanding
Software: Integer type variable usage, if-else logic
Fun learning by making a playable programmable handcraft toy!
START A BIT > Projects Library > This page
Here is an example of the successful result by our tutor.
A wooden base, length 30 cm, the tutor will make this for you
A wire bent and curved as you like to create a challenging path (don't be too mean!), the wire shape should be within an A4 paper size. You need to make this in the class.
A probe with a circle, the tutor will make this for you
Use Micro:bit pin 1 as digital signal input from the wire-path, use voltage HIGH (3V) inputting to pin 1 to present a "touch" event
No external resistor needed
Initially, the Micro:bit starts from counting as 0, show it on the LED matrix
When there is a touch, Micro:bit warns a sound (you can define what sound), meanwhile increases the counting by 1, show it
When the total amount of touches reaches 10, Micro:bit warns another sound (you can define), shows a sad face, meaning the whole game is over
Press A+B together to reset the game for next player
[ ] Simple: 30-60 minutes
[x] Moderate: 1-2 hours
[ ] Challenging: more than 2 hours
The estimation bases on average situation without unexpected troubleshooting, assuming that the student meets prerequisites. It only indicates rough time needed to complete this project, but not about technical difficulty, not covering discussion and sharing time. Here is a possible breakdown:
5-10 minutes: Understand requirement and solution, collect materials and tools
30-50 minutes: Handcraft wire-path making
5 minutes: Hardware wiring
15-20 minutes: Programming
5 minutes: Download and test play
One should have prior knowledge
Micro:bit V2 board, Micro:bit pin breakout board, Breadboard: Know what they are, better to have prior experience using them
MakeCode by Microsoft, the programming tool, better to have prior experience using it with Micro:bit
Resistor basic what/how: Just need to know what it is, better to know why we need it here, no need to know how to read the color rings
1x Micro:bit V2 board , with USB cable
1x breadboard
Some jumping wires, some with crocodile clips (basically 2 are needed, but we distribute 4 for each student here)
1x The wooden base with ready drilled holes
1x The probe, will be prepared by the tutor
Metal wire
3x plastic wire sleeve
1x A4 paper
1x white board pen
Tools to make the wire path
The tutor will guide you in the class. All hardware materials and tools are provided. The wooden base is ready made, with drilled holes, the probe is prepared.
Your main task is to design a shape of the wire-path, and make it using the metal wire by handwork. The picture here shows an example work.
Tip:
It's good to use an A4 paper to draw your design, then follow it to bend/curve the metal wire. It's not necessary to fully map the path as the paper, but use it more as a guide.
According to the requirement:
Wire-path connects to Micro:bit pin 1
Probe connects to Micro:bit pin 3V
Use the micro:bit pin breakout and breadboard to connect the components, you don’t need to use the exact holes in the breadboard as others, as long as the wiring path is correct.
By this tip so far and active exploration, you can get it done! No super tips.
You need a variable to help remembering the counting, use "Make a variable... ", give it a name, e.g. "counter", then you see 3 blocks available to manipulate this new variable, to increase/decrease it, or use it.
Variables ->
Make a variable...
To get the event of wire touch, use digital signal input, use this, remember to change to "digital read pin p1"
Advanced -> Pins ->
To show the counter result on Micro:bit built-in LED matrix, use this, drag your variable "counter" block into the white vacancy 0 here.
Basic ->
To show a happy face on Micro:bit built-in LED matrix, use this.
Basic ->
To play a sound, use this, it is not the only solution, you can also try other sound related blocks
Music -> Tone ->
To link the logic, you need a if-else block and logic judgement block as well.
You might need those multiple times, duplicate them in need.
Logic -> Conditionals ->
Logic -> Comparison ->
To get built-in button digital signal input, use this, remember to change to "on button A+B pressed"
Input ->
You also need these blocks to help making things work. They are normally prepared, just use it.
Basic ->
Basic ->
Advanced! If you don't understand, just do it as guided here. This is to set the input digital pin pulling mode, find this, change to "set pull pin p1 to down", put it in "on start" block!
Advanced -> more -> Pins ->
Usually, by this tip so far and active exploration, you can get it done! Please try really hard, before getting super tips if you are stuck.
This optional part covers further competence development, in terms of testing, troubleshooting, analysis, documentation, flow chart diagrams practices, etc.
Stand in front of the class, share with your group what you have made, please cover important points
Tell what it is your product
Demonstrate how it works
Explain how it works
Share with your group about
What troubles you met
How you analyze
How you get help
How you solve it
What you have learnt
The initialization of a digital input pin: Must be clearly "pulled" up or down.
Physical circuit solution: Add a "pulling resistor", like PJ002: External button with Micro:bit
Software solution: Not always available or specific pin, in this project, it's working with a "set pull pin p1 to down" block
Use your own way to visualize how the hardware components are connected by a free style drawing.
Visualize clearly the wiring path, mark clearly the pins and end points
So that your friends can follow this drawing to correctly reproduce the hardware setup
Any kind of children style drawing is OK! Here are some examples.
Use your own way to visualize how the programming controlling logic is done, by a free style drawing, so that your friends can follow this flow-chart to reproduce the programming.
You might be interested to know what is "flow chart", click to learn more, but so far, it's not needed to be that serious, just draw something that can help you explain to your friends how the programming is made.
This project is playable and fun, let's start a match, everyone plays other students' wire game, and mark how much scores you can get, candies await!
How is the "touch" detected in this project? How does it happen from the physical wire and probe touch to the digital signal in physical voltage change, to the digital signal in programming?
Tell us how the variable is used in your project here, how it helps you to count the "touches"?
(Optional) Tell us what is the digital signal inputting "pulling up/down" issue? How to solve it?
If you want to extend this project with timing, to automatically count the time spent in the game, this is could be one of the solutions, using extra 2 crocodile clips at the end point on the plastic sleeves like the picture here.
Then, we use the same way of wire-path and probe touching to extend to the extra "touching" the starting point and the ending point. So, please review how things are working with the basic setup, if you understand well, then the exploration here could be quite feasible to do for you, even without more super tips.
There are many good ideas around this wire game base, you can create your own variant of wire game, some might need minor adjustment on hardware and connections, some are pure software defined features making the game much challenging and fun! Some interesting ideas collected from our students:
Play a exciting celebration sound (you can define) when a player finishes the game with touches less than 3 (included)
Let's consider the time for a completion of wire-path following, there are many ways to detect a "start" and "end" point, if you want to do in a intelligent way, then some hardware change might need, otherwise, the most simple way is to use a button press to indicate a "start" point, and another button press to indicate an "end" point, for example. Anyway, try to take the timing into consideration for the game rules, you can image some interesting features...
You can make a super simple wire-path, maybe just a straight line, then the game rule could be more competing for the fastest completion, while of course need to still keep not touching the wire-path, it could be challenging if people want to rush to the end point to get shorter time, but still keep not touching
Here is another variant of wire game: you should keep touching the wire-path, never leave it, you count the times of un-touching instead
Another idea: Use Micro:bit to randomly generate a period of time of freezing, meaning that you hear a special beeping, you should keep frozen for a while, until the Micro:bit beep again to dismiss. This rule might need people monitoring the player really follows the rule, Micro:bit is just assisting the random beeping
...
Here is an example by the tutor
23w50 An Example of Wire Game with Creative Game Modes, there are "classic mode" where you should not touch the wire, and "creative invert mode" where you must keep touching the wire, the 2 modes will switch after a random time.
Used in Session w48 of LP2346: 3 Weeks Recap & Review, 23w46, a blog post 23w48 A Session with Handcraft and Programming for Wire Game
Used by demo for LP2517: Special Onboarding Workshop, 25w17
In LP2402: 4 Weeks Package with Wire Game 2G, we based on this basic Wire Game project, and extend with a fun "Invert Mode" together with our students. Please have a look at the learning logs there, for how we made things happen step by step, by group programming.