Engineers Garage

  • Electronic Projects & Tutorials
    • Electronic Projects
      • Arduino Projects
      • AVR
      • Raspberry pi
      • ESP8266
      • BeagleBone
      • 8051 Microcontroller
      • ARM
      • PIC Microcontroller
      • STM32
    • Tutorials
      • Audio Electronics
      • Battery Management
      • Brainwave
      • Electric Vehicles
      • EMI/EMC/RFI
      • Hardware Filters
      • IoT tutorials
      • Power Tutorials
      • Python
      • Sensors
      • USB
      • VHDL
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Product News
    • Business News
    • Company/Start-up News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • DigiKey Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Learn
    • eBooks/Tech Tips
    • Design Guides
    • Learning Center
    • Tech Toolboxes
    • Webinars & Digital Events
  • Resources
    • Digital Issues
    • EE Training Days
    • LEAP Awards
    • Podcasts
    • Webinars / Digital Events
    • White Papers
    • Engineering Diversity & Inclusion
    • DesignFast
  • Guest Post Guidelines
  • Advertise
  • Subscribe

How to use a wireless joystick to remotely control two servo motors

By Ashutosh Bhatt July 9, 2024

A dc servo motor provides precise motion control, enabling accurate positioning and speed regulation in various applications. It consists of a rotary or linear actuator, which allows for such precise control of angular or linear position, velocity, and acceleration. It’s used in several sectors, including:

  • Robotics
  • Industrial automation
  • Angular load positioning
  • Avionics
  • Automobiles

A few examples include:

  • Robotic arms: most are pick-and-place robots composed of a minimum of two to six (or more) servo motors.
  • Airplane and ship: servo motors are used in accurate angular positioning of rudder, elevator, aileron, and flaps in airplanes. They’re also used in rudder positioning in ships. 
  • Automobiles: servo motors are used in electronic power steering and cruise control systems of automobiles

One way to control servo-motor angle is by using a joystick, whereby the movement of a joystick (left-right-up-down) varies the angle of the servo motor. Typically, a single joystick movement controls the angles of multiple servo motors, which are attached to a rudder, elevator, aileron, etc., depending on the application.

In this project, we’ll program a wireless joystick to control two servo motors. The joystick will control a range of more than 1 km so that it can be used remotely.

The project consists of a joystick-based RF remote control built using a small, 8-pin microcontroller (ATtiny85) and a long-range RF trans-receiver module (HC12). The receiver side is built using Arduino NANO as the servo motor controller and the HC12 RF trans-receiver module.

System block-diagram

Figure 1. A system block diagram of joystick-controlled servo motors using ATtiny85, Arduino NANO and the HC12 sensor.

The system consists of two main parts:

  1. Transmitter –  a long-range RF remote control with a joystick
  2.
Receiver –  a servo controller that controls the angles of two servo motors

Here’s a breakdown of the components:

  • Transmitter: built using a joystick, the ATtiny85 microcontroller, the HC12 RF trans-receiver module, and a 6-V battery.
  • Joystick: a two-axis resistive joystick that generates two analog outputs of 0 – 5 V (Vx and Vy) for its movement on the ‘X’ and ‘Y’ axes. These two outputs are given as input to ATtiny85.
  • ATtiny85: a transmitter MCU. It receives analog inputs from the joystick, reading its ‘X’ and ‘Y’ directions and sending code based on these movements to the HC12 module.
  • HC12: a 434 MHz RF serial trans-receiver module that receives specific code from the ATtiny85 serially and then transmits it.
  • Battery: a Li-ion 6 V that’s used to provide power to all of the blocks.
  • Receiver: built using Arduino NANO board, two dc servo motors, and the HC12 RF trans-receiver module.
  • HC12: receives code transmitted by the HC12 module and sends it to Arduino NANO ATMega328 serially.
  • Arduino NANO board: receives code serially from the HC12 and controls the angle of two servo motors as per the code. It generates two PWM signals to control the servo motor angle, rotating it clockwise and anti-clockwise.

Transmitter circuit diagram

Figure 2. A circuit diagram of the transmitter and ATtiny85 connected to the joystick and the HC12 module — all powered by a 6-V battery.

This transmitter circuit uses only five components: a joystick, ATtiny85, the HC12, an LED, and a battery.

The two-axis joystick has four connections: (1) Vcc, (2) Gnd, (3) Vx, (4) Vy.

  • The Vcc and Gnd pins are connected with the battery’s +Ve and -Ve terminals for biasing.
  • The Vx and Vy pins are connected to ATtiny85’s pins 2 and 3, the chip’s analog inputs.

