Get Started

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


Before starting your own project, you must download the package on our website by visiting LEARN -> Get Tutorials-> Smart Car Kit V2.0 for Arduinoand unzip it.



Arduino is an open source platform that applies simple software and hardware. You can get it in a short even when you know little of it. It provides an integrated development environment (IDE) for code editing and compiling, compatible with multiple control boards. So you can just download the Arduino IDE, upload the sketches (i.e. the code files) to the board, and then you can see experimental phenomena. For more information, refer to

Arduino Board – SunFounder Compatible

In this kit, the SunFounder Uno R3 board is used and it is completely compatible with Arduino Uno Board.

Install Arduino IDE

The code in this kit is made based on Arduino, so you need to install the IDE first. Skip it if you have done this.

Step 1: Go to the website and click Software. On the page, check the software list on the right side under Download the Arduino Software.

Find the one that suits your operation system and click to download. There are two versions of Arduino for Windows: Installer or ZIP file. You’re recommended to download the former.

Step 2: Double click the .exe file and the following window will show up. Click

Click I Agree. The following interface will show up.

Choose Next.

Click Browse to choose the installation path or enter a directory at the Destination Folder.

Click Install.

The following interface will show up. (After the installing progress bar goes to the end, the Close button may be enabled for some PC. Just click it to complete the installation.)

Then a prompt appears. Select Always trust software for “Adafruit Industries” and click Install.

Select Always trust software for “Arduino srl” and click Install.

After the installation is done, click Close. Then an Arduino icon will appear on the desktop:

Add Libraries

1)     Select Sketch -> Include Library -> Add ZIP Library.

2)     Find the file MsTimer2.zipunder Smart Car V2.0 for Arduino\Code\Library. Click Open.

3)     Similarly, add IRromte.zipand NewPing.zipunder Smart Car V2.0 for Arduino\Code\Library to library.

4)     Then you’ll be prompted by Library added to your libraries. Check “Import libraries”. You also can see the libraries just imported have appeared on the list by going to Sketch->Include Library->MsTimer2.

Sensor Shield

It is convenient to place components on a breadboard. However, you need to have some electronic foundation to build various kinds of circuit. By using this sensor shield, you only need to wire components to the shield with some jumper wires, and then you can build your own project quickly. The sensor shield is one of the most common Arduino peripheral devices, as shown below:

Its schematic diagram is as shown below: note that VCC only supplies power to the devices connected to D2 (hooked to the black servo) and D3. Other components are powered by 5V.

Motor Driver Module

The motor driver module is used to drive two motors to rotate. The driver chip used here is L298N.

Its schematic diagram is as shown below:

L298N is a high voltage, large current driver chip manufactured by ST, which uses a 15-pin package.

Its main features are as follows:

• High operating voltage, which can be up to 40 volts.

• Large output current – the instantaneous peak current can be up to 3A.

• With 25W rated power.

• Two built-in H-bridge, high voltage, large current, full bridge driver, which can be used to drive DC motors, stepper motors, relay coils and other inductive loads.

• Using standard logic level signal to control.

• Able to drive a two-phase or four-phase stepper motor, and two-phase DC motors.

Its pin functions are as shown below:

115Sense ASense BThe sense resistor is connected between this pin and ground to control the current of the load.
23Out 1Out 2Outputs of the Bridge A; the current that flows through the load connected between these two pins is monitored at pin 1.
4VsSupply Voltage for the Power Output Stages.A non-inductive 100nF capacitor must be connected between this pin and ground.
57Input1Input2TTL Compatible Inputs of the Bridge A.
611Enable A Enable BTTL Compatible Enable Input: the L state disables the bridge A (enable A) and/or the bridge B (enable B).
9VssSupply Voltage for the Logic Blocks. A100nF capacitor must be connected between this pin and ground.
1012Input3Input4TTL Compatible Inputs of the Bridge B.
1314Out 3Out 4Outputs of the Bridge B. The current that flows through the load connected between these two pins is monitored at pin 15.

The driver module can drive two motors. The enable terminals ENA and ENB are effective at high level. The control mode (high/low level) and state of motor A are as shown below:

ENAIN1IN2State of Motor A
101Rotate clockwise
110Rotate counterclockwise

If you want to regulate the speed of motor A by PWM, you need to set IN1 and IN2, confirm the rotational direction of the motor, and then output PWM pulses for enabled terminals. Please note that the motor is in the free stop state when the signal of enabled terminal is 0. When the enabled signal is 1, if IN1 and IN2 are 00 or 11, the motor is in brake state, and the motor stops rotating. If IN1 is 0 and IN2 is 1, the motor A rotates clockwise; if IN1 is 1 and IN2 is 0, the motor A rotates counterclockwise. This is the control method for motor A. The control method for motor B is the same as that for motor A.

Step-down DC-DC Converter Module

The DC-DC module is used to reduce the input voltage and output a stable 5 volts voltage. Here the LM2596 switching voltage regulator is used to regulate the voltage.

The corresponding schematic diagram:

The LM2596 regulator is a monolithic integrated circuit ideally suited for easy and convenient design of a step−down switching regulator (buck converter). It is capable of driving a 3.0A load with excellent line and load regulation. It is internally compensated to minimize the number of external components to simplify the power supply design.

