Camera Car With Pan Tilt Control | ESP32Cam

hash include electronics
20 Mar 202211:57

Summary

TLDRThis video tutorial guides viewers on creating an upgraded surveillance camera car with pan-tilt control. It uses an ESP32 camera module to capture images and sends them to a mobile phone via Wi-Fi and WebSocket. The car is controlled through a custom mobile app, utilizing components like servo motors, a 4WD car kit, and a motor driver module.

Takeaways

  • 🚗 The project involves creating an upgraded surveillance camera car with pan-tilt control.
  • 📷 The car will use an ESP32 camera module to capture images and send them to a mobile phone via a WiFi connection.
  • 🔧 Key components needed include an ESP32 CAM module, pan-tilt servo assembly, SG90 servo motors, a 4WD car kit, L298 motor driver module, UBC or buck converter, a rechargeable battery, Arduino Uno, double-sided tape, and jumper wires.
  • 🔩 The assembly process involves fixing servos to a pan-tilt bracket, soldering wires to gear motors, and mounting motors on the car chassis.
  • 🛠️ The L298 motor driver module is connected to the ESP32 CAM module, and the servos are connected to specific I/O pins.
  • 📱 Control of the car is managed through a custom mobile app, utilizing a WebSocket for communication.
  • 🖥️ The ESP32 board needs to be installed via the Arduino Board Manager, and additional libraries such as Async TCP, Async Web Server, and ESP32 Servo must be added.
  • 🌐 The car's WiFi settings, including SSID and password, are configured in the code, and a web server is set up on port 80.
  • 🔄 The code includes functions for rotating motors, moving the car, handling root requests, and managing WebSocket events for both car control and video streaming.
  • 📸 The camera captures images and sends them to the camera WebSocket client, with the setup and send camera picture functions handling the image capture and transmission.
  • 🔌 Important considerations include setting the 'ws max queued messages' to one for smooth video streaming, ensuring proper WiFi connection, and providing a separate 5V DC supply to servos with sufficient current.

Q & A

  • What is the main project discussed in the video?

    -The main project discussed in the video is making an upgraded surveillance camera car with pan-tilt control that can be operated remotely using a mobile app.

  • What is the purpose of the pan-tilt assembly in this project?

    -The pan-tilt assembly allows the camera to rotate both horizontally and vertically, providing a 0 to 180-degree range of motion for capturing images.

  • Which module is used for capturing images in the car?

    -The ESP32 camera module is used for capturing images in the surveillance camera car.

  • How are the images captured by the ESP32 camera module sent to the mobile phone?

    -The images are sent to the mobile phone using a WebSocket through a Wi-Fi connection.

  • What components are needed to assemble the pan-tilt bracket and servos?

    -The components needed include an ESP32 CAM module, a pan-tilt servo assembly, and two SG90 servo motors.

  • What is the car kit included in the project and what does it come with?

    -The 4WD car kit included in the project comes with a car chassis, 4 TT gear motors, wheels, connectors, and screws.

  • Which motor driver module is used to control the car's motors?

    -The L298 motor driver module is used to control the car's motors.

  • What is the purpose of the UBC or buck converter in the project?

    -The UBC or buck converter is used to provide 5 volts to the servos from a 7 to 12-volt DC rechargeable battery.

  • How is the ESP32 board installed in the Arduino IDE for this project?

    -The ESP32 board is installed using the Arduino Board Manager, by adding the ESP32 board link provided in the description and then searching for and installing the ESP32 in the Board Manager.

  • What libraries need to be installed for the project to function properly?

    -The required libraries include Async TCP, Async Web Server, and the ESP32 Servo library, which can be installed via the Arduino IDE's Library Manager.

  • What is the importance of setting 'ws max queued messages' to one in the AsyncWebServer library?

    -Setting 'ws max queued messages' to one is crucial for ensuring that the video stream runs smoothly without delays.

  • How does the mobile app control the car and the camera?

    -The mobile app controls the car and the camera by sending commands to the ESP32 via WebSocket, which then processes these commands to move the car, adjust the camera, or control the servos.

  • What is the process for connecting the car to the mobile device for control?

    -To connect the car to the mobile device, one must connect to the car's Wi-Fi SSID using the provided password, then open Google Chrome on the mobile and type '192.168.4.1' to access the control app.

  • What are some troubleshooting tips provided in the video for issues with the car or app?

    -Troubleshooting tips include setting 'ws max queued messages' to one for smooth video, reconnecting Wi-Fi on the mobile if the app doesn't open, not using the IO 16 pin of ESP32 CAM as it's used internally, and ensuring a separate 5V DC supply with more than 2 ampere current for the servos.

