In this lesson, we will show you how to connect 4 DOF robot arm to Raspberry Pi and Use web browser to control the 4 servo joint of the arm.
No. | Picture | Device | Qty. | Accessories | Link |
1 | ![]() |
Raspberry Pi board | 1 | ||
2 | ![]() |
MG995 or SG90 Servo Motor | 4 | M2.2*8 Self Tapping Screw x 2 M2*4 Self Tapping Screw x 1 |
Click here to buy |
3 | ![]() |
PCA9685 | 1 |
PCA9685 | Raspberry Pi Physical Pin# |
SCL | SCL |
SDA | SDA |
GND | GND |
VCC | 5V |
V+ | Vin |
PCA9685 | Servo |
PWM 15 | Finger servo |
PWM 14 | Wrist servo |
PWM 11 | Arm servo |
PWM 10 | Base servo |
Step 1: Please run following command to download Linux script file:
wget http://osoyoo.com/driver/wifi-robot-arm/osoyoo-pi-arm.sh
then type the following command to install python program:
bash osoyoo-pi-arm.sh
Step 2: type following command to enter the folder osoyooarm
cd osoyooarm
Step 3: Find your Raspberry Pi IP address by typing following command:
hostname -I
You will see the IP board IP address like this:
192.168.0.28 fd00:bc4d:fba4:fea2:8bea:ed3f:cfbd:ba1e
In above example, 192.168.0.28 is the IP address of our Pi. You need to use this IP address to update the python code in Step 4.
Step 4: Type the following command to edit the file webcar.py
nano webarm.py
Change the default ip address 192.168.0.26 in line 15 to the raspberry pi IP address from Step 3, and cick “Ctrl”+”X” then “Y” to save the file and then click “enter” to exit
Step 5: Run the code by typing command
sudo python3 ~/osoyooarm/webarm.py
Step 6: In your PC or cell phone which is the same wifi network of your Raspberry Pi, open the browser and visit http://your_RaspberryPi_ip_address, you will see following UI
In the page, there are 4 Sliders which can control for servo joint, you can move the slider in order to rotate the servo and change arm and finger positions.
Reference:
Marcelo Rovai : Python WebServer With Flask and Raspberry Pi
https://towardsdatascience.com/python-webserver-with-flask-and-raspberry-pi-398423cc6f5d
DownLoad Url osoyoo.com