Microchip – Let my robot see!

by Craig Sullender on May 9, 2011

I promised to post some of my past microcontroller vision projects. This one has a Microchip PIC directly sampling a video signal. 8 pins well used.

Collapsible Quadruped Robot with Computer Vision, Laser Ranging, and Servo Control on a Single-Wire Network

Photos and video capture by Glenn Currie.

Download project design_files_PicVid97.zip.

____________

Austin Texas, 1997. I found a nice piece of aluminum and the Microchip PIC12C672 had just come out so I built this robot with basic machine vision, servo control, single-wire network, wireless com, and laser ranging – all based on the 8-pin microcontroller.

The goal was to develop the robot control software on the PC and then add a main processor to the robot after robot motion etc. was worked out.

The collapsible design worked; the robot would collapse and expand. (It was more like a jump since the servos were so strong.) The ranging and video motion targeting worked but only caught motion within a window of speeds–a smaller window than typical methods. Instead of developing a walking algorithm, I focused on computer vision. Later, following the same physical design, I designed a credit-card sized collapsible quadruped with micro-servos mounted to a cell phone battery. Again the computer vision issues became more important to solve. Robots can walk, it’s time for them to see.

Until microcontrollers are available with a pixel-processing peripheral, “I do not consort with those of the robot race.”

____________

Main ideas:

  • Modular design, add servos and other functions as needed.
  • Camera output is sampled directly by the PIC.
  • Single wire communications and control network.
  • The PIC detects object motion by sampling pixels from the video images.
  • Servo final positions are controlled by the PC during hosted development.
  • The servo position pulses are generated at the PIC inside each servo.
  • Laser ranging for direct distance measurement, size, 3D.
  • Power measurement at each servo PIC for servo loading and actual position feedback.
  • Wireless data link to a PC serial port for telemetry and hosted development.
  • Wireless composite video link for monitoring the camera and machine vision functions.
  • PC receives locations of objects detected by the video camera.
  • Video sampled at 30fps.

____________

Laser ranging by a laser offset from the camera axis. The top image shows the laser spot detected higher up in the image (further away). The lower image shows the laser spot detected lower (closer to the camera).

The PIC scans the incoming video and compares values between frames to detect changing pixel values. The vertical cursor pattern is drawn on the video signal by the PIC for demonstration. The cursor marks widen when changing pixel values are encountered. Laser ranging is accomplished by flashing the laser during every other frame. The flashing laser spot is detected as an area of changing pixel values.

____________

Servo with PIC installed. A servo with a clear body was used for the first tests.

The PIC receives commands from the 1-wire network, converts position command to pulse sequence, sends pulses to the servo, reads voltage across a resistor for a current measurement (servo loading), reports servo position and power to the 1-wire network.

____________

Block diagram and schematics.

Block diagram of the system.

Schematic of the single-wire (plus power and ground) comm network. Camera input, laser control, video output. RF modules for wireless control and monitoring.

Servo controller schematic.

PC host wireless comm.

Camera mods.

____________

Body and camera.

Legs down.

Collapsed.

Early test. Aluminum channel body.

Laser offset from camera.

Camera.

Camera modifications. The camera clock is buffered and output to the VidPic. The VidPic can then be synchronized (with Vsync) to the camera’s video output.

____________

System modules.

Camera and video module.

Inside of video module. Pic, video buffer, RCA output.

Modules connected by single-wire (plus power and ground) network.

Network hub.

RF module.

Tried the video RF transmitter on the right. Modified to plug into the RCA connector. The RF transmitter didn’t work very well.

____________

Video motion targeting cursor. The cursor sweeps across the video scene and detects changes due to motion. The resolution of detection is adjustable.

Video motion targeting cursor – adjusted to small vertical area.

Video motion targeting cursor – adjusted to larger vertical area.

Cursor catches flying Godzilla.

____________

(Write-up I entered in the Circuit Cellar Design Contest 1997)

Distributed Pics: Networked Embedded Video Acquisition and Servo Control for a Quadraped Robot

Microchip Pic12C672 microcontrollers are used in a  walking robot control system that has several servos and a video camera controlled by a remote PC.  The design goal for the hardware was a system that had individually addressable servos and camera on a communications network with a wireless link to the PC.