The HC12 module has four connections: (1) Vcc, (2) Gnd, (3) Tx, (4) Rx.

  • The Vcc and Gnd pins are connected with the battery’s +Ve and -Ve terminals for biasing
  • The Tx and Rx pins are connected to ATtiny85’s digital I/O pins D1 (pin 6) and D2 (pin 7), which will work as the chip’s serial Rx and Tx pins.

The LED connects with ATtiny85’s digital I/O pin 5.

Receiver circuit diagram

Figure 3. The circuit diagram of the receiver, with Arduino NANO connected to two servo motors and the HC12 module.

The receiver circuit uses two components — Arduino NANO and the HC12 module — along with two servo motors.

The HC12 module has four connections: (1) Vcc, (2) Gnd, (3) Tx, (4) Rx.

  • The Vcc and Gnd pins are connected with the motor driver’s 5-V output and Gnd pins.
  • The Tx and Rx pins are connected to Arduino’s digital I/O pins D2 and D3, which will work as serial Rx and Tx.

Both servo motors have three connections: (1) Vcc, (2) Gnd, (3) Signal.

  • The Vcc pin is connected to Arduino’s 5-V output, and the Gnd pin is connected to the circuit ground.
  • The signal input of servo motor 1 is the PWM output of Arduino’s D11.
  • The signal input of servo motor 2 is the PWM output of Arduino’s D10.

How it works

Understanding the transmitter

The joystick
The joystick is a two-axis joystick, which means it has two potentiometers inside. Both potentiometers are connected to 5 V and the ground. As the joystick is moved from left to right, one potentiometer’s resistance varies, generating a variable output of 0 – 5V as Vx.

Similarly, as the joystick is moved up and down, the other potentiometer’s resistance varies, generating a variable output of 0 – 5V as Vy.

These Vx and Vy outputs are given as analog input to the ATtiny85 microcontroller.

The ATtiny85 microcontroller
ATtiny85 receives two analog inputs, Vx and Vy, from the joystick and converts them into an equivalent digital value using its built-in 10-bit ADC.

The analog voltage of 0 – 5V is converted into a digital value between 0 – 1023. The Vx analog voltage of 0-5 V is converted into the digital value ‘X,’ as 0 – 1023. The Vy analog voltage of 0-5 V is converted into the digital value ‘Y,’ as 0 – 1023.

If this digital value is above or below a certain threshold value, then ATtiny85 will send a specific code (a command) to the HC12 to be transmitted.

Refer to the below table for the codes.

This code is given serially to the HC12 module.

The HC12 module
The HC12 module receives the command serially from ATtiny85 and transmits it using a 434 MHz carrier.

The LED
The LED blinks each time ATtiny85 transmits code using the HC12.

Understanding the receiver

The HC12 module
The HC12 module receives the transmitted code and gives it serially to Arduino.

Arduino
Arduino receives code from the HC12 module and controls the angles of the two servo motors, per the following table.

Arduino generates two PWM signals to control the angles of both servo motors.

  • When it receives the code ‘U,’ it increases the pulse width of pin D11, which increases the angle of servo motor 1.
  • When it receives the code ‘D,’ it decreases the pulse width of pin D11, reducing the angle of servo motor 1.
  • When it receives the code ‘R,’ it increases the pulse width on pin D10, which increases the angle of servo motor 2.
  • When it receives the code ‘L,’ it decreases the pulse width on pin D10, reducing the angle of servo motor 2.

Software program

For the transmitter, the ATtiny85 program is prepared and compiled using Arduino IDE’s software. The program is written in Arduino C/C++ language. It reads the two analog inputs using Arduino’s analogRead() function from ATtiny85’s analog input pins A1 and A2. It communicates with the HC12 module serially using Arduino’s SoftwareSerial.h library through the digital I/O pins D1 and D2. 

For the receiver, the Arduino program uses two libraries: SoftwareSerial.h and Servo.h.

The SoftwareSerial.h library communicates serially with the HC12 module through the digital pins D2 and D3. The Servo.h library controls the servo motor angle.

Servo.h is a built-in library for controlling the servo motor’s operation.

Here are the programs…

The transmitter program

The receiver program

Video

