Tutorial
Tutorial
About Battery
Freenove provides free and responsive product and technical support, including but not limited to:
Product quality issues
Product use and build issues
Questions regarding the technology employed in our products for learning and education
Your input and opinions are always welcome
We also encourage your ideas and suggestions for new products and product improvements
For any of the above, you may send us an email to:
support@[Link]
Safety and Precautions
Please follow the following safety precautions when using or storing this product:
Keep this product out of the reach of children under 6 years old.
This product should be used only when there is adult supervision present as young children lack necessary
judgment regarding safety and the consequences of product misuse.
This product contains small parts and parts, which are sharp. This product contains electrically conductive
parts. Use caution with electrically conductive parts near or around power supplies, batteries and
powered (live) circuits.
When the product is turned ON, activated or tested, some parts will move or rotate. To avoid injuries to
hands and fingers, keep them away from any moving parts!
It is possible that an improperly connected or shorted circuit may cause overheating. Should this happen,
immediately disconnect the power supply or remove the batteries and do not touch anything until it
cools down! When everything is safe and cool, review the product tutorial to identify the cause.
Only operate the product in accordance with the instructions and guidelines of this tutorial, otherwise
parts may be damaged or you could be injured.
Store the product in a cool dry place and avoid exposing the product to direct sunlight.
After use, always turn the power OFF and remove or unplug the batteries before storing.
About Freenove
Freenove is committed to assist customers in their education of robotics, programming and electronic circuits
so that they may transform their creative ideas into prototypes and new and innovative products. To this end,
our services include but are not limited to:
Educational and Entertaining Project Kits for Robots, Smart Cars and Drones
Educational Kits to Learn Robotic Software Systems for Arduino, Raspberry Pi and micro: bit
Electronic Component Assortments, Electronic Modules and Specialized Tools
Product Development and Customization Services
You can find more about Freenove and get our latest news and updates through our website:
[Link]
Copyright
All the files, materials and instructional guides provided are released under Creative Commons Attribution-
NonCommercial-ShareAlike 3.0 Unported License. A copy of this license can be found in the folder containing
the Tutorial and software files associated with this product.
This means you can use these resource in your own derived works, in part or completely, but NOT for the
intent or purpose of commercial use.
Freenove brand and logo are copyright of Freenove Creative Technology Co., Ltd. and cannot be used without
written permission.
○
R
📧📧 support@[Link]
Contents
Welcome................................................................................................................................................................................ 1
Contents................................................................................................................................................................................. 1
List ........................................................................................................................................................................................... 1
Spider Shield for Raspberry Pi................................................................................................................................... 1
Machinery Parts ........................................................................................................................................................... 2
Transmission Parts....................................................................................................................................................... 3
Acrylic Parts .................................................................................................................................................................. 3
Electronic Parts............................................................................................................................................................. 4
Tools............................................................................................................................................................................... 6
Calibration Graph ........................................................................................................................................................ 7
Required but NOT Contained Parts ......................................................................................................................... 8
Preface ................................................................................................................................................................................... 9
Raspberry Pi Introduction ........................................................................................................................................ 10
Chapter 0 Raspberry Pi Preparation ............................................................................................................................... 18
Install a System........................................................................................................................................................... 18
Getting Started with Raspberry Pi .......................................................................................................................... 28
Spider Shield for Raspberry Pi................................................................................................................................. 38
Chapter 1 Installation of Python Libraries(Important)................................................................................................. 40
Step 1 Obtain the Code............................................................................................................................................ 40
Step 2 Configuration ................................................................................................................................................. 43
Step 3 Execute the Installed Program.................................................................................................................... 46
Chapter 2 Assembly of the Robot (Important) ............................................................................................................. 48
Step 1 Installing Servo Base..................................................................................................................................... 48
Step 2 Installing Servos............................................................................................................................................. 50
Step 3 Assembling the center of the body ........................................................................................................... 53
Step 4 Installing Battery Holder .............................................................................................................................. 58
Step 5 Assembling Legs and Head to the Body .................................................................................................. 60
Step 6 Installing Base and Cover Plates ................................................................................................................ 70
Chapter 3 Module Test (necessary) ................................................................................................................................ 71
Chapter 4 Hexapod Robot ............................................................................................................................................... 82
Server ........................................................................................................................................................................... 83
Client ............................................................................................................................................................................ 90
Free your innovation ............................................................................................................................................... 114
Android and iOS app .............................................................................................................................................. 119
What's Next? ..................................................................................................................................................................... 120
█ [Link] List 1
List
Top
Bottom
📧📧 support@[Link]
2 Lister 2 Assembly of the RListobot (Important) [Link] █
Machinery Parts
📧📧 support@[Link]
█ [Link] List 3
Transmission Parts
Acrylic Parts
📧📧 support@[Link]
4 Lister 2 Assembly of the RListobot (Important) [Link] █
Electronic Parts
Please note: There are two models of connection boards, remember their version numbers.
LED module x1 Camera x1 HC-SR04 Ultrasonic Module x1
Note:
The PCB Version 2 is not on sale yet. They are current at our warehouse. The only distinction between
Version 1 and Version 2 of the adapter board lies in the modification of the LED control pin.
Version 1 employs GPIO18, whereas Version 2 has switched to GPIO10.
Due to significant changes in the Raspberry Pi 5, the library rpi-ws281x-python is unable to function
properly. This library was designed to work with GPIO18, and the lack of detailed documentation on the
RP1 chip from the Raspberry Pi authorities has hindered the resolution of this issue.
Consequently, we have introduced an alternative approach, utilizing the SPI MOSI pin for communication
with the LED lights. Although this restored the functionality of the LEDs, it also meant that SPI-related
pins (SCK, MISO) could not be used for other purposes. This serves as an interim measure, and once the
rpi-ws281x-python library resumes normal functionality on pi 5, Version 2 is expected to be phased out.
If you want to achieve the function of V2, you can connect GPIO10 to GPIO18 with a jumper wire, as
shown below.
📧📧 support@[Link]
█ [Link] List 5
Please note that this cable only come with the purchase of the Raspberry Pi 5 version.
Battery holder x2
📧📧 support@[Link]
6 Lister 2 Assembly of the RListobot (Important) [Link] █
Tools
📧📧 support@[Link]
█ [Link] List 7
Calibration Graph
📧📧 support@[Link]
8 Lister 2 Assembly of the RListobot (Important) [Link] █
Four 18650 lithium batteries without protection board. Discharge current is greater than 15A
📧📧 support@[Link]
█ [Link] Preface 9
Preface
Welcome to use this robot. Following this tutorial, you can make a very cool robot with many functions.
This kit is based on Raspberry Pi, a popular control panel, so you can share and exchange your experience
and design ideas with many enthusiasts all over the world. The parts in this kit include all electronic
components, modules, and mechanical components required for making the smart car. And all of them are
packaged individually. There are detailed assembly and commissioning instructions in this book.
And if you encounter any problems, please feel free to contact us for fast and free technical support.
support@[Link]
The contents in this book can help enthusiasts with little technical knowledge to make a robot. If you are
very interested in Raspberry Pi, and want to learn how to program and build the circuit, please visit our
website [Link] or contact us to buy the kits designed for beginners:
Freenove Basic\LCD1602\Super\Ultrasonic\RFID\Ultimate Starter Kit for Raspberry Pi
📧📧 support@[Link]
10 Prefaceer 2 Assembly of the RPrefaceobot (Important) [Link] █
Raspberry Pi Introduction
Raspberry Pi (called RPi, RPI, RasPi, the text these words will be used alternately later), a micro-computer with
size of a card, quickly swept the world since its debut. It is widely used in desktop workstation, media center,
smart home, robots, and even the servers, etc. It can do almost anything, which continues to attract fans to
explore it. Raspberry Pi used to be running with Linux system and along with the release of windows 10 IoT.
We can also run it with Windows. Raspberry Pi (with interfaces USB, network, HDMI, camera, audio, display
and GPIO), as a microcomputer, can be running in command line mode and desktop system mode.
Additionally, it is easy to operate just like Arduino, and you can even directly operate the GPIO of CPU.
So far, at this writing, Raspberry Pi has advanced to its fifth generation product offering. Version changes are
accompanied by increases in upgrades in hardware and capabilities.
The A type and B type versions of the first generation products have been discontinued due to various reasons.
What is most important is that other popular and currently available versions are consistent in the order and
number of pins and their assigned designation of function, making compatibility of peripheral devices greatly
enhanced between versions.
Below are the raspberry pi pictures and model pictures supported by this product. They have 40 pins.
📧📧 support@[Link]
█ [Link] Preface 11
Actual image of Raspberry Pi 3 Model B+: CAD image of Raspberry Pi 3 Model B+:
📧📧 support@[Link]
12 Prefaceer 2 Assembly of the RPrefaceobot (Important) [Link] █
📧📧 support@[Link]
█ [Link] Preface 13
Actual image of Raspberry Pi 1 Model B+: CAD image of Raspberry Pi 1 Model B+:
Actual image of Raspberry Pi 3 Model A+: CAD image of Raspberry Pi 3 Model A+:
📧📧 support@[Link]
14 Prefaceer 2 Assembly of the RPrefaceobot (Important) [Link] █
Actual image of Raspberry Pi 1 Model A+: CAD image of Raspberry Pi 1 Model A+:
📧📧 support@[Link]
█ [Link] Preface 15
Below are the raspberry pi pictures and model pictures supported by this product. They have 40 pins.
Hardware interface diagram of RPi 5 is shown below:
GPIO
Connector
USB
PCl Express Connector x4
interfance
On/Off button
Ethernet
Power Connector
Connector
GPIO
Connector Ethernet
Connector
Display
Connector
USB
Power Connector x4
Connector
📧📧 support@[Link]
16 Prefaceer 2 Assembly of the RPrefaceobot (Important) [Link] █
GPIO
Connector
USB
Connector
Display
Connector
Ethernet
Power Connector
Connector
GPIO
Connector
USB
Display Connector
Connector
Power
Connector
GPIO
Connector
Camera
Connector
📧📧 support@[Link]
█ [Link] Preface 17
GPIO
GPIO: General purpose input/output. We will introduce the specific feature of the pins on the Raspberry Pi
and what you can do with them. You can use them for all sorts of purposes. Most of them can be used as
either inputs or outputs, depending on your program.
When programming the GPIO pins there are 3 different ways to refer to them: GPIO numbering, physical
numbering, WiringPi GPIO Numbering.
BCM GPIO Numbering
Raspberry Pi CPU use BCM2835/BCM2836/BCM2837of Broadcom. GPIO pin number is set by chip
manufacturer. These are the GPIO pins as that computer recognizes. The numbers are unordered and don't
make any sense to humans. You will need a printed reference or a reference board that fits over the pins.
Each pin is defined as below:
For more details about pin definition of GPIO, please refer to [Link]
📧📧 support@[Link]
18 Chapter 0 Raspberry Pi Preparationer 2 Assembly of the RChapter 0 Raspberry Pi Preparationobot
[Link] █
(Important)
Install a System
Component List
Required Components
Raspberry Pi 5 / 4B / 3B+ (Recommended) 5V/3A Power Adapter. Different versions of
Raspberry Pi have different power requirements.
Micro USB Cable x1 Micro SD Card (TF Card) x1, Card Reader x1
This robot also supports the following versions of the Raspberry Pi, but additional accessories need to be
prepared by yourself.
Raspberry Additional accessories
Raspberry Pi Zero W Camera cable(>25cm) for zero w, 15 Pin 1.0mm Pitch to 22 Pin 0.5mm
[Link]
Raspberry Pi Zero 1.3 wireless network adapter,
Camera cable(>25cm) for zero w, 15 Pin 1.0mm Pitch to 22 Pin 0.5mm,
OTG cable (USB Type micro B to USB Type A)
Raspberry Pi 2 Model B wireless network adapter
Raspberry Pi 1 Model A+ wireless network adapter
Raspberry Pi 1 Model B+ wireless network adapter
📧📧 support@[Link]
█ [Link] Chapter 0 Raspberry Pi Preparation 19
In addition, RPi also needs an Ethernet network cable used to connect it to a WAN (Wide Area Network).
The Raspberry Pi 5 provides 1.6A of power to downstream USB peripherals when connected to a power supply
capable of 5A at +5V (25W). When connected to any other compatible power supply, the Raspberry Pi 5
restricts downstream USB devices to 600mA of power.
📧📧 support@[Link]
20 Chapter 0 Raspberry Pi Preparationer 2 Assembly of the RChapter 0 Raspberry Pi Preparationobot
[Link] █
(Important)
Optional Components
Under normal circumstances, there are two ways to login to Raspberry Pi: 1) Using a stand-alone monitor. 2)
Using a remote desktop or laptop computer monitor “sharing” the PC monitor with your RPi.
Required Accessories for Monitor
If you choose to use an independent monitor, mouse and keyboard, you also need the following accessories:
1. A display with a HDMI interface
2. A Mouse and a Keyboard with an USB interface
For different Raspberry Pi Modules, the optional items may vary slightly but they all aim to convert the
interfaces to Raspberry Pi standards.
Pi Zero Pi
Pi Zero Pi A+ Pi 3A+ Pi B+/2B Pi 4B Pi 5
W 3B/3B+
Monitor Yes (All)
Mouse Yes (All)
Keyboard Yes (All)
Micro-HDMI to
HDMI Adapter & Yes No Yes No No No No No
Cable
Micro-HDMI to
HDMI Adapter & No Yes
Cable
Micro-USB to
USB-A Adapter &
Yes No Yes No
Cable (Micro USB
OTG Cable)
USB HUB Yes Yes Yes Yes No No No No
USB to Ethernet Internal
select one from optional
Interface Integration
two or select Internal Integration
USB Wi-Fi Receiver Internal
two from two optional
Integration
📧📧 support@[Link]
█ [Link] Chapter 0 Raspberry Pi Preparation 21
📧📧 support@[Link]
22 Chapter 0 Raspberry Pi Preparationer 2 Assembly of the RChapter 0 Raspberry Pi Preparationobot
[Link] █
(Important)
Raspberry Pi OS
Automatically Method
You can follow the official method to install the system for raspberry pi via visiting link below:
[Link]
In this way, the system will be downloaded automatically via the application.
Manually Method
After installing the Imager Tool in the link above. You can also download the system manually first.
Visit [Link]
📧📧 support@[Link]
█ [Link] Chapter 0 Raspberry Pi Preparation 23
Select a Raspberry PI Device based on your Raspberry PI version. It will help us filter out the right version of
the system for the Raspberry PI.
📧📧 support@[Link]
24 Chapter 0 Raspberry Pi Preparationer 2 Assembly of the RChapter 0 Raspberry Pi Preparationobot
[Link] █
(Important)
📧📧 support@[Link]
█ [Link] Chapter 0 Raspberry Pi Preparation 25
📧📧 support@[Link]
26 Chapter 0 Raspberry Pi Preparationer 2 Assembly of the RChapter 0 Raspberry Pi Preparationobot
[Link] █
(Important)
Click Save, in the new screen, click Yes, wait for SD to brush into the Raspberry system.
📧📧 support@[Link]
█ [Link] Chapter 0 Raspberry Pi Preparation 27
Insert SD card
Then remove SD card from card reader and insert it into Raspberry Pi.
Connect to the power supply and wait for the Raspberry PI to turn on.
📧📧 support@[Link]
28 Chapter 0 Raspberry Pi Preparationer 2 Assembly of the RChapter 0 Raspberry Pi Preparationobot
[Link] █
(Important)
Monitor desktop
If you do not have a spare monitor, please skip to next section Remote desktop & VNC. If you have a spare
monitor, please follow the steps in this section.
After the system is written successfully, take out Micro SD Card and put it into the SD card slot of RPi. Then
connect your RPi to the monitor through the HDMI port, attach your mouse and keyboard through the USB
ports, attach a network cable to the network port and finally, connect your power supply (making sure that it
meets the specifications required by your RPi Module Version. Your RPi should start (power up). Later, after
setup, you will need to enter your user name and password to login. The default user name: pi; password:
raspberry. After login, you should see the following screen.
Congratulations! You have successfully installed the RASPBERRY PI OS operating system on your RPi.
Raspberry Pi 5, 4B, 3B+/3B integrates a Wi-Fi adaptor. You can use it to connect to your Wi-Fi. Then you can
use the wireless remote desktop to control your RPi. This will be helpful for the following work. Raspberry Pi
of other models can use wireless remote desktop through accessing an external USB wireless card.
Connect WiFi
📧📧 support@[Link]
█ [Link] Chapter 0 Raspberry Pi Preparation 29
Set Resolution
📧📧 support@[Link]
30 Chapter 0 Raspberry Pi Preparationer 2 Assembly of the RChapter 0 Raspberry Pi Preparationobot
[Link] █
(Important)
If you don't know what resolution to set properly, you can try 1920x1080.
In addition, your VNC Viewer window may zoom your Raspberry Pi desktop. You can change it. On your
VNC View control panel, click right key. And select Properties->Options label->Scaling. Then set proper
scaling.
Here, you have logged in to Raspberry Pi successfully by using VNC Viewer and operated proper setting.
📧📧 support@[Link]
█ [Link] Chapter 0 Raspberry Pi Preparation 31
Raspberry Pi 5/4B/3B+/3B integrates a Wi-Fi [Link] you did not connect Pi to WiFi. You can connect it to
wirelessly control the robot.
📧📧 support@[Link]
32 Chapter 0 Raspberry Pi Preparationer 2 Assembly of the RChapter 0 Raspberry Pi Preparationobot
[Link] █
(Important)
If you have logged in Raspberry Pi via display, you can skip to VNC Viewer.
If you don't have a spare display, mouse and keyboard for your RPi, you can use a remote desktop to share
a display, keyboard, and mouse with your PC. Below is how to use:
MAC OS remote desktop and Windows OS remote desktop.
MAC OS Remote Desktop
Open the terminal and type following command. If this command doesn’t work, please move to next page.
ssh pi@[Link]
The password is raspberry by default, case sensitive. You may need to type yes during the process.
📧📧 support@[Link]
█ [Link] Chapter 0 Raspberry Pi Preparation 33
📧📧 support@[Link]
34 Chapter 0 Raspberry Pi Preparationer 2 Assembly of the RChapter 0 Raspberry Pi Preparationobot
[Link] █
(Important)
📧📧 support@[Link]
█ [Link] Chapter 0 Raspberry Pi Preparation 35
📧📧 support@[Link]
36 Chapter 0 Raspberry Pi Preparationer 2 Assembly of the RChapter 0 Raspberry Pi Preparationobot
[Link] █
(Important)
Then download and install VNC Viewer according to your computer system by click following link:
[Link]
After installation is completed, open VNC Viewer. And click File New Connection. Then the interface is
shown below.
Enter ip address of your Raspberry Pi and fill in a name. Then click OK.
📧📧 support@[Link]
█ [Link] Chapter 0 Raspberry Pi Preparation 37
Then on the VNC Viewer panel, double-click new connection you just created,
The control board is mainly connected the Raspberry Pi through the “PI-GPIO” port and the positioning
holes on the board are suitable for the Raspberry Pi. The features and functions of the control panel are as
follows.
D2 Indicator D1 Indicator
S1(CTRL)Switch
S2(LOAD)Switch
IO Port
MPU6050 Port
LED Port
DC Jack
Ultrasonic Port
Servo Port
Buzzer
📧📧 support@[Link]
█ [Link] Chapter 0 Raspberry Pi Preparation 39
Spider Shield board: powered by two sets of batteries without protection plates, with each set containing
two 18650 batteries and voltage ranging from 7V-8.4V.
DC socket: Two DC sockets available, each connecting to one set of batteries, each containing two 18650
batteries.
S1(CTRL) Switch: It mainly controls chips like PCA9685 and ADS7830 and the power supply of the
Raspberry Pi. When it is pressed, D1 indicator will turn ON.
S2(LOAD) Switch: It mainly controls the power supply of servos. When it is pressed, D2 indicator will turn
ON.
LED port: Used to connect the LED Module, controlled directly by RPi.
MPU6050 Module port: Used to connect MPU6050, controlled directly by RPi.
PI-GPIO port: Used to connect control board with RPi, facilitating RPi to control the robot
I2CExtension Board: Used for the extension of other I2C devices.
Servo port: 32 servo ports available.
Sonic module port: The interface of HC-SR04 Ultrasonic Module is provided.
Buzzer: Turning ON when it is at high level and OFF at low level, directly controlled by RPi
📧📧 support@[Link]
40 Chapter 1 Installation of Python Libraries(Important)er 2 Assembly of the RChapter [Link]
1 Installation of █
Python Libraries(Important)obot (Important)
Caution: Do NOT install it without referring to the tutorial. Otherwise, it may cause installation errors and
damage the components.
Note:
1, Please use Raspberry Pi OS with Desktop
2, The installation of libraries takes much time. You can power Raspberry Pi with a power supply Cable.
3, If you are using remote desktop to login Raspberry Pi, you need to use VNC viewer.
You can watch this video while reading this chapter: [Link]
To download the code, you can power Raspberry Pi with a power supply cable or switch on S1 (Power Switch).
Then open the Raspberry Pi and the terminal. You can open the terminal by clicking as shown below, or you
can press “CTRL + ALT + T” on the desktop.
Terminal
Enter the following commands in the terminal to obtain the robot’s code and save it to the user’s directory”
Pi”. (Note that here are two commands, please enter them one by one in order.)
cd ~
git clone --depth 1
[Link]
📧📧 support@[Link]
█ [Link] Chapter 1 Installation of Python Libraries(Important) 41
First, execute python to check the default python on your Raspberry Pi. Press Ctrl-Z to exit.
If you want to set python2 as default python in other projects, just repeat the commands above and change
python3 to python2.
📧📧 support@[Link]
42 Chapter 1 Installation of Python Libraries(Important)er 2 Assembly of the RChapter [Link]
1 Installation of █
Python Libraries(Important)obot (Important)
Shortcut Key
Now, we will introduce several shortcuts that are very useful and commonly used in terminal.
1. up and down arrow keys. History commands can be quickly brought back by using up and down arrow
keys, which are very useful when you need to reuse certain commands.
When you need to type command, pressing “↑” will bring back the previous command, and pressing “↓” will
bring back the latter command.
2. Tab key. The Tab key can automatically complete the command/path you want to type. When there are
multiple commands/paths conforming to the already typed letter, pressing Tab key once won’t have any result.
And pressing Tab key again will list all the eligible options. This command/path will be directly completed
when there is only one eligible option.
As shown below, under the ‘~’directory, enter the Documents directory with the “cd” command. After typing
“cd D”, press Tab key, then there is no response. Press Tab key again, then all the files/folders that begin with
“D” is listed. Continue to type the character "oc", then press the Tab key, and then “Documents” is completed
automatically.
📧📧 support@[Link]
█ [Link] Chapter 1 Installation of Python Libraries(Important) 43
Step 2 Configuration
Click
Click
Note that if your connector version is V2.0, remember to turn on the SPI feature. If your connector version is
V1.0, turn off the SPI feature.
📧📧 support@[Link]
44 Chapter 1 Installation of Python Libraries(Important)er 2 Assembly of the RChapter [Link]
1 Installation of █
Python Libraries(Important)obot (Important)
Press "CTRL"+"O" and then "Enter" to save the modified content. Then press "CTRL"+"X" to exit editing.
After the modification is completed, reboot Raspberry Pi to make the change work. You can also reboot the
Raspberry Pi after completing the step 3 below.
Type a command to check whether the I2C module is enabled:
lsmod | grep i2c
If I2C module has been enabled, the following content will show up (the numbers showing in your device may
be different):
Install I2C-Tools
Type the command to install I2C-Tools.
sudo apt-get install i2c-tools
Install python-smbus
Python-smbus is a module of the program Python, which contains some classes and methods to operate I2C.
Type the following command to install python-smbus:
sudo apt-get install python3-smbus
📧📧 support@[Link]
█ [Link] Chapter 1 Installation of Python Libraries(Important) 45
Additional supplement
Raspbery Pi, other than 5, 4B and 400, needs to disable the audio module, othewise the LED will not work
properly.
1. Create a new [Link] and open it for editing
sudo nano /etc/modprobe.d/[Link]
Add following content: After adding the contents, you need to press Ctrl+O, Enter, Ctrl+Z.
blacklist snd_bcm2835
It will take effect after restarting, and you can restart after executing the next section.
If you want to restart the audio module, just restore the content modified in the above two steps.
📧📧 support@[Link]
46 Chapter 1 Installation of Python Libraries(Important)er 2 Assembly of the RChapter [Link]
1 Installation of █
Python Libraries(Important)obot (Important)
OV5647 Imx219
If your Rpi is a Pi 5, it will ask you which camera interface to use. You can type in cam0 or cam1 based on the
interface you want to use.
Note: Make sure you connect the camera cable to the corresponding interface.
If it is not Raspberry Pi, this setting is not needed, as there is only camera interface available.
📧📧 support@[Link]
█ [Link] Chapter 1 Installation of Python Libraries(Important) 47
Cam0
Cam1
The reboot of the pi takes some time, please wait with patience.
If the installation fails, please rerun [Link]. After the installation is completed, restart the Raspberry Pi. Most
installation failures are caused by network reasons.
sudo python [Link]
📧📧 support@[Link]
48 Chapter 2 Assembly of the Robot (Important)er 2 Assembly of the RChapter 2 Assembly
[Link]
of the Robot █
(Important)obot (Important)
You can watche this video while reading this chapter: [Link]
We will help you with any concerns via support@[Link]
Take out the disc servo arms from the servo package.
M1.8x8
📧📧 support@[Link]
█ [Link] Chapter 2 Assembly of the Robot (Important) 49
After all disc servo arms are installed successfully, it should look as follows:
📧📧 support@[Link]
50 Chapter 2 Assembly of the Robot (Important)er 2 Assembly of the RChapter 2 Assembly
[Link]
of the Robot █
(Important)obot (Important)
Servo
M4 Anti-Slip Nut
📧📧 support@[Link]
█ [Link] Chapter 2 Assembly of the Robot (Important) 51
M4x14
M4 Anti-Slip Nut
M4x14
M4 Anti-Slip Nut
Assembly
M3x12s
M3 Nut
📧📧 support@[Link]
52 Chapter 2 Assembly of the Robot (Important)er 2 Assembly of the RChapter 2 Assembly
[Link]
of the Robot █
(Important)obot (Important)
Assembly
M3x12
M3 Nut
Servos at left and right hip joints (Note: the direction of servos on each side is different.)
📧📧 support@[Link]
█ [Link] Chapter 2 Assembly of the Robot (Important) 53
Head
M2.5x8
M2.5x8
📧📧 support@[Link]
54 Chapter 2 Assembly of the Robot (Important)er 2 Assembly of the RChapter 2 Assembly
[Link]
of the Robot █
(Important)obot (Important)
M3x12
LED Module
M3 Nut
Wiring
📧📧 support@[Link]
█ [Link] Chapter 2 Assembly of the Robot (Important) 55
Note: There are two rows of female header, please plug the module into the right.
MPU6050 Module
Female Header on
the right
Installing Raspberry Pi
M2.5x8
Raspberry Pi
📧📧 support@[Link]
56 Chapter 2 Assembly of the Robot (Important)er 2 Assembly of the RChapter 2 Assembly
[Link]
of the Robot █
(Important)obot (Important)
Installing Connector
We have two types of connection boards, but they are installed in the same way.
See here for more information.
Connection board (PCB_V1.0) Connection board (PCB_V2.0)
M3x12
📧📧 support@[Link]
█ [Link] Chapter 2 Assembly of the Robot (Important) 57
📧📧 support@[Link]
58 Chapter 2 Assembly of the Robot (Important)er 2 Assembly of the RChapter 2 Assembly
[Link]
of the Robot █
(Important)obot (Important)
M3x14
Countersunk screw
M3 Nut
📧📧 support@[Link]
█ [Link] Chapter 2 Assembly of the Robot (Important) 59
M3x12
M3x12
📧📧 support@[Link]
60 Chapter 2 Assembly of the Robot (Important)er 2 Assembly of the RChapter 2 Assembly
[Link]
of the Robot █
(Important)obot (Important)
Before installing, fix the servos at the specified angle. At this point you need to run the servo program.
Plug batteries into the battery holder. And then plug the battery holder to control board.
Plug into
S2 S1
📧📧 support@[Link]
█ [Link] Chapter 2 Assembly of the Robot (Important) 61
Open Raspberry Pi. (All contents in Chapter 1 should be executed correctly first. If not, please return Chapter
1 to finish it first.)
Enter the following command to enter the directory where the servo program locates.
cd ~/Freenove_Big_Hexapod_Robot_Kit_for_Raspberry_Pi/Code/Server
b. Execute the following command to run “[Link]”.
sudo python [Link]
Next, fix each servo to the corresponding disc servo arm. Do NOT pull the servo wires during the installation
process.
📧📧 support@[Link]
62 Chapter 2 Assembly of the Robot (Important)er 2 Assembly of the RChapter 2 Assembly
[Link]
of the Robot █
(Important)obot (Important)
Bottom
Top
📧📧 support@[Link]
█ [Link] Chapter 2 Assembly of the Robot (Important) 63
📧📧 support@[Link]
64 Chapter 2 Assembly of the Robot (Important)er 2 Assembly of the RChapter 2 Assembly
[Link]
of the Robot █
(Important)obot (Important)
📧📧 support@[Link]
█ [Link] Chapter 2 Assembly of the Robot (Important) 65
Asseble 6 standoff
M3x12
M3x55
📧📧 support@[Link]
66 Chapter 2 Assembly of the Robot (Important)er 2 Assembly of the RChapter 2 Assembly
[Link]
of the Robot █
(Important)obot (Important)
📧📧 support@[Link]
█ [Link] Chapter 2 Assembly of the Robot (Important) 67
Installing head
Servo1
M2 Nut
M2 Nut
M2x16
M2x16
Camera
Servo0
M2x16
M1.4x5
Acrylic
M2 Nut Servo arm in the servo package
M2x16
Screws in servo
package
📧📧 support@[Link]
68 Chapter 2 Assembly of the Robot (Important)er 2 Assembly of the RChapter 2 Assembly
[Link]
of the Robot █
(Important)obot (Important)
📧📧 support@[Link]
█ [Link] Chapter 2 Assembly of the Robot (Important) 69
📧📧 support@[Link]
70 Chapter 2 Assembly of the Robot (Important)er 2 Assembly of the RChapter 2 Assembly
[Link]
of the Robot █
(Important)obot (Important)
M3x12
📧📧 support@[Link]
█ [Link] Chapter 3 Module Test (necessary) 71
Servo
Run program
Enter following commands in the terminal to test servos.
If the terminal displays the directory as below (where [Link] is located). You can directly execute the [Link]
command.
📧📧 support@[Link]
72 Chapter 3 Module Test (necessary)er 2 Assembly of the RChapter 3 Module Test (necessary)obot
[Link] █
(Important)
Result:
In the previous chapter, we have assembled the robot and executed the servo installation program, which
makes the six legs of the robot straight.
After running the servo test program, the robot slowly rotates its six legs clockwise from the original straight
state, and then lifts the legs up, and finally stands with the lower leg extended back. If the sequence of the
movement of your robot is different, please check whether the wiring is correct.
📧📧 support@[Link]
█ [Link] Chapter 3 Module Test (necessary) 73
Reference
set_servo_angle(channel, angle)
There are two parameters in this function to rotate the servo of specified channel to a specified angle.
The first parameter indicates the servo channel
The second parameter indicates the rotation angle
For example:
set_servo_angle(0,60) Rotate servo of channel 0 to 60 degrees
set_servo_angle(15,160) Rotate servo of channel 15 to 160 degrees
📧📧 support@[Link]
74 Chapter 3 Module Test (necessary)er 2 Assembly of the RChapter 3 Module Test (necessary)obot
[Link] █
(Important)
ADC Module
Run program
Enter following commands to test ADC module.
If the terminal displays the directory as below (where [Link] is located). You can directly execute the [Link]
command.
Result:
Print out the voltage value of two sets of batteries every one second,You can press "Ctrl + C" to end program.
The code is as below:
1 def test_Adc():
2 from adc import ADC
3 adc = ADC()
4 try:
5 while True:
6 Power=adc.read_battery_voltage()
7 print ("The battery voltage is "+str(Power)+'\n')
8 [Link](1)
9 except KeyboardInterrupt:
10 print ("\nEnd of program")
Reference
read_battery_voltage()
Return the voltage value of the battery, retaining two decimal places.
📧📧 support@[Link]
█ [Link] Chapter 3 Module Test (necessary) 75
Ultrasonic module
Run program
Enter the following command in the terminal to test the ultrasonic module:
If the terminal displays the directory as below (where [Link] is located). You can directly execute the [Link]
command.
Result:
Every 1s, the distance between the obstacle and the ultrasonic module will be printed in, and you can press
"Ctrl + C" to end the program.
The code is as below:
1 def test_Ultrasonic():
2 from ultrasonic import Ultrasonic
3 ultrasonic=Ultrasonic()
4 try:
5 while True:
6 data=ultrasonic.get_distance() #Get the value
7 print ("Obstacle distance is "+str(data)+"CM")
8 [Link](0.01)
9 except KeyboardInterrupt:
10 print ("\nEnd of program")
Reference
get_distance()
This function is used to obtain the distance of ultrasonic module and front obstacle, with unit CM.
📧📧 support@[Link]
76 Chapter 3 Module Test (necessary)er 2 Assembly of the RChapter 3 Module Test (necessary)obot
[Link] █
(Important)
Led
Note: Raspberry PI 5 is temporarily unavailable because the Library rpi-ws281x-python does not
support Raspberry PI 5. Please skip this section.
There is an LED module on the robot, as shown below:
Run program
Enter the following commands to test LED.
If the terminal displays the directory as below (where [Link] is located). You can directly execute the [Link]
command.
📧📧 support@[Link]
█ [Link] Chapter 3 Module Test (necessary) 77
If your connection board version is V2.0 and you do not have the SPI feature turned on, the LedPixel will not
show the color. Refer here to turn on the SPI
Result:
The LED lights up with the color of red, green, blue and white in turn and then it turns OFF. You can end the
program ahead of time by pressing "ctrl+c".
If the LED color display order is not correct, open the "[Link]" file in the current directory and modify the
value of the "[Link]" variable on line 16.
📧📧 support@[Link]
78 Chapter 3 Module Test (necessary)er 2 Assembly of the RChapter 3 Module Test (necessary)obot
[Link] █
(Important)
Reference
color_wipe(color, wait_ms)
This function erases the color of one pixel at a time, has two input parameters, color represents the color
to be erased, and wait_ms represents the erasure interval. The default is 50ms. For example, color_wipe
([255,0,0],20) means that the LED0 color is red first, wait for 20ms, and then the LED1 color is also red, so
that all eight LEDs are lit and red.
📧📧 support@[Link]
█ [Link] Chapter 3 Module Test (necessary) 79
Buzzer
Result:
The buzzer will be turn on lasting for 3s. Then the program will automatically end or you can press "Ctrl + C"
to end the program.
📧📧 support@[Link]
80 Chapter 3 Module Test (necessary)er 2 Assembly of the RChapter 3 Module Test (necessary)obot
[Link] █
(Important)
Reference
buzzer.set_state(cmd)
This function has one input parameter. If the input is True, the buzzer will be turned on. If the input is False,
the buzzer will be turned off.
📧📧 support@[Link]
█ [Link] Chapter 3 Module Test (necessary) 81
Camera
Run program
1. execute the cd command:
cd ~/Freenove_Big_Hexapod_Robot_Kit_for_Raspberry_Pi/Code/Server
2. Execute [Link] command:
python [Link]
Then please open and check the generated [Link] under
/Freenove_Big_Hexapod_Robot_Kit_for_Raspberry_Pi/Code/Server.
📧📧 support@[Link]
82 Chapter 4 Hexapod Roboter 2 Assembly of the RChapter 4 Hexapod Robotobot (Important)
[Link] █
Start Start
Wait Connect
connectio server
No
No
If
If success
Yes Yes
Wait
Send
command
comman
No Yes
If get
comman If success
Done N
Yes
success
Execute keep
Command sending
End End
📧📧 support@[Link]
█ [Link] Chapter 4 Hexapod Robot 83
Server
The server runs on the Raspberry Pi. It sends the camera data and ultrasonic module data to the client, and
receive commands from client.
The code in the Server folder is used as an example.
Part of the server code is as follows:
1 def get_interface_ip(self):
2 s = [Link](socket.AF_INET, socket.SOCK_DGRAM)
3 return socket.inet_ntoa([Link]([Link](),
4 0x8915,
5 [Link]('256s',b'wlan0'[:15])
6 )[20:24])
7 def start_server(self):
8 #ip address
9 HOST=self.get_interface_ip()
10 #Port 8002 for video transmission
11 self.server_socket = [Link]()
12 self.server_socket.setsockopt(socket.SOL_SOCKET,socket.SO_REUSEPORT,1)
13 self.server_socket.bind((HOST, 8002))
14 self.server_socket.listen(1)
15 #Port 5002 is used for instruction sending and receiving
16 self.server_socket1 = [Link]()
17 self.server_socket1.setsockopt(socket.SOL_SOCKET,socket.SO_REUSEPORT,1)
18 self.server_socket1.bind((HOST, 5002))
19 self.server_socket1.listen(1)
20 print('Server address: '+HOST)
21 def stop_server(self):
22 try:
23 [Link]()
24 [Link]()
25 except :
26 print ('\n'+"No client connection")
27 def reset_server(self):
28 self.turn_off_server()
29 self.turn_on_server()
30 [Link]=[Link](target=self.transmission_video)
31 [Link]=[Link](target=self.receive_instruction)
32 [Link]()
33 [Link]()
📧📧 support@[Link]
84 Chapter 4 Hexapod Roboter 2 Assembly of the RChapter 4 Hexapod Robotobot (Important)
[Link] █
Reference
For more code, please check “[Link]” in the Server directory.
get_interface_ip()
To obtain the IP address of RPi’s WLAN0
start_server()
To turn ON TCP to wait for the connection of Client
stop_server()
To turn OFF TCP
send_data()
To send commands to client
reset_server ()
To restart TCP
transmit_video()
To send video data to client
receive_commands()
To receive commands from client
📧📧 support@[Link]
█ [Link] Chapter 4 Hexapod Robot 85
Open Server
Enter IP address of your Raspberry Pi and fill in a Name. And click OK.
Then on the VNC Viewer panel, double-click new connection you just created, and the following dialog box
pops up. Enter username: pi and Password: raspberry. And click OK.
📧📧 support@[Link]
86 Chapter 4 Hexapod Roboter 2 Assembly of the RChapter 4 Hexapod Robotobot (Important)
[Link] █
WiFi
If the resolution ratio is not great or there is just a little window, you can set a proper resolution ratio via
steps below.
Select Screen Configuration. Select the appropriate resolution in the new window. Click Apply.
In addition, your VNC Viewer window may zoom your Raspberry Pi desktop. You can change it. On your
VNC View control panel, click right key. And select Properties->Options label->Scaling. Then set proper
scaling.
📧📧 support@[Link]
█ [Link] Chapter 4 Hexapod Robot 87
📧📧 support@[Link]
88 Chapter 4 Hexapod Roboter 2 Assembly of the RChapter 4 Hexapod Robotobot (Important)
[Link] █
If you don’t like the interface, you can also enter the commands to open the server. It is more convenient.
1. Use cd command to enter directory where [Link] is located:
cd ~/Freenove_Big_Hexapod_Robot_Kit_for_Raspberry_Pi/Code/Server
2. Run [Link]:
sudo python [Link] -t -n
or Run main,py with following command:
sudo python [Link] -tn
“-t” means open TCP communication. “-n“ means don’t show interface.
4 Modify permissions.
sudo chmod 777 [Link]
5 Enter the following command to create a directory.
mkdir ~/.config/autostart/
6 create and open “[Link]” file
sudo nano .config/autostart/[Link]
📧📧 support@[Link]
█ [Link] Chapter 4 Hexapod Robot 89
8 Modify permissions.
sudo chmod +x .config/autostart/[Link]
Note: To cancel auto start, please delete the files “[Link]” and “[Link]” created above.
📧📧 support@[Link]
90 Chapter 4 Hexapod Roboter 2 Assembly of the RChapter 4 Hexapod Robotobot (Important)
[Link] █
Client
Client can receive video data and commands from the server as well as send commands to server. It can also
be run in different systems including Windows and macOS as long as you install the related software and
libraries.
📧📧 support@[Link]
█ [Link] Chapter 4 Hexapod Robot 91
37 try:
38 self.client_socket1.send([Link]('utf-8'))
39 except Exception as e:
40 print(e)
41 def receive_data(self):
42 data=""
43 data=self.client_socket1.recv(1024).decode('utf-8')
44 return data
Reference
For more code, please check “[Link]” in the Client director.
turn_on_client ()
To connect to the server
turn_off_client ()
To disconnect server。
receiving_video()
To receive video data from server
is_valid_image_4_bytes ()
To check the integrity of each frame of video data
send_data ()
To send commands to server
receive_data ()
To receive commands from server
📧📧 support@[Link]
92 Chapter 4 Hexapod Roboter 2 Assembly of the RChapter 4 Hexapod Robotobot (Important)
[Link] █
When the Client is opened successfully, you need to turn on Raspberry Pi and open the server. Enter Raspberry
Pi’s IP address in the white IP editor and click “Connect” to connect the robot with RPi. After connecting
successfully, you need to calibrate the robot's six legs before control it to move.
Note: when Raspberry Pi is shut down, server will be closed. You need open server again the next time.
📧📧 support@[Link]
█ [Link] Chapter 4 Hexapod Robot 93
[Link] python3 and some related python libraries and execute the program through python3 editor.
This section will be completed in your computer with windows system, not Raspberry Pi.
Running client on Windows system requires the installation of some software and libraries, which take some
time. At this point, it does not require to run server and use the Raspberry Pi, so you can turn OFF RPi
temporarily. After installing successfully, turn ON the RPi and run the Server.
Install python3
Download the installation file via below:
[Link]
Select “Windows x86 executable installer”. Execute the installer when completes downloading.。
📧📧 support@[Link]
94 Chapter 4 Hexapod Roboter 2 Assembly of the RChapter 4 Hexapod Robotobot (Important)
[Link] █
Check “Add Python 3.8 to PATH” and install according to your needs.
📧📧 support@[Link]
█ [Link] Chapter 4 Hexapod Robot 95
My installation path here is Disk D (You can choose whichever you prefer). Click Install.
📧📧 support@[Link]
96 Chapter 4 Hexapod Roboter 2 Assembly of the RChapter 4 Hexapod Robotobot (Important)
[Link] █
Installation finishes.
📧📧 support@[Link]
█ [Link] Chapter 4 Hexapod Robot 97
Install libraries including PyQt5 library, opencv library, numpy library, etc.
If have not download the zip file, download it via below:
[Link]
Then unzip it and delete “-master” to rename it to “Freenove_Big_Hexapod_Robot_Kit_for_Raspberry_Pi”.
Then put it into D disk for example.
You can also place it into other disks (like E), but the path in following command should be modified
accordingly (replace D: by E:).
Press “win + R” and enter cmd, and click ok. Then enter following commands.
[Link] D disk. If you put it into E, it should be E:
D:
[Link] directory where setup_windows.py is located:
cd D:\Freenove_Big_Hexapod_Robot_Kit_for_Raspberry_Pi\Code
[Link]: setup_windows.py
Python setup_windows.py
The installation takes some time, please wait with patience. When all the libraries are installed successfully,
you can see the prompt “All libraries installed successfully” on the screen.
📧📧 support@[Link]
98 Chapter 4 Hexapod Roboter 2 Assembly of the RChapter 4 Hexapod Robotobot (Important)
[Link] █
If there is any library fails to install, it will print “Some libraries have not been installed yet. Please run 'python
setup_windows.py' again” on the screen, then you need to execute the command python setup_windows.py
again. Most installation fails because of poor network, so you can check your network before installing the
libraries.
📧📧 support@[Link]
█ [Link] Chapter 4 Hexapod Robot 99
Open client
Press “win + R” and enter cmd, and click ok. Then enter following commands.
[Link] D disk. If you put it into E, it should be E:
D:
[Link] directory where [Link] is located:
cd D:\Freenove_Big_Hexapod_Robot_Kit_for_Raspberry_Pi\Code\Client
[Link] [Link]:
Python [Link]
Note: If the default python of your Windows system is not Python3 but python2, change the command
[Link] as follows:
Python3 [Link]
The client interface is shown as below:
📧📧 support@[Link]
100 Chapter 4 Hexapod Roboter 2 Assembly of the RChapter 4 Hexapod Robotobot (Important)
[Link] █
When the Client is opened successfully, you need to turn on Raspberry Pi and open the server. Enter Raspberry
Pi’s IP address in the white IP editor and click “Connect” to connect the robot with RPi. After connecting
successfully, you need to calibrate the robot's six legs before control it to move.
Note: when Raspberry Pi is shut down, server will be closed. You need open server again the next time.
Running client on macOS system requires the installation of some software and libraries, which take some
time. At this point, it does not require to run server and use the Raspberry Pi, so you can turn OFF RPi
temporarily. After installing successfully, turn ON the RPi and run the Server. The system comes with python2
instead of python3, so you need to install python3 first, as all the program of this robot are run with python3.
Install python3
Download the installation package via: [Link]
If your macOS is NOT 11, like 10.15, please install python 3.8. If you have
📧📧 support@[Link]
█ [Link] Chapter 4 Hexapod Robot 101
Slide to the bottom of the page and click macOS 64-bit installer.
Click Continue
📧📧 support@[Link]
102 Chapter 4 Hexapod Roboter 2 Assembly of the RChapter 4 Hexapod Robotobot (Important)
[Link] █
Click Continue
Click Agree
📧📧 support@[Link]
█ [Link] Chapter 4 Hexapod Robot 103
Click “Install”, enter the computer password and click “Install Software”.
Install successfully
📧📧 support@[Link]
104 Chapter 4 Hexapod Roboter 2 Assembly of the RChapter 4 Hexapod Robotobot (Important)
[Link] █
Open “Terminal”
📧📧 support@[Link]
█ [Link] Chapter 4 Hexapod Robot 105
When all the libraries are installed successfully, you can see the prompt “All libraries installed successfully” on
the screen. If there is any library fails to install, it will print “Some libraries have not been installed yet. Please
run ' python3 setup_macos.py' again” on the screen, then you need to execute the command python3
setup_macos.py again.
If you are using macOS under 11.0, like 10.15. Just skip to “Open client”.
If you are using macOS 11.0 or later version. Please run commands below:
pip3 uninstall PyQt5
pip3 install PyQt5
Most installation fails because of poor network, so you can check your network before installing the libraries.
Open client
Installing successfully, now you are in the directory where setup_macos.py locates.
1. Enter the following command to enter the client program folder:
cd Client/
2. Enter the following command to run the program
python3 [Link]
📧📧 support@[Link]
106 Chapter 4 Hexapod Roboter 2 Assembly of the RChapter 4 Hexapod Robotobot (Important)
[Link] █
When the Client is opened successfully, you need to turn on Raspberry Pi and open the server. Enter Raspberry
Pi’s IP address in the white IP editor and click “Connect” to connect the robot with RPi. After connecting
successfully, you need to calibrate the robot's six legs before control it to move.
Note: when Raspberry Pi is shut down, server will be closed. You need open server again the next time.
📧📧 support@[Link]
█ [Link] Chapter 4 Hexapod Robot 107
Open client
Enter the following commands at the terminal.
1. Use the cd command to go to the directory where [Link] is located.
cd ~/Freenove_Big_Hexapod_Robot_Kit_for_Raspberry_Pi/Code/Client
2. Run [Link]:
sudo python [Link]
📧📧 support@[Link]
108 Chapter 4 Hexapod Roboter 2 Assembly of the RChapter 4 Hexapod Robotobot (Important)
[Link] █
When the Client is opened successfully, you need to turn on Raspberry Pi and open the server. Enter Raspberry
Pi’s IP address in the white IP editor and click “Connect” to connect the robot with RPi. After connecting
successfully, you need to calibrate the robot's six legs before control it to move.
Note: when Raspberry Pi is shut down, server will be closed. You need open server again the next time.
📧📧 support@[Link]
█ [Link] Chapter 4 Hexapod Robot 109
Calibration
3. Connect client with server successfully, click the "Calibration" button on the client, then a calibration
window pops up.
📧📧 support@[Link]
110 Chapter 4 Hexapod Roboter 2 Assembly of the RChapter 4 Hexapod Robotobot (Important)
[Link] █
4. Calibrate the six legs to make the six foot points fall to the corresponding positions. (Due to the error of
the installation and error of the servos themselves, the six foot points may fail to fall to the specified
position perfectly, which is reasonable but we should try to make them as accurate as possible.)
📧📧 support@[Link]
█ [Link] Chapter 4 Hexapod Robot 111
5. When all the six foot points fall to the specified positions, click “Save” and you can control the robot to
move.
Note: Poor calibration will affect the robot’s movement. You can recalibrate it when needed.
📧📧 support@[Link]
112 Chapter 4 Hexapod Roboter 2 Assembly of the RChapter 4 Hexapod Robotobot (Important)
[Link] █
Control
Battery Power
📧📧 support@[Link]
█ [Link] Chapter 4 Hexapod Robot 113
📧📧 support@[Link]
114 Chapter 4 Hexapod Roboter 2 Assembly of the RChapter 4 Hexapod Robotobot (Important)
[Link] █
If you have any concerns, please feel free to contact us via support@[Link]
If you want to write your own program to control the robot dog, you can follow this chapter.
The robot program is based on python3. If your python is python2 by default, please change to python3.
If you have never learned python before, you can learn some basics through the following links:
[Link]
Program
First, open Thonny Python IDE which is easy to use for beginners.
📧📧 support@[Link]
█ [Link] Chapter 4 Hexapod Robot 115
Name it myCode and save it in Server folder of robot code folder that you have downloaded.
📧📧 support@[Link]
116 Chapter 4 Hexapod Roboter 2 Assembly of the RChapter 4 Hexapod Robotobot (Important)
[Link] █
Open the Server folder of the robot code and you can see the file you created.
Write the code in [Link] and click save after finishing, as shown below.
📧📧 support@[Link]
█ [Link] Chapter 4 Hexapod Robot 117
Type the following command to enter the directory where [Link] is located.
cd ~/Freenove_Big_Hexapod_Robot_Kit_for_Raspberry_Pi/Code/Server
Run [Link]
sudo python [Link]
Result:
The robot moves straight forward first and then walks to the right (Gait Mode1 and Action Mode1), and then
it moves back and turn right.( Gait Mode2 and Action Mode2)
Related py Files
Some important functions included in the py files are listed below. For more detailed code, please refer to the
corresponding py file.
[Link]
Function Description
voltage(channel) Returns the voltage value of corresponding channel
batteryPower() Returns the voltage value of the two sets of batteries
[Link]
Function Description
run(command) Enter 0, the buzzer will not sound; Enter 1, the buzzer sounds.
[Link]
Function Description
coordinateToAngle(x,y,z) Enter the foot coordinate and it returns the rotation angle of servos
on each joint.
angleToCoordinate(a,b,c) Enter the joint angles and it returns the foot coordinate.
Condition() Process the action command
coordinateTransformation() Transformation of coordinate system
map() Mapping a value from one range to another
Position(x,y,z) Control the in-situ movement of the body in x,y,z directions
postureBalance(r,p,y) Control in-situ twist of the body(deflection angle, roll Angle and
course angle)
run() Control the movement of the robot with two gait modes and two
📧📧 support@[Link]
118 Chapter 4 Hexapod Roboter 2 Assembly of the RChapter 4 Hexapod Robotobot (Important)
[Link] █
action modes.
[Link]
Function Description
imuUpdate() Update the current deflection angle, roll angle and course angle of
the robot
[Link]
Function Description
ledIndex( Index, R, G, B) Turn ON a single LED and set its color
wheel(pos) Generate RGB value of different colors
LED_TYPR(order,R_G_B) Change the order in which the LED color data is transmitted. When
the value of the order parameter is
"RGB", the order of data transmission should be: R-G-B; when the
value of the order parameter is "GBR",
and the order of data transmission should be: G-B-R
theaterChaseRainbow(strip, The function is used to make 7 LEDs show one color at the same time,
wait_ms) and change various colors to blink.
The blinking interval is wait_ms, and the default value is 50ms
rainbow(strip, wait_ms) This function achieves the effect of rainbow breathing. It makes 7
LEDs display same color at the same
time, and then change all various colors like breathing. The interval is
wait_ms. The default value is 20ms.
rainbowCycle(strip, wait_ms) This function also achieves the effect of rainbow breathing. but unlike
rainbow(), it makes eight LEDs to display different colors at the same
time, and then change various color separately. The interval is
wait_ms.
The default value is 20ms
[Link]
Function Description
setServoAngle(channel, angle) Rotate the servo of specified channel to a specified angle
[Link]
Function Description
getDistance() Obtain the distance between the ultrasonic module and the barrier in
front of it.
📧📧 support@[Link]
█ [Link] Chapter 4 Hexapod Robot 119
You can download and install the Freenove Android app from below:
On Google play:
[Link]
On GitHub:
[Link]
In this github repository, you can find the App instruction ([Link]).
You can download and install the Freenove iPhone ios app by searching freenove in app store.
Gait Mode/
Action Mode
LED
Power of servo
Balance
Height Mode
Operator
The servos and the Raspberry Pi are powered by two separate, independent power supplies. When the
servos are powered OFF, the power supply of RPi remains its original state.
📧📧 support@[Link]
120 What's Next?er 2 Assembly of the RWhat's Next?obot (Important) [Link] █
What's Next?
THANK YOU for participating in this learning experience!
We have reached the end of this Tutorial. If you find errors, omissions or you have suggestions and/or
questions about the Tutorial or component contents of this Kit, please feel free to contact us:
support@[Link]
We will make every effort to make changes and correct errors as soon as feasibly possible and publish a
revised version.
After completing the contents in this book, you can try to reform this robot by purchasing and installing other
Freenove electronic modules, or improving the code to achieve different functions. We will also try our best
to add more new functions and update the code on our github ([Link]
If you want to learn more about Arduino, Raspberry Pi, Smart Cars, Robotics and other interesting products
in science and technology, please continue to visit our website. We will continue to launch fun, cost-effective,
innovative and exciting products.
[Link]
📧📧 support@[Link]