Requirements for the overall design centered on simplicity and utility.  Servos should be easily added and removed without having to change microcontrollers or support circuitry, accuracy for servo power measurement to indicate loading should be better than 10% of full scale, accuracy for servo position sensing should be better than 5% of full scale, and accuracy for video ranging should be better than two inches at one foot.  Video motion detection should function reliably even with a complex video scene.  The prototype should demonstrate basic functions and take commands from a common RS232 ASCII communications program found on any PC.  A separate user interface for more complicated robot control will be written for the PC after the prototype is proven.

The implementation was to embed a Pic12C672 in each servo (ServoPic) and in the camera (VideoPic).  Each ServoPic measures servo load, reports servo position and receives a list of movements so that the robot can walk without further updates from the PC.  The VideoPic reports the location of moving objects in the video scene, reports ranging data, and acquires video pictures.  Each Pic microcontroller uses a single pin to transmit and receive the RS232 data.  The communications backbone is an RS232 (protocol, not voltage level) network attached to the ServoPics and the VideoPic.  The network communicates with a remote PC via a wireless Linx receiver and transmitter pair at each end.

Contents

I. Overview

II. VideoPic: Video Acquisition, Motion Detection, Ranging, and Single Wire Communication

III. ServoPic: Servo Control, Position Monitor, Power Measurement and Single Wire Communication

IV. Controller Network

V. The Prototype

VI. Photos, Demonstration

VII. Schematics, Source Code, Parts List

I. Overview

Distributed Pics: Networked Embedded Video Acquisition and Servo Control for a Quadraped Robot

Microchip Pic12C672 microcontrollers are used in a  walking robot control system that has several servos and a video camera controlled by a remote PC.  The design goal for the hardware was a system that had individually addressable servos and camera on a communications network with a wireless link to the PC.

Requirements for the overall design centered on simplicity and utility.  Servos should be easily added and removed without having to change microcontrollers or support circuitry, accuracy for servo power measurement to indicate loading should be better than 10% of full scale, accuracy for servo position sensing should be better than 5% of full scale, and accuracy for video ranging should be better than two inches at one foot.  Video motion detection should function reliably even with a complex video scene.  The prototype should demonstrate basic functions and take commands from a common RS232 ASCII communications program found on any PC.  A separate user interface for more complicated robot control will be written for the PC after the prototype is proven.

The implementation was to embed a Pic12C672 in each servo (ServoPic) and in the camera (VideoPic).  Each ServoPic measures servo load, reports servo position and receives a list of movements so that the robot can walk without further updates from the PC.  The VideoPic reports the location of moving objects in the video scene, reports ranging data, and acquires video pictures.  Each Pic microcontroller uses a single pin to transmit and receive the RS232 data.  The communications backbone is an RS232 (protocol, not voltage level) network attached to the ServoPics and the VideoPic.  The network communicates with a remote PC via a wireless Linx receiver and transmitter pair at each end.

A quadraped robot was constructed.  Each leg consists of two sub-micro servos, connected in a way that allows dog like walking and sitting.  A ninth servo, controlled by a tilt sensor, will later serve as a tail to balance the robot during the four legged gait.  The video camera is mounted to the front of the body.  The advantages of this arrangement are that the camera can be tilted up or down by changing the body tilt and the forelegs can be used as arms when the body weight is placed fully on the hind legs.  The body is a five inches long, 3/4 inch wide aluminum channel.  The robot is 3.5 inches tall standing, and 1.75 inches collapsed.  The robot is designed to function from a single 3.6 V to 4.8 V battery pack.  The battery is mounted up under the body, inside the aluminum channel.

This document describes the design of the sensing, control and communication circuitry of the prototype, excluding the tilt sensor and tail.

II. VideoPic: Video Acquisition, Motion Detection, Ranging, and Single Wire Communication

VideoPic

The Pic12C672 eight pin microcontroller has exactly the peripherals and pins required for remote video acquisition and control. Pin usage is 1. power, 2. ground, 3. live video input, 4. clock input, 5. video sync input, 6. video marker output, 7. communications input/output, and 8. laser ranging enable output or clock output.

Video Camera

