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
Laptop Adapter Charger 65W Adapter 19.5V 3.34A AC DC Power Adapter 7.4*5.0mm for Dell Notebook NEW US Laptop Keyboard Replacement For Acer Aspire E5-473 Notebook Keyboards Black Original Laptop Backlight Keyboard For Dell Inspiron 7590 Notebook Keyboards Rplacement Silver Laptop Backlight Keyboard For Lenovo Thinkpad E580 Notebook Keyboard With Pointer Laptop Keyboard Replacement For MSI CR420 Notebook Keyboards Laptop Keyboard Replacement For Sony Vaio VPC-EA Notebook Keyboards 19V 4.74A 90W Laptop Power Adapter for HP Notebook Charger AC DC 5.5*2.5mm Adapter Original US Laptop Keyboard Rplacement For Dell Vostro V3700 Notebook Keyboards Black Laptop Backlight Keyboard Replacement For MSI GS65 Notebook Keyboards 19V 2.1A 40W Laptop Power Adapter for Asus Notebook Charger AC DC 2.5*0.7mm Adapter
hot articles
Best 5 Tips to Choose a Best Buy Laptop Battery Replacement
50
Advantages of Selecting Lenovo Thinkpad Ac Adapter
50
How You Can Make Money on Laptop Screen Protective Film Products
50
What Is the RF Connector_ RF Connector Classification and Specification Introduction
50
Why to Choose a Lenovo Laptop Keyboard for Your Home
49
The Evolution of the Laptop Replacement Parts in China
49
Sony Laptop Keyboard Price: the Best New Sony Laptop Keyboard Price in the Market
49
A Quick Brief Guide to Buy the Best Thinkpad Laptop Adapter
49
The New Trend in Laptop Keyboard Replacement
49
How to Choose a Home Central Air Conditioner Is Very Important to Master This Little Trick
49
motor related articles
How to Buy Cheap and Stylish Dell Laptop Keyboard Price
How Does a Acer Laptop Keyboard Replacement Price Work?
How to Select and Toshiba Laptop Keyboard Price Tops Together
How to Choose Professional Samsung Laptop Keyboard Price?
How to Use Fujitsu Keyboard Laptop for Your New Home?
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!