CR101 Tutorial – Class 3

This lesson will introduce DC motors, differential drive, variables, and how to use the rover.

DC Motors

Unlike servos, which turn to fixed positions, DC motors are continuous and can constantly spin. Used for fast motion, they are found in many different objects in our everyday lives, such as toy cars, electric fans, and more. They can turn both ways.

DO NOT forcefully stop when it’s in motion or turn the motor while it is stopped, as that can easily damage or even break it.

Differential Drive

Also known as tank drive, this is the most common control mechanism for driving robots. To put it simply, the difference in the two motor speeds is what controls the robot in this scenario. When both motors are moving at the same speed, the robot will move in a straight line. But if one wheel is faster than the other, the robot will turn – with the turn growing more drastic as we increase the difference. We can use this to control how our robot moves.

To pivot left, the left wheel has to go backwards and the right wheel has to go forwards. If you want it to pivot right instead, the opposite has to occur. To turn, the motor on the side that you want the rover to turn in has to be moving slower than the other one.

Assembling our Rover

Follow these steps to see how the rover the following projects will be referring to is assembled:

Step 1: Turn your board over and attach the two DC motors. The black ends of the motors should be facing forwards (forwards being the opposite direction from the board). The motors are screwed in using these holes:

CR101 Tutorial - Class 3

Step 2: Pull your wires through the two openings in the center of the board.

Step 3: Attach the wheels to the motors.

Step 4: The front wheel (with the ball on it) is called a caster. Attach the caster to the board using the holes pictured below – which way you put it on doesn’t matter!

CR101 Tutorial - Class 3

Step 5: Gently unscrew the motor drivers pictured, but don’t pull the bolts out. Insert the motor wires in the following order: black, red, black, red, with each motor being plugged into the driver on the same side as it. Screw the motor drivers back in to tighten them, but don’t screw them in too tight – if it’s too tight, the wire tips can break off if the wires are moved too much.

CR101 Tutorial - Class 3

Programming the Motors

In CarduBlock, motor movement is controlled by four blocks – Motor Forward, Motor Backward, Motor Speed, and Motor Stop. Motor Speed in particular is capable of replicating the functions of Motor Forward/Backward, since it lets you manually set the speed of the motors , while Motor Forward and Backward set the motors to their maximum/minimum speed by default. Note that the Motor Stop is extremely important – if you don’t tell it to stop, the motor will keep spinning indefinitely!

Look at the following programs. What do you think is happening in each of these? If you think you’ve got it, program these and try it out with your rover. See if you guessed their function correctly!

CR101 Tutorial - Class 3
CR101 Tutorial - Class 3


CR101 Tutorial - Class 3

In programming, we often want to store information for later use. To do that, we need to use something called a variable, found in the pink Variables and Constants bin. We can store information like numbers in variables, and that information can be assigned, used, and modified in the program at any time.

Each variable must have a unique name for identification. Every time when you want to use a variable, just “call” its name.

Challenge: Use variables and the potentiometer to control the speed settings of your rover.

End Challenge

Program your rover to navigate through a series of gates. Include two LEDs to signify which way the rover is turning.
Hint: Try to break the program down into smaller bits!

That’s all for this tutorial! Look forward to the final lesson!