Build your first robot
Every robot does three things again and again: it senses the world, thinks (runs your program) and acts (moves or makes light and sound). A two-wheel robot car is the best first robot.
What you need
- A brain: the TinkerPie V1 board (it has motor outputs built in), or an Arduino with a motor driver.
- Two DC gear motors with wheels, and a caster wheel or ball at the front.
- A battery pack for the motors, and a chassis (you can design one in TinkerPieCAD).
- Sensors: an ultrasonic sensor for obstacles, or line sensors for following a track.
How a robot steers
| Left motor / right motor | The robot… |
|---|---|
| forward / forward | drives straight |
| forward / stop | turns right |
| stop / forward | turns left |
| forward / backward | spins on the spot |
Motors need more current than a microcontroller pin can give, so they always go through a motor driver, which works like a pair of electronic switches that can also reverse the motor.
Program 1: avoid obstacles
forever:
if distance < 20 cm:
stop, back up a little, turn
else:
drive forward
Program 2: follow a line
forever:
if the left sensor sees black: turn left
if the right sensor sees black: turn right
otherwise: drive forward
Test before you build
In TinkerPie Studio, the simulator shows motor and servo gauges, so you can test the program first. Then download it to the board. Look at the robot projects and the TinkerPie books for step-by-step builds.
Safety
- Lift the robot (wheels in the air) the first time you test motors.
- Use the battery pack made for your robot, and switch it off before changing wires.
More guides: Learn with TinkerPie.