0% found this document useful (0 votes)
86 views41 pages

ESP32 Camera 4WD Robot Car Kit

The document provides a comprehensive guide for assembling and programming an ESP32 Camera 4WD Robot Car Kit, detailing steps from assembly to web remote control. It includes instructions on wiring, uploading code via Arduino IDE, and troubleshooting common issues. Additionally, it covers specifications of the ESP32-CAM and the L298N motor driver used for controlling the robot's motors.

Uploaded by

smang10
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
86 views41 pages

ESP32 Camera 4WD Robot Car Kit

The document provides a comprehensive guide for assembling and programming an ESP32 Camera 4WD Robot Car Kit, detailing steps from assembly to web remote control. It includes instructions on wiring, uploading code via Arduino IDE, and troubleshooting common issues. Additionally, it covers specifications of the ESP32-CAM and the L298N motor driver used for controlling the robot's motors.

Uploaded by

smang10
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 41

ESP32 Camera 4WD Robot Car Kit

Content
 Step 1:Assembly Tutorial ........................................................................................1
 Step 2:Wiring .......................................................................................................... 2
 Step 3:Upload Main Code .......................................................................................5
 Step 4:Mobile Device Connects to the ESP32-Cam Robot .................................... 6
 Step 5:Web Remote Control ESP32-Cam Robot Car ........................................... 10
 How to Upload Main Code ................................................................................... 12
 Install Arduino IDE ........................................................................................... 12
 Installing ESP32 Add-on in Arduino IDE ......................................................... 13
 Install CH340 Driver ......................................................................................... 17
 Upload Code ...................................................................................................... 25
L298N Motor Driver .....................................................................................................31
ESP32-CAM Specifications ..........................................................................................36
 Step 1:Assembly Tutorial
O Video.mp4
For more details refer to Assembly Tutorial

1/38
 Step 2:Wiring

2/38
3/38
4/38
 Step 3:Upload Main Code

Tip:Since the program has been uploaded to the ESP32Cam before the factory, you
can just skip this step and no need to upload it repeatedly.
Learn more about How to Upload Main Code

5/38
 Step 4:Mobile Device Connects to the ESP32-Cam Robot
Turn on the power switch. When the red LED light on the ESP32CAM board lights up, it means:
ESP32CAM WiFi Available. If it does not light up, try restarting the ESP32CAM.

6/38
Mobile device connects to the wifi hotspot:ESP32-Cam Robot

7/38
Type and access the address "192.168.4.1" on your browser

8/38
Tip:If the remote control web page fails to load,
The possible reasons are:
1) The battery is low. Make sure the total battery voltage is >11.1V

2) The wrong wifi device is connected, the correct device name:

3)Because some mobile devices have the network assistant turned on by default. This may
cause control instructions to be routed incorrectly. It is recommended that you turn off the
mobile data network and only turn on the wifi network.

9/38
 Step 5:Web Remote Control ESP32-Cam Robot Car

10/38
The robot car is not moving? There may be the following reasons:

①It must be powered by 18650*3 batteries. Make sure the total battery voltage>11.1V.
Due to air transportation, the battery may not be included in the kit, you need to buy the
battery yourself.

②Wrong wiring, loose wiring

If none of the above is the case. Press the RST button and the four motors will run.
You can use the RST button to verify whether the motor and drive circuit wiring are correct.

11/38
 How to Upload Main Code
 Install Arduino IDE

Go to https://www.arduino.cc/en/Main/Software. If you have questions about the installation of Arduino IDE,


you can refer to Getting Started with Arduino products.

Tip:Before starting this installation procedure, make sure you have the latest version of the Arduino IDE
installed in your computer. If you don’t, uninstall it and install it again. Otherwise, it may not work.

12/38
 Installing ESP32 Add-on in Arduino IDE

①Open the Boards Manager. You can go to Tools > Board > Boards Manager… or you can simply click
the Boards Manager icon in the left-side corner.

