SEARCH
TOOLBOX
LANGUAGES
modified on 6 October 2011 at 14:18 ••• 1,509 views

RC Servo Processor

From WFFwiki

Jump to: navigation, search

Contents

Introduction

Rcservoprocessor red.jpg


On a continuing mission to build an autonomous sailing robot we needed a way to more rapidly prototype boat designs and wanted to use a standard remote control model control system to save time by using off-the-shelf parts. When controlling servos with microcontroller based electronics you can use the full 180 degrees of rotation; however standard RC systems typically only support 90 degrees or less. We also needed a way to limit the rotational speed of the servos to prevent wear and damage to parts of the boat.

The RC Servo Processor is a simple and small device which sits in between your RC receiver and servo which allows you to control both the rotation range and speed of a servo. Using only 4 components it is small, light and power efficient.

YouTube Demonstration Video


The RC Servo Processor Board

The RC Servo Processor allows you to define the expected range of input from your RC controller and then map that range on to your desired output. This is performed by simply changing some #define statements in the PIC12F source code. The firmware takes care of calculating the required PWM output to the servo by scaling the available input range to the desired output.

To set up the firmware you must first specify the range of output your RC controller supports, this is typically around 1100uS to 1900uS:

// Definitions for RC Receiver input (in units of 0.5uS)
// 1146uS to 1889 uS
#define RX_MIN_WIDTH	1146*2
#define RX_MAX_WIDTH	1889*2

The you can specify the desired output range using the following define statements:

// Definitions for RC Servo output (in units of 0.5uS)
// 400uS to 2150uS
#define SERVO_MIN_WIDTH	400*2
#define SERVO_MAX_WIDTH	2150*2

Note that the units are in 0.5uS, so 400uS is 800 (which is why the definitions contain the *2 to make it clearer). Finally there are 2 more supported settings; the rotational speed limit - this can be set to 0 for no limit, or it represents the maximum difference in uS from pulse-to-pulse generated by the RC receiver (so this is typically the maximum change in 1/50th of a second). You can also set up the number of samples which are used to measure the RC controllers output. Since the PIC12F is using the internal oscillator, averaging the readings helps to prevent jitter in the output:

// Rotational Speed limitation for output servo
// Set to zero for no limit or specify the maximum allowed pulse width variation
// per output pulse (in units of 0.5uS).  Note: the actual speed of the output
// pulses is dependent on the RC Receiver output, but is typically one pulse per
// 20mS (50 pulses per second).
#define SERVO_SPEED_LIMIT 0
 
// Number of samples to average the positive pulse width from (2-5)
#define NO_OF_SAMPLES 4

The firmware takes advantage of the fact that RC control systems send a control pulse of around 1-2mS followed by a pause of 20-30mS. The PIC12F samples the pulse from the RC receiver and then performs all the required calculations for the output pulse during the relatively long gap before sending the pulse to the target. This means that the firmware can be coded without the need for interrupts and helps to keep the timing stable.

Circuit Schematic

The following diagram shows the circuit schematic for the RC Servo Processor:


RC Servo Processor Schematic.png


The PCB is designed to be as simple and compact as possible. By placing the 5V Regulator and PIC close together the design requires only 2 100nF capacitors to stabilise the power on either side of the regulator. The board draws its power from the servo power feed, however due to the on-board regulator it can operate with battery packs greater than 5Vs without issue:


RC Servo Processor Board.png


Files for download

Below you will find the project files including the HiTech C firmware and the Eagle CAD schematic and PCB files:


PCB and Schematic - The PCB artwork and schematics in Eagle CAD format

PIC12F683 Firmware - The PIC12F683 firmware source code (for HiTech C)



Donate to waitingforfriday.com:

If you like this site and want to help support future projects, or you just want to show appreciation for a project you built, used or enjoyed, please consider leaving a PayPal donation. It's quick, secure and helps us to run the site and fund future projects!


PayPal, fast, easy and secure



Most popular pages:

  1. Building a PIC18F USB device ‎(148,999 views)
  2. Home ‎(135,384 views)
  3. Projects ‎(67,453 views)
  4. 4-Bit Computer ‎(59,813 views)
  5. Open Source Framework for USB Generic HID devices based on the PIC18F and Windows ‎(58,014 views)
  6. Open Source Visual C++ Class for USB Generic HID Communication ‎(38,704 views)
  7. USB RGB LED VU Meter ‎(32,356 views)
  8. PIC USB Development Board ‎(31,672 views)
  9. Real-Time Audio Spectrum Analyser ‎(31,512 views)
  10. 16x8 LED Matrix Display ‎(27,176 views)
  11. Controlling LED brightness using PWM ‎(24,874 views)
  12. USB Performance Monitor ‎(23,415 views)
  13. C64 VICE Front-End ‎(23,200 views)
  14. PC Case USB LCD ‎(19,100 views)
  15. Commodore SID 6581 Datasheet ‎(15,450 views)
  16. Rotary Encoder Demonstration ‎(15,185 views)
  17. Retro Computing ‎(14,677 views)
  18. Reverse engineering an MB Electronic Simon game ‎(14,013 views)
  19. 3D House ‎(13,044 views)
  20. LED Colour Organ ‎(11,122 views)

more >>