You may also like:


  • How to design pick-and-place robot using Arduino

  • How to select brushless dc motors for robotic vehicles

  • Arduino compatible coding 02: Getting started with Arduino

  • What are different types of industrial robots?

  • How to select an electronic speed controller for your drone

  • What are the components of robotic arms and industrial robots?

  • Designing a servo motor angle controller using IC NE555

  • Dc motor speed and direction control with stm32f103 microcontroller and…

Filed Under: Electronic Projects, Video
Tagged With: Arduino, arduinonano, ATtiny85, dcservomotor, electronicproject, HC12sensor, joystck, sensor, servomotor
 

Next Article

← Previous Article
Next Article →

Questions related to this article?
👉Ask and discuss on Electro-Tech-Online.com and EDAboard.com forums.



Tell Us What You Think!! Cancel reply

You must be logged in to post a comment.

EE TECH TOOLBOX

“ee
Tech Toolbox: Internet of Things
Explore practical strategies for minimizing attack surfaces, managing memory efficiently, and securing firmware. Download now to ensure your IoT implementations remain secure, efficient, and future-ready.

EE Learning Center

EE Learning Center
“engineers
EXPAND YOUR KNOWLEDGE AND STAY CONNECTED
Get the latest info on technologies, tools and strategies for EE professionals.

HAVE A QUESTION?

Have a technical question about an article or other engineering questions? Check out our engineering forums EDABoard.com and Electro-Tech-Online.com where you can get those questions asked and answered by your peers!


RSS EDABOARD.com Discussions

  • High Side current sensing
  • The comparison of different Tcl script checkers
  • Voltage mode pushpull is a nonsense SMPS?
  • Reducing "shoot-through" in offline Full Bridge SMPS?
  • How to simulate power electronics converter in PSpice?

RSS Electro-Tech-Online.com Discussions

  • Back to the old BASIC days
  • Parts required for a personal project
  • PIC KIT 3 not able to program dsPIC
  • Failure of polypropylene motor-run capacitors
  • Siemens large industrial PLC parts

Featured – RPi Python Programming (27 Part)

  • RPi Python Programming 21: The SIM900A AT commands
  • RPi Python Programming 22: Calls & SMS using a SIM900A GSM-GPRS modem
  • RPi Python Programming 23: Interfacing a NEO-6MV2 GPS module with Raspberry Pi
  • RPi Python Programming 24: I2C explained
  • RPi Python Programming 25 – Synchronous serial communication in Raspberry Pi using I2C protocol
  • RPi Python Programming 26 – Interfacing ADXL345 accelerometer sensor with Raspberry Pi

Recent Articles

  • What is AWS IoT Core and when should you use it?
  • AC-DC power supply extends voltage range to 800 V DC
  • Infineon’s inductive sensor integrates coil system driver, signal conditioning circuits and DSP
  • Arm Cortex-M23 MCU delivers 87.5 µA/MHz active mode
  • STMicroelectronics releases automotive amplifiers with in-play open-load detection

EE ENGINEERING TRAINING DAYS

engineering

Submit a Guest Post

submit a guest post
Engineers Garage
  • Analog IC TIps
  • Connector Tips
  • Battery Power Tips
  • DesignFast
  • EDABoard Forums
  • EE World Online
  • Electro-Tech-Online Forums
  • EV Engineering
  • Microcontroller Tips
  • Power Electronic Tips
  • Sensor Tips
  • Test and Measurement Tips
  • 5G Technology World
  • Subscribe to our newsletter
  • About Us
  • Contact Us
  • Advertise

Copyright © 2025 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy

Search Engineers Garage

  • Electronic Projects & Tutorials
    • Electronic Projects
      • Arduino Projects
      • AVR
      • Raspberry pi
      • ESP8266
      • BeagleBone
      • 8051 Microcontroller
      • ARM
      • PIC Microcontroller
      • STM32
    • Tutorials
      • Audio Electronics
      • Battery Management
      • Brainwave
      • Electric Vehicles
      • EMI/EMC/RFI
      • Hardware Filters
      • IoT tutorials
      • Power Tutorials
      • Python
      • Sensors
      • USB
      • VHDL
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Product News
    • Business News
    • Company/Start-up News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • DigiKey Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Learn
    • eBooks/Tech Tips
    • Design Guides
    • Learning Center
    • Tech Toolboxes
    • Webinars & Digital Events
  • Resources
    • Digital Issues
    • EE Training Days
    • LEAP Awards
    • Podcasts
    • Webinars / Digital Events
    • White Papers
    • Engineering Diversity & Inclusion
    • DesignFast
  • Guest Post Guidelines
  • Advertise
  • Subscribe