Rc Servo Driver For Mac

Posted on

A Microchip PIC based servo controller offering many of the capabilities of digital servos for under $9! The controllers capture the r/c receiver output, optionally manipulate the samples, then regenerate new servo control signals. As such, they greatly enhance what is possible with cheap servos. They were created for my Here is a list of some of the things possible:. Expand number of things that can be controlled. Drive multiple servos (with different ranges) from single input.

Limit, increase or reverse range of motion on servos. Change center point on servo. Convert absolute servo position to delta/incremental changes. Convert transmitter actions into on/off toggles (for lighting effects, etc.). Suppress servo control pulses when static to reduce chattering.

Encode r/c positions into serial bitstream for a remote controller. It's programmed using a Microchip 5-pin (In-Circuit Serial Programming) header. You'll need to install MicroChip's free - there are versions for Windows, Linux & Mac. You'll also need a device programmer, such as Microchip's. Servos use a three wire connection: ground, power, and the control signal. For the most part, all vendors use that ordering also (Futaba/JR/Hitec/Airtronics-Z).

Old Airtronics servos are an exception (swapped power/ground). The control pins use pulse-width-modulated signals. Pulses varying in width that repeat periodically. The pulses typically range from 1 to 2msecs and repeat every 20msecs. If the pulses stop, the servo stops at its last position.

A 1msec pulse makes a servo moves to one end of its range. A 2msec pulse, and it goes to the other. A pulse somewhere in between moves the servo accordingly. There are no standards however and some servos move more or less amounts. Some servos are sold as 'digital'. They accept the same type of control signals. However, digital flavors use a microcontroller instead of an analog control loop on the servo motor.

They can move faster & be programmed to manipulate the ranges/center-points/reverse-range/constant-run/etc. The down side is higher price, more power consumption & more noise. Now for under $9 you can reuse older servos & get many of those same features.

I've only looked at the output of a couple different brands of standard r/c receiver, but both worked the same. Ie: sequential/stepped outputs. The receivers do not pulse all their control outputs at once.

The first channel pulses (ie: 1msec to 2msec). After the first pulse deasserts, then the second channel pulses. Repeat for remaining channels. From the PIC programming perspective, sequential outputs make life easier.

A tighter software loop can be used, meaning larger counts & better resolution. For example, sampling a pulse 100 times instead of 20 times.

The former gives five times the resolution - a good thing! To verify your receiver works the same, use an oscilloscope or logic analyzer. Look at a couple different receiver control signal pins. If they resemble the drawing you're good to go. My steam turret tank has two servo controllers. One in the tank chassis base attached to the receiver, and another in the turret itself.

The base-controller samples the receiver and drives the engine servos, steam whistle servo & head/tail lights. It also supplies a serial bitstream (of the raw receiver inputs) to the turret-controller. The turret-controller receives the serial bitstream, and drives the turret servo, cabin light, gun elevation servo, gun light, gun solenoid, and the turret sound module. The latter three all trigger simultaneously but for different amounts of time. The code is written in Microchip assembly language (mpasm). Instead of plowing through gory detail I'll give a hopefully easier to understand overview. The servo controller software samples the inputs, averages the last few to filter noise, performs range/center-point adjustment, and then regenerates the outputs (optionally suppressing inactive ports).

There are two variants of the code. The only real difference is where the servo inputs come from. The base controller directly samples the receiver. The turret samples a serial bitstream generated by the base. The same source code supports both variants.

See defines TXCHIP (for base) & RXCHIP (for turret version). Various options have associated timer counts. The code implements timers by tracking the number 20msec loops.

For example, if an input has been idle for 32 loops (0.64 sec) the idle input filter will trip. Attachments. Configure output and alter range and center point: #define OUTPUT0 input2; Output 0 tracks channel 2 #define MIN0PULSE 90; Reduce output range to 1.3 to 1.7ms (0.014ms/tick).

#define MIN0PULSE 122; Nominal range is 64 to 148 (0.9 to 2.1ms). #define CENTER0PULSE 102; Alter center point to 102 ticks. #define OUTPUT5 input3; Output 5 tracks channel 3 #define MIN5PULSE 50; Increase output range to 0.5 to 2.5msec. #define MAX5PULSE 178; Don't exceed what your servos can handle! Change output to use delta increments, instead of absolute position from transmitter: #define OUTPUT1 input4; Output 1 tracks channel 4 #define DELTAINPUT4 10; Update position of simulated input 4 every; 0.2 seconds (10 loops. 20msec) Convert transmitter movement into on/off toggles: #define TOGGLEUP2 input0; Toggle output 2 on/off if channel 0 moved up. #define TOGGLEDN3 input0; Toggle output 3 on/off if channel 0 moved down.

#define PULSEUP4 input1,50; Pulse output 4 for 1 second if channel 1; moved up (50 loops & 20msec). #define PULSEDN5 input1,25; Pulse output 5 for 0.5 secs if channel 1 moved down. Suppress servo control pulses when no input changes occur: #define OUTPUT0 input2; Output 0 tracks channel 2 #define IDLECENTER0 8; Suppress output 0 when within center zone +- 8; ticks for over 64 loops (1.2 secs). #define OUTPUT1 input4; Output 1 tracks channel 4 #define IDLEINPUT4 OUTMASK1; Suppress output 1 when input 4 idle for 32 loops. The board design allows using just the PIC alone, or augmenting outputs with external transistors. There are also spare transistor pads, LED's pads, and space for a SPI ROM.

Power Supply The various servos, lighting, solenoid can cause momentary droops in the battery power. To avoid brownouts, the controllers have a diode & 47uf capacitor. These feed a 3.3V regulator, then the PIC. There are additional filtering caps on the PIC side.

PIC & EEPROM The PIC can be any of the footprint compatible Microchip PIC's. The 16LF1825 I used is a mid-range part with more memory, a UART & other capabilities. Obviously if you choose a 5V part, change the voltage regulator to match. I'd intended on using a Microchip SPI EEPROM to store sound samples, but ended up using an external sound module instead.

The SPI ROM shares pins used for capturing r/c inputs. Therefore it can't be used unless the controller is receiving input over a serial bitstream. External Transistor Drivers PIC's are capable of directly driving an LED. However, for larger loads external drivers are useful. For my turret tank, I used the external transistors mostly for driving head/tail lamps. Attachments.

The PCB layout isn't anything special. The various headers were placed to fit a Spektrum AR6000 receiver. I wanted the controller outputs accessible when installed on the receiver.

Rc servo driver for mac download

Function followed form for everything else. The boards were fabricated. Three for $7.05 including shipping. They come with double-sided solder mask & silk screen labels. The boards should work with other receivers, but you may want to redo the form factor. If you have no need for the external transistors/spares the board outline can be much smaller.

Unfortunately Microchip doesn't make programming PIC's as simple as I'd like. A simple checkbox for 'Supply Power to Target' would be nice.

Connect PicKit-3 to the ICSP header. Observe the pin 1 indication!. Launch the Microchip MPSIM-X IPE (integrated programming environment).

Load the hex file (File - Import). Configure to supply power to the r/c controller:. Select advanced mode (Settings - Advanced Mode).

Rc Servo Driver For Mac Free

Enter password (defaults to 'microchip') & click 'Log on'. Select 'Power' screen on left. Check 'Power Target Circuit' option. Select the 'Operate' screen on left. Pick 'PIC16LF1825' from Device drop-down. Double check you selected the 3.3V 'LF' version. Click the 'Apply' button.

Click the 'Connect' button. Click the 'Program' button. Hopefully all goes well & you're done! Note: The PicKit-3 probably won't be happy if you have servos plugged in.

Rc Servo Driver For Mac Mac

I recommend disconnecting everything before updating the chip.