Experiment 1 Going Forward and Backward

Share for us
Share on facebook
Share on twitter
Share on pinterest
Share on whatsapp

In this experiment, the car begins to walk, but it is just the simplest movements: going forward and backward and then stopping. This is the first and most important step for car walking. The subsequent experiments are all based on this experiment. You need to download the Smart Car for Arduino zip file on LEARN->Get Tutorials->Smart Car Kit for Arduino on our website, which contains the code and user manual for each experiment. After the assembly and circuits are finished, if you feel the wires are too messy, you may wrap them with the heat shrink tubing so the car can look more adorable with neat wiring. Now let’s get started!

The physical diagram for the car to go forward and backward is as shown below:

Components

– 1 * Smart Car for Arduino

– 2 * 18650 battery

– 1 * USB cable

– Several Dupont wires

Experimental Principle

The batteries output 7.2V to the switch module. When you press the button of the switch module, 7.2V will be input to the step-down DC-DC converter module which then outputs 5V after lowering the voltage. 5V is input to the sensor shield to supply for the servo. The MG995 servo at the front is to control the direction the car walks in. In this experiment, the car keeps walking straight forward/backward. The motor driver module is used to drive the two gear reducers connected to the rear wheels of the car, of which the rotation drives that of the wheels. Thus, the car begins to walk.

Experimental Procedures

1)     Connect the motor driver module and sensor shield

Motor Driver ModuleSensor Shield
5v5v
ENA5
INT18
INT29
INT310
INT411
ENB6

2)     Connect the motor driver module and two motors:

Note:

Please pay attention to that diagram. Each gear reducer has two wiring terminals. You should wire them correctly. The wiring will affect the rotational direction of the gear reducers. If you do not know how to distinguish, you can try wiring them randomly first. Then burn the code under the path Smart Car for Arduino\Code\1.Car_Forward \Car_Forward to the board to see whether the car moves forward. If it does, you’ve wired them correctly. If not, you may need to change the wiring until the car moves forward.

3)     Connect the sensor shield and the servo

ServoSensor Shield
+ (Red Wire)5v
– (Brown Wire)GND
Signal Output (Orange Wire)2

4)     Connect the step-down DC-DC converter module and switch module

Note: The two pins of the battery holder should not be in contact; otherwise it will cause a short circuit and the battery will be burnt.

After you have finished all the connections, connect the SunFounder Uno board to your computer. Download the sketch under the path Smart Car for Arduino\Code \1.Car_Forward\Car_Forward, and then remove the USB cable. Press the button on the switch module, and the car starts running.

Experimental Phenomena

When you press down the button of the switch module, the car starts to go straight. 2 seconds later, it starts to go backwards and then stops after another 2 seconds. If you press down the button for a second time, the car will start to walk again. If you want to change the time the car walks, you can modify the sketch as you like.