Marshall Optical Systems Division supplied the V-X0071 CMOS video camera with a 3.6 mm lens.

Besides the composite video signal, two other signals are required from the camera for the VideoPic.  These are a pixel clock and vertical sync.  The V-X0071 provides these signals, unfortunately the pixel clock is disabled during the vertical sync signal.  The simplest work around is to tap into the video camera crystal oscillator clock.  If the camera did not provide vertical sync and pixel clock, a video sync separator and PLL circuit would need to be added to the VideoPic circuit.

Modifications to the camera are shown on the related schematic.  A single inverter gate was connected to the video clock as a buffer.  The inverter package is very small and can be glued to the back of the camera.  The linear voltage regulator was removed from the camera board so that the camera could be powered from the common VCC.

Video Display

For monitoring live video during development, a video cable is attached from the RCA connector of the VideoPic circuit to a video monitor.  A Maxim video buffer  drives the cable and inserts markers generated by the Pic.  The markers appear on the monitor as short horizontal lines with a gap in the middle to indicate the exact location of each video sample.  When movement is detected the mark for the corresponding location widens.  Sensitivity and resolution were tested by observing live video as well as serial data.

Motion Detection

Live video (DC coupled, 1 V min. to 2.5 V max.) was connected directly to the analog input of the Pic12C672.  The video signal is sampled by the Pic A-D converter and compared to previous samples to detect change in the scene indicating movement.  The detection threshold is adjustable  for more or less sensitivity.

Two scan modes are implemented:

1) 64 sample locations are spread out over the screen.   Markers are added to the video as shown.  The small space between each pair of markers is the exact location of the sample.  Any change in the video scene that enters the sample space will be detected as movement.

The first acquisition at each location is saved.  All samples after that are compared to the first samples.  Any movement, even if it is very slow, causes detection.  Again the locations are sampled and saved, and then observed indefinitely for the next movement.

Movement reports are two bytes indicating the first horizontal and vertical location of a pair of columns, and two bytes indicating which samples detected movement by which bits are set in the bytes (MSB is the top marker).  For example, if the third column is at video line 0×10 and 0×20 clock cycles ((0×20 * 4) video clock cycles) horizontally, and movement is detected at sample five, third column, and sample seven, fourth column, the VideoPic would report V: 0×10, H: 0×20      0×08, 0×02

The VideoPic causes the markers at locations of detected movement to widen.
__ __      __ __      __ __      __ __      __ __      __ __      __ __      __ __
__ __      __ __      __ __      __ __      __ __      __ __      __ __      __ __
__ __      __ __      __ __      __ __      __ __      __ __      __ __      __ __
__ __      __ __      __ __      __ __      __ __      __ __      __ __      __ __
__ __      __ __   ___ ___    __ __      __ __      __ __      __ __      __ __
__ __      __ __      __ __      __ __      __ __      __ __      __ __      __ __
__ __      __ __      __ __   ___ ___    __ __      __ __      __ __      __ __
__ __      __ __      __ __      __ __      __ __      __ __      __ __      __ __

2) 64 locations in a vertical column are sampled every other frame, and then compared on the frames in between.  Response time is 33 mSec., but slow moving objects will be missed.  The column can be scanned smoothly across the screen looking for moving objects.  Scanning is also useful for tracking the laser spot when ranging.  The laser will not always be alligned perfectly with the center axis of the lens.  To prevent having to make adjustments by hand, the detection column scans when it loses the laser spot and stops while the laser is detected.

Movement reports are two bytes indicating the first horizontal and vertical location, and eight bytes indicating which samples detected movement by which bits are set in the bytes (MSB is the top marker).

The VideoPic causes the markers at locations of detected movement to widen.
__ __
__ __
__ __
__ __
.
.
.

64 total sample locations

Several of the motion detection parameters are adjustable from the remote PC, including  sensitivity threshold, sample location, horizontal scan speed, scan mode, and distance between samples.  The Pic can send A-D data to the PC for video capture. The Pic can cause the PC to sound a beep each time movement is detected, and send immediate locations of movement.

Laser Ranging

The laser is mounted directly above or below the camera and aimed at an angle towards the center of the video camera lens axis (center of the video picture).  The closer an object is to the camera, the further from the center the laser spot appears in the picture.