Outlines

00:00

🚗 Building an Upgraded Surveillance Camera Car

This video tutorial guides viewers through the process of constructing an advanced surveillance camera car equipped with pan-tilt control. The car is designed to rotate the camera horizontally and vertically from 0 to 180 degrees, capturing images with an ESP32 camera module. These images are then transmitted to a mobile phone via a Wi-Fi connection using WebSocket. The car is controlled via a custom mobile app, and the video provides a step-by-step assembly guide, including the use of components such as the ESP32 CAM module, pan-tilt servo assembly, SG90 servo motors, a 4WD car kit, L298 motor driver module, UBC or buck converter, a rechargeable battery, Arduino Uno, double-sided tape, and jumper wires. The assembly involves soldering wires to gear motors, mounting motors on the car chassis, connecting motors to the motor driver module, and setting up the ESP32 camera module with the pan-tilt assembly.

05:08

💻 Programming the Surveillance Camera Car

The second part of the video focuses on the software aspect of the project, detailing the necessary steps to program the surveillance camera car. Viewers are instructed to install the ESP32 board using the Arduino Board Manager, and to add the ESP32 board link provided in the video description. Libraries such as Async TCP and Async Web Server are required, which can be added through the Arduino IDE's library manager. Importantly, the video emphasizes the need to adjust the 'ws_max_queued_messages' parameter in the 'async/websocket.h' file to ensure smooth video streaming. The ESP32 Servo library is also installed for servo control. The code includes setting up the pan and tilt servo pins, defining motor control pins, and configuring Wi-Fi credentials. The video demonstrates how to create a web server, handle WebSocket events for car control, and manage the camera's image stream. The mobile app is accessed by connecting to the car's Wi-Fi and navigating to the car's IP address in a browser, allowing users to control the car and view the camera feed.

10:14

🔍 Final Tips and Troubleshooting

In the final segment, the video provides crucial tips and troubleshooting advice for the surveillance camera car project. Key points include setting the 'ws_max_queued_messages' to one for optimal video performance and ensuring the video displays correctly on the mobile app. If the video does not appear, reconnecting the Wi-Fi on the mobile device is suggested. The video also warns against connecting the IO 16 pin of the ESP32 CAM, as it is used internally by the PSRAM. If there are issues with code uploading, reconnecting the USB cable to the laptop or ensuring a stable power supply to the servos with more than 2 amperes current is recommended. The video concludes with a reminder to like, share, comment, and subscribe for more content.

Mindmap

Keywords

💡Surveillance Camera

A surveillance camera is a security device used to monitor a location and record activities. In the context of the video, it is integrated into a car to create a mobile surveillance system. The script mentions an 'upgraded surveillance camera car,' highlighting the camera's role in capturing images for monitoring purposes.

💡Pan-Tilt Control

Pan-tilt control refers to the ability to rotate a camera or other device horizontally (pan) and vertically (tilt) to cover a wide range of angles. The script describes using a 'pan-tilt assembly' to achieve this, allowing the surveillance camera to be directed to different areas without moving the car itself.

💡ESP32 Camera Module

The ESP32 Camera Module is a device that combines the capabilities of the ESP32 microcontroller with a camera, enabling image capture and processing. The script specifies that images will be 'captured using ESP32 camera module,' which is central to the video's project of creating a surveillance camera car.

💡Websocket

A Websocket is a communication protocol that provides full-duplex communication channels over a single TCP connection. In the video's context, it is used to 'send these images to our mobile phone,' allowing real-time image transmission from the car to a mobile device.

💡Mobile App

