Servo Controller

This is a PIC-based board for control of multiple servos in predefined sequences.

Version 1

Hardware

  • Based on Microchip PIC18F252?
  • Interfaces with analog RC servos

Firmware

  • Max servo resolution is 0.5°
  • Servo span is 128°
  • Max update rate is 50Hz (20ms)
  • Max sequence length is 1024 steps

Software

  • Sequences can be developed and downloaded using standalone program
    • Developed in Visual Basic
  • Allows real-time control of each servo
  • Linear interpolation to create smooth sequences
  • Saving and loading of sequences
  • Writing to and reading from the controller
  • Real-time emulation of the sequence with breakpoints
  • PC Program File (Use ServoControl V1.0.exe)
  • Source VB File, v1.1 (zip format):

Sequence Files

  • TAB delimitated text file
  • Each row is a single step
  • Each Column is a servo value (col #0 = servo #0; ... col #n = servo #n).
  • 8th column is value of time step (how long to hold that row)
  • Servo value is expressed as a byte (0 to 255 corresponding -64° to 63.5°; 128 = 0°)
  • Sequence time is expressed in milliseconds.
    • ONLY USE MULTIPLES OF 20 ms

Version 2

Hardware

Firmware

  • 2.5.2
    • Added automatic interpolation for all channels, all steps, all sequences, at 50 Hz
    • Firmware V2.5.2
  • 2.5.1
    • Fixed bug in 2.5
      • All bits in sequence memory must be erased (set to 1) before programming
    • Firmware V2.5.1
  • 2.5
  • 2.0

Software

Version 3 (12 May 2005)

Hardware

Firmware

  • 16 independent sequences
    • Can be changed during operation
  • Max sequence length is 255 steps
  • Changes sequence at zero position, so if all zero positions are identical, you can get seamless transition between gaits

Software

  • + and - buttons added to change sequence
    • Inverted logic - Sequence 0 corresponds to all high values on 4-pins
  • Emulator can also go between sequences
  • Clear All key resets all sequences!

Sequence Files

  • NOT COMPATIBLE with v1.x and 2.x
  • Requires sequence number (open sequence file in text editor for details)


Other Issues

PIC Compatibility

  • 18F2520 is not directly swappable for 18F252
  • Reading and writing of flash, using V2.x firmware, does not work.
  • The model number in ServoMain.asm was modified and 18fxx20_conf.h was created to fix compile errors due to P18F252.inc and P18F2520.inc discrepancies. However, problems remained.
  • Can be further pursued (see 18F2520 datasheet and Errata).

Programming Instructions

  • Install or locate MPLAB v6.0 or greater
  • Plug in MPLAB ICD2 programmer/debugger (round, red puck)
    • External power as well as USB cable required.
    • Phone cord connects puck to red programmer board
  • For DIP, drop chip into ZIF socket
  • Adjust wires according to PIC pinout. For standard 28-pin package
    • Vpp = Pin 1
    • Vdd = Pin 20 (Pin 32 on ZIF)
    • Gnd = Pin 8
    • Gnd = Pin 19 (Pin 31 on ZIF)
    • PGD = Pin 28 (Pin 40 on ZIF)
    • PGC = Pin 27 (Pin 39 on ZIF)
  • Start MPLAB (Right click, "Run As...", Administrator)
    • Programmer -> MPLAB ICD2
    • Programmer -> Settings -> Status
      • If Module Vpp fails, ignore it. If other things fail, recheck connections
    • Configure -> Select Device and select PIC model
  • Cycle ICD2 power and close/restart MPLAB software (due to bugs)
  • Open project
  • Build all
    • If error "Build Tool not found" occurs,
      • Project -> Select Language Toolsuite -> Navigate to Program Files\Microchip\MPASM Suite\ and set locations for mpasmwin.exe, mplib.exe, and mplink.exe
      • Project -> Select Language Tool Locations -> Microchip MPASM Toolsuite ->Executables -> click on each file and set as noted above

  • On SITH, Use 3rd USB port (looking from rear) from the left for ICD2

- AMcClung? - 13 Jan 2005, 09 March 2006

PC Communication

  • Two cables made (1 by VirgilioMattoli? , 1 by SanjayDastoor). Schematics included in hardware schematic (see above)

PC Software Operation

  • Select port (COM1, usually)
  • Click green "Connect" button
  • Zero each servo (does not do this properly in program initialization)
  • MAKE SURE "Connect" BUTTON IS OFF BEFORE DOWNLOADING SEQUENCES

PC Serial Port Monitor

-- SalomonTrujillo - 22 Jun 2006

Sequence Generation

GaitPlanner?

GestureTweak?

Controller Operation

The PIC program starts in ServoMain.asm

Upon startup:

  1. Sets ports (in ServoRoutines.asm)
  2. Initializes variables (in ServoRoutines.asm)
  3. Turns on green LED for 1/2 second
  4. Turns on red LED for 1/2 second
  5. Turns on green LED for 1/2 second
  6. Initializes serial communications
  7. Enters Main Loop
    1. Checks for key presses (Keys18F.asm)
      • Key 1 = Start -> Really Key_2 in code -> TIMER_MOV_ON
        • Turns on green LED, sets interrupt, starts TIMER3
        • Turns on red LED
      • Key 2 = Stop -> Really Key_3 in code -> TIMER_MOV_OFF
        • Auto-zero?
        • Turns off green LED, resets interrupt, starts TIMER3
        • Turns off red LED
    2. Reads Sequence Status Number (ServoRoutines.asm)

-- JonathanKarpick - 23 Jan 2006

Wireless control

Boards can now be controlled via remote control.

  • On V2, board can be remotely started, stopped, and reset
  • On V3, gaits can also be selected
  • RF modules are KH series from Linx Technologies
    • Transmitter and Receiver manuals
    • Maps 8 input pins on transmitter to 8 output pins on receiver
    • Has 10 tri-state bits for addressing, so multiple boards can be used
    • Tie 'Transmit Enable' line high to continuously update receiver
    • IMPORTANT: When transmitter line changes state, ALL receiver lines drop low for one transmission cycle before returning to transmitter state. As a result, normally high switches cannot be used. For Virgilio's controller, all switches had to be changed to normally low. The modified code is attached below. To modify other versions, comment out all 'comf' commands in the Keys18F? .asm file

Firmware

-- SanjayDastoor - 05 Apr 2006

Platforms

This board was successfully used on the following platforms:

Sprawlita

ToyBot04?

SpinyBot?

StickyBot (see StickyBotController)


This page consolidated information from the previous page. To view old page, go to Revision 1.22

-- SanjayDastoor - 28 Apr 2006

 
This site is powered by the TWiki collaboration platformCopyright &© by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback