Tuesday, August 22, 2017
Home » Bonus Content » Picaxe Controller Part II

Picaxe Controller Part II


Small Arms Expert!

This is supplemental information to the construction article in ROBOT magazine, May/June 2012, by Eric Ostendorff. See source code provided at the bottom of this page.

ABC Blocks

Supply Voltage:

I use 4 rechargeable NiMH AA cells to power the robot and PICAXE board. After considerable experimentation, I determined that all servos operate more smoothly at 3.6V, while the PICAXE board is powered by 4.8V. The same four cells are used, but the servo power is tapped off at 3 cells. I used a two position switch in order to apply power first to the PICAXE, then optionally to the servos.

Servo Range of Motion:

The code lists my servos: PULSOUT/SERVOPOS value range in the very beginning. These are the center and limit values. You will need to experimentally determine similar ranges for each of your servos and incorporate those limits in the code as necessary. Where possible, the program listings are commented to indicate hard-coded servo locations.

Parts & Tools

Home position:

The arm should be parked in a safe home position at powerdown and powerup for protection and predictability. At powerup, the software assumes the arm is in the home position and sends servo commands to maintain that position. If the arm is in another location, it will jump to the home position suddenly, possibly causing damage. Home position coordinates are hard-coded into the software in the HOME subroutine near the end. You will need to adjust these numbers for your arm.

Gripper A

Servo motion subroutine:

In order to move all joints slowly and smoothly for precise control, the MOTION subroutine INCements or DECrements the SERVOPOS values one unit at a time from the servo’s current position (servo0, servo1, servo2, etc) to the servo desired position (goal0, goal1, goal2, etc). All six servos may move simultaneously. The servo moving farthest will be the last servo moving. Once all servos are in their goal position, motion stops and the subroutine ends.

Gripper B

Alphabet Keyboard program:

The program reads letters typed into a standard PS/2 keyboard, then picks up and stacks four 5/8″ wooden blocks.

Video: http://www.youtube.com/watch?v=kF6TwbIT384

Blocks: http://helpinghahnscom.fatcow.com/store/page7.html  ($3, mention ROBOT)

The arm coordinates for each position in the final stack are hard-coded into the program. The blocks are initially arranged in a fixed radius so that only the shoulder rotation servo must be controlled to select the letter. The block locations are not hard-coded, but calculated. Using A=1, B=2, C=3, etc, the SERVOPOS value for any letter is CON+7*N. The wrist does a 90-degree rotate maneuver after pickup to orient and center each block.

Gripper C

IR Teach Pendant:

The program reads a SIRC (Sony) protocol remote control to move each joint manually. A universal remote set up for a Sony television works fine.



Gripper Rotate 


Joints (axes) are controlled using the four arrow keys and selected using the 2,5,8 and 0 buttons on the remote. These buttons are physically inline just like the robot joints to aid the user:

2 key: gripper UP=open DOWN=close

5 key: wrist pitch & roll UP= up DOWN= down LEFT=left RIGHT=right

8 key: elbow UP= open/up DOWN=close/down

0 key: shoulder UP=back/up DOWN=forward/down LEFT/RIGHT=rotate

Grip Rotate Pitch

To record the current arm position, press the remote’s ENTER key. This WRITEs the current byte values of all 6 axes to EEPROM data memory. The first arm position is stored at locations 1-6. The second position is at 7-12, etc. Thus, the 20M2’s 256-byte data memory can store 42 sequential positions for playback. Note that since all servos move simultaneously on playback, it is possible that combined motions may inadvertently cause interference and try to “drive the gripper under the floor” or into another object. It may be necessary to move to an intermediate position between certain extreme positions to provide maneuvering room. Summary of button functions:

MENU: home arm position

ENTER: store arm position in memory

EXIT: end learning sequence

GUIDE: playback entire sequence

20m2 Board

You can modify the code to use different buttons if desired. Look in the first part of the MAIN program.

Current joint values and joint currently selected are displayed onscreen using SERTXD commands while using the remote. The arm twitches a bit with each press of the ENTER button. This is normal, as the WRITE process interrupts the SERVOPOS pulse stream, which controls the servos.

 Home  Range 9 Inches  Side View
 Top View a  Top View b  Wall Mount

ABC Blocks (Enlarged)

Top View a (Enlarged)

Robot Arm Accuracy Test

More 3-Axis Robot Arm Gripper Videos






Sparkfun Electronics