The laser is enabled for one frame and disabled for one frame repeatedly to cause a detection in scan mode 2) above.  The stack of 64 sample locations gives a good vertical resolution of the laser spot location.

A 635nm laser module (Resources Un-Limited) modified to operate from 3-6V supply (Jameco Laser Driver #126711) was found to be very bright.  The camera even detected the spot on non-reflective black fabric.  A bright white wall was a problem, helped some by a Kodak Wratten 80A IR block filter.  Rather than go into the details of modifying the laser, I recommend finding a laser module that already operates from 3-5V.

If the VideoPic was used in a security application instead of robotics, an alternate function for the laser enable pin could be to activate an alarm or the record function of an attached VCR when motion is detected in the video scene.  The Pic could simply throw a relay or modulate an IR emmitter pointed the VCR remote control input.

VideoPic Software

Code was written with the Pic C compiler from CCS.  The CCS compiler has built in C functions for RS232, general IO, A-D conversion, and interrupts.  See the source listing for comments.

The major hurdle for the Pic software was syncronizing to the live video.  In order to detect movement in a video scene, the exact same location must be sampled repeatedly, and the A-D converter value compared to find change greater than a set threshold.  The microcontroller can’t time video delays with enough resolution to hit the same pixel every time.  Even with the video camera clock driving the microcontroller clock input and the video vertical sync used as an interrupt, timing is still only as accurate as the clock cycles of a wait loop.

The solution was to use the Sleep function to stop the microcontroller on a single instruction, then interrupt Sleep with vertical sync.  This causes a fixed delay from a known position in the program.  Adjustable software delays then position the A-D converter samples anywhere in the video scene.   Functions were created in C and assembly to give single clock resolution to the horizontal position in video and single line resolution to the vertial position.  One VideoPic function is to scan across the screen looking for the modulated laser beam.  The scan movement is perfectly smooth.

The ServoPic and the VideoPic are addressable.  Each Pic only responds to its own address.   Normal RS232 ASCII data is used so that the system can be demonstrated on any PC with a standard serial communications terminal program.  If  ‘v’ is pressed at the PC, the VideoPic responds by printing its menu on the PC screen.  Selections from the menu are enterd on the PC and the VideoPic reponds with video data, motion data etc. If a PicServo’s address is entered, for example ‘z’, the proper servo will respond with its menu.

The menu response is included for demonstration purposes, and uses much of the ROM space of the Pic.  The menu response can be removed after the robot user interface and control program for the PC is written.

III. ServoPic: Servo Control, Position Monitor, Power Measurement and Single Wire Communication

ServoPic

The surface mount version of the Pic12C672 is small enough to mount inside the servo body of the smallest model airplane servo.  No additional compnents are required due to the on chip 4 mHz oscillator.

Serial communication uses one wire, so the only connections to the modified servo are power, ground and the PicServo TXRX signal.  The original three wire servo connector is retained.

The Pic generates the pulses required for the control of the servo.  The movement data from the PC determines how wide the pulses are, how fast they change, whether the change is positive or negative and how long the pulses are applied to the servo.  A list of twelve movements can be downloaded to the VideoPic.

Servo position is determined by making an A-D conversion of the voltage at the center contact of the potentiometer that comes mounted in the servo.  Each servo needs to be calibrated under no load conditions to determine the pulse width to servo position relationship.

Various sizes and makes of servos were tested.  The servo pulse width to position relationship can vary from servo to servo.  Be careful to prevent the Pic from driving the servo past its mechanical end points.

Position Control and Sensing

Model airplane servos are pulse width proportional, meaning that the servo position reflects the width of the pulse applied to the servo input.  The ServoPic calculates the pulse width from the following data input from the PC: 1) initial_pulse_width, 2) data in the array Speed[ movement number] , 3) data in the array Pulses[movement number]. For example, if initial_pulse_width is 70, Speed[0] is 2, and Pulses[0] is 4,

then for movement 0 the ServoPic generates four pulses: 700uS, 720uS, 740uS, and 760uS wide.  The full range of servo movement fits into a one byte word with 10uS resolution.  The pulse period is 20mS.  Putting movements in the form of speed and duration makes it possible to coordinate the movements of all of the servos while executing complex motion curves from a simple list.