Since LM2596 converter is a switch−mode power supply, its efficiency is significantly higher in comparison with popular three−terminal linear regulators, especially with higher input voltages. The LM2596 operates at a switching frequency of 150 kHz thus allowing smaller sized filter components than what would be needed with lower frequency switching regulators. It is available in a standard 5−lead TO−220 package with several different lead bend options, and D2PAK surface mount package.


  • Fixed Output Voltage: 5V
  • Guaranteed 3.0 A Output Load Current
  • Wide Input Voltage Range up to 40 V
  • 150 kHz Fixed Frequency Internal Oscillator
  • TTL Shutdown Capability
  • Low Power Standby Mode, typically 80 μA
  • Thermal Shutdown and Current Limit Protection

Its pin functions are as shown below:

1VINThis is the positive input supply for the IC switching regulator. A suitable input by pass capacitor must be present at this pin to minimize voltage transients and to supply the switching currents needed by the regulator.
2GNDCircuit ground
 3 OUTPUTInternal switch. The voltage at this pin switches between (+V IN − V SAT) and approximately −0.5V, with a duty cycle of approximately V OUT /V IN. To minimize coupling to sensitive circuitry, the PC board copper area connected to this pin should be kept to a minimum
4FeedbackSenses the regulated output voltage to complete the feedback loop
5ON/OFFAllows the switching regulator circuit to be shut down using logic level signals thus dropping the total input supply current to approximately 80 µA. Pulling this pin below a threshold voltage of approximately 1.3V turns the regulator on, and pulling this pin above 1.3V (up to a maximum of 25V) shuts the regulator down. If this shutdown feature is not needed, the ON /OFF pin can be wired to the ground pin or it can be left open; in either case the regulator will be in the ON condition

Switch Module

The switch module is used to turn on/off the power. A self-locking switch is used. It is a single-pole double-throw switch. When the button is not pressed, pin 1 and 3 are connected, and pin 4 and 6 are connected, as shown in figure (a). When the button is pressed, pin 2 and 3 are connected, and pin 4 and 5 are connected, as shown in figure (b).

  (a) When the button is NOT PRESSED                          (b) When the button is PRESSED

Ultrasonic Module HC-SR04 Distance Sensor 

The ultrasonic ranging module HC-SR04 provides 2cm-700cm non-contact measurement function, and the ranging accuracy can reach 3mm. Stable signal can be ensured within 5m, and signal gradually fades beyond 5m till disappearing at 7m position.

The module includes ultrasonic transmitters, receiver and control circuit. The basic principle of work:

1)     Using IO trigger for at least 10us high level signal;

2)     The module automatically sends eight 40 kHz square waves and detect whether there is a pulse signal sent back.

3)     If there’s a signal sent back, output a high level through pin ECHO; the time duration is the time from sending the ultrasonic to the returning.

Thus, test distance = (high level time × velocity of sound (340M/S) / 2.

The timing diagram is as shown below. You only need to supply a short 10uS pulse to the trigger input to start the ranging, and then the module will send out an 8-cycle burst of ultrasound at 40 kHz and raise its echo. The echo is a distance object that is pulse width and the range in proportion .You can calculate the range through the time interval between sending trigger signal and receiving echo signal. Thus,

uS / 58 = centimeters or uS / 148 =inch; or: the range = high level time * velocity (340M/S) / 2; You’re recommended to use over 60ms measurement cycle, in order to prevent conflicts between trigger signal and echo signal.

Line Follower Module

The TCRT5000 infrared photoelectric switch adopts a high transmit power infrared photodiode and a highly sensitive phototransistor. It works by applying the principle of objects’ reflecting IR light – the light is emitted, then reflected, and sensed by the synchronous circuit. Then it determines whether there exists an object or not by the light intensity. It can be used to easily identify black and white lines.

In other words, the different conduction levels of the phototransistor when it passes over black and white lines can generate different output voltages. Therefore, all we need to do is to collect data by the AD converter on the STM8S105C4 and then send the data to the master control board via I2C communication.

This module is an infrared tracking sensor one that uses a TRT5000 sensor. The blue LED of TRT5000 is the emission tube and after electrified it emits infrared light invisible to human eye. The black part of the sensor is for receiving; the resistance of the resistor inside changes with the infrared light received.

Supply Voltage: 5V; PCB Dimensions: 124 x 30 mm

IR Receiver Module

The infrared-receiver module uses the HS0038B as the infrared receiving head which receives infrared signals and can independently receive infrared ray and output signals compatible with TTL level. It’s similar with a normal plastic-packaged transistor in size and it is suitable for all kinds of infrared remote control and infrared transmission.


  • High protection ability against EMI.
  • Circular lens for improved reception characteristics.
  • Line-up for various center carrier frequencies.
  • Low voltage and low power consumption.
  • High immunity against ambient light.
  • Photodiode with integrated circuit.
  • TTL and CMOS compatibility.
  • Long reception distance.
  • High sensitivity.
  • Pb free and RoHS compliant.


Servo is a set of automatic control system composed of DC motors, reduction gear set, sensors and control circuits. The output shaft can be rotated to a certain angle by sending signals. The servo can only rotate in a certain range, for example, 0-180°. It cannot rotate in circle continuously like DC motor. The servo enables you to easily rotate an object in a certain angle, so it is widely used in model planes and robot joints.

Only the MG995 SG90 Micro Servo is used in this kit, which is assembled on the front chassis of the car for steering structure.