Wireless Control of Servo Motor

0
2203
Comment errors or corrections found for this circuit, and get the chance to win big! You can find our comments section at the end of this page.

I made my first robot when I was in college and always thought to make totally wireless. So the same I thought about making doors lock operated wirelessly and my shelf lock and a lot of other stuff. Many new electronics engineers this way, either they never get time or they think it’s a lot to learn and create to do something like that.

In this article I‘ll focus on how we can actually do this by controlling a servo motor with RF communication. Today we will command and operate a servo motor with RF data link.
So for starters we’ll see basic block diagram of how the system flow will be work:

Figure 1: System Block diagram

As per figure 1 the logical block of unit has 3 major sections
1. Power : includes power source and regulator
2. Signal processing : includes RF radio , and controller to process received data
3. Drive : includes controller to create drive signal and amplify it to desired power

We will be using SmartRF from Knewron Technologies that is an nrf24l01 based device. SmartRF has an 8 bit atmega324 and a RF radio, so our RF receiver and controller is physically same module, but I kept them separate in block diagram for logical understanding.

Figure 2: SmartRF module

Servo Operation

Just for a quick brief let’s revise a methodology to drive a servo motor. Out of 3 lines of a servo, two are Power and Ground and third is control line or signal pulse or PWM input, whatever it is called in different parts of engineering world. Most common is a signal line. So we will use this convention for rest of the article. Generally the servos follow same colour convention to maintain standardization.
• RED: Supply Positive
• Black/Brown: Supply Ground
• Orange/White : Signal

Figure 3: Servo Motor

The signal line needs to be fed with pulse of a certain width at a particular duration to keep the servo at a steady position. The width is called as pulse width and duration is related in terms of pulse frequency. You need to check with your servo data sheet for exact values of these two parameters. The frequency is kept constant and the pulse width is varied to get servo to another position.

Figure 4: Servo control signal waveform

Part List

• 2 x SmartRF module
• 1 x USB cable
• 1 x Mobile charger with Micro USB header
• 1 x Servo motor
• 3 x Female to Male breakout cables
• 1x Breadboard (optional)

Besides these components, a laptop or PC with serial terminal software will be required to give commands to the setup.

System Setup

Following is the schematic for whole setup and the image for actual setup.

Figure 5: Schematic for Receiver side

Following are actual setup images.

Figure 6: Transmitter connected to USB
Figure 7: Receiver connected to Servo

I will be using two identical SmartRF boards for receiver and transmitter. The transmitter is connected to laptop’s USB port and the receiver is powered through a 5V charger.

Control of Servo using RF channel

We will be using V3001 bought online for this article, whose pulse width range is
0.9 mS for -90 degrees or 0 degrees
2.1 mS for 90 degrees or 180 degrees

This motor requires a 50 Hz frequency at signal line to operate. The drive software needs to translate the rotation values into pulse width and feed this pulse to servo at pulse rate frequency.

We need to provide the rotation angle to servo through RF link. For this we will broadcast the data on RF channel, from the receiver side, it has to receive the data and convert it into numbers and feed to drive side of software.

As we are using nrf24l01, we’ll be sending commands on SPI and data received will be read over SPI by receiver. There are some available libraries of nrf24l01 or you can build one of your own. So now to keep is simple, we will use sending integer numbers referring to milliseconds. For this demo I’ll keep the resolution low, so we will send integers as follows

90 -> 0.9 mS->-90 degrees
210->2.1 mS-> 90 degrees

The transmitter will send a data from 90 to 210 and receiver will operate accordingly.
Firstly for receiver I’ll be running a simple while loop to generate pulse and wireless receiver will be put on interrupt. Using a PWM or timer will give you freedom to use controller for other tasks simultaneously. Till the receiver receives a new data it will maintain the last data and position. Following code snippet creates pulses of desired width at 50Hz.

LEAVE A REPLY

Please enter your comment!
Please enter your name here