Home | Articles | Projects | Downloads | YouTube Channel   

Select the desired language Greek English

Home Projects [You are here...]

This article is not completed yet

Weird PCB Robot

This is my weird robot build with Veroboards


  • CPU: Basic Stamp 2. Board of Education
  • Motion: Two legs with 3 degrees of freedom each (Each leg looks like a PUMA manipulator, without the end effector tool). Two free running wheels are used at the frontend (no extra motors). The legs are pushing the robot like a cart.
  • Motors: Six small servomotors (1.5 Kg). Three motors on each leg.
  • Sensors:
    • Eyes: Two infrared transceivers at the front, for object avoidance.
    • Ears: Two microphones. Capability to detect sound direction.
Program - (Motion)

Programming this weird robot to move in not an easy task. The required procedures are not so simple, like in the case of a wheeled robot (or even on a three servo robot). The number of servos is enough to complicate the procedures. Using a different procedure for going forward, turning left and right is not the best way, because you will soon overflow the microcontroller's rom (EEPROM), due to the complexity of the routines.
Thinking all that, I was searching a way to make the motion routine more generic, to cover all the cases (forward, left, right, backwards etc). The simplest way is to save all the necessary PWM values to memory. The trick here is to split each motion in frames. Each frame will have the PWM values of all the servos (in our case, six). The only thing you need, is to save the number showing total frames in the motion scenario. By addressing to the start of each scenario, it is possible to write a generic motion procedure.

For the example lets take a look on how we should save the PWM values for a going forward motion scenario.

Forward0 DATA 2
Forward1 DATA Word 450, Word 550, Word 450, Word 850, Word 880, Word 600
Forward2 DATA Word 450, Word 470, Word 600, Word 850, Word 800, Word 750

The PWM values are the result of trial and error and they will be different to your robot.
In this case we split the scenario in two frames (Forward1 and Forward2). Forward0 shows the total number of frames (in our case, two). All these numbers have a meaning. In my case this is the format of each frame

Format: Total Steps (byte)
        Right Shoulder (Word) -> Right Arm (Word) -> Right Elbow (Word) ->
        Left Shoulder (Word) -> Left Arm (Word) -> Left Elbow (Word)

The first byte is the total number of the frames. The six word numbers in each frame are for the right and left leg respectively.
So in order the robot execute the movement, the only thing we have to do is point the address (word) variable to the starting address of each movement. In our case:

address = Forward0

where "Move" is the generic motion subroutine. Now, if we want to turn left will write something like that

address = GoRight0

supposing we have saved in memory the PWM values of the specific movement. For example:

GoRight0 DATA 2
GoRight1 DATA Word 330, Word 550, Word 500, Word 700, Word 880, Word 600
GoRight2 DATA Word 330, Word 500, Word 600, Word 700, Word 800, Word 700

Once we have decided they way we will save the PWM values of the servos in robot's memory, we can go on writing the generic motion subroutine. Despite the complicity the motion subroutine is quite simple

  ' Generic motion subroutine for the weird legged robot.
  ' First read total frames.

  address = address + 1
  FOR j=1 TO bdata
    ' Send total 21 pulses for each servo.
    ' 21 pulses are enough to complete the motion (of one frame).
    ' You may need to change it for different type of servos

    FOR i=0 TO 20
      PAUSE 3
      ' Read PWM value for right shoulder and send the pulse.
      READ address,Word wdata
      PULSOUT right_shoulder,wdata
      ' Read PWM value for right arm and send the pulse.
      READ address + 2,Word wdata
      PULSOUT right_arm,wdata
      ' Read PWM value for right elbow and send the pulse.
      READ address + 4,Word wdata
      PULSOUT right_elbow,wdata

      ' Read PWM value for left shoulder and send the pulse.
      READ address + 6,Word wdata
      PULSOUT left_shoulder,wdata
      ' Read PWM value for left arm and send the pulse.
      READ address + 8,Word wdata
      PULSOUT left_arm,wdata
      ' Read PWM value for left elbow and send the pulse.
      READ address + 10,Word wdata
      PULSOUT left_elbow,wdata
 ' Go to next frame

    address = address + 12

First we go to the address stored in the variable address and we read the total number of frames (variable bdata). Each frame is consisted from 12 bytes total (6 word values). Next we read the six word PWM values with the order we discussed earlier and simultaneously we send the pulses to the servos. Each stored value is the duration of the pulse we must send to the appropriate servo. In reality each value is the duration in milliseconds divided by the factor two, because 2ms is the step of Basic Stamp 2.
For each frame we send the same PWM values to the servos for 21 times (meaning we send total 21 pulses to each servo). This is important or else the motion will not be able to complete (servos require a number of pulses to complete their movement to the desired position).
When sending of all these pulses is completed, we go to the address of the next frame (if this exists) and we repeat the process. The reason we increase the value of the variable address by 12 is because 12 bytes are stored in each frame, as we said earlier.


In the following picture you can see the robot


Watch the following videos of the robot in action

Created: 18/11/2005
Updated: -

Home | Articles | Projects | Downloads | YouTube Channel
Copyright 1997 - 2009 Dimitris Piperidis. All rights reserved