Note that under sufficient servo loading, the applied pulse width will not agree with the actual servo position.

The servos used for this project already have potentiometers for position sensing.  The video Pic measures the potentiometer wiper voltage the actual servo position.  Servos will differ in mechanical travel and potentiometer voltages so the ServoPic will have to be calibrated by incrementally moving the servo and taking position measurements.  The other two terminals of the potentiometer could be connected to the unused A-D converter inputs of the Pic12C672, for example using the high side of the potentiometer for VREF.  Greater accuracy was not required, so the simpler design was chosen.

For initial demonstration and development the ServoPic position control loop is left open with the master PC requesting position information and setting servo pulse widths.  Future versions of the ServoPic will close the position control loop in the Pic code by relating measured position to desired position.

Current Sensing

Every 20mS the ServoPic sends a position controlling pulse to the servo.  Then the servo’s own control circuitry applies a power pulse to the servo motor.  The more the servo has to work to achieve the desired position, the wider the power pulse, and the higher the average current consumed.  Therefore current measurement represents servo loading.

Depending on the servo and power supply voltage used, it may be necessary to change from a 1.00 Ohm to a 0.51 Ohm current sense resistor.

ServoPic Software

The ServoPic and the VideoPic are addressable.  Each Pic only responds to its own address.   Normal RS232 ASCII data is used so that the system can be demonstrated on any PC with a standard serial communications terminal program.  If  ‘v’ is pressed at the PC, the VideoPic responds by printing its menu on the PC screen.  Selections from the menu are enterd on the PC and the VideoPic reponds with video data, motion data etc.

If a PicServo’s address is entered, for example ‘z’, the proper servo will respond with its menu.  The operator can then enter a sequence of motions for the servo to save and repeatedly follow, or request the servo’s position.  Each servo is given its list of movements, then they are all started at the same time with a common address that means “all servos start”.   Each movement input consists of a speed (Speed[movement number]) and a duration (Pulses[movement number]).  The result is that the servos can have sequences of unique and complex movements that are initiated at the same time and are repeatable with no further input except an “all servos start” command.  A walking algorithm can be implemented so that a complete gait is input once and then the robot walks by repeating the gait.

The menu response is included for demonstration purposes, and uses much of the ROM space of the Pic.  The menu response can be removed after the robot user interface and control program for the PC is written.

See “VideoPic Software” above for more information.

The Pic12C672 has an on chip oscillator.  It is factory calibrated with the calibration data stored in ROM.  The factory calibration data or user calibration data can be loaded into the OSCCAL register during runtime to change the frequency of the internal oscillator.  The ServoPic program loads the factory calibration at power up, but the OSCCAL value can be changed later by the remote PC.

The concern was that the internal oscillator might not be accurate or stable enough for RS232 communications.  Tests over temperature (a 100 Watt light bulb placed one inch from the IC) and voltage (3.5-5V) showed a change in internal oscillator frequency, but the frequency remained within the accurate operating range for RS232 communications.

See the source listing for more comments.

IV. Controller Network

Communications

The Pic12C672 generates RS232 compatible serial communications.  A single pin (TXRX) watches for an ASCII character (from the PC) representing the correct address, and then the TXRX pin switches to output and sends a menu of command choices to the PC.

Each of  the ServoPics and the VideoPic have a three wire flat cable with a servo-type connector on the end.  The three conductors are for power, ground and serial communications.  All of the three wire cables from the ServoPics and the VideoPic are connected to a central hub circuit.  For each TXRX signal a pair of diodes creates separate TX and RX signals.  All of the TX signal are connected together into one TX line.  All of the RX signals are connected together into one RX line.  Together with ground, the TX and RX signals are routed to the Linx RF circuit.

Note in the schematics that the RS232 data is uninverted.  The Linx circuits transmit data using Carrier-Present Carrier-Absent modulation.  A high on the data line means the transmitter is using more power.  The inactive state of RS232 is low, and this polarity is maintained thoughout the communications network.

The maximum data rate of the Linx circuits is 5k bps, so 4.8k baud was chosen for the RS232 data.