A mobile app is a software application designed to run on mobile devices. The script mentions controlling the car 'using our own mobile app,' which implies a custom application developed for the purpose of operating the surveillance camera car remotely.

💡SG90 Servo Motors

SG90 Servo Motors are small actuators that can rotate to specific angles when a signal is received, often used in robotics for precise movement control. The script lists 'SG90 servo motors' as components needed for the pan-tilt mechanism of the surveillance camera.

💡4WD Car Kit

A 4WD (four-wheel drive) car kit typically includes the components necessary to assemble a car model with four-wheel drive capabilities. The script refers to assembling a car using a '4WD car kit,' which forms the base for the surveillance camera car project.

💡L298 Motor Driver Module

The L298 is a dual full-bridge driver module that can be used to drive inductive loads such as relays, solenoids, DC and stepping motors. In the script, it is mentioned to 'attach L298 and motor driver module on car chases,' which is essential for controlling the car's motors.

💡UBC or Buck Converter

A UBC (Universal Battery Charger) or Buck Converter is an electronic device that converts voltage from a higher level to a lower level. The script mentions using a 'UBC or Buck converter to provide 5 volts to servos,' which is necessary for powering the servo motors.

💡Arduino Uno

Arduino Uno is a microcontroller board based on the ATmega328P. It is widely used for building and prototyping electronics projects. The script indicates using an 'Arduino Uno for uploading code,' which is a common practice for programming microcontrollers in DIY projects.

💡Async Web Server Library

The Async Web Server Library is a collection of functions and classes that enable the creation of web servers capable of handling asynchronous requests. The script instructs to 'install the async tcp and async web server library,' which is crucial for the implementation of the Websocket communication in the surveillance camera car.

Highlights

Introduction to creating an upgraded surveillance camera car with pan-tilt control.

The car can rotate the camera 0 to 180 degrees horizontally and vertically.

Use of ESP32 camera module for capturing images.

Images are sent to a mobile phone using WebSocket through Wi-Fi.

Control of the car is managed through a custom mobile app.

List of components required for the project, including ESP32 CAM module and servo motors.

Assembly of the pan-tilt bracket and fixing of servos.

Soldering wires to gear motors and mounting them on the car chassis.

Connecting the L298 motor driver module to the ESP32 CAM.

Fixing the ESP32 camera module on the bracket.

Mounting the pan-tilt assembly on the car chassis.

Connecting the UBC to the battery supply for servos.

Steps to install the ESP32 board using Arduino Board Manager.

Installation of necessary libraries for the project.

Adjusting the 'ws max queued messages' parameter for smooth video streaming.

Inclusion of ESP32 servo library for controlling servo motors.

Code setup for pan and tilt servo pins, motor control, and Wi-Fi connection.

Creation of a web server and WebSocket for camera and servo input control.

Development of an HTML page for the car control app.

WebSocket event callback functions for receiving commands from the mobile.

Setup of the camera and Wi-Fi server within the code.

Instructions for uploading the code using Arduino Uno.

Connecting the battery to the car and opening the mobile app for control.

Important points and troubleshooting tips for the project.

Conclusion and call to action for likes, shares, comments, and subscriptions.

Transcripts

play00:00

[Music]

play00:14

hey guys welcome back to hash include

play00:16

electronics with another video and in

play00:18

this video we are going to make upgraded

play00:20

surveillance camera car with pan tilt

play00:22

control using this pan tilt assembly we

play00:24

can rotate the camera horizontally and

play00:26

vertically from 0 to 180 degrees we will

play00:28

capture images using esp32 camera module

play00:31

and send these images to our mobile

play00:33

phone using websocket through wifi

play00:35

connection we will control car using our

play00:37

own mobile app so let's get started and

play00:39

make this car if you haven't subscribed

play00:41

please hit subscribe button below and

play00:42

press bell icon to get latest updates

play00:44

[Music]

play00:49

we will need following components

play00:51

esp32 cam module

play00:54

pan tilt servo assembly

play01:07

sg90 servo motors

play01:11

we will need two motors

play01:12

[Music]

play01:14

4wd car kit

play01:25

this car kit comes with car chases

play01:30

4 tt gear motors

play01:32

wheels

play01:34

connectors and screws