13/38
②Search for esp32 and select 2.0.11 ,click the INSTALL button for esp32 by Espressif Systems.

14/38
③Installing, this will take a while

15/38
④Successfully installed platform esp32:2.0.11

16/38
 Install CH340 Driver

What is CH340 Driver?

CH340 is a TTL (serial) to USB converter and vice versa. This chip has been used in some boards such as
Arduino boards, ESP8266, etc. The boards using the CH340 chip,need a programmer in order to access the
processor or to program them.But there is a downside. An extra driver must be installed before starting to

work with boards having this IC.

So before uploading the code, you need to install the CH340 driver. Otherwise you won't be able to find the
correct COM port in the Arduino IDE.If your computer has already installed the CH340 driver, you can skip
this step.

17/38
If you connect your board to the computer before installing the driver, your computer will not recognize the
board correctly and you will see following image in Device Manager.

To open Device Manager, search for it in the Windows Start menu.

18/38
Follow the steps below to install the CH340 driver:

① Downloading the driver

First, download the CH340 driver from the this link.

Windows CH340 Driver

You can also download the latest version of the driver directly from the manufacturer’s site google link

19/38
② Installing the driver

After downloading the driver, open it and click Install.

Tip:Before installing the driver software, you must connect the ESP8266 D1 WiFi
UNO board to your computer with a USB cable

20/38
After successful installation you should see this message

Note:In some cases, you may need to reset Windows after the driver installation is complete.

21/38
③ Checking Correct Driver Installation in Device Manager

If your driver has been installed correctly, and if you connect your board to a computer, then you can see its
name and port number in the Port section. For example, my Arduino board is connected to COM28.

22/38
④ Checking Correct Driver Installation in Arduino IDE

Open the Arduino IDE software. Go to the Tools->Port: menu , select the COMx.
Note that this port number must be the same as the number you saw in the previous step.

23/38
Tip:If you don't find the Arduino CH340 device in your computer's device manager or
Arduino IDE, It means the driver software installation failed. You can try
①UNINSTALL the driver, restarting your computer, and then repeating the
above steps.

②Change the USB interface or change to another computer


③Use a USB cable that can transfer data, not just power

24/38
 Upload Code

①Start Arduino IDE, open the code in

File->Open...->ESP32 Camera 4WD Robot Car Kit>Main Code>ESP32_Camera_4WD_Robot_Car.ino

25/38
②Use USB cable to connect the ESP32CAM board to the computer.(It may be that the power supply of the
USB interface of the computer is insufficient, you can turn on the power switch of the robot car at the same
time.)

26/38
③Select your Board in Tools > Board menu>esp32>AI Thinker ESP32-CAM

27/38
④Select the Port (if you don’t see the COM Port in your Arduino IDE, you need to Install the CH340
Drivers)

28/38
⑤Click the Upload button in the Arduino IDE. Wait a few seconds while the code compiles and uploads
to your board.

29/38
If everything went as expected, you should see a “Done uploading.” message.If the Arduino IDE reports
errors maybe you missed some steps. Arduino getting started guide is as follows

Errors when uploading a sketch Getting Started with Arduino products

30/38
L298N Motor Driver
There are many ways to control a DC motor. The method we’ll use here is suitable for most hobbyist motors, that require

6V or 12V to operate.

We’re going to use the L298N motor driver that can handle up to 3A at 35V. Additionally, it allows us to drive two DC

motors simultaneously, which is perfect to build a robot.

The L298N motor driver is shown in the following figure:

31/38
L298N Motor Driver pinout
Let’s take a look at the L298N motor driver pinout and see how it works.

The motor driver has a two terminal block in each side for each motor. OUT1 and OUT2 at the left and OUT3 and OUT4 at the
right.

 OUT1: DC motor A + terminal


 OUT2: DC motor A – terminal
 OUT3: DC motor B + terminal
 OUT4: DC motor B – terminal

