The Servo Gizmo


Chuck McManis

Summer 2002


Introduction

Every now and then I come up with an idea that turns out to be all right. In this case its something that started out life as a Weapons Systems Module for BattleBots.

Mark Kottlowski, the driver for the KillerBotZ team and the driver/builder of "Little Hater" wanted a way to control some pneumatics that he was installing into his BattleBot. The requirements were simple; using one channel of his R/C receiver, activate one (or two if active retraction was required) solenoids that controlled airflow into a pneumatic cylinder.

As I had done the speed controller for KillerB and used the PIC16F628 in that project, it seemed pretty easy to "whip out" something that would do what I wanted.

Description

The result is something I've come to call the "Servo Gizmo."  It started life fairly targeted toward a particular application (the weapons controller role) but I quickly realized that with a bit of work I could generalize it to a number of applications. When Mike Phillips approached me with a need to have something that could invert a Gyroscope signal I knew this was the board to do that too.

The circuit for the gizmo is actually quite neat. The PIC16F628 is perhaps the ideal microcontroller in an 18 pin package. It has everything, up to and including a built-in oscillator that a designer needs for a kick-butt embedded device. Click on the schematic image at the right to see a PDF file of the circuit schematic.

This is probably close to the final version. As I mention elsewhere in these pages I wouldn't mind bringing the CCP pin out to the servo header and I really should have run 5V to the serial connector to make an off board RS-232 adapter that much easier. Both are easily fixed with a bit of blue wire and an Exacto knife. :-) However, even without these "improvements" I think you will be pleased with board.

The Hardware

The basic device is a PIC16F628 on a board with a signal conditioning circuit designed to let it hook up to R/C radio gear. The production board is 1.75" by 2.0" and there are plans for a pretty nifty mounting bracket in the works. The complete set of I/O facilities on board are as follows:

The choice of a 4-wire plug vs the mare traditional 3 wire plug was the easy availability of 4-wire Molex "KK" connectors.

A wiring option allows this port to supply 5V to the receiver if desired so that you don't need a separate receiver battery pack.

The serial port is also a 4 wire plug although its wire such that you can create a DTE or DCE type wiring by switching the plug around (the pins are GND, Tx, Rx, GND). I left it at 5V because this is compatible with things like BASIC Stamps etc and you can always add an RS232 level shifter in the hood adapter cable.

The pushbutton is also on RB0 so you can use it as an interrupt source to the PIC. Unfortunately its input line does not come out to one of the connectors.

Of course the use of the LEDs is optional, however the LEDs and button are the only "true" user interface available without hooking up a terminal.

One of the jumper connects to the RESET pin of the PIC. This lets you use it as a reset button during testing and development but then use it as a jumper in production. On the 16F628 you program the control fuses to make MCLR an input rather than a reset.

Both are pulled high by 47K resistors so leaving the jumpers off means they will be read logic "1" to the PIC.

By configuring the driver chip as an H-bridge it is possible to make a very small motor driver and hence a small electronic speed control.

I've gone to some pains with the hardware to make this system more flexible and reliable. In particular there is a jumper to allow you to feed back 5V to your R/C receiver, thus powering it from the batteries in your project rather than a specific set of receiver batteries. Secondly, the high current outputs are disabled by pull down resistors that have to be countered by the PIC first putting port B into an output state and then driving its RB4 and RB5 pins high. When the PIC resets, it tri-states its outputs and this circuit insures that the bridge chip turns off when that happens.

Hooking up to the Gizmo

Hook up to the Gizmo is done through its three connectors, J1, J2, and J3. The hookup diagram is shown below.



Figure 1: Hookup Locations on the Servo Gizmo

As you can see from figure 1, this diagram inputs tend to come from the left and the outputs are on the right. The connectors have the following function:

J1 - This connector accesses the serial interface. It can be programmed for general purpose I/O as well. The current rev of the board puts ground on pin 1 and pin 4 of this connector, future versions will put 5V on pin 1 when the 5V jumper is installed to allow a simple RS-232 converter board to be hooked here.

J2 - This connector provides access to the CCP pin and is used to attach the Gizmo to your R/C receiver or BASIC Stamp, etc. In this rev pin 1 of this connector is a no-connect but in the next rev pin 1 will connect directly to RB3 (this will allow it to be used as an output if you want).