play01:36

we will also need l298 moto driver

play01:38

module ubc or buck converter to provide

play01:41

5 volt to servos 7 to 12 volt dc

play01:43

rechargeable battery in our case lipo 2s

play01:45

battery arduino uno for uploading code

play01:49

double sided tape and few jumper wires

play01:52

let's first assemble the pan tilt

play01:54

bracket and fix servos please check my

play01:56

video on pan tilt control for detailed

play01:58

assembly

play02:04

[Music]

play02:13

[Music]

play02:28

let's assemble the car now first let's

play02:30

solder wires to gear motors

play02:35

mount all four motors on car chases

play02:37

using connectors and screws

play02:39

[Music]

play02:48

[Music]

play02:50

now attach both the cartridges plate

play02:52

using screws and make sure that it is

play02:54

tightened properly so that we don't have

play02:55

any loose part

play02:59

[Music]

play03:05

[Music]

play03:10

join red to red and black to black wires

play03:12

of dc motors on each side

play03:14

attach l298 and motor driver module on

play03:16

car chases now

play03:19

now let's make a connection as per

play03:21

circuit diagram

play03:22

connect right side motors to out 1 and

play03:24

out 2 pins of l2 98 motor driver module

play03:29

now connect left side motors to out 3

play03:31

and out 4 pins of motor driver module

play03:36

now connect l298 and motor driver module

play03:38

to esp32 campaigns as per table

play03:43

connect both enable a and enable b pins

play03:45

to io02 pins of esp32 cam

play03:55

we will take plus 5 volt and ground from

play03:57

l298 and motor driver module and provide

play03:59

to esp32 cam module

play04:03

fix esp32 camera module on bracket now

play04:07

[Music]

play04:10

mount pan tilt assembly on car chases

play04:12

now

play04:20

connect pan servo and tilt solver to i o

play04:22

14 and i o 15 respectively

play04:27

connect ubc to battery supply and

play04:29

provide plus 5 volt and ground to servos

play04:32

[Music]

play04:47

attach dc battery power connectors to

play04:48

motor diver module to plus 12 volt pin

play04:51

and ground pin

play04:55

attach wheels to car now

play04:59

[Music]

play05:07

[Music]

play05:13

let's take a quick look at the code

play05:15

first we need to install esp32 board

play05:17

using arduino board manager i have

play05:19

provided the esp32 board link in the

play05:21

description below go to file then go to

play05:24

preferences and add the esp32 board link

play05:26

then go to tools and then board manager

play05:29

and search for esp32 and install it

play05:32

after that we need to install the async

play05:34

tcp and async web server library

play05:36

download these libraries from the links

play05:38

provided in the description below

play05:42

once downloaded go to sketch include

play05:44

library and then click on add zip file

play05:47

select the downloaded zip library file

play05:49

and click add similarly add async web

play05:52

server library as well

play05:56

now we need to set one parameter which

play05:57

is very important step so that video

play05:59

runs smoothly go inside your sketch

play06:01

folder then libraries folder search for

play06:04

esp async web server folder and then go

play06:07

inside src folder open async websocket.h

play06:10

file and change ws max queued messages

play06:12

to one for our esp32 board and save it

play06:16

now we need to install esp32 servo

play06:18

library as well for controlling servo

play06:20

motors go to tools and then manage

play06:22

library search for esp32 servo and

play06:25

install it

play06:29

now we need to include the esp

play06:31

underscore camera async tcp library and

play06:33

async web server library also we need to

play06:35

include esp32 server library as well

play06:38

after that define pan and tilt servo

play06:40

pins as io 14 and io 15. we have created

play06:43

objects for pan and tilt servos we no

play06:45

longer need to create any dummy servos

play06:48

because of timer issues i have figured

play06:50

that issue and sorted out by changing

play06:51

timer used by camera settings we have

play06:53

assigned the right and left motor pins

play06:55

we will use single io2 pin for enable

play06:58

and enable b pins of motor driver module

play07:00

then we have defined light pin as io4 we

play07:03

have defined some constant for car

play07:05

movements we have set pwm frequency

play07:07

resolution and channels for speed and

play07:09