The number of nodes on the network is limited by the drive power of the buffer at the Linx RF receiver.  Each node has a load of 10k Ohms and some capacitance.  The resistive load for nine ServoPics and one VideoPic is 1k Ohm.

Wireless

The RF circuits Linx Technologies are straight forward to implement.  Each transmitter/receiver pair cost under $20.  Purchase of the $140 evaluation kit is required by Linx.

The RF circuits were mounted to solid copper clad board for a ground plane.

V. The Prototype

Construction

The prototype was constructed on Surfboard PCB breadboards from Digikey, part number 9161CA-ND.  Two Surfboards fit perfectly inside the Radio Shack Mini Project Box part number 270-288.  The project was divided into modules: 1) Video camera,  2) VideoPic and video opamp on Surfboards in a Mini Project Box, 3) laser module, 4) serial communications network hub on etched copper clad board in a Mini Project Box, 5) wireless RF Linx circuits on solid copper clad board in a Mini Project Box , and 6) servos.  On the PC end, the wireless RF Linx circuits in a Mini Project Box were connected to the PC RS232 port and took +5V power from a keyboard cable adapter.

Three conductor flat cable and servo type connectors are used throughout to allow each module to be disconnected during construction and installation.

Follow instructions from Linx Technologies for best results with the RF section.  The wireless section is sensitive to transmit and receive antenna layout.  For the prototype, with minimal performance expectations, wire wrap wire was used for antenna.

Prototype ServoPics used either the Pic12C672 outside the servo case or the Pic12C509 inside the servo case since the surface mount version of the Pic12C672 was not available.  The prototype VideoPic used the dip version of the Pic12C672.

The prototype VideoPic takes the 12.288 MHz video clock directly into the microcontroller clock input. An engineer from Microchip assured me that 12 MHz is “pretty conservative” for the Pic12C672-10.  Still, if the application does not allow exceeding the recommended 10 MHz rating, insert a divide by two circuit in line with the clock signal.  Tests with live video indicated that this will not appreciably affect the video sampling performance of the PIC12C672.  Timing portions of the software would have to be changed  to accomodate the slower clock.

The Pic external RC oscillator function is exploited for its single clock input pin and no clock output pin.  This frees a pin for laser ranging control.  Driving the RC clock input in this way is discouraged by  Microchip.  Measurements showed no change in current consumption with or without driving the RC clock input, perhaps due to the high speed of the video clock, so it was decided to proceed with the design as descibed.  If the application does not allow the use of the external RC oscillator function in this way, the laser ranging pin can be left unconnected and the HS oscillator function enabled.  The video marker pin is only needed for development, so it can drive the laser enable signal during untethered robot operation.  Keep in mind that  in a creative field like engineering, “if foolishness is prevented, so is cleverness.”  The Pic12C672 doesn’t  prevent either.

The whole system operated with a supply voltage down to 3.5 Volts.

Power Consumption

For VCC = +5V / +3.5V

VideoPic:
Pic12C672 and Maxim video buffer: 15mA/10mA
Modified CMOS video camera: 18mA/12mA
Laser: 23mA/23mA average while ranging
ServoPic (each):
Servo inactive: 11mA/10mA
Servo active, no load: 50mA/45mA
Servo active, with load: 200mA/200mA
Wireless transmitter + receiver:
Inactive: 8mA/5mA
Active: 11mA/7mA

Results

The VideoPic had surprising performance in video acquisition.  The sample window appeared to be two-four pixels effectively.  The data sheet gives a longer sample period, but actual performance was quite good.  If integration over multiple pixels is taken into account, slow video frame grabbing with good resolution can be implemented.  Motion detection and stability were excellent. The video markers (showing detection  locations)  added to the live video were rock steady. Motion detection was sensitive and even complicated stationary objects were rejected.  Response time was 33 mSec. to 125 mSec, depending on the scan function.

The video markers were difficult to see against dark portions of the video scene.  A solution would be to sum an analog voltage with the video signal at the marker locations.  This could be accomplished from a Pic IO pin.  A high output would raise the video signal to produce a white marker.  A low output would lower the video signal to produce a black marker.  Tristating the pin would allow the video signal to appear unchanged.  The subroutine that creates the video marker already has the previous sample at that video location passed to it as a parameter.  So the marker subroutine can cause a white marker if the last sample was black, etc. Thus the markers will always show up in the video with good contrast to the surrounding scene.

