Components Required

Image Component Quantity Available in Kit
evive 1
USB A-B Cable 1
Metal Servo Motor and Accessories 1
XY-axis Joystick Module 1
12C 2A DC Adapter 1
Male to Female Jumper Cable 20cm 5

Introduction

In this tutorial we will control the position of a RC (hobby) servo motor with a Joystick.

A servo motor is a rotary actuator that allows for precise control of angular position.  It consists of a suitable motor coupled to a sensor for position feedback.

Metal Servo motor

Control using evive and Arduino IDE

evive has two dedicated servo motor outputs pins.

Signal pin of servo 1 is connected to digital pin 44 and servo 2 is connected to digital pin 45.

evive servo output channel

Circuit Diagram

In the following example, I will be showing you how to control servo through channel 1. Given below is the circuit diagram:

evive Servo Joystick

A Servo pin has three wires (Order to be connected in evive, left to right)

  • Brown wire: GND
  • Red wire: VCC
  • Orange wire: Signal
Caution: Power evive using a 12V 2A power adapter for smooth functioning of servo motor. The VVR (Variable voltage) should be close to 6V.

A Joystick have 5 pins:

  • Ground
  • 5V
  • VRx: X position connects to Analog pin 0
  • VRy: Y position
  • SW: Z press

How Joystick works?

Joystick has 2 potentiometers and a switch.
A potentiometer has a wiper sliding on a resistive strip. If the wiper is close to GND, it outputs 0V, and if it is close to VCC or 5V, it outputs 5V.
In Arduino IDE,  if the wiper is close to GND you get 0 value and if it close to VCC, you get 1023. Hence you get approx. 512 when joystick is at default position.

Code

Control using Arduino Uno

Arduino uno has 6 PWM pins: 3, 5, 6, 9, 10, and 11 which provide 8-bit PWM output with the analogWrite() function.

We will controlling servo using Pin 3.

Circuit Diagram

Caution: Power servos using a 6V 2A power adapter for smooth functioning of servo motor.

Code