Smart Robot Arm Kit
Smart Robot Arm Kit
LAFVIN
Content
Packing list ...............................................................................................................................................................................................2
Lesson 1 Installing IDE ........................................................................................................................................................................... 3
Lesson 2 Add Libraries and Open Serial Monitor ................................................................................................................................ 18
Lesson 3 Blink ....................................................................................................................................................................................... 30
Lesson 4 Installation Method ................................................................................................................................................................ 41
Lesson 5 Control of servo ......................................................................................................................................................................86
Lesson 6 Analog Joystick Module .........................................................................................................................................................91
Lesson 7 Dual-JoyStick Controlled Robot Arm ................................................................................................................................... 94
Lesson 8 Bluetooth Controlled Robot Arm ...........................................................................................................................................97
Lesson 9 PS2 Controlled Robot Arm (Extension) .............................................................................................................................. 110
LAFVIN
Company Profile
Established in 2011, lafvin is a manufacturer and trader specialized in research,development and production of 2560 uno,nano boards,and all kinds of
accessories or sensors use for arduino,rasperrry.We also complete starter kits designed for interested lovers of any levels to learn Arduino or
Raspberry.We are located in Shenzhen,China.All of our products comply with international quality standards and are greatly appreciated in a variety of
different markets throughout the world.
Customer Service
We are cooperating with a lot of companies from diffirent countries.Also help them to purchase electronic component products in china,and became the
biggest supplier of them. We look forward to build cooperate with more companies in future.
By the way,We also look forward to hearing from you and any of your critical comment or suggestions.Pls email us by [email protected] if you
have any questions or suggestions.
As a continuous and fast growing company. We keep striving our best to offer you excellent products and quality service.
Our Store
Aliexpress store: https://www.aliexpress.com/store/1942043Brand in Amazon:LAFVIN
Product Catalog
https://drive.google.com/drive/folders/0BwvEeRN9dKllblZING00TkhYbGs?usp=sharing
Tutorial
This tutorial include codes,labraries and lessons. It is designed for beginners. It will teach every users how to assembly the smart robotic arm kit and use
Arduino controller board, sensors and modules.Our robotic arm kit has the following characteristics:
Visualized Installation Steps.
Rich control can meet the needs of DIY players,includes Wired JoyStick Control; Phone Bluetooth Control; Wireless PS2 JoyStick Control.
1/115
LAFVIN
Packing list
Packing list:
1pcs Uno r3 board
4pcs MG90S Servo
1pcs V5.0 extension board
1pcs USB Cable
2pcs Joystick Module
1pcs 20PIN F-F Dupont Wire
1pcs Bluetooth Module
1pcs Screwdriver
1pcs Wrench
1set Acrylic Board
1set Screw Kit
1pcs CD Tutorial
2pcs Bunding belt
4pcs Rubber Mat
2/115
LAFVIN
The version available at this website is usually the latest version, and the actual version may be newer than the version in the picture.
3/115
LAFVIN
4/115
LAFVIN
5/115
LAFVIN
Also version 1.8.0 is available in the material we provided, and the versions of our
materials are the latest versions when this course was made.
6/115
LAFVIN
7/115
LAFVIN
Click Next
You can press Browse… to choose an installation path or directly type in the
directory you want.
8/115
LAFVIN
Finally, the following interface appears, click Install to finish the installation.
9/115
LAFVIN
10/115
LAFVIN
You may directly choose the installation package for installation and skip the contents below and jump to the next section. But if you want to
learn some methods other than the installation package, please continue to read the section.
Unzip the zip file downloaded, Double-click to open the program and enter the desired development environment
11/115
LAFVIN
12/115
LAFVIN
13/115
LAFVIN
14/115
LAFVIN
Right-click on the device and select the top menu option (Update Driver Software...).
You will then be prompted to either ‘Search Automatically for updated driver software’ or ‘Browse my computer for driver software’. Select the
option to browse and navigate to the X\arduino1.8.0\drivers.
15/115
LAFVIN
Click 'Next' and you may get a security warning, if so, allow the software to be installed. Once the software has been installed, you will get a
confirmation message.
Windows users may skip the installation directions for Mac and Linux systems and jump to Lesson 1. Mac and Linux users may
continue to read this section.
16/115
LAFVIN
17/115
LAFVIN
18/115
LAFVIN
Then the library manager will open and you will find a list of libraries that are already installed or ready for installation. In this example we will
install the Bridge library. Scroll the list to find it, then select the version of the library you want to install. Sometimes only one version of the
library is available. If the version selection menu does not appear, don't worry: it is normal.
There are times you have to be patient with it, just as shown in the figure. Please refresh it
and wait.
19/115
LAFVIN
Finally click on install and wait for the IDE to install the new library. Downloading may take time depending on your connection speed. Once it
has finished, an Installed tag should appear next to the Bridge library. You can close the library manager.
You can now find the new library available in the Include Library menu. If you want to add your own library open a new issue on Github.
20/115
LAFVIN
libraries in the IDE. Do not unzip the downloaded library, leave it as is.
In the Arduino IDE, navigate to Sketch > Include Library. At the top of the drop down list, select the option to "Add .ZIP Library''
You will be prompted to select the library you would like to add. Navigate to the .zip
file's location and open it.
21/115
LAFVIN
22/115
LAFVIN
Return to the Sketch > Import Library menu. You should now see the library at the bottom of the drop-down menu. It is ready to be used in
your sketch. The zip file will have been expanded in the libraries folder in your Arduino sketches directory. NB: the Library will be available to
use in sketches, but examples for the library will not be exposed in the File > Examples until after the IDE has restarted.
Those two are the most common approaches. MAC and Linux systems can be handled likewise. The manual installation to be introduced below
as an alternative may be seldom used and users with no needs may skip it.
Manual installation
To install the library, first quit the Arduino application. Then uncompress the ZIP file containing the library. For example, if you're installing a
library called
"ArduinoParty", uncompress ArduinoParty.zip. It should contain a folder calledArduinoParty, with files like ArduinoParty.cpp and
ArduinoParty.h inside. (If the .cpp and .h files aren't in a folder, you'll need to create one. In this case, you'd make a folder called "ArduinoParty"
and move into it all the files that were in the ZIP file, like ArduinoParty.cpp and ArduinoParty.h.)
Drag the ArduinoParty folder into this folder (your libraries folder). Under Windows, it will likely be called "My Documents\Arduino\libraries".
For Mac users, it will likely be called "Documents/Arduino/libraries". On Linux, it will be the "libraries" folder in your sketchbook.
23/115
LAFVIN
Your Arduino library folder should now look like this (on Windows): My Documents\Arduino\libraries\ArduinoParty\ArduinoParty.cpp
My Documents\Arduino\libraries\ArduinoParty\ArduinoParty.h My Documents\Arduino\libraries\ArduinoParty\examples
or like this (on Mac and Linux): Documents/Arduino/libraries/ArduinoParty/ArduinoParty.cpp
Documents/Arduino/libraries/ArduinoParty/ArduinoParty.h Documents/Arduino/libraries/ArduinoParty/examples
....
There may be more files than just the .cpp and .h files, just make sure they're all there. (The library won't work if you put the .cpp and .h files
directly into the libraries folder or if they're nested in an extra folder. For example: Documents\Arduino\libraries\ArduinoParty.cpp and
Documents\Arduino\libraries\ArduinoParty\ArduinoParty\ArduinoParty.cpp won't work.)
Restart the Arduino application. Make sure the new library appears in the Sketch->Import Library menu item of the software. That's it! You've
installed a library!
24/115
LAFVIN
Arduinos and other microcontrollers, they decided to include a serial terminal with the software. Within the Arduino environment, this is called
the Serial Monitor.
Making a Connection
Serial monitor comes with any and all version of the Arduino IDE. To open it, simply click the Serial Monitor icon.
25/115
LAFVIN
Selecting which port to open in the Serial Monitor is the same as selecting a port for uploading Arduino code. Go to Tools -> Serial Port, and
select the correct port. Tips: Choose the same COM port that you have in Device Manager.
26/115
LAFVIN
27/115
LAFVIN
Settings
The Serial Monitor has limited settings, but enough to handle most of your serial communication needs. The first setting you can alter is the baud
rate. Click on the baud rate drop-down menu to select the correct baud rate. (9600 baud)
Last, you can set the terminal to Autoscroll or not by checking the box in the bottom left corner.
28/115
LAFVIN
Pros
The Serial Monitor is a great quick and easy way to establish a serial connection with your Arduino. If you’re already working in the Arduino
IDE, there’s really no need to open up a separate terminal to display data.
Cons
The lack of settings leaves much to be desired in the Serial Monitor, and, for advanced serial communications, it may not do the trick.
29/115
LAFVIN
Lesson 3 Blink
Principle
The UNO R3 board has rows of connectors along both sides that are used to connect to several electronic devices and plug-in 'shields' that extends its
capability.
It also has a single LED that you can control from your sketches. This LED is built onto the UNO R3 board and is often referred to as the 'L'
LED as this is how it is labeled on the board.
30/115
LAFVIN
You may find that your UNO R3 board's 'L' LED already blinks when you connect it to a USB plug. This is because the boards are generally
shipped with the 'Blink' sketch pre-installed.
In this lesson, we will reprogram the UNO R3 board with our own Blink sketch and then change the rate at which it blinks.
In Lesson 0, you set up your Arduino IDE and made
sure that you could find the right serial port for it to
connect to your UNO R3 board. The time has now
come to put that connection to the test and program
your UNO R3 board.
The Arduino IDE includes a large collection of example
sketches that you can load up and use. This includes an
example sketch for making the 'L' LED blink.
Load the 'Blink' sketch that you will find in the IDE's
menu system under File > Examples > 01.Basics
31/115
LAFVIN
When the sketch window opens, enlarge it so that you can see the entire sketch in the window.
32/115
LAFVIN
The example sketches included with the Arduino IDE are 'read-only'. That is, you can upload them to an UNO R3 board, but if you change them,
you cannot save them as the same file.
Since we are going to change this sketch, the first thing you need to do is save your own copy.
From the File menu on the Arduino IDE, select 'Save As..' and then save the sketch with the name 'MyBlink'.
33/115
LAFVIN
You have saved your copy of 'Blink' in your sketchbook. This means that if you ever want to find it again, you can just open it using the File >
Sketchbook menu option.
34/115
LAFVIN
Attach your Arduino board to your computer with the USB cable and check that the
'Board Type' and 'Serial Port' are set correctly.
35/115
LAFVIN
Note: The Board Type and Serial Port here are not necessarily the same as shown in picture. If you are using 2560, then you will have to
choose Mega 2560 as the Board Type, other choices can be made in the same manner. And the Serial Port displayed for everyone is
different, despite COM 26 chosen here, it could be COM3 or COM4 on your computer. A right COM port is supposed to be COMX
(arduino XXX), which is by the certification criteria.
The Arduino IDE will show you the current settings for board at the bottom of the window.
Click on the 'Upload' button. The second button from the left on the toolbar.
If you watch the status area of the IDE, you will see a progress bar and a series of messages. At first, it will say 'Compiling Sketch...'. This
converts the sketch into a format suitable for uploading to the board.
36/115
LAFVIN
Next, the status will change to 'Uploading'. At this point, the LEDs on the Arduino should start to flicker as the sketch is transferred.
The other message tells us that the sketch is using 928 bytes of the 32,256 bytes available.After the 'Compiling Sketch..' stage you could get the
following error message:
37/115
LAFVIN
It can mean that your board is not connected at all, or the drivers have not been installed (if necessary) or that the wrong serial port is selected.
If you encounter this, go back to Lesson 0 and check your installation.
Once the upload has completed, the board should restart and start blinking. Open the code
Note that a huge part of this sketch is composed of comments. These are not actual program instructions; rather, they just explain how the
program works. They are there for your benefit.
Everything between /* and */ at the top of the sketch is a block comment; it explains what the sketch is for.
38/115
LAFVIN
gle line comments start with // and everything up until the end of that line is considered a comment.
The first line of code is: int led = 13;
As the comment above it explains, this is giving a name to the pin that the LED is attached to. This is 13 on most Arduinos, including the UNO
and Leonardo.
Next, we have the 'setup' function. Again, as the comment says, this is executed when the reset button is pressed. It is also executed whenever the
board resets for any reason, such as power first being applied to it, or after a sketch has been uploaded.
void setup() {
// initialize the digital pin as an output.
pinMode(led, OUTPUT);
}
Every Arduino sketch must have a 'setup' function, and the place where you might want to add instructions of your own is between the { and
the }.
In this case, there is just one command there, which, as the comment states tells the Arduino board that we are going to use the LED pin as an
output.
It is also mandatory for a sketch to have a 'loop' function. Unlike the 'setup' function that only runs once, after a reset, the 'loop' function will,
after it has finished running its commands, immediately start again.
39/115
LAFVIN
Inside the loop function, the commands first of all turn the LED pin on (HIGH), then 'delay' for 1000 milliseconds (1 second), then turn the LED
pin off and pause for another second.
You are now going to make your LED blink faster. As you might have guessed, the key to this lies in changing the parameter in () for the 'delay'
command.
This delay period is in milliseconds, so if you want the LED to blink twice as fast, change the value from 1000 to 500. This would then pause
for half a second each delay rather than a whole second.
Upload the sketch again and you should see the LED start to blink more quickly
40/115
LAFVIN
41/115
LAFVIN
Connect the UNO R3 board and the computer with a USB cable. Open the program Lesson_4_INSTALL and upload the program
to the board. Press the reset button, The servo motor will be transferred to the 90 degree position required for installation.Keep 90
degrees before installation, do not rotate servo motor gear at will.Now let's start installing the servo section.
42/115
LAFVIN
Now the four servo motors are turned to the 90 degree position. Next, install the servo motor's swing arm according to the direction
indicated in the picture. It may be vertical or parallel. Next we started to install the robot arm.
43/115
LAFVIN
44/115
LAFVIN
45/115
LAFVIN
46/115
LAFVIN
47/115
LAFVIN
48/115
LAFVIN
49/115
LAFVIN
50/115
LAFVIN
51/115
LAFVIN
52/115
LAFVIN
53/115
LAFVIN
54/115
LAFVIN
55/115
LAFVIN
56/115
LAFVIN
57/115
LAFVIN
58/115
LAFVIN
59/115
LAFVIN
60/115
LAFVIN
61/115
LAFVIN
62/115
LAFVIN
63/115
LAFVIN
64/115
LAFVIN
65/115
LAFVIN
66/115
LAFVIN
67/115
LAFVIN
68/115
LAFVIN
69/115
LAFVIN
70/115
LAFVIN
71/115
LAFVIN
72/115
LAFVIN
73/115
LAFVIN
74/115
LAFVIN
75/115
LAFVIN
76/115
LAFVIN
77/115
LAFVIN
78/115
LAFVIN
79/115
LAFVIN
80/115
LAFVIN
81/115
LAFVIN
82/115
LAFVIN
83/115
LAFVIN
84/115
LAFVIN
After the installation is complete, note : the screws on the joints that the robot arm can rotate are slightly looser. If the
screws are too tight, they will not rotate, so you should check that the screws on the joints that can be rotated are not
too tight. If you find that your robot arm is not free to rotate or some parts are stuck after the installation, you should
carefully check the above installation steps. In particular, pay attention to the points in the installation step diagram
that are “parallel”, “90 degrees”, or marked to other texts. There are a few places where buyers often make mistakes.
85/115
LAFVIN
Introduction
Servo motors are great devices that can turn to a specified position.Usually, they have a servo arm that can turn 180 degrees. Using
the Arduino, we can tell a servo to go to a specified position and it will go there. As simple as that!Servo motors were first used in the
Remote Control (RC) world, usually to control the steering of RC cars or the flaps on a RC plane. With time, they found their uses in
robotics, automation, and of course, the Arduino world.
There are two ways to control a servomotor with Arduino. One is to use a common digital sensor port of Arduino to produce
square wave with different duty cycle to simulate PWM signal and use that signal to control the positioning of the motor. Another way
is to directly use the Servo function of the Arduino to control the motor. In this way, the program will be easier.Next, we learn how to
control the servo.The servo motor has three leads. The color of the leads varies between servo motors, but the red lead is always 5V and
GND will either be brown.The red one is the power wire and should be connected to the 5v port and signal control line is usually
orange
86/115
LAFVIN
Wiring diagram
87/115
LAFVIN
Test instructions
After connecting,please open the the program and load up the code - Lesson_5_Single_Servo onto your Arduino board. See Lesson 3 for details
about program uploading if there are any errors.Before you can run this, make sure that you have installed the < Servo> library or re-install it, if
necessary. Otherwise, your code won't work.For details about loading the library file, see Lesson 2.
88/115
LAFVIN
On the basis of single servo motor control, we learn to control four servo motors at the same time.At this point, we need to be aware that
the four servo motors are connected to different digital interfaces on the control board.
Wiring diagram
89/115
LAFVIN
Test instructions
After connecting,please open the the program and load up the code - Lesson_5_Multiple_servo onto your Arduino board.upload well the code.
Powered on, press the reset button, the robot arm will realize a cyclic motion. The claw is clamped,after one second the claw is opened.Turn to
the right,after one second turned to the left.stretch out the arm,after one second the arm is retracted.the claw is raised after one second lowered.
90/115
LAFVIN
Introduction
Joystick
The module has 5 pins: VCC, Ground, X, Y, Key. Note that the labels on yours may be slightly different, depending on where you got the
module from. The thumb stick is analog and should provide more accurate readings than simple ‘directional’ joysticks tact use some forms of
buttons, or mechanical switches. Additionally, you can press the joystick down (rather hard on mine) to activate a ‘press to select’ push-button.
We have to use analog Arduino pins to read the data from the X/Y pins, and a digital pin to read the button. The Key pin is connected to ground,
when the joystick is pressed down, and is floating otherwise. To get stable readings from the Key /Select pin, it needs to be connected to VCC
via a pull-up resistor. The built in resistors on the Arduino digital pins can be used. For a tutorial on how to activate the pull-up resistors for
Arduino pins, configured as inputs
91/115
LAFVIN
Wiring diagram
92/115
LAFVIN
Test instructions
After wiring, please open the program in the code folder- Lesson_6_ Analog_Joystick_Module and click UPLOAD to upload the
program.Connect the UNO R3 to computer using a USB cable, then open the serial monitor and set the baud rate to 9600, you should see the
analog value of the right Joystick pin X,Y.
93/115
LAFVIN
Wiring diagram
94/115
LAFVIN
95/115
LAFVIN
Test instructions
After wiring,please open the program in the code folder- Lesson_7_Dual_JoyStick_Controlled_Robot_Arm. connect the UNO R3 to
computer using a USB cable,click UPLOAD to upload the program.now you can use two Joystick modules to control 4DOF robot arm realize
different motions.The relationship between joystick and manipulator joint control is as follows.
Left Joystick arm Right Joystick arm
X1<50 push the left joystick to the X2<50 push the right joystick to the
right, the claw opens left, the servo that controls
the arm rotation turns left
X1>1000 push the left joystick to the X2>1000 push the right joystick to the
left, the claw closed right, the servo that controls
the
arm rotation turns right
Y1<50 push the left joystick to the Y2>1000 push the right joystick to the
down , lower the robot upper down,draw back the robot
arm lower arm
Y1>1000 push the left joystick to the Y2<50 push the right joystick to the
up,lift up the robot upper up,stretch out the robot
arm lower arm
96/115
LAFVIN
1) Bluetooth test
Introduction:
The HC06 is a Serial port Bluetooth module which having fully qualified Bluetooth V2.0+EDR (Enhanced Data Rate) 3Mbps Modulation with
complete 2.4GHz radio transceiver and baseband. It uses CSR Blue core 04‐External single chip Bluetooth system with CMOS technology and
with AFH (Adaptive Frequency Hopping Feature).
97/115
LAFVIN
Wiring diagram
98/115
LAFVIN
Upload code
After wiring, please open the program in the code folder--Lesson_8_Bluetooth_Test_ and click UPLOAD to upload the
program. See Lesson 3 for details about program uploading if there are any errors.Attention:The bluetooth module should be pulled out before
you upload the program every time,or it will be failed to upload the program.After the code has been successfully uploaded to the UNO board,
reconnect the Bluetooth.
99/115
LAFVIN
100/115
LAFVIN
Then make sure the Bluetooth module is connected. Pair your phone with HC-06. for doing this go to Settings->Bluetooth->Scan device->select
HC-06 and pair it. Pass code to pair is '1234'.Open Bluetooth Terminal software, go to options and select 'connect a device - secure' option. It it
ask for pass code enter 1234.If your phone is connected to the Bluetooth module, you will see a usable device called HC-06 on the PAIRED
DEVICES(As shown below).If the HC-06 does not appear on the PAIRED DEVICES, reoperate the above steps.
101/115
LAFVIN
After the above steps are complete, we open the LAFVIN_Robot_arm app.
102/115
LAFVIN
Then click on the SCAN, and the HC-06 will appear in our scan results.Select HC-06.
After selecting the hc-06 device, click on the green button and wait 5 seconds. The green button shows the connected , which means that the app
is connected to the Bluetooth module successfully.(Note: When the Bluetooth module is not successfully connected, the red LED light will
103/115
LAFVIN
continue to flash. When the connection is successful, the red LED light will be remain on.)
Test instructions
104/115
LAFVIN
Upload the code, hookup well and power up. After connecting the Bluetooth APP, open the serial monitor and set the baud rate to 9600, press
down the control key on the APP, you should see the corresponding value. Shown below.
105/115
LAFVIN
%4#
%5#
%6#
%7#
%A#
%B#
%C#
%D#
106/115
LAFVIN
Wiring diagram
107/115
LAFVIN
108/115
LAFVIN
Test instructions
After wiring, please open the program in the code folder--Lesson_8_Bluetooth_Controlling_Arm and click UPLOAD to upload the program.
Attention:The bluetooth module should be pulled out before you upload the program every time,or it will be failed to upload the program.After
the code has been successfully uploaded to the UNO board, reconnect the Bluetooth.Repeat the steps above regarding the app connection to the
Bluetooth module.Now that the app has successfully connected to Bluetooth, we can begin to control the robotic arm through the app.
APP KEY value
turns right
109/115
LAFVIN
Wiring diagram
110/115
LAFVIN
111/115
LAFVIN
Test instructions
After wiring, please open the program in the code folder--Lesson_9_PS2_Control_Arm and click UPLOAD to upload the program. But
before upload the program,should place the PS2X_lib folder inside the libraries folder of Arduino IDE directory. Method for Adding Library
Files to DIE Reference Lesson 2-Add Libraries and Open Serial Monitor.We provide PS2X_lib library files in the library on the CD.
After successfully uploading the program, turn on the PS2 handle power switch. The signal light will flash. When the signal stop flashing,
the controller and the receiver will be connected successfully.The control relationship between joystick and manipulator on handle is as follows
112/115
LAFVIN
Wiring diagram
113/115
LAFVIN
114/115
LAFVIN
Test instructions
After wiring, please open the program in the code folder--Lesson_9_PS2_Controlling_Posture_Memory and click UPLOAD to upload
the program.You can control Arduino and remember no more than 20 actions.Press the key Z1 of right Joystick to save the angle value of 4
servos control.Then change the movement of the arm through the joystick and press the key Z1 of right Joystick to remember this action as the
second action. Press the key Z2 of left Joystick to operate all posture saved in the variable.
115/115