Activating the servos interfered with video and motion detection due to induced noise on the power lines.  Since motion detection is only valid when the robot is stationary, this will not be a problem for normal operation.

Ranging was demonstrated and accuracy was better than 1 inch at 1 foot.

The ServoPic had good resolution for servo positioning and smooth servo movement over a useful range of speeds.  Position was not measured independently, but the position reading from the ServoPic was compared to the input pulse width of an unloaded servo and was found to be stable and repeatable to within 2% of full scale 128.  Current sensing was also difficult to test due to the short transitions of the servos, but from observation and measurement the accuracy is estimated to be within 5% of full scale 0.5 Amps.

The “all servos start” command from the PC worked, but for the robot controller program I would recommend sending the “all servos start” or “all servos stop” command three times in succession.

A 0.001 uF capacitor was added at the Linx TXM418LC input to absorb transients. This prevented transmitted data from a ServoPic or VideoPic from coupling back through the serial com network TX line to the  TXRX pin of another node.  Also low capacitance Schottky diodes were important to prevent coupling back through the TX line.

The RF circuits from Linx Technologies were effective and easy to use.  The complete robot system worked dependably after the wireless section was given its own power supply separate from the servo power supply.  Maximum RF communications range was not tested.  There was no minimum range, which is helpful during development when all of the equipment and circuits are on one desktop.

A small RF video transmitter for sending live video to the monitor during untethered operation was tested.  One drawback of the RF video transmitter was that it did not work well at close distances.

Future Versions

The next task is to implement walking algorithms.  A tilt sensor will be added and the robot balanced during the gait by shifting the body weight with a tail servo.

After the robot user interface is written for the PC, code for the menu respone of the VideoPic and ServoPics will be removed.  The extra code space in the ServoPic will be used for more complex closed loop servo algorithms.  Ranging without the laser, using video only, will be attempted with the freed up code space in the VideoPic.

The next version of the robot will use a 600 mAh, 6 V cell phone battery for both the body and power.

Conclusion

Microchip Pic12C672 microcontrollers are used in a  walking robot control system that has individually addressable servos and camera.  The small form of the Pic12C devices make them ideal for embedding in servos and video cameras.  The peripherals and performance of the Pic12C672 make it a perfect match for acquisition, communication and control.

Components (1997)

Pic C Compiler, $99 – $350
— CCS, phone 414-781-2794
RXM-LC-418 or RXM-LC-315, $11.80
TXM-LC-418 or TXM-LC-315, $5.60
Evaluation Kit, approx. $140
— Linx Technologies , phone 800-736-6677
V-X0071 CMOS video camera with a 3.6 mm lens, approx. $70
— Marshall Optical Systems Division , phone 310-390-6608
A 635nm laser module, $69
— Resources Un-Limited, phone 603-668-2499
Laser Driver #126711, $9.95
— Jameco, phone 800-831-4242
Surfboard PCB breadboards, part number 9161CA-ND
— Digikey,  phone 800-344-4539
Mini Project Box part number 270-288
— Radio Shack
Three pin servo connectors, male and female pins and shells
— FMA Inc., phone 800-343-2934
Three conductor flat cable, #759633, $12.99
Servos, all kinds
— Hobby Shack, phone 800-854-8471

____________

 

Host PC terminal controls, microcontroller firmware, schematics, BOM, etc.

Download the project design_files_PicVid97.zip.

 

____________

This post brings back memories. Image processing and robots were always colliding. My first robot was a hexapod. Los Angeles California, 1991. It walked but the plastic body was too flexible. Next time … aluminum.

My assistant now does sound design, and writes about sound design for live events.

 

At the same time I was working on a color modulator for a video modem (dial-up telephone – copper pair – POTS) for the inventor, the very cool Frank Perelman. At my day job I had a $50k scope to watch relays open and close. Here I had an old used $50 scope for watching video signals. Frank taught me to use resistors instead of tri-state bus buffers between data buses. Good times.

Color modulator in progress.

A bit noisy after another night of breathing solder.

Remedied by another night of music in LA.

Share:
---
---

Leave a Comment

Previous post:

Next post: