Intro: Space Race: Simple Arduino Clicker Game to Make With the Kids
¡I'm uploading a video showing how it works today! Stay tuned
Let's have fun with an space-themed instructable that can be made along with kids, and later be enjoyed by them alone as a toy.
You can use it as a mean to teach them history about cold war and the space race with this simple project, but don't be fooled: we'll all use and learn about:
- 3D Design (kids friendly thanks to TinkerCAD)
- Cardboard crafting
- Painting or other crafts you want to include ;)
Space Race is a game:
You must repeatedly press your button to make your ship advance towards the moon. The first to arrive there wins. You must fight against gravity that will pull you down to earth. Starting before the led goes out (or your spaceship is ready) will cost you a penalty, and the start time will be random to test your reflexes even more.
Step 1: Tools and Materials Needed
- Arduino board
- Uno, Mega, etc will do. Must support Servo library.
- A computer to program it
- 2 Pushbuttons. I used arcade like ones, big and sturdy.
- 2 resistors (4.7k ohm will do fine)
- 2 Servos. I used the cheapest model SG-90
- 1 LED diode of your favorite color
- A protoboard + some jumper cables
- Perhaps you'll need some electric wire, depending on your jumpers length and final design.
Step 2: Programming the Game in Arduino
I programmed the game for you so you can use it right away.
I commented the most of the code to help you understand what's going on, and to encourage you to learn some Arduino. Note that I'm not a programmer, so perhaps that's not the most elegant code. On the other hand, this demonstrates that if I can learn to code, you can do it too if you try ;)
I made a section called CONFIGURATION. You must customize the maximum angle that your servos will reach to fit your build. Take a look at the config sections comments.
You can also tinker with the experience configuration: Try the default values first and then experiment to see how it turns out: Negative Gravity? Make the game longer or harder? explore the program to see what you can do.
Just open and upload the code shared here into your Arduino/Genuino board, looking at it you can learn about:
- State machines
- Basic servo library usage and problems
- Button debouncing and why you must do it
- Random function, and much more.
If you need help uploading this code, go to : https://www.arduino.cc/en/Main/Howto
The code is 362 lines, so I decided to upload the .ino file instead of copying the code here.
Step 3: Building the Circuit
I used TinkerCAD for the first time to design the circuit. I liked it as it was easy and faster than other alternatives:
Let me explain a little about this simple circuit:
From right to left you see:
Just ground, Vcc and signal. The real magic with them occurs in the software part. You can read on the net that Arduino doesn't have enough power to run a servo properly, but i overcame this with some programming tricks (detaching them after movement to avoid jittering, for example). As you can see my Mega board has enough power to run all the stuff in this project with no external power supply.
Are connected to ground by a 4.7k PULL-DOWN RESISTOR. If we didn't use that resistor the Arduino would pick up a lot of electric noise from the enviroment, giving erratic and false readings. This resistor makes sure that any electrical signal/noise goes to ground instead of the input pin if it's not strong enough as a true positive is. It will be nice to experience by yourself: just unplug the wires of pins 2 or 3 and look what happens :)
At the left we have an
Usually we should use a resistor in series with it to avoid eventually burning the LED, but since we're using the board and not a standalone arduino we're taking advantage of the built in resistor and led on pin 13, they're already there! You can even save this LED while doing the testing, but since we want to enclose the arduino we'll need a LED diode outside.
Step 4: Building the Frame
We could use wood and some tools, but since we want something a child can make, we'll use several layers of cardboard glued together for greater hardness.
I made first the vertical walls, and then cut the first layer of the upper cover to fit them.
It doesn't matter if the layers don't fit perfectly, you can level them cutting the extra with a cutting blade as shown in the pictures.
The bottom layer is glued only in one end.
Did you know that alternating the wave direction of the cardboard layers confers it more mechanical resistance? If you cut the bottom layer with the wave perpendicular to the long side, it will be easier to bend it to open it.
Cut the rails for the ship wires, but don't cut the holes for the buttons or the USB cable yet.
Step 5: Integrating the Circuit
First attach some wire to the servos so you can try in different positions. Pressing the reset button in the arduino will make the servos go all their way up and down, that will help you placing them perfectly (and set the appropriate angle in the code). Once you glued the servos to the bottom layer it's time to place the buttons and their holes. I cut a button hole before gluing the servos and it was a mistake: The button couldn't go all it's way in because of the servo!
To avoid the use of a soldering iron and tin, I came with an easy solution to attach the wires: Tie them by their conductive part and apply hot glue, which is safer for a kid.
You won't need a lot of glue so don't over do it: Remember that hot glue is non conductive. Just put the glue enough to make sure that they make contact and include some of the cable outer cover. You'll see it in the pictures.
Now place your arduino board, your protoboard and make sure that the cables don't get in the servos way. Glue them with just a little drop so you can reclaim them for future projects.
I made a hole for the LED with the scissors. Remember that the small 3mm LEDs won't stand 5V, so take care when testing them. Negative (catode) is the short leg and goes to ground.
If the Arduino doesn't work or it reboots, that means that you've wired something wrong. I recommend testing the circuit before installing it. You can use just two wires instead of a button, shorting them to simulate the click ;)
Don't fit the buttons in their holes yet if you're going to decorate the outside case
Step 6: Building the Ships and Decorating the Box
I made these two models in TinkerCAD as my first option for
I'm sharing them with you, but I think it will be more fun to design your own. It was a breeze as you can see ;)
I wanted to end this project live with my little cousin at a family meeting, so we eventually crafted our ships with a sheet of newspaper. I didn't have my 3D printer at that place, nor the time for my cousin to design her ship. The ships are the last part to be added.
To decorate the box
I printed and glued a deep space picture, plus a cutout from the Earth and another of the Moon. You can paint it in black with colorful stars: Get creative!
Step 7: Play and Experiment
Find some friends and... Let's play!
When you've had enough of this project you can reclaim all the parts, or you can tinker it to upgrade it if you dare to code.
Feel free to ask or comment, let me know what you think. Of course I'd love to see it if you build one of these.
Thank you for watching this Instructable. If you keep learning and making things, someday we all will be able to go for the moon :)