Hello everyone! In this tutorial we will create light controlled robot cars and play soccer with them. It will be similar to Rocket League, except we will use arms attached to servo motors to hit the ball.
This tutorial assumes that you have a working environment setup with the Arduino IDE and Cardublock library. See here for more information.
- Arduino Uno
- SwissCHEESE Kit
- Hitec HS-311 Standard Economy Servo
- SwissCHEESE Light Sensor X 4
- Robot Car Chassis Of Your Choice
- Gearmotor and Wheel Set X 2
- M4 Nuts And Bolts X 12
- A ping-pong ball
- A power source for the Arduino (we use a 3000mAh NiMH battery pack)
Note: we will be using our own robot car configuration including two motors and a caster. Feel free to use your own robot car as long as it is controlled with the Arduino, and has 2 DC motors included.
- Mount the Arduino on the car chassis, and then mount the SwissCHEESE shield on the Arduino.
- Using 2 nuts and bolts, attach the servo face at the front end of your robot car.
- Using 2 nuts and bolts, attach 2 brackets to the servo to form the kicker.
- Using 2 nuts and bolts per light sensor, attach one at the front, back, left and right sides of the chassis.
- When wiring, make sure that the Arduino USB wire is not plugged into the computer.
- Attach the wires of the two motors to the SwissCheese at M1, and M2.
- Connect a jumper wire from:
- I0 to the light sensor on the right.
- I1 to the light sensor on the front.
- I2 to the light sensor on the left.
- I3 to the light sensor on the back.
- O0 to servo at the front.
- Open up Arduino IDE, and go to Tools –> CarduBlock Edu to open up the Cardublock user interface.
- Subroutines make your program easier to read. To use subroutine blocks, or delays look in Control. To use motor blocks, or servo blocks, look in CAROBOT SwissCHEESE. Using this, assemble 6 subroutines like below.
- Next, create the following below. To use the loop, or if else statements, look in Control. To use the orange comparison blocks, look under Tests. To use the light sensor, look in CAROBOT SwissCHEESE.
- Now connect the Arduino USB wire to the computer and hit “Upload To Arduino” *
*Make sure you have the following selected: Tools –> Boards –> Arduino Uno/Genuino, and Tools –> Ports –> COMX (where x is a number).