How to Use Arduinonuno to Control the Cloud Desktop Camera Bracket with Dual Servo Sg90 Motor

Lever module

The joystick is one of the simplest ways to control the servo motor. Although some tutorials require motors or other extras, this tutorial requires only basic peripherals. Joystick, also known as "thumb joystick", is a cool control interface of the project, especially for robotics. X-axis and y-axis are two 10K potentiometers, which can control 2D motion by generating analog signals. There is also a button that can be used to control other commands or actions.

HC-SR04

In this tutorial, I will take hc-sr04 ultrasonic sensor as an example to set up a servo controlled PTZ. However, remember that the bracket can be used for sensors, cameras, etc!

Let's start

Collection hardware

Arduino UNO

2 servo motor sg90

Lever module

Double servo support

Some jumpers

HC-SR04

Arduino UNO

Lever module

servo motor

Bread board

PTZ Support Kit

First assemble the double servo support. I'm using sparkfun's pan / tilt Stand Kit.

Connecting hardware

Let's start with 2 servers. I'm using a bread board to simplify the connection.

Connection of servo motor and Arduino UNO.

Up / down servo Arduino right / left servo Arduino

Red cable 5V red cable 5V

Black cable GND black cable GND

Yellow or white cable P WM (4) yellow or white cable PWM (10)

Complete the connection according to the connection diagram above and below.

Connection of joystick module and Arduino UNO.

Lever Arduino

5V5V

GNDGND

U / Du / D analog 4

L / RL / R simulation 3

The final wiring is as follows:

Final project schematic.

After everything is connected, it will be as follows!

source code

Copy and paste the following code into the Arduino software. Be sure to test (compile) the code before uploading it to the Arduino board.

When you upload code to Arduino, the server should not move until you use the joystick.

#include

const int servo1 = 11; // first servo

const int servo2 = 10; // second servo

const int joyH = 3; // L/R Parallax Thumbstick

const int joyV = 4; // U/D Parallax Thumbstick

int servoVal; // variable to read the value from the analog pin

Servo myservo1; // create servo object to control a servo

Servo myservo2; // create servo object to control a servo

// Servo

myservo1.attachservo1; // attaches the servo

myservo2.attachservo2; // attaches the servo

// Inizialize Serial

// Display Joystick values using the serial monitor

// Read the horizontal joystick value value between 0 and 1023

servoVal = mapservoVal 0 1023 0 180; // scale it to use it with the servo result between 0 and 180

myservo2.writeservoVal; // sets the servo position according to the scaled value

// Read the horizontal joystick value value between 0 and 1023

servoVal = mapservoVal 0 1023 70 180; // scale it to use it with the servo result between 70 and 180

myservo1.writeservoVal; // sets the servo position according to the scaled value

delay15; // waits for the servo to get there

/**

* Display joystick values

*/

How to Use Arduinonuno to Control the Cloud Desktop Camera Bracket with Dual Servo Sg90 Motor 1

hot searches
Original Laptop Keyboard Replacement For Toshiba Satellite T210 Notebook Keyboards With Frame Silver Laptop Keyboard Replacement For HP Elitebook folio 9470M Notebook Keyboards 48W 12V 4A DC 5.5*2.5mm AC Power Adapter Suitable for Notebook Adapter Plug-in Power Adapter LED Monitor etc Universal 90W 20V 4.5A DC USB AC Adapter Laptop Power Adapter For Lenovo Edge E440 E431 T440 E470 T560 E560 E450 Z410 Notebook Charger Original Laptop Keyboard For Lenovo Thinkpad SL400 Notebook Keyboard With Pointer Laptop Backlight Keyboard Replacement For HP Zbook 15 G1 Notebook Keyboards New Lenovo ThinkPad T460 Original Notebook English Keyboard NEW US Laptop Replacement Keyboard For HP Compaq CQ320 Notebook Keyboards Black Hot Sale Laptop Keyboard For Lenovo Ideapad Z360 Notebook Keyboard With Frame Grey Original Laptop Keyboard Replacement For HP Pavilion DM1-3000 Notebook Keyboards Black
hot articles
Laptop Battery External Charger Connector Cable - How to Use the Best One for Your Needs
53
How You Can Make Money on Laptop Screen Protective Film Products
52
What Are the Advantages and Disadvantages of Replacement Laptop Keyboard Keys?
52
Why to Choose a Custom Laptop Keyboard for Your Home
51
A Complete Guide to the Different Kinds of Dell Inspiron Keyboard Key
51
5 Top Tips When It Comes to Laptop Screen Supplier
50
Why to Choose a Lenovo Laptop Keyboard for Your Home
50
What Is the RF Connector_ RF Connector Classification and Specification Introduction
50
What Are the Best Dell Laptop Keyboard for 2021?
50
Sony Laptop Keyboard Price: the Best New Sony Laptop Keyboard Price in the Market
50
motor related articles
How to Choose a Led Display Screen for Your Premies to Attract Customer
How Do I Control My Laptop Computer Display Screen?
How to Realize the Intelligent Configuration Design of LED Display Screen in Installation and Debugg
With the Rapid Development of LED, the Supporting Equipment of LED Display Screen Needs to Be Upgrad
What Kind of LED Display Screen Is More Suitable for Party and Government Organs
you might like
Category Film Adapter
Laptop Adapter China 19V 6.3A 120W Motor Crowberry Laptop Replacement Parts Brand
Contact US

    Bao’an District  Shenzhen City, China

     +86 189 3806 5764

NEWSLETTER SUBSCRIBE
no data
Copyright © 2021 CrowBerry

   

chat online
NEED HELP? WE'RE HERE!