32/38
At the bottom you have a three terminal block with +12V, GND, and +5V. The +12V terminal block is used to power up the
motors. The +5V terminal is used to power up the L298N chip. However, if the jumper is in place, the chip is powered using the
motor’s power supply and you don’t need to supply 5V through the +5V terminal.

Note: if you supply more than 12V, you need to remove the jumper and supply 5V to the +5V terminal.

It’s important to note that despite the +12V terminal name, with the setup we’ll use here (with the jumper in place) you can
supply any voltage between 6V and 12V. In this tutorial will be using 4 AA 1.5V batteries that combined output approximately
6V, but you can use any other suitable power supply.

In summary:

 +12V: The +12V terminal is where you should connect your power supply
 GND: power supply GND
 +5V: provide 5V if jumper is removed. Acts as a 5V output if jumper is in place
 Jumper: jumper in place – uses the motors power supply to power up the chip. Jumper removed: you need to provide 5V
to the +5V terminal. If you supply more than 12V, you should remove the jumper
At the bottom right you have four input pins and two enable terminals. The input pins are used to control the direction of your
DC motors, and the enable pins are used to control the speed of each motor.

 IN1: Input 1 for Motor A


 IN2: Input 2 for Motor A
 IN3: Input 1 for Motor B
 IN4: Input 2 for Motor B
 EN1: Enable pin for Motor A
 EN2: Enable pin for Motor B
There are jumper caps on the enable pins by default. You need to remove those jumper caps to control the speed of your motors.

33/38
Control DC motors with the L298N
Now that you’re familiar with the L298N Motor Driver, let’s see how to use it to control your DC motors.

Enable pins

The enable pins are like an ON and OFF switch for your motors. For example:

 If you send a HIGH signal to the enable 1 pin, motor A is ready to be controlled and at the maximum speed;
 If you send a LOW signal to the enable 1 pin, motor A turns off;
 If you send a PWM signal, you can control the speed of the motor. The motor speed is proportional to the duty cycle.
However, note that for small duty cycles, the motors might not spin, and make a continuous buzz sound.
SIGNAL ON THE ENABLE PIN MOTOR STATE

HIGH Motor enabled

LOW Motor not enabled

PWM Motor enabled: speed proportional to duty cycle

Input pins
The input pins control the direction the motors are spinning. Input 1 and input 2 control motor A, and input 3 and 4 control
motor B.

 If you apply LOW to input1 and HIGH to input 2, the motor will spin forward;

34/38
 If you apply power the other way around: HIGH to input 1 and LOW to input 2, the motor will rotate backwards. Motor B
can be controlled using the same method but applying HIGH or LOW to input 3 and input 4.

Controlling 2 DC Motors – ideal to build a robot


If you want to build a robot car using 2 DC motors, these should be rotating in specific directions to make the robot go left, right,
forward or backwards.

For example, if you want your robot to move forward, both motors should be rotating forward. To make it go backwards, both
should be rotating backwards.

To turn the robot in one direction, you need to spin the opposite motor faster. For example, to make the robot turn right, enable
the motor at the left, and disable the motor at the right. The following table shows the input pins’ state combinations for the
robot directions.

DIRECTION IN 1(D2) IN 2(D4) IN 3 (D7) IN 4(D8)

Forward 0 1 0 1

Backward 1 0 1 0

Rotate_Right 1 0 0 1

Rotate_Left 0 1 1 0

Stop 1 1 1 1

35/38
ESP32-CAM Specifications

36/38
37/38
The ESP32-CAM is based upon the ESP32-S module, so it shares the same specifications. It has the following features:

 802.11b/g/n Wi-Fi

 Bluetooth 4.2 with BLE

 UART, SPI, I2C and PWM interfaces

 Clock speed up to 160 MHz

 Computing power up to 600 DMIPS

 520 KB SRAM plus 4 MB PSRAM

 Supports WiFi Image Upload

 Multiple Sleep modes

 Firmware Over the Air (FOTA) upgrades possible

 9 GPIO ports,Built-in Flash LED

38/38

You might also like