J3 - The third connector is where power is supplied and where the high current outputs are available. The layout forced something of a mix up in the pins, however the pair 3,5 can be used as a simple H-bridge output (see the Ant Weight ESC page). Pins 1 and 8 are connected to the PIC and to the 754410 so if you choose to use them as inputs be aware that you're also talking to the TI chip and make allowances. For folks who just want 6 bits of parallel I/O I suggest they leave the 754410 out and install jumpers on the IC pads to connect the PIC pins directly to the output connector.

Application Software

The interesting thing about this device is that you can change its function by replacing the firmware in the PIC chip. As I develop applications I will put pointers to them on this page,

A block diagram of the servo gizmo appears on the right. "Inputs" are on the left, "outputs" are on the right, and the signal LEDs are shown on the bottom. Terms "inputs" and "outputs" are in quotes because you can program them to be either inputs or outputs in most cases. Not shown in the system diagram are the two configuration jumpers J1 and J2, although technically they are another pair of inputs.

The following application "personalities" have been developed for the Servo Gizmo:

Weapons Systems Module - The initial application for this board was that of a weapons controller. The linked page describes how the hardware is used and the basic software design for controlling pneumatic cylinder solenoids.

Piezo Gyro Inverter* - This is the application Mike Phillips needed and it take the Gyro as an input and an "invert" signal and regenerates the output of the gyro on the output as either a pass through or as an inversion.

Ant Weight ESC - This application uses the 754410 as an H-bridge to drive a 1 amp DC motor based on the signal input from a radio receiver. This could be used in the design of an Ant weight (1 lb) battlebot. At 20 gms for the board (no heat sink) its light enough for two and a mixer.

Spinner Motor Controller* - This application is useful for BattleBots that employ spinner weapons and need to meet strict spin down requirement. The firmware is configured to start the weapon when the servo signal indicates "forward" and to electromagnetically put on the brakes when the input signal goes back to neutral.

RC Radio To BASIC Stamp * - This application provides two (or 3) functions;

Mini-Sumo Brain * - This application is a simple mini-sumo where the 755410 controls two motors in a differentially driven sumo robot. The serial port is converted into two bits of input which act as edge sensors on the ring.

Servo Pre-processor - This application would pre-process an R/C servo pulse and then feed the captured/scaled output through the serial port to a BASIC Stamp or some other on-board processor.

LCD Diagnostic Console - This application hooks the Gizmo board up to an HD44780 controlled LCD for use as a diagnostic console during PIC development.

Photovore/Robo-roach * - This application uses the tunability of the input amplifier and the mini-sumo code to create a board that will either be attracted to or repelled by the signal source being fed into the servo input. This can either be a photo sensor or a microphone.

Design History

The board has gone through a number of revisions before I was happy with it. I put together a web page that showed the individual stages of its development. As you will see if you follow the link, it started with a fairly dedicated role, doing the job of WSM, but the effort to make it smaller and then to make it more flexible drove it to the current state.

One of the more interesting things I learned in this process was the dual nature of designing a really tightly packed board but also one that had a number of components. At some point I'll probably do a surface mount version, although on that version I would be sure to have an on-board programming connector.

Printed Circuit Board Availability and a note about "IP"

My personal philosophy regarding the "business" around this sort of stuff is pretty simple. I build these projects mostly for my own benefit and I am glad when they can benefit others. If you're building one on your own I'm happy to help out, if your robot club wants to build a dozen as a group project that is great too. But if you want to market and resell this design, you need to license that right from me.

At the present time, all the parts for this board can be purchased from Digikey and I have a number of extra printed circuit boards that came from a run I did for me (you do more than you need and save a few bucks). I'm happy to sell you a professional quality circuit board for this circuit for $5 each.  

If you buy a board I will include the complete parts list with Digikey catalog numbers, a complete schematic, and  some basic directions on how to assemble the board. I will also answer any questions you have via email on assembly and bringup (its a pretty simple circuit). To build one you will need a pair of diagonal cutters, a soldering iron with a 'fine' tip, and a voltmeter.

If you would like to buy one or more, email me first with the number you would like and I'll tell you if I have that many left. Quantities are limited.

Building One From a Kit

I do have some circuit boards made up and the parts list is an easy order from Digikey, if there is enough interest I'll see about putting together a kit with boards and parts. In the mean time I've created a set of Assembly Instructions for you to follow when building up the board.

There is a complete Parts List with Digi-key part numbers available as well.

Return to The Projects Page

Robotics Notebook


1Works In Progress (WIP) - These personalities are being developed and their web page is not yet available.