Make and Program Your Own Robots For The Commodore 64 and VIC 20
Make and Program Your Own Robots For The Commodore 64 and VIC 20
YOUR OWN
ROBOTS
FORTHECOMMODORE64
AND VIC20
WILLIAM CLARK
BEAVER BOOKS
== CONTENTS
About this book ....... ... .... ..... ........ ..... .... ..... ............ ...... ... .. .... ...... ...... ....... ........ 3
Linking up robots to your computer .. ............. .. ... .... ........... .............. ...... ....... ... 4
Programming and robot control ..... ...... ... .. .... ..... .... ........ ..... .... ... ... .......... .. ..... . 5
Wiring and electrical circuits .. .. .. ... .. ....... ....... ... ..... ... ........ .. .. ... ..... .. ... ..... .. ..... .. 6
Using LEGO® ................ .. ... .......... ..... ... ........... .. .. .... ... ......... ... ...... .... ........ ..... . 7
Projects
1 Walking Android ..... ..... ........... .... ... .......... .. ... ...... .. .... .... .. ... ... .. ..... ....... .. ... 8
2 Whirly Turtle ............ ............ .... .. .... .. ... .. ......... ......... ...... ...... .. .. .. ......... ..... 11
3 Lift Operator .... .... ....... ...... ..... .......... ... .. ... .... ....... ..... .. ..... .. .... ... ..... .... .. .... 15
4 Card Reader ... ....... ..... .. ..... ...... ... .......... .. ..... ... ... ...... ..... ...... .... ........ ... .. ... 20
5 Mini-arm ... ... ..... ......... ... ...... ... .. .. .. .. .. ... .. .. ..... ... .. .................. ........ ....... ... .. 25
6 Plotter...... .......... ..... .... ....... ..... ..... ...... ... ..... .. ... ..... ....... ....... .... .... .. .. ..... ... . 32
7 Maxi-arm ......... .... ..... .. .. ...... ..... .. .. ... ............ .. ... ..... ..... .... ...... .. ..... ....... .... .. 40
Useful addresses and information ...... ........... .. ... .. .. .. .. .. .. .... ... .. .. .. .. ................. 48
All rights reserved. No reproduction , copy or transmission of this publication in any form or by any means, may be made
without written permission from the publisher.
This book is sold subject to the condition that it shall not, by way of trade or otherwise, be lent, resold , hired out, or
otherwise circulated without the publisher's prior consent in any form of binding or cover other than that in which it is
published and without a similar condition including this condition being imposed on the subsequent purchaser.
ISBN 09 942660 9
2
ABOUT THIS BOOK
Many of you may think that typical robots are like All our robots are made from LEGOI! Technic
R2D2 of Star Wars fame, the Daleks of Dr Who or building sets and motors. Many of you will probably
like machines that walle and talk like a human already have a collection of LEGO pieces .
b eing. This is mostly untrue, as you will discover To program the robots, you will need, in addition
fro m the projects in this book. A robot is any to your home computer, an interface unit. We have
machine that can be programmed by a computer to used a readily available purpose-built interface unit
carry out a task automatically. Most robots do but if you are good with electronics or know
simple jobs that people find boring or too someone who is, you could make your own from the
dangerous to do. details we provide. To SAVE the robot control
There are seven robot projects in this book for programs, you will also need a cassette tape
ou to try. The projects are designed to give you an recorder or disc drive unit, and to display and
_-sight into the basics of how robots are built and check your programs, a tv or monitor.
ork. They are very simple and start with a walking Before starting the projects, read the following
:-obot and progress to a 'pick and place' robot arm. four pages to become familiar with the basic
=-or each project we provide full details of what the techniques and skills you will need to build and
:- bot can do, how it does it, what you will need to program the robots. Then, we recommend that you
::::ake it, how to build it, link it to your home try the projects one at a time in the sequence they
mputer, and program it. After completing the are presented in the book. None ofthe projects
:;::- jects, you should be able to build and program should take you more than two or three hours to
:- . ts of your own design. complete.
3
I LINKING UP ROBOTS TO YOUR COMPUTER
To control the robots in this book using your contains six electronically controlled switches
computer you will need an interface unit. This is a called relays. A relay is a switch in which the
device that links together the motors in the robots, contact - the part that does the connecting (closing)
the battery box power source and the computer. and disconnecting (opening) - is moved by the
Inside the interface unit is an electronic circuit that force of an electromagnet. When the magnet is on,
switches the power to the motors on and off when the contact moves to the conducting position.
instructed by the computer. We have used an When the magnet is off, the contact is pulled away
interface unit called a VicRellt can be obtained by a small spring and the relay stops conducting.
from any good computer dealer or from one of the The relays allow the computer to switch on and off
suppliers listed on page 48. devices such as motors, lamps and alarm bells.
The VicRel comes with an instruction leaflet.
Study this carefully before proceeding. The unit
Turn off your computer (remembering first to SAVE Also on the VicRel there are two switch inputs.
any important programs) then plug the interface These allow you to connect ordinary switches to the
unit into the user port on the back of the machine. interface so that the computer can sense when the
Now turn the computer back on. First you must set switches are open (off) or closed (on). In some of
up the user port to transmit signals to the relays and our projects we use simple switches as sensors.
receive signals from the switch inputs. Type You could, though, use switches in, say, floor mats
COMMODORE 64 VIC 20 or door handles and use your computer to operate a
POKE56579,63 POKE37138,63 burglar alarm
The relays are numbered I to 6. Each relay has a
control value as follows Using the switch inputs
Re~y 1 2 3 4 5 6 To find if either of the switches is open or closed,
Control value I 2 4 6 16 32 you have to 'look into' the computer's memory,
To switch on any relay, type where an item of data is automatically changed by
POKE56577, control POKE37 136, control the switches turning on and off
value value To test if switch 1 is closed (on), type
For example, to switch on relay, 1 type PRINT PEEK(56577)ANDI28 (Commodore 64)
POKE56577,1 POKE37 136, 1 PRINT PEEK(37136)ANDI28 (Vic 20)
To switch on relay 5, type If it is closed, the computer will print O.
POKE56577,16 POKE37136,16 If it is open. the computer will print 128.
By adding together control values you can switch Testing for switch 2, instead type
on combinations of re~ys. For example, to switch PRINT POKE(56577)AND64 (Commodore 64)
on re~ys 2 and 6 (control values 2+32), type PRINT POKE(37136)AND64 (Vic 20)
POKE56577,34 POKE37136,34 and the computer will print 0 if it is closed and 64 if
To switch on relays 3 and 5 (control values 4+ 16), it is open.
type This happens whatever state the relays or the
POKE56577,20 POKE37136,20 other switch sensors are in
To turn off all the relays, type
POKE56577,0 POKE37136,0
To convert the programs in this book for
When you type these commands only the relays the Vic20 change line 20 in every program
you want to go on are operated, all the others are to:
turned off (if they are not already off). 20 PRT =37136:POKE37138,63
The following program will switch relay 1 on
and turn on the motor when you press any key:
10 POKE56579,63 10 POKE37138,63 (In case you cannot obtain a VicRel or should you
20 GETA$:IF A$=""THEN20 wish to build your own interface unit, we supply a
= 30 POKE56577, 1 30 POKE37136, 1 F= circuit diagram on page 48.) =
PROGRAMMING AND ROBOT CONTROL
When you have built a robot you
CHECKING CONTROL SYSTEMS
are going to control using your
computer, type in the program
printed with the project. If you To check a program, first carefully compare the lines you have typed in
have not typed in programs with those in the program printed in the book Ifyou thinkyour program
is correct but you are still having problems, refer to the table below.
b efore, look in your computer's Here we list some of the most common problems which occur with the
manual to see how it is done. robots together with the remedies.
The interface unit should be
plugged into the user port before Problem Remedies
you turn on the computer and None of the motors will run Check the batteries are fresh
start typing in the program. Take Check the wiring and connections
care to type in the lines correctly. are good
Do not try RUNning the program Check that the LEGO plugs are
until you have typed it all in. plugged in properly.
When you have entered all the Make sure you are switching the
program, SAVE it on tape or disc. correct relay.
Do not RUN the program, unplug All the motors run in the Change the position of the
the interface unit or turn off the wrong direction pole reverser on the
c omputer. battery box.
Having SAVEd the program, If you are not using a pole
VERIFY it to check it is stored reverser, turn the plugs over on
properly. Then try RUNning the the battery box.
program. If the program causes
the computer to crash, LOAD the One of the motors runs in the Turn the plug over on
copy on the tape or disc back into wrong direction that motor.
the computer and check it The motors run but will not Check the switches are send-
through on the screen. stop under computer control ing pulses to the computer by
watching the green lights flash on
the VicRel
Check that when one motor stops,
Writing your own control its switch remains in the on
p rograms position.
After you have done some of the
projects, you should start to
understand how we use the interface
unit to control robots. You should be
able to write your own simple 10 REM ••LIFT (ONTROLLER** 20 set user port address
20 PRT=56577:POKE56579,63 30 set variables to drive Up,
programs to switch motors on and off 30 UP=9:0W=6:SP=O:CL=1 Down , Stop. Set Current
We use some of the interface unit 40 INPUT"WHIGH LEVEL 1-7";NL Level to 1
relays to do the pole reversing S0 IFNL)70RNL(tORNL=CLTHEN4~ 40 ask Which Level. Set Next
60 TD=NL-CL
(changing the direction of rotation of 70 IFSGN(TO )=-lTHENPOKEPRT, DW
Level to this vatue
50 check level between 1 & 7
the motors) and some to switch the 8u IFSGN(TU)=ITHENPOKEPRT,UP
60 find Travel Distance
90 FORI=ITOABS(TD)*6
motors on and off To help you lB~ IF(PEEK(PRT)AND128>=BTHENl0f' 70 switch molar on. II travel
understand the structure of our I 1~ IF(PEEK(PI<'T)ANDI2B)=128THEN110 distance negalive:Down
programs and what each line does, 12(' NEXT! :CL =NL 80 switch motor on. If travel
130 POKEPRT,SP:GOT040 distance positive:Up
opposite is a copy of our Lift Operator READY. 90 set up program to count 6 x
project program fully labelled and travel distance pulses
annotated (see project on pages lrom the interface
100 wait for switch to open
15-19).
110
120
wait lor switch 10 close
finish counting pulses. Set
Current l evel to Next Level
F= 5
130 switch motor off. Go back
to.line40
I WIRING AND ELECTRICAL CIRCUITS
To connect up your robots to the interface unit you
will have to do some simple wiring. For each cable
battery box
project we have provided a simple wiring diagr.am
in which we have drawn the components life-like. plug
The illustration opposite shows thCJ components. @@@@@
The cable we use for most ofthe projects is ~ @©©@©
called ribbon cable. It is flat like a ribbon and has ~
several strands which run side-by-side. It is best to
-
buy about 2 metres of 20-way (20-strand) ribbon switch pole reverser
cable which will suffice for projects in the book.
In our wiring diagrams we have shown the
.-....... mmm
interface unit on the left, with the terminals JJmIL
numbered, and the motors, battery box and so on,
and the wires corning from them, on tlie right. interface unit
The ribbon cable and all other electrical
components are obtainable from any good
electrical or electronics store or supplier.
In our larger projects we show you in the wiring To connect the wires from the motors, switches and
section how best to cut and separate the individual so on into the VicRel, undo the little terminal screws
strands of the ribbon cable to wire up the robot using a small screwdriver and into each hole ofthe
motors and switches. Separate the strands by unit poke the wire or wires as appropriate. Tighten
gently pulling them apart. Some of the projects use the screws down firmly but not too hard. It is
non-standard widths of ribbon cable, such as 4-way sometimes useful to bend each twisted wire back
or 12-way. In these cases, split the 20-way cable against its plastic sheath. This can stop the wire
along the entire length you wish to use then cut off breaking if accidentally tugged when fixed in the
the appropriate section. VicRel.
Once you have cut the cable to length, strip the Wherever you have to make an electrical
plastic sheathoffthe ends ofthe individual strands. connection, the wire should actually touch (make
It is best to use wire-strippers for this. Close the contact with) the metal of the terminal.
cutting blades gently onto the strands so you cut the Below are examples of some of the connections
plastic but not the metal wire. Then slide off the we use in our wiring diagrams.
~
plastic. Strip about 8mm of sheath off the end of
each strand. Finally, twist together the metal fibres
~~C:~~d
of each wire.
~ toonepinofa
motor/battery plug
6
USING LEGO
~ e robots in this book are all constructed from
:..EGO! Technic pieces. We chose LEGO because it
~~@~Yl
•I
.:S e most popular, most widely available and most
ersatile of all children's model construction Beam (8 units)
systems. It is of course possible to make robots with
- er types of building kits and you might like to try
:::is after making our designs.
~
Plate (2 x 6 units)
24-tooth cog
e.':~~i ~h i, *
aid instructions and the same component names as
=sed in LEGO plans. The illustration opposite
-..., ws and labels the main components. Where
--ere may be confusion over the name used for a
sma!! pulley
ponent or the component is unusual we have
ted it in the parts chart we provide for each (SP) 0
ect large pulley (LP) crown (24C) 1/2 bush
=-::.~ earlier projects in the book are designed so Most robots are simple to control if the moving parts
..r.c... <hey can be built with just the parts contained operate slowly. You will have noticed in your LEGO
~ i:. standard LEGO kit or combination of standard motor instructions that to make things move slowly
But if you do not already have the kit we you need to 'gear down' the power from the motor.
_::ccmmend you buy, you can try and follow our We found it best to take the initial power from the
GC.SlC design and modify the robot to suit the pieces motor using a belt driving a large pulley wheel
_...;. do have. You may even be able to improve on (LP). This causes the motor to do 10 revolutions
...::deslgns! while the pulley does only I -a gearing down of 10
:: you need to obtain one or two specific to 1. If one then mounts an 8-tooth cog wheelan the
:::::~ponents you can probably obtain them from the pulley's shaft and uses this to drive a 40-tooth cog
=00 Spares Service. To order from this service wheel, the pulley does 5 revolutions when the
need an order form printed at the back of a 40-tooth cog does only 1 (a gearing down of 40/8 or 5
"'-::00 catalogue. The catalogues are available from to 1). The overall effect is that the motor does 50
shops and department store toy departments. revolutions while the 40-tooth cog - the output from
=- e best kits for building robots are those which the motor - does only 1. This is a reduction in speed
:::::~ lots of pins, pegs, gears and toggles as well of 50 to 1. You can see that by using different
=- :JeaIIlS and plates. The motor starter set No. 8050 combinations of gear wheels you can get a series of
..5 ~ Ideal set to start with. Supplementary set No. different reductions.
=:=-:" is a very good extension of any LEGO (When using switch between the switch
_~ection if you are going to progress to building
sensors note that the closing mechanism and
=-;;;e robots. The motors used in the projects are output-wheel, robot the output. Drive belts
- - .oo.ttery powered 4.5V Technic motors but you arm etc. - must be will slip.)
:z: use the l2V Technic motors (as long as you driven by toothed 'gears
-=;e a power pack) or the large 4.5V motors
gh you may find it cl,ifficult to build these
--: ur designs.
bots at school
..:. ..:. plan to build robots at school, it is possible to
-x ·. . e Educational LEGO Spares Service, which is
--.:.:::per than the ordinary spares seryice. For
-- . see page 48.
7
5
WALKING ANDROID
With just one motor and a few parts, you can build a
robot that walks along on two legs. Our design is an
android, a robot that looks and acts like a human.
But as you will see if you try yourself, it is difficult to
make a machine that walks exactly as we do.
This robot walks well because it can balance
in any position. You can test this by connecting it
to the battery box and stopping it in different
positions. The android keeps upright and stable
because its legs are rigid, its feet overlap one
another, and its weight is always spread over an
entire foot.
Beams
Plates
j1x2 j1X3 j1 x4 j 1x8 j2X 4 j 2x8
J
[6 J 3 J 2 J 2 J 4 J 3 J
Axles
I! I; I : I
Gears
8
I~ I ~I~I ~ I~I~I
8
CD
a
hand.
Rotor
arm f!ife
/:). Assemble and fit the four leg
rotor arms onto the 6-length axles.
The arms should be at the same
angle on each sid e of the body but
opposite to one another on either
side, as shown .
9
[> The body unit is now complete .
Lift it into the upright position
ready to add the legs.
[> Build each leg from the parts structure with simple sensors and ,
shown and attach it to the body as a fini shing touch , have fitted a
using rotor arm pins. Th e pins fit 'nose' below.
into the th ird and seventh holes of Test th e android on a battery
the 16-unit beam of each leg. box. If it moves stiffly , loosen all
Add a head of your own the gears. Th en connect it to the
design - we 've just used a computer.
I PROGRAMMING Wi RING
Program 1 starts the android when a key is pressed and
stops it when another key is pressed. (Any key can be
used .) Program 2 starts the android in the same way but
stops it after about 7 seconds . You can lengthen or
shorten this period by increasing or decreasing the delay
value in line 50. Try to adjust this number so that your
android takes one slow step at a time . Both these
programs can be used to control a motor in any of your
own androids or indeed any robot.
10
HIRLYTURTLE WHAT YOU NEED
All the constructional pieces can be obtained from the motor kit
No. 8700 (or 880) and the supplementary kit No. 8710.
_:--e walking android in Project 1 did not have a very
_ be:> 'c function except to show how to switch a
Ion and off using the computer. In this project,
-~ e computer controls the motor in either direction-
=hckwise or anticlockwise. As a result, the floor
_ bo or turtle, can perform two functions. It can Plates
=-'7"'e forwards and it can spin round. This is similar
- standard turtles except that they can turn to the
~efl or right and drive forwards or backwards.
Om turtle has a holder for a pen, which allows it to
=---aw lines on a sheet of paper as it moves forwards.
en the turtle spins, it pivots about the pen and so
Gears
:xl line is drawn. Lay a large sheet of paper flat on a
:aD e and try and operate the turtle to draw different
- ' pes and patterns. Draw a few lines with a blue
_ e n, the n change this for a red or green pen.
Fibre-tip pens are the best to use.
12
Motor
I================~ assembly
. add the motor assembly of v Fit the rear wheels onto half-
:;:es and gears beneath the large shafts and slot these into short
_ vss -plate. (Note, this is the beams on plates either side of the
"ear of the turtle.) motor unit. Push two 8-unit axles
with bushes at the top through the
top and bottom cross-plates and fix
half-bushes onto the bottom ends.
The axles must not touch the ground.
13
1
Operating hints and tips
1 As the turtle whirls about, the wire from the motor can
sometimes get tangled in the wheels. Strap the wire to
one of the bushes on top of the vehicle using a rubber
band and ho ld the wire so that it hangs down to the turtle.
2 The pen tip should rest directly between the two rear
wheels or when the turtle spins it will draw a little circle .
I PROGRAMMING
The first program allows the whirly turtle to be
controlled directly from the keyboard using the S key
to spin and the F key to drive forwards . The Pattern I WIRING
Drawer program allows you to instruct the whirly turtle
to perform several moves which it then repeats. The The interface block
DATA program line contains pairs of command numbers. is being used as
The first number tells the turtle how many units to a pole reverser
spin, the second how far to drive forwards . The main to drive the
program draws cypentagon . The series of moves are motor in two
ended by putting 0, 0 at the end of the DATA line. We directions.
have provided some alternative DATA lines. Experiment
by inserting your own command numbers.
-=--'---=-..L....:=.......J---'--'--'--'--'---' Plates
~ I8l24TLPl
CI2JAxles ~Gears Fourth floor-going up
The lift car is win ched up on a piece of string wound
round the axle at the top of the shaft. The motor, whi ch is
geared down , drives the axle back and forth. As the car
goes up or down , the switch mechanis m closes the
• moto r, 3 1 x 8 steering plates, 2 drive belts,
switch six times between each level. The switch sends
30cm length of string , 3 2.5cm·squares of cooking foil , pulses to th e computer, which is set up to stop the car
a paper clip , 50cm length of 4-way ribbon cable. after 6, 12, 18, 24 pulses and so on . So to go from the 4th
to the 6th floor the computer counts 2 x 6 = 12 pulses.
15
CD
\l The base is a simple assembly of plates and beams. \l Build separately the four main upright supports.
A steering plate is used at the back as a cross -link. Fit pegs top and bottom as shown.
® ~
~
': ~
~
~
~
ct
~
~ ~
~
"
~
~
~
~
•
~
~
~
~
~
~
\l Attach the supports to the base. (Only the bottom ~ ~
ends of supports are shown.) Push the pegs in firmly. ~ ~
~ ~
~ ~
~ ~
~
~
~
"
~
~
~
~
~ ~
(f)
~
~
~ ~
~~
16
®
17
MAKING THE SWITCH
b
g::z c
=-=
2 Bend the loop into the shape shown then poke it
through a pin with a hole through it. The loop at
the end of the clip should be about 3mm across.
~ ]t
"{;;JJ
'-
back and through the slots in the pin .
/ '
.~
) b "'-.:. '\ "=
: ~ .~ ' ~)~~ ~
4 Wrap anoth er pin with a square of foil. Then
push the three pins into the holes indicated. 6. Add the switch beam , plain beam , cross-plate
and motor. (See left for details of how to
[~B~~fi~~i~~J
make the switch.) The paper clip on the switch
Foil pin Third pin sho uld be pulled over to be above the foil.
Fix the belt between motor and pulley wheel.
PROGRAMMING WIRING
~ - program will move the lift car to The wiring is similar to that for
eve I. When you RUN it, the the Whirly Turtle project except
"'puter assumes the lift car is at there is also the home-made switch
_= el 1 (ground floor) . If it is not, and a pole reverser is fitted
~ "nect the motor to the battery box to the battery bo x.
d move the car to the bottom of the
aft. Then reconnect the motor to
"interface. The program will ask
~u 'WHICH LEVEL? ' Type in a
.. 'TIber from 1 to 7 and press 10 REM**LIFT CO NTROLLER**
::-::TURN . The car will move to that 20 PRT=56577 : POKE56579 63 J
= el and automatically stop . It does 30 UP=9:DW=6 : SP=0 :CL=1
- s by driving the motor in the correct 40 INPUT "WHIGH LE VEL 1-7";NL
:: 'ection and then counting the
:: Ises from the switch. (If you wish to
50 IFNL)70RNL(10RNL=CLTHEN40
~se a taller lift shaft you will have to
60 TD=NL-CL
: ange the value 7 in line 50 to the 70 IFSGN(TD ) =-ITHENPOKEPR~DW
-J mber of levels in your model.) The 80 IFSm~ ( TIl >= 1 THEtWm::EF'f<:T.I UP
:rogram will then again ask the 90 FORI=lTOABSCTD)*6
:uestion. Note that if you type in , say , 100 IF ( PEEK ': PRT::O mm 128.) =0THEN 10"(1
2 , the lift car will move to level 2 and 110 IF ( PEEK(PRT : O AND128)=128THEN110
-ot just go up or down two floors .
12 0 NEXT I : CL =t~L
13 0 POKEPRT,Sp:GOT040
READlrl.
19
CARD READER WHAT YOU NEED
This simple device allows the computer to identify The maiority of pieces can be obtained from
motor starter set No. 8050.
a cardholder by reading the number encoded on a
card. It could be used as the basis for a security
device on a safe or on a door so that only certain
people are allowed into the room. Or it could be I-I-!-+I-;-+I----':--+I-:-t1_!- t--:--i1
1 1
Beams
used as a card reader in a cash dispenser, and you
could have a bank account record in your
computer. Pla,tes
The identity cards are made from ordinary
cardboard. The number on each card is encoded in
binary as a row of punched holes. You may have
encountered binary numbers in your computer's
manual or learnt about them at school or computer
tHE
2 3 Axles
I
8
3 I
24 40 SP
Gears
I~I~I.:.I I
4
club. Binary numbers use only two figures, or digits,
oand 1, to represent numbers. So 1 in binary is 1, 2 IbII
is 10, 3 is 11,4 is 100 and so on. In our machine
1 motor, 4 small wheels, 1 10x20 base plate , 6 drive belts, 1 1 x 8
cards, a hole punched thro~gh the card represents steering plate , 2 1 x 2 smooth plates, 50cm length of 6-way ribbon
1 and an absence of hole (solid card) represents a O. cable , 6 2.5cm squares of cooking foil, 2 paper clips.
As a card feeds through the reader, its code number is
read by th e com puter.
20
= :a d IS put in the correct way round , the far the card has moved through the machine. Th e
"::; In the reader is opened and the right-hand row of holes contains the binary encoded
'"5 ""e motor on . The card is drawn in by the number. When the computer has finished reading the
- - : a d the holes pass under the switches. The code , the motor is left running for a short while and the
, noles allows the computer to sense how card is fed out of the reader. The motor is then turned off.
- of motor
ent to base plate
21
C> Make up the next level of beams ,
axles, gears and small wheels, and
place it in position on the first
level.
22
!:::. The switches are of a
different design to
switches used elsewhere in
the book. The arms of the
paper clips should be set
to the angle shown .
Here is a simplified industrial robot arm for you to All pieces can be obtained from motor starter
build. Industrial robots do simple jobs that people set No. 8050, supplementary set No. 8710 and
motor unit No. 1175 (from the spares service) .
find boring and repetitive, such as packing and
sorting. They can also perform dangerous tasks,
like mixing chemicals and handling radioactive
materials. Our robot arm can pick up small
objects, swivel round on its base, then place
them down anywhere within its reach.
Our design uses two motors to do the job that
in larger robots is normally performed by three
motors. One motor drives the arm round on the 1 : 12
. 4
4 12~C 1. ~O I. SP3 1LP1 I Gears
.
base, while the other motor raises and lowers the
~O
arm and operates the gripper. The base and arm-
often called the waist and shoulder - both have 1 ; 1 6 I : I I Axles
built-in switch sensors. These, together with the 2 motors , 3 small drive
program, allow you to 'teach' the arm a set of belts, 3 large drive
belts, 50cm length of
moves which it can then repeat completely 8-way ribbon cable.
under the control of the computer. For the switches - belts ,
cooking foil , paper
The robot arm, with a small cube held in its gripper, clips.
swivelling round on its base.
25
Up, round, down; up, round , down
As the arm turns at the 'waist'
it can stop at anyone of 36 set
positions, and as it moves up and
down at the 'shoulder' there are
7 or 8 stop positions from bottom
to top .
The gripper closes its fingers
on an object. When the fingers
cannot close any more, the arm raises
up to the chosen position . Then
the arm turns , lowers and , as the
object touches the tabletop , the
grippers open. This is a 'pick-
and-place ' action .
THE BASE
'V Construct the bottom part of the 'V Assemble and add the next level ,
base with beams and plates from the with gear wheels, axles and so on,
supplementary set. Add the upright making sure you have used the
axle and the gear wheel. correct pieces (see insets for
details). Place small drive belts
on the pulleys. Make sure the
gears mesh properly and move freely.
CD
26
> Another layer of plates is
added front and back . Th e motor
®
unit that tu rns the arm is fixed at
he back of the base with more
plates. Hook the loose drive belt
onto the motor spindle.
27
THEARM
View from
underside End-on view of
front of arm
28
I> Add the last layer of gears and
beams to the top of the model. The
gears should move freely and
smoothly .
®
View of motor-
pulley assembly
29
V Attach the arm to the 2 x 8 plate
on the base.
6-7cm
12-15cm
15 - 20 c m
I.. ~I
40cm
30
Ie REM MINI ~RM CONTROLLER
20 PRT=56577:POKE56579 J 63
30 DR(0)=6;DR(2)=9:Ml=16:M2=32:T=129
40 DIMRl(50))R2(50 ) I PROGRAMMING I
100 REf'i t1EtiU After typing in the program , SAVE it
110 PRItH":J'1ItH AR~l PROGRAt'lt'lER" on tape. When you RUN the program ,
12(1 F'RItH")lBELECT:-" the menu will appear on the screen.
13(1 F'RItH"1l1 - TERCH t10'\"E:?" Select an option by pressing either
14(1 PRItH lin? - REPEAT ~10¥'ES" the 1,2 or 3 key. To TEACH the arm a
150 PR I NT")Il3 - SET HOt'lE POS IT 1 ON" series of moves , use the 1 and Q
keys to make the arm turn to and fro,
17(1 GETRf:lFVAL(Rf)(10RVAL(Rf»3THENI70 and 2 and W to make it go up and
180 ON VALCRI)GOSUB200,30G:400 down . At the end of each move, press
190 GOT0110 S to set the position in memory. At
200 REM TEACH MOVES the end of a series of moves press
210 PRItH":JTEACHHW ~l(tDE":RP=l : A:i='''' RETURN to go back to the menu.
22(1 >~$=A$: GETAt Pressing 2 will repeat the moves
230 I FA:t=" "ANDPEEK( 197) <:> 64 THEHAt=XI that you have taught the mini arm.
HOMING the arm allows you to use
240 IFAS=CHRt(13)THENRETURN the programming keys to set the first
250 IFA:t="S"THENGOSUB270 position for the series of moves.
260 GOSUB500:GOT0220
270 REM SET R POSITION IN ROUTINE
280 RICRP)=C1 :R2 (RP)=C2
290 RP=RP- (RP<50)IRETURN
300 REM REPEAT MOVES
310 PRINT":-REPEATING t'lO'v'ES"
320 FORI=0TORP-l:Nl=Rl(I):N2=R2(I)
330 G05UB600:NEXTI :RETURN
4(10 REf'1 HOt1E ARM
410 PRItH":'}-lOt'lE ARt'1 t'10DE"
420 GETA$:IFRS=""THEN420
430 IFA$=CHR$(13)THENC1=0:C2=(1:RETURN
440 GOSUBS00:GOT0420
508 REM CALCULATE ' DRIVE VALUES
510 Nl=Cl+ (At="l" ) - ( A$="Q" )
520 ti2=C2+(A1= "2" ) -(A$="W' >
5313 GOSUB6012i: RETUf;:N
60~ REM DRIVE TO Nl,N2
610SP=Nl-Cl:JF5P=OTHEN630
620 POKEPRT M1+DRrSGNCSP ) +1) ~GOSUB?00
J
63~ SP=N2-C2:IFSP=QTHENG5C
640 POKEPRT~M2+DR(SGN(SP)+1);GOSUB7GB
650 (,1 =1-11 : C2=N2: RETLJR~j
700 REM COUNT PUlSES
710 FORQ=lTORB£(SP)
726 lFCPEEk(P~T)AND T )=0THEN720
730 IF(PEEK(PRT)RNDT)=TTHEN730
740 liEXTQ: POkEPRT / (3 : RETURN
READY.
31
PLOTTER f-'=--+---+-=-_+-:=---+-..:.~2=-+-.:. :1:86 . .-j1 Beams
I;.I ~I~I ~
attached to a drum which is rotated, and the pen is 2 5 3 2
moved from side to side only. Our model is a drum ItII ~ ill:::5
plotter. It uses two motors, one to move the pen, the
other to move the drum. A home-made
electromagnet raises and lowers the pen.
2
11
4
10
8
2
INon-holed
beams
2 4 6 8
Doodle, doodle, doodle 2 1 2 Axles
The motor at the front drives the penholder to the left and
right across the paper to draw horizontal lines. When the
drum is rotated but the holder kept still, the pen draws 2 motors; 4 small belts, 3 medium; 2 large wheels; 4 plugs, 2 battery
vertical lines. Diagonal lines are drawn using a boxes; 50cm length of 1O-way ribbon cable, 1 paper fastener, paper
combination of small vertical and horizontal lines. To move cli ps, 1 steel metric-5 25mm -long bolt with nut; 34 s.w.g. enamelled
copper wire (obtainable from electronics shops); thin card,
the pen to another point on the paper without drawing a double-sided sticky tape, Blu-Tack, 2-way terminal block.
line, the holder is raised . This is done by turning on the
electromagnet, which attracts a small metal paper fastener
fixed on the holde r.
32
<l Build the frame forthe base.
Break a medium belt, tie one end
through a rim-hole on the pulley
and make a knot, and secure
the other end to the cross-
beam using a pin .
6 33
<J At the back of the assembly,
add the plates and switch for the
belt drive. Remember
to pull the paper clip arm over
above the foil pin before
securing the switch. The paper
clip should be slightly curved
on what will be the left-hand
side of the switch (see inset) . Rear of
drive
assembly
® ®
34
!> Working again at the front
left-hand side , add the other
half of the chain drive assembly.
Allow the chain to pass under
the 24-tooth cog wheel.
o
®
!> Make up the slide that supports
the penholder. The half-bushes
sit on studs on the plate.
0000
10000 1
~1~11~11~lrrll~§;~~~
~
O~~~~~
0000
0000
0000
35
8 8
36
I> Fix the drum on the plotter
frame . Note the drum-supporting beam
units. Add the two motors and medium-
size belts. Wire up the model. Two
loose wires go to each of the switches,
a plug to each motor, and the last two
wires go to the electromagnet.
E
It)
N
6
37
MAKING THE DRUM MAKING THE MAGNET
You will need 2 large LEGO wheels , a piece of You will need a 2 x 4 holed plate, 2 half-pins,
card 160x280mm and double-sided sticky tape. 1 steel M5 25mm bolt with nut, and some 34 s.w.g.
1 Wrap double-sided sticky tape round the enamelled wire.
outer edge of each wheel. 1 Poke the bolt through the central hole of
2 Peel off the tape backing and the plate and screw on the nut undern8ath. Do
roll the card round the wheels. not over-tighten.
The edges of the card must align
with the edges of the wheels.
3 When you have nearly finished
rolling the card round, place a
strip of sticky tape across the • ••
2
front end of the card. Peel off
the backing, then stick the
end down to complete the drum. 2 Push the half-pins
into the outer holes of
the plate then poke about
1Ocm of wire through
2 one of the half-pins.
3 Wind the wire round
the bolt about 800
turns . (Write down the
numbers 1 to 8 and each
time you reach 100,
cross off the next
number.) Cut the wire
from the spool. •
4 5
4 Into each wheel, push a 6-length axle bearing
a bush and a 40-tooth cog wheel. The axles fit 4 Poke the loose end of the wire through the
through the end beam-stacks on the plotter. other half-pin . Cut the ends to leave
Wrap a sheet of drawing paper round the drum long 'tails'. 5 Gently scratch the enamel
and stick down the ends using Blu -Tack . When off the ends of each tail, twist the bare ends
you have finished your drawing, simply remove with the bare wires of the ribbon cable and
the paper anq replace it with a new sheet. poke the 'plugs ' into the half-pins as shown .
Operating hints and tips small and very tight. You may find it best to use a
1 The pen should rest on the paper so that the paper medium-size belt doubled-up.
fastener is about 1mm from the electromagnet. Adjust the 4 To support the pen in the holder, wrap a belt round the
gap between fastener and magnet by sliding the pen in pen and holder arms (axles) . Slip the paper fastener
and out of the holder. between them. Use a fine-point felt tip pen .
2 To keep the electromagnet wiring neat, make ajunction 5 Do not leave the electromagnet on for too long . It wil l
on top of the front motor to connect the magnet to the get quite hot and will drain the batteries very quickly.
ribbon cable . Place two smal l smooth plates on the motor 6 You can use any kind of paper to draw on but for best
and, with double-sided sticky tape, attach a 2-way piece of results use a good quality cartridge paper such as
terminal block (obtainable from an electrical shop) . See typing paper.
main photo on page 32 .
3 The be lt used in the chain drive gears (step 3) should be
I PROGRAMMING
10 REM PLOTTER CONTROLLER The main program contains sub-
20 PRT=56577:POKE56579,63 routines to control the plotter.
30 MX=8=MY=16:D(O)=2:D(2)=4:PS=0 We have given 3 examples which
40 XC=0:YC=0:XN=O:YN=0 draw different pictures. The
50 ;:::::;= 12::: : 'T'::;=64 routines are fairly easy to use.
To raise the pen in a program ,
100 REM DEMO , CIRCLE type GOSUB 1100. To lower
1.1. (1 CiCl::;UE: 1500 the pen, type GOSUB 1000. To
120 FOR~=OT02*rr STEPrr!20 reset the machine back to its
130 XN=R*COSCA):YN=R*SINCA) starting point, type GOSU B
140 GOSUE:2000:GOSUE:1000:NEXTA 1500. To move the pen to the
position X, Y, where X is a
150 GOSUE:1100:END position on the horizontal
1000 REM PEN DOWN scale and Y on the vertical
1010 PS=0 :POKEPRT,PS:RETURN scale , type XN=x; YN=y:
1100 REr'1 PEI'-~ UP GOSUB 2000.
1110 PS=l:POKEPRT,PS:PETURN
1500 REM RESET FROM KEYBOARD
1510 PF.: HH F:E::;ET -- I..Y:;E CUF.::::OR ~::: E'T'::; TO"
11
1520 F'R I rH" r'1 0 ',,.'E .' THa~ F'I?E::::::; F.:ETURrl" 100 REM DEMO, SQURRE
1530 GO::::UB 11 (10 110 GOSUBI500:GOSUBI000
1540 GETA$: I FFI$= "THEt·~ 1530
11 1:::::0 HWUT"LEHGTH OF t;IDE "; L
1550 ;::J~=>::t-H (A:t:= n" ) - (I=i$=
11 11 • • " )
140 XH=L:GOSUB2000
150 'T't·j=L : GO::;UB2[l1:::10
1560 'T't·~='T't·H (A$=" J" ) - (Flt= "'l.'!l" ) 160 ~< H=O : GO::::;UB20(10
1570 IFAt=CHRt(13)THEN1590 171:1 'T't·j=(t : GOSUB20(1(1
180 GOSUBI100: EHD
1580 GOSUB2000:GOT01540 PERD'T',
1590 XC=0:YC=0:RETURN
2000 REM MOVE TO XN,YN 1(10 f;Hl DE~10, S I t·jE l·lA VE
2010 XN=INT(XN):YN=INT(YN) I11j GO::;IJE: 15[10
2020 DX=XN-XC:IFDX=OTHEN2100 13[1 FOF: )< t~ =OT080
2030 POKEPRT;MX+D(SGN(DX)+l) 140 'T't·j= 0:: (80- )·n-D 16:> *8 It-W<t·j,·... :3)
15(1 G08UB20[10: GOSUB 10(1(1
2040 FORI=lTOABS(DX) 160 NEXTXH:GOSUBI1 0 0
2050 IF(PEEK(PRT)ANDXS)=0THEN2050 170 E~m
PERD'T',
2860 IF(PEEK(PRT)ANDXS)=XSTHEN2060
2070 NEXTI:XC=XN:POKEPRT,PS
2100 DY=YN-YC:IFDY=OTHEN2160
2110 POKEPRT,MY+D(SGN(DY)+l)
2120 FORI =lTOABSCDY)
2130 IF(PEEK(PRT)ANDYS)=0THEN2130
2140 IF(PEEKCPRT)ANDYS)=YSTHEN2140
2150 NEXTI:YC=YN:POKEPRT,PS
2160 F.ETI...IRt·~
F.:EAD'r' ,
39
MAXI ARM
We'v·e called this robot a maxi-arm because it is Reaching out, picki ng up
both iarger and more versatile than our mini-arm Under control from the computer, the top plate of the base
machine. It can not only move in a circle, it can also unit that supports the arm can rotate and stop at anyone of
extend and shorten in length from the 'shoulder' to 36 positions . The arm can slide in and out at the shoulder,
pick and place objects anywhere within a large stopping at anyone of about 20 positions. The gripper at
the end of the arm closes its fingers on an object and then
area It uses three motors and is built from a fairly
raises the object off the ground . At the wrist, the gripper
larg.e assortrnent of LEGO Technic pieces. (If you has about 15 stop positions. The arm-support, shoulder
don't have enough LEGO pieces yourself, perhaps and gripper all have a switch sensor which allows the
you can build the robot with a friend who has some computer to 'sense' how far each has driven.
LEGO Technic kits.) The base unit is the same as In effect, the gripper can be moved to pick up an object
that used for the mini-arm (see pages 25-31), but to anywhere within a sphere-shaped area around the
make the robot more sturdy, the base must be shoulder. The technical name forthis type of robot arm is a
placed on two 10 x 20 plates. polar arm.
40
THE ARM
41
t> Add the racking pieces. The
gripper drive gears are mounted
on axles that lie within the
beams at the back of the arm .
Motor/switch assembly
from far side
42
THE GRIPPER
®
L.On the 4-length axles , mount
the 4-length steering plates ,
setting them in a V-shape.
4 Lock them onto the axles using
4
half-bushes. When the steering
L. Add the 6-length beam, short axles, plates are moved in and out , the
and two more 14-cog gears. Slide half-togg le on the top
half-bushes part of the way up should move back and forth.
each axle.
®
L. Push 2-length axles through
the ends of the short steering L.Add the 6 x 1 side beams bearing
plates then complete the pins and fit a short axle with a
'fingers' with 6-length steering toggle in the top , central,
plates and 4 x 1 plates . Use half- half-toggle .
bushes on the ends of the axles
to lock the steering plates to gether.
43
/':,. Fix the gripper onto the end /':,. The completed gripper. Pull
of the arm you have already built. the belt over the front beam ,
Add the bottom plate and the top underneath, then up onto the
plate bearing a half-pin. half-bush. The gripper should
At the front , add the 2 x 1 beam. spring open in a downward
Hook a medium-size belt over position .
the toggle unit.
THE SHOULDER
Operating hints and tips then need only one battery unit.)
1 To allow the gripper to grasp objects more easily, use 3 If you use pole reversers on the two battery boxes to
draught-excluder tape on the fingers . avoid over-running the arm , you may find that the motors
2 If you interface the arm directly to your computer, you will only drive in one direction. Simply change the position
will need two battery boxes. However, if you are good with of the reverser on one battery box.
electronics, you could use the interface to switch a larger 4 With wires going to all parts of the model, be sure that
'double-pole change-over relay ' (obtainable from an you keep the wiring neat and tidy so as not to foul any of
electronics shop) which will act as a pole reverser, the mechanisms. (We discuss wiring up the base unit on
changing the direction of drive of the motors. (You will page 30.)
Shoulder
Gripper
w
o
o
3
3 Base
150mm
46
10 REM ARM CONTROLLER
1
2(:1 F'RT.=56577: F'OKE56579 63
30 MB=16:MS=8:MG=4:D(0 =1:D(2)=2:SW=128
40 DIMB(50),S(50),G(50
50 Ii:t= ::m~I~J!!l" : c:t=
II II nilllllil" PROGRAMMING 1
60 F'R I iH ::']='(1:::: t·IO.
II :E: A:~;E : =';HOULDER OF.: I PF'ER II
Watford Electronics,
33 Cardiff Road , Watford.
Herts WD1 8ED
The author would like to thank the following for their help in
preparing this book: Ben Matthews, Malcolm Crocker, CSE
Also look at the adverts Computers (Pangbourne), John Grey, Helen Seymour-Jones ,
in major computer magazines. Robert Solly.
\",,1
L--02
\",,3 2
L--04
\",,5 3
L--06
.... l§
~7
...~ >--+5\1
'--<>8
....
u
: z~
~'J
(I)
~
:::> 0
5 u
II< '--<>10
~ ~
:::> ~11 6
;!;
~
u
'--<>12 ~
....
+5\1~14 ~
lSI
u
........... 15 <II
17
18 J'J'
~ LIGHT EMITTING DIOOE
48
ISBN 0-09-942660-9
UK £2.95
Australia $8.95* 00295
Canada $5.95*
I
*recommended price
9 t0099 426608