Updated 24 September 2020
Kits and Gadgets Electronics Inc.
Farwaniya, Kuwait 80003
Kuwait
ph: +965 99571844
kits
Most assembly plants nowadays rely heavily on robotic arms in assembling their products. These electro-mechanical machines has replaced humans in many factories because of its many advantages. Among them, are its effeciency, productivity, reliability and immunity to human factors and natural behaviours. They can work mostly round the clock at 24/7 mode without stress or fatigue. They are programmable and able to perform multi-tasking jobs. The only drawback is the downtime during maintenance period and when some electronic circuits, electrical wirings and mechanical parts failed to function or damaged. Robotic arms can work autonomously or with minimum human intervention depending on its configuration. There are more advanced design capable to function with very high precission and accuracy.
A Toy Robotic Arm as shown or similar is available in some stores or on the internet. This Toy Robotic Arm is the basic principle and can perform some of the basic functions or movements compare to the more sophisticated industrial type which can be programmed and perform various tasks. This basic robotic arm only utilized several DC motors and basic mechanical parts to operate powered by batteries.
However, this Toy Robotic Arm can be modified to work as programmable or function autonomously without continued human intervention.
TOY ROBOTIC ARM
The idea here now is to modify this Toy Robotic Arm so it will work like the basic industrial type with autonomous mode instead of operating it through the switches connected to it. Once modified It can be programmed to do some basic tasks repeatedly several times and work autonomously. Actually, you just need to press a key or some keys on your keyboard depending on what function you want it to initiate once you learn how to program it.
So, with the help of some materials listed below and modification guides, this Toy Robotic Arm will function like the basic industrial type.
WHAT YOU NEED:
1. Raspberry Pi Computer Board - any model
2. SD Card - with RISCOS, BBC BASIC and GPIO Module
Download GPIO Module here: http://tankstage.co.uk/software.html
3. 5.0 Volts DC Power Supply - for Raspberry Pi
4. 12 Volts DC Power Supply - for Relay board
5. Relay Board - available from this website
6. Side Cutter
7. Long nose plier
8. Heatshrink tube
9. Soldering Iron
10. Soldering lead
11. Diode Rectifier (2pcs) - any diode rated at 50V / 1A or better, Ex. 1N4001
12. D-Type Connector pins
13. Wires - #22 or 24 AWG
BASIC INTERNAL ELECTRICAL DIAGRAM
MODIFICATION INSTRUCTION:
1. Cut-off the Remote Controller Switch and mark or label the white ribbon cable as shown.
2. Solder a female 'D' Type Connector pin on each wire and insulate with a heatshrink tube as shown.
WIRE FUNCTION IDENTIFICATION CORRESPONDING RELAY
A - B+ SUPPLY --------------------------------- GPIO 4 ----------------------- A
B - B- SUPPLY ---------------------------------- GPIO 17 ---------------------- B
C - BASE MOTOR------------------------------ GPIO 27 ---------------------- C
D - SHOULDER MOTOR--------------------- GPIO 22 ---------------------- D
E - ELBOW MOTOR----------------------------- GPIO 10 ---------------------- E
F - WRIST MOTOR------------------------------ GPIO 9 ------------------------ F
G - CLAMP MOTOR------------------------------ GPIO 11 ---------------------- G
H - LAMP ------------------------------------------ GPIO 7 ------------------------ H
RELAY ASSIGNMENT
DUAL POLARITY GROUNDING POINT
NOTE:
1. THE RELAY A TO H ARE DPDT TYPE. SO, YOU CAN USE EITHER OF THE SWITCH OR
PARALLEL IT USING JUMPER WIRE.
2. DIODES A & B ARE BLOCKING DIODES TO PREVENT SHORTING WHEN THE POLARITY OF
THE GROUNDING TERMINAL CHANGES FROM POSITIVE TO NEGATIVE AND VICE VERSA
DURING FUNCTION SWITCHING.
ALL MOTORS CONNECTION
TERMINATION OF WHITE RIBBON CABLE TO RELAY BOARD
3. Insert a 'D' Type Connector male pin on the relay terminal holes of the Relay Board and solder. Cut-off excess length of the pins. Note that two pins are needed for each relay.
4. Cut a small strip of raw circuit board or copper plate or wire to be use as Ground Terminal.
5. Fasten the Ground Terminal on the middle part of the Relay Board as shown.
6. Cut eight pieces of about 8 cm length of #22 AWG wire.
6. Solder a female pin on one end of each wire and insulate with heatshrink tube.
7. Plug-in the wires to the Relay Board terminal pins as shown (Green Wires).
8. Solder the other end of each wire except A and B to the Grounding Teminal fastened on Relay Board.
9. Solder the Anode side of the diode to the other end of Green wire A.
10. Solder the Cathode side of the diode to the other end of Green wire B.
11. Solder the other end of diodes A and B to the Grounding Teminal.
12. Plug-in the Robotic Arm white ribbon cable wires to the corresponding relay terminal pins.
13. Plug-in the ribbon cable or connect the jumper wires to Raspberry Pi P1 terminal pins and connect the other end to the Relay Board input terminal according to wiring identification connection as shown above.
14. Highlight the program code below using your mouse or touch pad and 'right click' to copy to Notepad or any text editor. Transfer the code to the BBC BASIC Programming Language StrongEd window text editor and SAVE as BASIC file.
15. Run and see if the menu as shown below show-up on your monitor.
THE PROGRAM MENU
NOTE:
Just contact or email me should there be any problem regarding this project or experiment.
HOW IT WORKS VIDEO
https://www.youtube.com/watch?v=nNTYAzqSk7E
THE PROGRAM CODE
10 MODE 20: GCOL 3: OFF
20 COLOUR 26: PRINT TAB(1,10); "Press Key to activate:"
30 COLOUR 7
40 PRINT TAB(1,16); "> OR UP= TO SWITCH B+ SUPPLY": REM GPIO 4
50 PRINT TAB(1,18); "< OR DOWN= TO SWITCH B- SUPPLY": REM GPIO 17
60 PRINT TAB(1,20); "B= TOMOVEBASE ": REM GPIO 27
70 PRINT TAB(1,22); "S= TOMOVESHOULDER ": REM GPIO 22
80 PRINT TAB(1,24); "E= TOMOVEELBOW ": REM GPIO 10
90 PRINT TAB(1,26); "W= TOMOVEWRIST ": REM GPIO 9
90 PRINT TAB(1,28); "C= TOMOVECLAMP ": REM GPIO 11
100 PRINT TAB(1,30); "T= FUNCTIONAL CHECK "
110 PRINT TAB(1,32); "SPACEBAR= RESET "
120 COLOUR 18: PRINT TAB(1,1); "Raspberry Pi Robotic Arm"
130
140 COLOUR 12: PRINT TAB(36,1); "BUILT & PROGRAMMED BY: Rolly Estomaguio"
150
160 REM Programmed on: 12 May 2014 - Updated 04 July 2015
170
180 COLOUR 31: PRINT TAB(42,3); "http://www.kits-gadgets.com"
190
200 ON ERROR PRINT REPORT$;" at line ";ERL:END
210 PROCinit
220 COLOUR 10: PRINT TAB(1,50); "Press Escape to finish"
230 PROC_switch
240
250 DEFPROCinit
260 OSCLI"RMEnsure GPIO 0.00 RMLoad GPIO"
270 OSCLI"RMensure GPIO 0.40 ERROR Please install the GPIO module"
280 SYS"GPIO_EnableI2C",0
290 SYS"GPIO_ExpAsGPIO",2
300 SYS"GPIO_GetBoard" TO PiType%
310 DIM A%(17)
320 IF PiType%=12 A%()= 3,4,17,27,22,10,9,11,7,8,25,23,15,14,24,2
330 ENDPROC
340
350 DEFPROC_switch
360 L$=GET$: OFF
370 IF L$= "B" OR L$= "b" PROC_base
380 IF L$= "S" OR L$= "s" PROC_shoulder
390 IF L$= "E" OR L$= "e" PROC_elbow
400 IF L$= "W" OR L$= "w" PROC_wrist
410 IF L$= "C" OR L$= "c" PROC_clamp
420 IF L$= "Q" OR L$= "q" QUIT
430 IF L$= "T" OR L$= "t" PROC_robotarm
450 PROC_switch
460
470 DEFPROC_robotarm
480 REM THIS SUBROUTINE IS TO TEST ALL MOVEMENTS AUTONOMOUSLY
490 SYS "GPIO_WriteData",4,1: REM B+ ON
500 SYS "GPIO_WriteData",27,1: REM BASE ON
510 FOR D= 1 TO 38E6:NEXT
520 SYS "GPIO_WriteData",4,0: REM B+ OFF
530 SYS "GPIO_WriteData",27,0: REM BASE OFF
540 FOR D= 1 TO 1E6:NEXT
550 SYS "GPIO_WriteData",17,1: REM B- ON
560SYS "GPIO_WriteData",22,1: REM SHOULDER ON
570 FOR D= 1 TO 10E6:NEXT
580 SYS "GPIO_WriteData",17,0: REM B- OFF
590 SYS "GPIO_WriteData",22,0: REM SHOULDER OFF
600 FOR D = 1 TO 1E6:NEXT
610 SYS "GPIO_WriteData",17,1: REM B- ON
620 SYS "GPIO_WriteData",9,1: REM WRIST ON
630 FOR D= 1 TO 13E6:NEXT
640 SYS "GPIO_WriteData",17,0: REM B- OFF
650 SYS "GPIO_WriteData",9,0: REM WRIST OFF
660 FOR D= 1 TO 1E6:NEXT
670 SYS "GPIO_WriteData",4,1: REM B+ ON
680 SYS "GPIO_WriteData",11,1: REM CLAMP ON - CLOSE
690FOR D= 1 TO 7E6:NEXT
700 SYS "GPIO_WriteData",4,0: REM B+ OFF
710 SYS "GPIO_WriteData",11,0: REM CLAMP OFF
720 FOR D= 1 TO 1E6:NEXT
730 SYS "GPIO_WriteData",4,1: REM B+ ON
740 SYS "GPIO_WriteData",9,1: REM WRIST ON
750 FOR D= 1 TO 13E6:NEXT
760 SYS "GPIO_WriteData",4,0: REM B+ OFF
770 SYS "GPIO_WriteData",9,0: REM WRIST OFF
780 FOR D= 1 TO 1E6:NEXT
790 SYS "GPIO_WriteData",4,1: REM B+ ON
800 SYS "GPIO_WriteData",22,1: REM SHOULDER ON
810 FOR D= 1 TO 13E6:NEXT
820 SYS "GPIO_WriteData",4,0: REM B+ OFF
830 SYS "GPIO_WriteData",22,0: REM SHOULDER OFF
840 FOR D = 1 TO 1E6:NEXT
850 SYS "GPIO_WriteData",17,1: REM B- ON
860 SYS "GPIO_WriteData",27,1: REM WAIST ON
870 FOR D= 1 TO 38E6:NEXT
880 SYS "GPIO_WriteData",17,0: REM B-OFF
890 SYS "GPIO_WriteData",27,0: REM WAIST OFF
900 SYS "GPIO_WriteData",17,1: REM B- ON
910 SYS "GPIO_WriteData",11,1: REM CLAMP ON - OPEN
920 FOR D= 1 TO 5E6:NEXT
930 SYS "GPIO_WriteData",17,0: REM B- OFF
940 SYS "GPIO_WriteData",11,0: REM CLAMP OFF
950 FOR D= 1 TO 15E6:NEXT
960 K%= INKEY (0.6)
970 IF INKEY (-99) THEN PROC_switch
980 PROC_robotarm
990
1000 DEFPROC_base
1010 OFF
1020 SYS "GPIO_WriteData",27,1
1030 REPEAT
1040 K%= INKEY (.5)
1050 IF INKEY (-99) SYS "GPIO_WriteData",27,0: PROC_switch
1060 IF INKEY (-122) THEN SYS "GPIO_WriteData",17,1: SYS "GPIO_WriteData",4,0: REM CW ROTATE
1070 IF INKEY (-26) THEN SYS "GPIO_WriteData",4,1: SYS "GPIO_WriteData",17,0: REM CCW ROTATE
1080 FOR D% = 1 TO 2000000:NEXT
1090 SYS "GPIO_WriteData",17,0: SYS "GPIO_WriteData",4,0
1100 PROC_base
1110
1120 DEFPROC_shoulder
1130 SYS "GPIO_WriteData",22,1
1140 REPEAT
1150 L%= INKEY (.5)
1160 IF INKEY (-99) SYS "GPIO_WriteData",22,0: PROC_switch
1170 IF INKEY (-58) SYS "GPIO_WriteData",17,1: SYS "GPIO_WriteData",4,0
1180 IF INKEY (-42) SYS "GPIO_WriteData",4,1: SYS "GPIO_WriteData",17,0
1190 FOR D%= 1 TO 2000000:NEXT
1200 SYS "GPIO_WriteData",17,0: SYS "GPIO_WriteData",4,0
1210 PROC_shoulder
1220
1230 DEFPROC_elbow
1240 SYS "GPIO_WriteData",10,1
1250 REPEAT
1260 M%= INKEY (.5)
1270 IF INKEY (-99) SYS "GPIO_WriteData",10,0: PROC_switch
1280 IF INKEY (-58) SYS "GPIO_WriteData",17,1: SYS "GPIO_WriteData",4,0
1290 IF INKEY (-42) SYS "GPIO_WriteData",4,1: SYS "GPIO_WriteData",17,0
1300 FOR D%= 1 TO 2000000:NEXT
1310 SYS "GPIO_WriteData",17,0: SYS "GPIO_WriteData",4,0
1320 PROC_elbow
1330
1340 DEFPROC_wrist
1350 SYS "GPIO_WriteData",9,1
1360 REPEAT
1370 N%= INKEY (.5)
1380 IF INKEY (-99) SYS "GPIO_WriteData",9,0: PROC_switch
1390 IF INKEY (-58) SYS "GPIO_WriteData",17,1: SYS "GPIO_WriteData",4,0
1400 IF INKEY (-42) SYS "GPIO_WriteData",4,1: SYS "GPIO_WriteData",17,0
1410 FOR D%= 1 TO 2000000:NEXT
1420 SYS "GPIO_WriteData",17,0: SYS "GPIO_WriteData",4,0
1430 PROC_wrist
1440
1450 DEFPROC_clamp
1460 SYS "GPIO_WriteData",11,1
1470 REPEAT
1480 O%= INKEY (.5)
1490 IF INKEY (-99) SYS "GPIO_WriteData",11,0: PROC_switch
1500 IF INKEY (-122) SYS "GPIO_WriteData",17,1: SYS "GPIO_WriteData",4,0
1510 IF INKEY (-26) SYS "GPIO_WriteData",4,1: SYS "GPIO_WriteData",17,0
1520 FOR D%= 1 TO 2000000:NEXT
1530 SYS "GPIO_WriteData",17,0: SYS "GPIO_WriteData",4,0
1540 PROC_clamp
NOTE:
The above program is not final and has several unnecessary commands and line numbers. Feel free to modify if necessary. Nevertheless, it works fine without modification.
NEXT ON THIS PROJECT:
1. Installation of end limit switches.
2. Upgrading the program code.
REMINDERS:
The author, publisher or provider of the above information does not and will not provide any guarantee that all information stated herein are free of errors.
Any attempt to exercise, simulate or initiate to follow the above information are at the sole discretion and risk of the one building the project and owner of the devices, gadgets and materials required to build.
The same condition applies if any failure, fault and damage occured during or while performing and following the given instructions for the purpose of experimentation, curiosity and as a building hobby.
However, the author of the above information made sure that the prototype, simulation and preliminary project and ideas above are working and performing according to the desired results and functions before its publication.
Additionally, any project, kits and gadgets published on this website have undergone rigorous tests and simulation.
Copyright 2013 Kits and Gadgets Electronics Inc. All rights reserved.
Kits and Gadgets Electronics Inc.
Farwaniya, Kuwait 80003
Kuwait
ph: +965 99571844
kits