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.

View this post on Instagram

CAROBOT Soccer is coming to @makerfestival 2018! Control our robots with a flashlight and try to score a goal against your opponents. Come by our booth next weekend and check it out! __ Interested in signing up your child for our robotics classes in #markham? Visit the link in our bio to find out more! __ Are you an educator interested in making teaching #robotics easy? DM us for more info! . . . #toronto #arduino #engineering #technology #innovation #software #diy #computers #tech #stem #steam #raspberrypi #canada #makers #code #computerscience #science #education #programming #yorkregion #ontario #edutainment #robot #stemeducation #makerfestivalto #fifa #fifa2018 #worldcup

A post shared by CAROBOT Learning and Research (@carobotorg) on



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. 


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



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


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

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

Leave a Reply