Using a Robot Arm with FUZE BASIC

As part of the educational kit, the FUZE Workstation can be purchased with an accompanying robot arm. This is a 149 piece kit-form robotic arm, that requires assembly and is powered by four D-type batteries. It’s connected to the RPi or FUZE via a USB cable and is also Windows compatible.

I, ROBOT

We won’t go into the construction of the robot arm here, the instructions which come with the arm are easy to follow and it can be completed and ready for use within a couple of hours or so. Let’s look at how to get it working.

STEP 1

The robot arm is one of the first external hardware components that was released and fully compatible with the Raspberry Pi; as such, it’s an excellent project to get into, from the construction of the arm itself, to operating it via the FUZE Workstation.

STEP 2

Start by plugging the robot arm into one of the spare USB ports on the back of the FUZE workstation. Ensure that the arm has its batteries correctly in place and that its power switch is On. Now open FUZE BASIC and remain in the Immediate Mode.

STEP 3

To begin with, let’s look at a few commands to make the robot arm move. In Immediate Mode, in FUZE BASIC, enter:

ArmBody (1)

This starts the arm rotating clockwise (looking down on it).

STEP 4

Once the arm begins to rotate clockwise it will get to the limit of its range and start clicking. When it starts this quickly enter the command:

ArmBody (0)

This will stop the arm from moving.

STEP 5

Now enter:

ArmBody (-1)

This will start moving the arm anti-clockwise. Again, when it starts to click enter the command:

ArmBody (0)

To stop it from moving.

STEP 6

The other commands to make the arm move are:
ArmShoulder          (x) – where x can be 1, -1 or 0
ArmElbow (x) – where x          can be 1, -1 or 0                               
ArmWrist (x) – where x          can be 1, -1 or 0                               
ArmGripper (x) – where          x can be 1 -1, or 0
ArmLight (x) – where x          can be 1 or 0

Note: you can press the up arrow key to re-enter the previously typed commands, so you can quickly stop the arm’s movement when it reaches its limit.

STEP 7

Let’s create a program allowing you to move the arm around freely. There are some new commands here: PROC and DEF PROC, that enables BASIC to jump to a PROCedure, another part of the program, then back with ENDPROC. FONTSCALE determines the size of the on-screen print display and HVTAB is an X and Y coordinate system to print on-screen.

STEP 8

Press F2, and type in the following:

PROC ResetArm
PROC DisplayInstructions
End
DEF PROC ResetArm
ArmBody (0)
ArmShoulder (0)
ArmElbow (0)
ArmWrist (0)
ArmGripper (0)
ArmLight (0)
ENDPROC
DEF PROC DisplayInstructions
CLS
FONTSCALE (2,2)
Ink = Red
Print “I, Robot”
Ink = White
HVTAB (0,2)

This is the start of the program, resetting the arm and preparing the on-screen display.

STEP 9

Now to expand the program to control the arm:
Print “Press:”
Print
“1 or 2 for Body Left & Right”
Print “3 or 4 for Shoulder Up & Down”
Print “5 or 6 for Elbow Up & Down”
Print “7 or 8 for Wrist Up & Down”
Print “9 or 0 for Gripper Open & Close”
Print “Enter to turn the Light On or Off”
Ink = Red
Print “Spacebar to stop all movement and turn off the light.”
ENDPROC

STEP 10

Now we need to process the user input. There’s a lot here but type the content as shown in the screenshot. Save the code and Run; you can now control the robot arm using the number keys 1 to 0, the Enter key for the light and Spacebar to reset everything.

More information