This is a quick and simple tilt sensor using copper tape, screws, and a metal marble that should only take you a few minutes to build, so you can concentrate on coding a really fun tilt game! This sensor design is courtesy of Aaron Graves.
|Step One: Create Earth|
You can then place your DIY tilt sensor in a pool noodle for an amazing alt controller you made yourself!
Let's make one!
To create EARTH, use copper tape to wrap from end to end on the inside of a small pipe or tube. Make sure you have tape on all sides of your pipe, but leave space between the tape, so when you insert the screw for left and right, they will not come in contact with the copper tape and register a false key press.
Since a ball will be making the connection, you will want your tape pieces placed really close together! Plus, you will want tape traces on the top, bottom, and sides of the inside to ensure connections when people are tilting the pool noodle!
Once the screw is in place, the metal ball inside will connect the EARTH connections made with the tape to the left or right key press connected to the metal screws.
|Step Two: Insert Marble|
Place a screw through the pipe on one end of your pipe, and then place the metal marble inside. Make sure the metal screw does not come in contact with the copper tape or your sensor will not work.
|Step Three: Create Left and Right Tilt Inputs|
With the marble inside, place another screw on the other end of your pipe again making sure the screw does not make contact with the conductive tape. Instead the marble will complete and make sure the marble will make contact with each screw when you tilt left and right.
Use an alligator clip to connect one screw to the left arrow input on your Makey Makey.
Place another alligator clip from the other screw to the right arrow key input on your Makey Makey.
Connect the white hook up wire that is connected to the copper tape to an alligator clip from the white wire to an EARTH input on your Makey Makey.
Here is another view of this tilt sensor.
|Step Four: Insulate|
To ensure that hook up wire stays in place and to insulate the center of your sensor, use masking tape to cover the connection.
Then place your entire sensor inside a pool noodle! The alligator clips can come out one end or both ends, that is up to you!
If you have the extra long alligator clips from the STEM pack, they are a great way to get more mobility and movement to this project.
|Step Four: Design a Tilting Game|
Now that you've made a tilt sensor, it is time to design a rad game in Scratch!
You'll want to make your main sprite to tilt left and right when the left and right arrows are pressed.
Code Left and Right Movement
If you want to add scoring, you'll want to set the score to ZERO when the green flag is clicked.
You'll want to make a couple of sprites of falling things for your main sprite to catch (or avoid!) The third picture of code is the code we used to make raining tacos. This code will make a sprite appear in a random location at the top of your screen, and fall to the bottom, but return to the top in a random spot once it reaches the bottom of the screen. If you duplicate this sprite, you'll have more objects falling from the sky. Or you can move this same code to your backpack and add other sprites that will drop for your main sprite to catch.
Code Falling Objects
We've also added the "increase variable" here, so that in our game if the taco touches the chick, your score will increase! In our game, we also made a cloud that falls and if the chick runs into the "falling sky" the score variable will decrease.
Here is our example project to get you started, plus you can test your own controller here!
As a teacher, this project would be a great way to add coding to story project. You could also use this as an analysis tool. What other stories could be turned into a catching or chasing game? Or you could have students think about objects that might increase or decrease the main character's mood? Or you could have the objects that fall from the sky be plot points. There are lots of ways to use coding to emphasis concepts from literature!
What story will your students hack?