light we have defined some settings

play07:11

related to camera we need to set the

play07:13

ssid and password for our esp32 wi-fi we

play07:16

have created web server at port number

play07:18

80. we will be using websocket for

play07:20

camera and servo input control then we

play07:23

have created html page for our car

play07:25

control app and stored it in html

play07:27

homepage variable this is the main page

play07:29

which will be displayed on mobile it has

play07:31

image section to display the video and

play07:33

also has all buttons to control the car

play07:35

when any control button is pressed on

play07:37

mobile it will send particular number to

play07:39

esp32 using websocket we have created

play07:42

websocket to display the image sent from

play07:44

the car we have created rotate motor

play07:46

function which takes motor number and

play07:48

direction as arguments it will rotate

play07:50

motor in forward or backward direction

play07:52

then we have move car function which

play07:54

will take command like up down left

play07:56

right stop and move the car accordingly

play07:58

we have handle root function which will

play08:00

send the html page when we type app

play08:02

address on mobile browser we have oncar

play08:04

input websocket even callback function

play08:06

which will be called when esp32 receives

play08:09

any command from mobile if received

play08:11

control is move car then we will call

play08:12

mookar function if received control is

play08:15

speed then we will set the car speed if

play08:17

received control is light then we will

play08:19

set the flash if received control is

play08:21

spanned or tilt then we will move the

play08:23

servos accordingly we have on camera

play08:25

websocket even callback function which

play08:27

will be called when we get request for

play08:29

video stream once connected we will set

play08:31

the client id we have created setup

play08:33

camera function to emit the camera then

play08:35

we have created send camera picture

play08:37

function which will capture the image

play08:39

and send it to camera websocket client

play08:41

we have created setup pin mode function

play08:42

to setup the servos it will attach servo

play08:44

pins to servo objects it will also set

play08:47

the motor pins as output inside setup

play08:49

function we will call setup pinmode

play08:50

function then begin wifi using soft ap

play08:53

mode setup callback function on root and

play08:56

on not phone then attach the websocket

play08:58

handler to web server now begin the

play08:59

wi-fi server also set up the camera

play09:02

inside loop function we just need to

play09:03

call cleanup cloud function to clean up

play09:05

old client connections we will also

play09:07

capture and send the camera images i

play09:09

have provided the link to the code in

play09:11

the description below you can upload it

play09:12

directly in our case we will use arduino

play09:15

uno for uploading the code check my

play09:16

previous video on esp32 cam car for

play09:19

detailed explanation on how to upload

play09:21

code using arduino uno connect battery

play09:23

to car now

play09:27

let's open mobile app now go to wi-fi

play09:29

settings and connect to my wi-fi car

play09:31

ssid using password as one two three

play09:33

four five six seven

play09:35

open google chrome browser on mobile and

play09:37

type

play09:39

192.168.4.1 it will open our camera car

play09:42

control app sometimes we might have to

play09:44

reconnect the wi-fi if app does not open

play09:46

that's it let's see how it works

play09:52

[Applause]

play09:56

[Music]

play10:14

[Music]

play10:22

[Music]

play10:39

[Music]

play11:16

we need to remember some important

play11:18

points we need to set ws max skewed

play11:20

messages to one otherwise the video will

play11:22

be very slow if video is not displayed

play11:25

on the app then reconnect the wi-fi on

play11:26

mobile do not connect io 16 pin of esp32

play11:29

cam it is used internally by ps ram if

play11:32

uploading of port fails then try after

play11:34

reconnecting usb cable to laptop make

play11:36

sure to provide separate 5v dc supply to

play11:39

servos the power supply should have more

play11:41

than 2 ampere current hope you guys

play11:42

enjoyed the video and thanks for

play11:44

watching stay safe and please like share

play11:46

comment and don't forget to subscribe to

play11:48

my channel

play11:49

[Music]

play11:56

you

Rate This

5.0 / 5 (0 votes)

相关标签
DIY ElectronicsSurveillance CameraPan-Tilt ControlESP32 ModuleMobile AppCar AssemblyServo MotorsWiFi ConnectionLive StreamingArduino CodingTech Tutorial
您是否需要英文摘要?