Tutorial: Light Controlled Robot Cars

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.

https://www.instagram.com/p/BklPi-wnUrD/?utm_source=ig_web_copy_link

 

Materials

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. 

Assembly:

  1. Mount the Arduino on the car chassis, and then mount the SwissCHEESE shield on the Arduino.Tutorial: Light Controlled Robot Cars
  2. Using 2 nuts and bolts, attach the servo face at the front end of your robot car. Tutorial: Light Controlled Robot Cars
  3. Using 2 nuts and bolts, attach 2 brackets to the servo to form the kicker.Tutorial: Light Controlled Robot Cars
  4. Using 2 nuts and bolts per light sensor, attach one at the front, back, left and right sides of the chassis.Tutorial: Light Controlled Robot Cars

 

Wiring

  1. When wiring, make sure that the Arduino USB wire is not plugged into the computer.
  2. Attach the wires of the two motors to the SwissCheese at M1, and M2.Tutorial: Light Controlled Robot Cars
  3. Connect a jumper wire from:
    1. I0 to the light sensor on the right.
    2. I1 to the light sensor on the front.
    3. I2 to the light sensor on the left.
    4. I3 to the light sensor on the back.
    5. O0 to servo at the front.Tutorial: Light Controlled Robot Cars

Programming

    1. Open up Arduino IDE, and go to Tools –> CarduBlock Edu to open up the Cardublock user interface.
    2. 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.Tutorial: Light Controlled Robot Cars
    3. 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.

Tutorial: Light Controlled Robot Cars

  1. 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).