0% found this document useful (0 votes)
7 views130 pages

Tutorial

The document provides an overview of Freenove products, specifically focusing on the Robot Dog Kit for Raspberry Pi, including safety precautions, support information, and assembly instructions. It emphasizes the importance of following guidelines for safe use and offers technical support for users. Additionally, it outlines the components included in the kit and the necessary external parts required for operation.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views130 pages

Tutorial

The document provides an overview of Freenove products, specifically focusing on the Robot Dog Kit for Raspberry Pi, including safety precautions, support information, and assembly instructions. It emphasizes the importance of following guidelines for safe use and offers technical support for users. Additionally, it outlines the components included in the kit and the necessary external parts required for operation.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

█ [Link].

com List 1

Welcome
Thank you for choosing Freenove products!

About Battery

First, read the document About_Battery.pdf in the unzipped folder.


If you did not download the zip file, please download it and unzip it via link below.
[Link]

Get Support and Offer Input

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.

Need support?  support@[Link]


2 List [Link] █

About Freenove

Freenove provides open source electronic products and services worldwide.

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

Free your innovation

Raspberry Pi® is a trademark of Raspberry Pi Foundation ([Link]

Need support?  support@[Link]


█ [Link] List 1

Contents
Welcome....................................................................................................................................................................................... 1
List .................................................................................................................................................................................................. 2
Robot Shield for Raspberry Pi ........................................................................................................................................ 2
Machinery Parts ................................................................................................................................................................. 3
Transmission Parts............................................................................................................................................................. 4
Acrylic Parts......................................................................................................................................................................... 4
Electronic Parts and Tools ............................................................................................................................................... 5
Required but NOT Contained Parts .............................................................................................................................. 7
Preface .......................................................................................................................................................................................... 8
Raspberry Pi Introduction ................................................................................................................................................ 9
Chapter 0 Raspberry Pi Preparation ................................................................................................................................... 19
Install a System................................................................................................................................................................ 19
Getting Started with Raspberry Pi .............................................................................................................................. 29
Robot Shield for Raspberry Pi ..................................................................................................................................... 39
Chapter 1 Install Python Libraries (Required) ................................................................................................................... 41
Step 1 Obtain the Code and Set python3 as default ............................................................................................ 41
Step 2 Configuration ..................................................................................................................................................... 44
Step 3 Run the Installation Program .......................................................................................................................... 47
Chapter 2 Assemble Robot ................................................................................................................................................... 48
Step 1 Install Disk Servo Arms ..................................................................................................................................... 48
Step 2 Install Body Bracket ........................................................................................................................................... 51
Step 3 Install Shield ........................................................................................................................................................ 52
Step 4 Install MPU6050 ................................................................................................................................................. 53
Step 5 Install LED module ............................................................................................................................................ 53
Step 6 Install Raspberry Pi ............................................................................................................................................ 55
Step 7 Install Connector................................................................................................................................................ 56
Step 8 Install Servo to Acrylic Board .......................................................................................................................... 58
Step 9 Run Servo Program (Necessary) .................................................................................................................... 61
Step 10 Assemble Legs to Body ................................................................................................................................. 64
Step 11 Assemble Head................................................................................................................................................ 68
Step 12 Assemble Head to Body ................................................................................................................................ 69
Step 13 Wiring................................................................................................................................................................. 70
Step 14 Install Calibration Support ............................................................................................................................ 74
Step 15 Verify Assembly ............................................................................................................................................... 75
Chapter 3 Module test (Required) ...................................................................................................................................... 76
Chapter 4 Robot Dog ............................................................................................................................................................. 88
Server................................................................................................................................................................................. 89
Client.................................................................................................................................................................................. 96
Free your innovation.................................................................................................................................................... 120
Android and iOS app................................................................................................................................................... 126
What's Next?........................................................................................................................................................................... 128

Need support?  support@[Link]


2 List [Link] █

List
If you have any concerns, please feel free to contact us at support@[Link]

Robot Shield for Raspberry Pi

Top

Bottom

Need support?  support@[Link]


█ [Link] List 3

Machinery Parts

Note: You may receive M1.4*4 or M1.4*5. Both are suitable. If a package of M1.2*7 self-tapping
screws cannot be found, it may be packed in the servo package.

Need support?  support@[Link]


4 List [Link] █

Transmission Parts

ES08MA Ⅱservo package x12 S90 servo package x1

Acrylic Parts

Need support?  support@[Link]


█ [Link] List 5

Electronic Parts and Tools

Please note: There are two models of connection boards, remember their version numbers.
LED module Camera HC-SR04 ultrasonic module

Connection board (PCB_V1.0) Connection board (PCB_V2.0) Not yet available for
sale

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.

Need support?  support@[Link]


6 List [Link] █

Jumper wire F/F(4) for ultrasonic module

10cm 3Pin LED cable (same direction)

25cm 15Pin camera cable (reversed direction)

FPC soft line x1

Please note that this cable only come with the purchase of the Raspberry Pi 5 version.
Cross screwdriver (3mm) x1 Cable tidy x80cm Red ball
Cross screwdriver (2mm) x1

Need support?  support@[Link]


█ [Link] List 7

Required but NOT Contained Parts

Two 18650 lithium batteries without protected board.


The continuous discharge current >10A
It is not easy to find proper batteries on Amazon. Search 18650 3.7V high drain on eBay or other
websites.

Raspberry Pi (Recommended model: Raspberry 5 / 4B / 3B+) x1

Need support?  support@[Link]


8 Preface [Link] █

Preface
Welcome to use Freenove Robot Dog Kit for Raspberry Pi. Following this tutorial, you can make a very cool
robot dog 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. This kit contains all electronic components, modules,
and mechanical components required for making the robot dog. And all of them are packaged individually.
There are detailed instructions for assembly and configuration in this book.

If you encounter any problems, please feel free to contact us for quick and free technical support.

support@[Link]

This book can help enthusiasts with little technical knowledge to make a robot dog. 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

Need support?  support@[Link]


█ [Link] Preface 9

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.

Practicality picture of Raspberry Pi 5: Model diagram of Raspberry Pi 5:

Need support?  support@[Link]


10 Preface [Link] █

Actual image of Raspberry Pi 4 Model B: CAD image of Raspberry Pi 4 Model B:

Actual image of Raspberry Pi 3 Model B+: CAD image of Raspberry Pi 3 Model B+:

Need support?  support@[Link]


█ [Link] Preface 11

Actual image of Raspberry Pi 3 Model B: CAD image of Raspberry Pi 3 Model B:

Actual image of Raspberry Pi 2 Model B: CAD image of Raspberry Pi 2 Model B:

Need support?  support@[Link]


12 Preface [Link] █

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+:

Need support?  support@[Link]


█ [Link] Preface 13

Actual image of Raspberry Pi 1 Model A+: CAD image of Raspberry Pi 1 Model A+:

Actual image of Raspberry Pi Zero W: CAD image of Raspberry Pi Zero W:

Actual image of Raspberry Pi Zero: CAD image of Raspberry Pi Zero:

Need support?  support@[Link]


14 Preface [Link] █

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

MINI HDMI Camera Display


Connector x2 Connector Connector

Hardware interface diagram of RPi 4B is shown below:

GPIO
Connector Ethernet
Connector

Display
Connector

USB
Power Connector x4
Connector

Micro HDMI Camera Audio


Connector x2 Connector Connector

Need support?  support@[Link]


█ [Link] Preface 15

Hardware interface diagram of RPi 3B+/3B/2B/1B+:

GPIO
Connector
USB
Connector
Display
Connector

Ethernet
Power Connector
Connector

HDMI Camera Audio


Connector Connector Connector

Hardware interface diagram of RPi 3A+/A+:

GPIO
Connector

USB
Display Connector
Connector

Power
Connector

HDMI Camera Audio


Connector Connector Connector

Hardware interface diagram of RPi Zero/Zero W:

GPIO
Connector

Camera
Connector

HDMI USB Power


Connector Connector Connector
Need support?  support@[Link]
16 Preface [Link] █

GPIO
GPIO: General purpose input/output. We will introduce the specific feature of the pins on the Raspberry Pi
and how you can utilize them in all sorts of ways in your projects. Most RPi Module pins can be used as either
an input or output, depending on your program and its functions. When programming the GPIO pins, there
are 3 different ways to reference them: GPIO numbering, physical numbering, WiringPi GPIO Numbering.

BCM GPIO Numbering


The Raspberry Pi CPU uses Broadcom (BCM) processing chips BCM2835, BCM2836 or BCM2837. GPIO pin
numbers are assigned by the processing chip manufacturer and are how the computer recognizes each pin.
The pin numbers themselves do not make sense or have meaning as they are only a form of identification.
Since their numeric values and physical locations have no specific order, there is no way to remember them,
so you will need to have 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]

Need support?  support@[Link]


█ [Link] Preface 17

PHYSICAL Numbering
Another way to refer to the pins is by simply counting across and down from pin 1 at the top left (nearest to
the SD card). This is 'physical numbering', as shown below:

WiringPi GPIO Numbering

Different from the previous two types of GPIO serial numbers, RPi GPIO serial number of the WiringPi are
numbered according to the BCM chip use in RPi.

(For more details, please refer to [Link] )

Need support?  support@[Link]


18 Preface [Link] █

You can also use the following command to view their correlation.
gpio readall

For more details about wiringPi, please refer to [Link] .

Need support?  support@[Link]


█ [Link] Chapter 0 Raspberry Pi Preparation 19

Chapter 0 Raspberry Pi Preparation

Install a System

Firstly, install a system for your RPi.

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

Need support?  support@[Link]


20 Chapter 0 Raspberry Pi Preparation [Link] █

Power requirements of various versions of Raspberry Pi are shown in following table:


Product Recommended Maximum total USB Typical bare-board
PSU current peripheral current draw active current
capacity consumption
Raspberry Pi 1 Model A 700mA 500mA 200mA
Raspberry Pi 1 Model B 1.2A 500mA 500mA
Raspberry Pi 1 Model A+ 700mA 500mA 180mA
Raspberry Pi 1 Model B+ 1.8A 1.2A 330mA
Raspberry Pi 2 Model B 1.8A 1.2A 350mA

Raspberry Pi 3 Model B 2.5A 1.2A 400mA


Raspberry Pi 3 Model A+ 2.5A Limited by PSU, board, and 350mA
connector ratings only.
Raspberry Pi 3 Model B+ 2.5A 1.2A 500mA
Raspberry Pi 4 Model B 3.0A 1.2A 600mA
Raspberry Pi 5 5.0A 1.6A (600mA if using a 3A 800mA
power supply)
Raspberry Pi 400 3.0A 1.2A 800mA
Raspberry Pi Zero 1.2A Limited by PSU, board, and 100mA
connector ratings only
Raspberry Pi Zero W 1.2A Limited by PSU, board, and 150mA
connector ratings only.
Raspberry Pi Zero 2 W 2A Limited by PSU, board, and 350mA
connector ratings only.
For more details, please refer to [Link]

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.

Need support?  support@[Link]


█ [Link] Chapter 0 Raspberry Pi Preparation 21

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

As to Pi Zero and Pi Zero W, you also need the following accessories:


1. A Mini-HDMI to HDMI Adapter and Cable.
2. A Micro-USB to USB-A Adapter and Cable (Micro USB OTG Cable).
3. A USB HUB.
4. USB to Ethernet Interface or USB Wi-Fi receiver.

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

Need support?  support@[Link]


22 Chapter 0 Raspberry Pi Preparation [Link] █

Required Accessories for Remote Desktop


If you do not have an independent monitor, or if you want to use a remote desktop, you first need to login
to Raspberry Pi through SSH, and then open the VNC or RDP service. This requires the following accessories.

Pi Zero Pi Zero W Pi A+ Pi 3A+ Pi B+/2B Pi 3B/3B+/4B/5


Micro-USB to USB-A
Adapter & Cable
Yes Yes No
(Micro USB OTG
NO
Cable)
USB to Ethernet
Yes Yes Yes
interface

Need support?  support@[Link]


█ [Link] Chapter 0 Raspberry Pi Preparation 23

Raspberry Pi OS
Without Screen - Use Raspberry Pi - under Windows PC: [Link]

With Screen - Use Raspberry Pi - under Windows PC: [Link]

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]

And then the zip file is downloaded.

Need support?  support@[Link]


24 Chapter 0 Raspberry Pi Preparation [Link] █

Write System to Micro SD Card


First, put your Micro SD card into card reader and connect it to USB port of PC.

Then open imager toll. Clicked Choose Device.

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.

Need support?  support@[Link]


█ [Link] Chapter 0 Raspberry Pi Preparation 25

Clicked Operating System.

Choose system that you just downloaded in Use custom.

Need support?  support@[Link]


26 Chapter 0 Raspberry Pi Preparation [Link] █

Choose the SD card. Then click “Next”.

You can configure the Raspberry PI according to your needs.

Need support?  support@[Link]


█ [Link] Chapter 0 Raspberry Pi Preparation 27

Enable ssh and configure WiFi


On the GENERAL screen, configure your information based on your actual situation.
Enable SSH on the SERVICES page.

Click Save, in the new screen, click Yes, wait for SD to brush into the Raspberry system.

Need support?  support@[Link]


28 Chapter 0 Raspberry Pi Preparation [Link] █

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.

Need support?  support@[Link]


█ [Link] Chapter 0 Raspberry Pi Preparation 29

Getting Started with Raspberry Pi

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

Need support?  support@[Link]


30 Chapter 0 Raspberry Pi Preparation [Link] █

Set Resolution
You can also set other resolutions.

Need support?  support@[Link]


█ [Link] Chapter 0 Raspberry Pi Preparation 31

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.

Need support?  support@[Link]


32 Chapter 0 Raspberry Pi Preparation [Link] █

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.

Need support?  support@[Link]


█ [Link] Chapter 0 Raspberry Pi Preparation 33

Remote desktop & VNC


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.

Need support?  support@[Link]


34 Chapter 0 Raspberry Pi Preparation [Link] █

You can also use the IP address to log in Pi.


Enter router client to inquiry IP address named “raspberry pi”.
For example, I have inquired to my RPi IP address, and it is “[Link]".

Open the terminal and type following command.


ssh pi@[Link]
When you see pi@raspberrypi:~ $, you have logged in Pi successfully. Then you can skip to next section.

Then you can skip to VNC Viewer.

Need support?  support@[Link]


█ [Link] Chapter 0 Raspberry Pi Preparation 35

Windows OS Remote Desktop


If you are using win10, you can use follow way to login Raspberry Pi without desktop.
Press Win+R. Enter cmd. Then use this command to check IP:
ping -4 [Link]

Then [Link] is my Raspberry Pi IP.


Or enter router client to inquiry IP address named “raspberrypi”. For example, I have inquired to my RPi
IP address, and it is “[Link]".
ssh pi@xxxxxxxxxxx(IP address)
Enter the following command:
ssh pi@[Link]

Need support?  support@[Link]


36 Chapter 0 Raspberry Pi Preparation [Link] █

Enable VNC Viewer


Type the following command. And select Interface Options→P5 VNC → Enter→Yes→OK. Here Raspberry Pi
may need be restarted, and choose ok. Then open VNC interface.
sudo raspi-config

Need support?  support@[Link]


█ [Link] Chapter 0 Raspberry Pi Preparation 37

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.

Need support?  support@[Link]


38 Chapter 0 Raspberry Pi Preparation [Link] █

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.

Here, you have logged in to Raspberry Pi successfully by using VNC Viewer


Need support?  support@[Link]
█ [Link] Chapter 0 Raspberry Pi Preparation 39

Robot Shield for Raspberry Pi

Shield Introduction
The shield is connected to the Raspberry Pi through the IO Port on the board. The positioning holes on the
board are suitable for the Raspberry Pi. The features and functions are as follows.

S2(CTRL) Battery level indicator

S1(LOAD)
D2 indicator

D1 indicator

LED port
IO port

MPU6050 port

Need support?  support@[Link]


40 Chapter 0 Raspberry Pi Preparation [Link] █

Buzzer

Sonar port

Servo port

⚫ Robot Shield board: It requires two 18650 3.7v batteries.


⚫ S1(LOAD) Switch: It mainly controls the power supply of servos, buzzer, ultrasonic module and LED
module. The D1 indicator will light up when S1 is pressed.
⚫ S2(CTRL) Switch: It mainly controls the power of chips such as PCF9685, ADS7830 and Raspberry Pi. The
D2 indicator will light up when S2 is pressed.
⚫ LED port: It is used to connect LED module which is controlled by Raspberry Pi.
⚫ MPU6050 port: It is used to connect MPU6050 which is controlled by Raspberry Pi.
⚫ Battery level indicator: It consists of four LEDs. When the battery power decreases gradually, the LEDs
will get dimmer gradually until it’s turned off.
⚫ IO port: It is used to connect shield with Raspberry Pi conveniently.
⚫ Servo port: There are 16 servo ports with control accuracy of 0.09 degrees.
⚫ Sonic module port: The interface of HC-SR04 Ultrasound Module is provided.
⚫ Buzzer: It is directly controlled by raspberry pi, which is turned on at high level and off at low level.

Need support?  support@[Link]


█ [Link] Chapter 1 Install Python Libraries (Required) 41

Chapter 1 Install Python Libraries (Required)


If you have any concerns, please feel free to contact us at support@[Link]
In this chapter, we will do some necessary foundational preparation work: Start your Raspberry Pi and install
some necessary libraries. And in next chapter, we will assemble the robot dog.
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 view YouTube video as a reference.


[Link]

Step 1 Obtain the Code and Set python3 as default

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

The terminal is shown below:

Type following command to get robot dog code and place it in user directory "Pi".
Please execute commands below one by one in turn.
cd ~
git clone --depth 1
[Link]

Need support?  support@[Link]


42 Chapter 1 Install Python Libraries (Required) [Link] █

Downloading takes much time. Please wait with patience.


You can also find and download the code by visiting our official website ([Link] or our
GitHub repository ([Link]

Set Python3 as default python (Necessary)


First, execute python to check the default python on your Raspberry Pi. Press Ctrl-Z to exit.

If it is python3, you can skip this section.


If it is python2, you need execute the following commands to set default python to python3.
1. Enter directory /usr/bin
cd /usr/bin
2. Delete the original python link.
sudo rm python
3. Create new python links to python.
sudo ln -s python3 python
4. Check python. Press Ctrl-Z to exit.
python

If you want to set python2 as default python in other projects, just repeat the commands above and change
python3 to python2.

Need support?  support@[Link]


█ [Link] Chapter 1 Install Python Libraries (Required) 43

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 “↑” (the Up key) will go backwards through the command
history and pressing “↓” (the Down Key) will go forwards through the command history.
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 letters, pressing Tab key once won’t have any
result. And pressing Tab key again will list all the eligible options. However, when there is only one eligible
option, the command/path will be completely typed as soon as you press the Tab key..
As shown below, under the ‘~’directory, enter the Documents directory with the “cd” command. After typing
“cd D”, press Tab key, there is no response. Press Tab key again, 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 typed
automatically.

Need support?  support@[Link]


44 Chapter 1 Install Python Libraries (Required) [Link] █

Step 2 Configuration

Enable I2C, SPI and VNC


The I2C interface Raspberry Pi is disabled by default. You need to open it manually.

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.

Need support?  support@[Link]


█ [Link] Chapter 1 Install Python Libraries (Required) 45

Set I2C Baud Rate


Open the terminal and enter the following command.
sudo nano /boot/firmware/[Link]
The default I2C Baud Rate is 100000. Now we change it to 400000, because this can speed up the response
speed of the servos to make robot dog walk faster. If the baud rate is 100,000, the robot walks slowly.
Scrolling the middle of the mouse to find dtparam=i2c_arm=on, and add “i2c_arm_baudrate=400000”.

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

Need support?  support@[Link]


46 Chapter 1 Install Python Libraries (Required) [Link] █

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

2. We also need to edit config file.


sudo nano /boot/firmware/[Link]
Find the contents of the following two lines (with Ctrl + W you can search):
# Enable audio (loads snd_bcm2835)
dtparam=audio=on
Add # to comment out the second line. Press Ctrl+O, Enter, Ctrl+X.
# Enable audio (loads snd_bcm2835)
# dtparam=audio=on

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.

Need support?  support@[Link]


█ [Link] Chapter 1 Install Python Libraries (Required) 47

Step 3 Run the Installation Program

1. Execute following commands to enter directory of “[Link]”.


cd ~/Freenove_Robot_Dog_Kit_for_Raspberry_Pi/Code
2. Run [Link]
sudo python [Link]

This program will automatically install the pca9685, rpi_ws281x, PyQt5 library, etc. Please reboot the Raspberry
Pi after the installation is completed, as shown below.

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]

Need support?  support@[Link]


48 Chapter 2 Assemble Robot [Link] █

Chapter 2 Assemble Robot


If you have any concerns, please feel free to contact us at support@[Link]

It is recommended to assemble and use the robot dog according to the tutorial. Otherwise, there may be
installation errors, device damage, etc.

Don’t reverse batteries. Or the board will be damaged.

Step 1 Install Disk Servo Arms

Take out 12 disk servo arms from the servo packages.

M1.2*7screws
Disk servo arm

There are 4 pairs of opposite holes on the disk servo arm, and the distance between each pair is different.
Need support?  support@[Link]
█ [Link] Chapter 2 Assemble Robot 49

Please use the 2 pairs of holes with longer distance.

Disk servo arm

M1.2x7

M1.2*7 screws are contained in following plastic bag. If a package of M1.2*7 self-tapping screws cannot
be found, it may be packed in the servo package.

This side is
Longer distance attached to
acrylic board.

Need support?  support@[Link]


50 Chapter 2 Assemble Robot [Link] █

Get following 4 parts.

This side should be on the


left. Don’t reverse it.

M1.2x7

With two holes

M1.2x7

Need support?  support@[Link]


█ [Link] Chapter 2 Assemble Robot 51

Step 2 Install Body Bracket

Rectangular hole
Head mark

M3 Nut

M3x12 Note its position

With one hole

M3 Nut Head mark

M3x12

Brass standoffs
M2.5x14+6

M2.5x8

Need support?  support@[Link]


52 Chapter 2 Assemble Robot [Link] █

Step 3 Install Shield

Shield

Brass standoffs
M2.5x14

Need support?  support@[Link]


█ [Link] Chapter 2 Assemble Robot 53

Step 4 Install MPU6050

Note: There are two rows of headers. Plug the MPU6050 into the outer Row.

MPU6050

Step 5 Install LED module

M3x12

LED module

M3 Nut

Need support?  support@[Link]


54 Chapter 2 Assemble Robot [Link] █

Install the top bracket.

Head

Rear

Connect shield with LED module.

3-pin cable of LED

This step will be very helpful for later assembly.

Use tapes
to cover
the hole
Use tapes
to cover
the hole

Need support?  support@[Link]


█ [Link] Chapter 2 Assemble Robot 55

Step 6 Install Raspberry Pi

Attach the Raspberry PI to the robot dog with four M2.5x8 screws.

M2.5x8

Raspberry Pi

Need support?  support@[Link]


56 Chapter 2 Assemble Robot [Link] █

Step 7 Install Connector

Install connector to connect Raspberry Pi and shield.

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)
Not yet available for sale

Press it till the pins


protrude from the holes.

Press connector to
reach its end.

Need support?  support@[Link]


█ [Link] Chapter 2 Assemble Robot 57

√ ×

If you have any concerns, please feel free to contact us via support@[Link]
We will offer you satisfying solution.

Now we have assembled the main body part. We will assemble leg parts later.

Need support?  support@[Link]


58 Chapter 2 Assemble Robot [Link] █

Step 8 Install Servo to Acrylic Board

Acrylic part M2x14

M2 Nut

Black servo

Note: There are four parts. They are different .

Need support?  support@[Link]


█ [Link] Chapter 2 Assemble Robot 59

Assemble two sets.


Servo
M2x14

M2 Nut

Assemble two sets.

M2x14

M2 Nut

Assemble parts to the top.

M3x12

M3 Nut

Now you get two sets of joint parts.

Need support?  support@[Link]


60 Chapter 2 Assemble Robot [Link] █

Assemble another two parts. Note: they are different from parts above.

Assemble another two parts. Note: they are different from parts above.

Asseble them.

M3x12

M3 Nut

Now you will get four parts as below. Note, they are different.

Need support?  support@[Link]


█ [Link] Chapter 2 Assemble Robot 61

Step 9 Run Servo Program (Necessary)

Connect All 12 black servos and 1 blue servo to servo port Randomly. And install batteries. Push batteries
to “+” ends.

Install batteries
3.7v 18650
High drain

12 black servos
1 blue servo wiring

Need support?  support@[Link]


62 Chapter 2 Assemble Robot [Link] █

You can still use cable to power Raspberry Pi with switches ON. If you disconnect cable, the batteries will
power Raspberry Pi. Press S1 and S2 and there will be two indicators ON.

S2

S1

Turn on the Raspberry Pi. Make sure all three steps in Chapter 1 have been performed correctly. If you
haven’t done that, please perform the steps in Chapter 1 first.
a. Type the following command to enter servo code folder “Server”.
cd ~/Freenove_Robot_Dog_Kit_for_Raspberry_Pi/Code/Server
b. Run [Link]
sudo python [Link]
After running the program, all servos will keep at 90°.
Next we will connect the servos to disk arm.
Keep the power on and all servos connected during the assembly. Don’t disconnect servos.
[Link]
When running the code, if it reports “Remote I/O error”, please check the following three aspects:
1. Whether the connector is connected well

Connector

Need support?  support@[Link]


█ [Link] Chapter 2 Assemble Robot 63

2. Whether both S1 and S2 are turned ON

S2

S1

3. Whether the batteries are contacted well with the battery holder

Need support?  support@[Link]


64 Chapter 2 Assemble Robot [Link] █

Step 10 Assemble Legs to Body

Keep the power ON and all servos connected to shield. Do NOT disconnect wiring. We need to keep the
servo at 90° when connected to them to servo arms. (servo wires are not shown in the following content.)
Try to install them close to 90°. The angles are acceptable within 65~115.

Small screw in Close to 90°


servo package

Assemble legs of one side. Try to install them at 90°. The angles are acceptable within 65~115.

Small screw in
servo package
Close to 90°

Assemble legs of the other side.

Need support?  support@[Link]


█ [Link] Chapter 2 Assemble Robot 65

Keep the power ON and all servos connected to shield. Do NOT disconnect wiring.
Select two legs of different sides as rear legs. And install them as below. Then install the servo screws.

Servo screw

In this step, if you did not cover tape to the holes before, you can turn off Load S1 to install the screw. After
the screw is installed, turn on the Load S1.

M3 Nut M3 Screw M3 Nut


M3 Nut

M3x12

Only one bracket is needed.


M3x12

Bracket

M3 Nut

Need support?  support@[Link]


66 Chapter 2 Assemble Robot [Link] █

Keep the power ON and all servos connected to shield. Do NOT disconnect wiring.
Assemble front legs and install the servo screw.

Servo screw

Assemble them.

In this step, if you did not cover tape to the holes before, you can turn off Load S1 to install the screw. After
the screw is installed, turn on the Load S1.

M3 Nut

M3x12

Need support?  support@[Link]


█ [Link] Chapter 2 Assemble Robot 67

M3 Nut

M3x12

Need support?  support@[Link]


68 Chapter 2 Assemble Robot [Link] █

Step 11 Assemble Head

M1.4x4

Ultrasonic module

Camera

The servo arm and screws are included in the blue servo package.

Screw in servo package

Servo arm

M2x14

M2 Nut

Need support?  support@[Link]


█ [Link] Chapter 2 Assemble Robot 69

Step 12 Assemble Head to Body

M2x14
M2 Nut

Keep the power ON and servos connected when installing arm to servo.

Small screw in
servo package

Install acrylic part on the other side.

We will complete wiring in next section. Shut down the Raspberry Pi first. Do NOT turn on Raspberry Pi
until chapter 3.

Need support?  support@[Link]


70 Chapter 2 Assemble Robot [Link] █

Step 13 Wiring

Connect servos according to the numbers. Note servo ports 0, 1, 14 are not connected to servo. They
are spare.

Need support?  support@[Link]


█ [Link] Chapter 2 Assemble Robot 71

Wiring of Ultrasonic module (Note: Do NOT connect wrongly. If you connect 5V to GND, it may
damage the ultrasonic module)

Camera for Pi3/4


Pay attention to the blue side of camera cable.
(Note: plugging and unplugging the cable requires the Raspberry Pi to be powered off, otherwise
the camera module may be burned.)

√ ×

Need support?  support@[Link]


72 Chapter 2 Assemble Robot [Link] █

Pay attention to the blue side of camera cable.

√ ×
Camera for Pi5
Please note that this cable is only available with the purchase of the Raspberry PI 5 version.
Connect one end of cable to Raspberry Pi. Please note the front and back of the cable.

√ ×

Need support?  support@[Link]


█ [Link] Chapter 2 Assemble Robot 73

Connect another end of cable to Raspberry Pi. Please note the front and back of the cable.

√ ×

Need support?  support@[Link]


74 Chapter 2 Assemble Robot [Link] █

Step 14 Install Calibration Support

M3x12

M3x12

M3 Nut
Support

Need support?  support@[Link]


█ [Link] Chapter 2 Assemble Robot 75

Step 15 Verify Assembly

Turn on two switches and run following two commands again.


a. Type the following command to enter servo code folder “Server”.
cd ~/Freenove_Robot_Dog_Kit_for_Raspberry_Pi/Code/Server
b. Run [Link]
sudo python [Link]

The robot should show the following posture.

Servo screw

If it does not look like this, you need to disassemble servo screws of incorrect servos. Then reassemble
the incorrect servo to make the robot look like posture above.

Need support?  support@[Link]


76 Chapter 3 Module test (Required) [Link] █

Chapter 3 Module test (Required)


If you have any concerns, please feel free to contact us at support@[Link]

The robot dog has been assembled in the previous chapter. This chapter will test each module of the robot
dog. It is a necessary check for later control.

Before starting, please install the battery for the robot dog and turn on the S1 and S2 switches. Place the
robot dog with the calibration supports on a horizontal table to ensure that the wiring of each servo is correct.

Please use VNC Viewer to build this robot when you use remote mode to login RPi, or there will be
errors. Because other desktop remote doesn’t support GUI.

Servo
Execute following command to check i2c address.
i2cdetect -y 1

As shown in the figure below, the addresses 0x40, 0X48, and 0X68 corresponds to the PCA9685 chip, ADS7830
chip, and MPU6050 module, respectively.

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.

1. If not, execute the cd command:


cd ~/Freenove_Robot_Dog_Kit_for_Raspberry_Pi/Code/Server
2. Execute [Link] command:
sudo python [Link] Servo

Need support?  support@[Link]


█ [Link] Chapter 3 Module test (Required) 77

Result:
After assembly in the previous chapter, the robot should look as shown in picture A.
After servo test program is executed, the robot’s posture will change to A, B, C, D gradually, which indicates
the servo channel works normally.
If the situation is not correct, check the servo wiring.

(A) (B)

(C) (D)

Need support?  support@[Link]


78 Chapter 3 Module test (Required) [Link] █

The code is as below:


1 from Servo import *
2 servo=Servo()
3 def test_Servo():
4 try:
5 for i in range(90):
6 [Link](4,90-i)
7 [Link](7,90-i)
8 [Link](8,90+i)
9 [Link](11,90+i)
10 [Link](0.01)
11 for i in range(90):
12 [Link](2,90-i)
13 [Link](5,90-i)
14 [Link](10,90+i)
15 [Link](13,90+i)
16 [Link](0.01)
17 for i in range(60):
18 [Link](3,90-i)
19 [Link](6,90-i)
20 [Link](9,90+i)
21 [Link](12,90+i)
22 [Link](0.01)
23 print ("\nEnd of program")
24 except KeyboardInterrupt:
25 print ("\nEnd of program")

Reference
setServoAngle(channel, angle)
This function has two parameters to control the Servo of the corresponding channel to the corresponding
angle.
The first parameter indicates the servo channel
The second parameter is the rotation angle
Example:
setServoAngle (0,60) The Servo of channel 0 is turned to 60 degrees
setServoAngle (15,160) The Servo of channel 15 is turned to 160 degrees

Need support?  support@[Link]


█ [Link] Chapter 3 Module test (Required) 79

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 second
command [Link].

[Link] not, execute the cd command:


cd ~/Freenove_Robot_Dog_Kit_for_Raspberry_Pi/Code/Server
[Link] [Link] command:
sudo python [Link] ADC

Result:
Print voltage value of batteries per second. You can press "Ctrl + C" to end the program.

Need support?  support@[Link]


80 Chapter 3 Module test (Required) [Link] █

The code is as below:


1 from ADS7830 import *
2 adc=ADS7830()
3 def test_Adc():
4 try:
5 while True:
6 Power=[Link](0)/255.0*5.0*3
7 print ("The battery voltage is "+str(Power)+"V")
8 [Link](1)
9 print ('\n')
10 except KeyboardInterrupt:
11 print ("\nEnd of program")

Reference
readAdc (channel)
This function has one parameter for reading the ADC value of the corresponding channel.

For example:
readAdc (0)
Read the ADC value of the batteries voltage. The returned number ranges between 0-255. Divide the
obtained value by 255.0 and then multiply by the reference voltage of 5.0V, and then triple the value to
get the batteries voltage.

Need support?  support@[Link]


█ [Link] Chapter 3 Module test (Required) 81

Ultrasonic module
Run program
If the terminal displays the directory as below (where [Link] is located). You can directly execute the [Link]
command.

1. If not, execute the cd command:


cd ~/Freenove_Robot_Dog_Kit_for_Raspberry_Pi/Code/Server
2. Execute [Link] command:
sudo python [Link] Ultrasonic

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 from Ultrasonic import *
2 ultrasonic=Ultrasonic()
3 def test_Ultrasonic():
4 try:
5 while True:
6 data=[Link]() #Get the value
7 print ("Obstacle distance is "+str(data)+"CM")
8 [Link](1)
9 except KeyboardInterrupt:
10 print ("\nEnd of program")
Reference
getDistance()
This function is used to obtain the distance between ultrasonic module and the obstacle in front of it in
centimeters.

Need support?  support@[Link]


82 Chapter 3 Module test (Required) [Link] █

LED
There is an RGB LED module on the robot as 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.

[Link] not, execute the cd command:


cd ~/Freenove_Robot_Dog_Kit_for_Raspberry_Pi/Code/Server
[Link] [Link] command:
sudo python [Link] Led
If you are using the Led feature for the first time, it will ask for the PCB version of the connection board.

Please enter 1 or 2 according to the version number of your connection board.


Connection board (PCB_V1.0) Connection board (PCB_V2.0)

Not yet available for sale.


See here for more information.

Need support?  support@[Link]


█ [Link] Chapter 3 Module test (Required) 83

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 module will show red, green, blue and white in turn. Then all LED are turned OFF.
You can end the program ahead of time by pressing "ctrl+c".
The code of [Link] is as below:
1 from Led import *
2 led=Led()
3 def test_Led():
4 try:
5 #Red wipe
6 [Link]([255, 0, 0])
7 [Link](1)
8 print ("\nRed wipe")
9
10 #Green wipe
11 [Link]([0, 255, 0])
12 [Link](1)
13 print ("\nGreen wipe")
14
15 #Blue wipe
16 [Link]([0, 0, 255])
17 [Link](1)
18 print ("\nBlue wipe")
19
20 #White wipe
21 [Link]([255, 255, 255])
22 [Link](1)
23 print ("\nWhite wipe")
24
25 [Link]([0, 0, 0]) #turn off the light
26 print ("\nEnd of program")
27 except KeyboardInterrupt:

Need support?  support@[Link]


84 Chapter 3 Module test (Required) [Link] █

28 [Link]([0, 0, 0]) #turn off the light


29 print ("\nEnd of program")

Need support?  support@[Link]


█ [Link] Chapter 3 Module test (Required) 85

Buzzer
Run the program

Enter following command in the terminal to test buzzer.


If the terminal displays the directory as below (where [Link] is located). You can directly execute the [Link]
command.

[Link] not, execute the cd command:


cd ~/Freenove_Robot_Dog_Kit_for_Raspberry_Pi/Code/Server
[Link] [Link] command:
sudo python [Link] Buzzer

Result:
The buzzer will be turned ON lasting for 3s. Then the program will automatically end or you can press "Ctrl +
C" to end the program.

Need support?  support@[Link]


86 Chapter 3 Module test (Required) [Link] █

The code is as below:


1 from Buzzer import *
2 buzzer=Buzzer()
3 def test_Buzzer():
4 try:
5 [Link]('1')
6 [Link](1)
7 print ("1S")
8 [Link](1)
9 print ("2S")
10 [Link](1)
11 print ("3S")
12 [Link]('0')
13 print ("\nEnd of program")
14 except KeyboardInterrupt:
15 [Link]('0')
16 print ("\nEnd of program")

Reference
[Link](cmd)
This function has one input parameter. If the input is ’1’, the buzzer will be turned on. If the input is ‘0’, the
buzzer will be turned off.

Need support?  support@[Link]


█ [Link] Chapter 3 Module test (Required) 87

Camera
There are two ways to drive the camera.
First method, use the system's default camera detection function.
1. Open the [Link] file.
sudo nano /boot/firmware/[Link]
2. Enable the automatic camera detection function.
camera_auto_detect=1
Second method, manually configure the camera.
1. Disable the automatic camera detection function.
camera_auto_detect=0
2. Add the following instruction at the very bottom.
If you are a Raspberry PI 5, add the following command.
dtoverlay = ov5647,cam0
If you are not a Raspberry PI 5, add the following command.
dtoverlay = ov5647
3. Save the file and exit, then restart the Raspberry PI.
Run program
1. execute the cd command:
cd ~/Freenove_Robot_Dog_Kit_for_Raspberry_Pi/Code/Server
2. Execute command below:
python [Link]
Then please open and check the generated [Link] under
/Freenove_Robot_Dog_Kit_for_Raspberry_Pi/Code/Server.

Then please open and check the generated [Link] under


/Freenove_Robot_Dog_Kit_for_Raspberry_Pi/Code/Server.

Need support?  support@[Link]


88 Chapter 4 Robot Dog [Link] █

Chapter 4 Robot Dog


If you have any concerns, please feel free to contact us at support@[Link]

This robot has rich functions, such as real-time video, LED, ultrasonic ranging. The server and client are
established, based on Python3 and PyQt5. They communicate via TCP/IP protocol. The robot can be
controlled remotely within a local area network (LAN).

Start Start

Open server Open client

Wait Connect
connection server

No
No

If success
If success

Yes
Yes
Wait
Send
command
command

No Yes

If get
command If success

Done No
Yes success
keep
Execute
sending
Command

End End

Need support?  support@[Link]


█ [Link] Chapter 4 Robot Dog 89

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 server code is as below:
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 turn_on_server(self):
8 #ip adress
9 HOST=self.get_interface_ip()
10 #Port 8000 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, 8000))
14 self.server_socket.listen(1)
15
16 #Port 5000 is used for instruction sending and receiving
17 self.server_socket1 = [Link]()
18 self.server_socket1.setsockopt(socket.SOL_SOCKET,socket.SO_REUSEPORT,1)
19 self.server_socket1.bind((HOST, 5000))
20 self.server_socket1.listen(1)
21
22 print('Server address: '+HOST)
23
24 def turn_off_server(self):
25 try:
26 [Link]()
27 [Link]()
28 except :
29 print ('\n'+"No client connection")

Need support?  support@[Link]


90 Chapter 4 Robot Dog [Link] █

Reference
For more code details, please open “[Link]” in Server folder to check.
get_interface_ip()
This function can get the IP address of WLAN0 of the Raspberry Pi.
turn_on_server()
This function is used to open TCP and wait for a client connection. The channel of port 5000 is mainly used
to send and receive commands between the client and server. The channel of port 8000 is used to send
video data to the client.
turn_off_server()
This function is used to close TCP.

send_data()
This function is used to send commands to the client.

reset_serve()
This function is used to close TCP and restart.

transmission_video()
This function is used to transmit video data to the client.

receive_instruction()
This function is used to receive commands from the client

Need support?  support@[Link]


█ [Link] Chapter 4 Robot Dog 91

Open Server
Step 1 Login Raspberry Pi via VNC viewer
Because server and client use GUI. You need use VNC viewer as remote desktop way.
Download and install VNC Viewer according to your computer system by clicking 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. 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.

Need support?  support@[Link]


92 Chapter 4 Robot Dog [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.
Need support?  support@[Link]
█ [Link] Chapter 4 Robot Dog 93

Step 2 Run commands

Enter following command in the terminal.


1. Use cd command to enter directory where [Link] is located:
cd ~/Freenove_Robot_Dog_Kit_for_Raspberry_Pi/Code/Server
2. Run [Link]:
sudo python [Link]

The interface is as below:

You will see your server address (Raspberry Pi IP), Which is the LAN IP address of your Raspberry Pi. In the
next chapter, you will need to enter this IP address to connect the Raspberry Pi client with the server.

Need support?  support@[Link]


94 Chapter 4 Robot Dog [Link] █

The robot will start from this posture. We define it as Relax mode. It will also be referenced later.

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_Robot_Dog_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.

Sever Auto Start


1 Open the terminal and execute the following two commands respectively to create a “[Link]” file.
cd ~
sudo touch [Link]
2 Open “[Link]”.
sudo nano [Link]
3 Add the following contents to “[Link]” file.
#!/bin/sh
cd "/home/pi/Freenove_Robot_Dog_Kit_for_Raspberry_Pi/Code/Server"
pwd
sleep 10
sudo cp [Link] /home/pi
sudo python [Link]

Need support?  support@[Link]


█ [Link] Chapter 4 Robot Dog 95

Press Ctrl + O and then press Enter to save it. Press Ctrl+X to exit.

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]

7 Add the following content to “[Link]” file.


[Desktop Entry]
Type=Application
Name=start
NoDisplay=true
Exec=/home/pi/[Link]
Press Ctrl + O and then press Enter to save it. Press Ctrl+X to exit.

8 Modify permissions.
sudo chmod +x .config/autostart/[Link]

9 Finally enter the following content to reboot Raspberry Pi.


sudo reboot

Note: To cancel auto start, please delete the files “[Link]” and “[Link]” created above.

Need support?  support@[Link]


96 Chapter 4 Robot Dog [Link] █

Client

The client can receive video data and commands from the server, and can send commands to the server. And
it can run on different systems, such as windows, macOS and so on. However, you need to install related
software and libraries when running it.

Part of client code is as below:


1 def turn_on_client(self,ip):
2 self.client_socket1 = [Link](socket.AF_INET, socket.SOCK_STREAM)
3 self.client_socket = [Link](socket.AF_INET, socket.SOCK_STREAM)
4 print (ip)
5 def turn_off_client(self):
6 try:
7 self.client_socket.shutdown(2)
8 self.client_socket1.shutdown(2)
9 self.client_socket.close()
10 self.client_socket1.close()
11 except Exception as e:
12 print(e)
13 def receiving_video(self,ip):
14 stream_bytes = b' '
15 try:
16 self.client_socket.connect((ip, 8000))
17 [Link] = self.client_socket.makefile('rb')
18 except:
19 #print ("command port connect failed")
20 pass
21 while True:
22 try:
23 stream_bytes= [Link](4)
24 leng=[Link]('L', stream_bytes[:4])
25 jpg=[Link](leng[0])
26 if self.is_valid_image_4_bytes(jpg):
27 if self.video_flag:
28 [Link] = [Link]([Link](jpg, dtype=np.uint8),
29 cv2.IMREAD_COLOR)
30 if self.ball_flag:
31 self.Looking_for_the_ball()
32 self.video_flag=False
33 except BaseException as e:
34 print (e)
35 break

Need support?  support@[Link]


█ [Link] Chapter 4 Robot Dog 97

Reference
For more code details, please open “[Link]” in Client folder to check.
turn_on_client ()
This function is used to connect client to the server.
turn_off_client ()
This function is used to disconnect from the server.

receiving_video()
This function is used to receive video data sent from the server.

is_valid_image_4_bytes ()
This function is used to check whether each frame of video data is complete.

Looking_for_the_ball ()
This function is used to find the small ball in the video image.

send_data ()
This function is used to send commands to the server.
receive_data ()
This function is used to receive commands from the server.

Need support?  support@[Link]


98 Chapter 4 Robot Dog [Link] █

Run Client on Windows system


There are two ways to run Client on Windows.
Option 1 Running executable file directly
Find the “[Link]” file in the specified directory, double click it and the Client is opened.

After the client is successfully opened,


[Link] need to open the Raspberry Pi and Turn on the server,
[Link] the Raspberry Pi's IP address in the white IP edit box,
[Link] "Connect" to connect client to the Raspberry Pi.
After the connection is successful, you need to calibrate the robot in Calibration section. After the calibration
is completed, the robot dog can be controlled to move.
You can refer to this video: [Link]
Note: when Raspberry Pi is shut down, server will be closed. You need open server again the next time.

Need support?  support@[Link]


█ [Link] Chapter 4 Robot Dog 99

Option 2 Install python3 and some related python libraries to run client
If you want to modify the client, you can follow this section.
This section will be completed in your computer with windows system, not Raspberry Pi.
To run the client on a Windows system, you need to install some software and libraries, which takes some
time. During this process, it does not need to run a server and a Raspberry Pi. You can turn off the Raspberry
Pi first. After the installation is completed, turn on the Raspberry Pi and the server.

Install python3
Download the installation file via the below link:
[Link]

Click Latest Python 3 Release - Python 3.8.1 (as an example).

Choose “Windows x86-64 executable installer” to download and install.

Need support?  support@[Link]


100 Chapter 4 Robot Dog [Link] █

Select “Add Python 3.8 to PATH”. And choose Customize installation.

Select all options and click Next.

Need support?  support@[Link]


█ [Link] Chapter 4 Robot Dog 101

Here python is installed into D disk as an example (You can choose your own installation path). Click Install.

Wait for installation.

Need support?  support@[Link]


102 Chapter 4 Robot Dog [Link] █

Installation is successful.

Need support?  support@[Link]


█ [Link] Chapter 4 Robot Dog 103

Install PyQt5, opencv, numpy and other libraries


If you have not download the zip file, download it via below link:
[Link]
Then unzip it and delete “-master” to rename it to “Freenove_Robot_Dog_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_Robot_Dog_Kit_for_Raspberry_Pi\Code
[Link]: setup_windows.py
Python setup_windows.py

Or double-click "setup_windows.py" to execute the installation program, under following path:


Freenove_Robot_Dog_Kit_for_Raspberry_Pi\Code\
Or use python3 to run "setup_windows.py".

Note: If the default python in your windows system is not python3 but python2, then change all "python" in
"setup_windows.py" to "python3" and run the command "setup_windows.py" as shown below.

Python3 setup_windows.py

Need support?  support@[Link]


104 Chapter 4 Robot Dog [Link] █

Installation takes some time, please be patient. If all installations are successful, it will prompt “Press any key
to continue…” and "All libraries installed successfully".

If some libraries are not installed successfully, it will prompt "Some libraries have not been installed yet. Please
run 'python setup_windows.py' again". Then you need to execute the python3 setup_windows.py command
again. Most installation failures are caused by a poor network. You can check the network before installing.

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_Robot_Dog_Kit_for_Raspberry_Pi\Code\Client
[Link] [Link]:
Python [Link]

Or double-click "[Link]". under following path:


Freenove_Robot_Dog_Kit_for_Raspberry_Pi\Code\Client
Or use python3 to run "[Link]".

Note: If the default python in your windows system is not python3, then change the command to run
[Link] as shown below.
Python3 [Link]

Need support?  support@[Link]


█ [Link] Chapter 4 Robot Dog 105

The client interface is shown below:

After the client is successfully opened,


[Link] need to open the Raspberry Pi and Turn on the server,
[Link] the Raspberry Pi's IP address in the white IP edit box,
[Link] "Connect" to connect client to the Raspberry Pi.

After the connection is successful, you need to calibrate the robot in Calibration section. After the calibration
is completed, the robot dog can be controlled to move.
Note: when Raspberry Pi is shut down, server will be closed. You need open server again the next time.

Need support?  support@[Link]


106 Chapter 4 Robot Dog [Link] █

Run Client on macOS system


Here take MacOS 10.13 as an example. To run the client on MacOS, you need to install some software and
libraries. During the installation, it does not need to run a server and use a Raspberry Pi. You can turn off the
Raspberry Pi first. After the installation is completed, turn on the Raspberry Pi and run the server. MacOS 10.13
comes with python2, but no python3. The programs of this robot can only run on python3.
Install python3
Download installer, link [Link]

Click Python 3.8.2.

If your macOS is 11. Like 11.0, please install python 3.9.

If your macOS is NOT 11, like 10.15, please install python 3.8. If you have

installed python 3.9. You need uninstall it first.

Need support?  support@[Link]


█ [Link] Chapter 4 Robot Dog 107

On the bottom of the page, click macOS 64-bit installer to download installer.

Then install python.

Click Continue.

Need support?  support@[Link]


108 Chapter 4 Robot Dog [Link] █

Click Continue.

Click Agree.

Need support?  support@[Link]


█ [Link] Chapter 4 Robot Dog 109

Click Install. If your computer has a password, enter the password and click Install Software.

Now the installation is completed successfully.

Need support?  support@[Link]


110 Chapter 4 Robot Dog [Link] █

You can find in Applications.

Install PyQt5、opencv、numpy and other libraries


If there is no robot dog code in your macOS, you can download it via link below:
[Link]

After downloading successfully, you can find it under “Downloads”.

Open “Terminal”.

Need support?  support@[Link]


█ [Link] Chapter 4 Robot Dog 111

Type following command in Terminal.


1. Enter “Downloads” where the code is located. If your path is different, please modify the command.
cd Downloads
2. Enter directory where setup_macos.py is located:
cd Freenove_Robot_Dog_Kit_for_Raspberry_Pi/Code/
3. Run setup_macos.py:
python3 setup_macos.py
Installation takes some time, please wait patiently.

If some libraries are not installed successfully, it will prompt "Some libraries have not been installed yet. Please
run 'python3 setup_windows.py' again". Then you need to execute the python3 setup_windows.py command
again. Most installation failures are caused by a poor network. You can check the network before installing.

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

Need support?  support@[Link]


112 Chapter 4 Robot Dog [Link] █

Open client

After installation is completed in previous step, now it is in the directory that setup_macos.py is located.

1. Type following command to enter where the program is located.


cd Client/
2. Type following command to run the program.
python3 [Link]

Need support?  support@[Link]


█ [Link] Chapter 4 Robot Dog 113

After the client is successfully opened,


[Link] need to open the Raspberry Pi and Turn on the server,
[Link] the Raspberry Pi's IP address in the white IP edit box,
[Link] "Connect" to connect client to the Raspberry Pi.
Then you need calibrate the robot in the Calibration section. After the calibration is completed, robot dog can
be controlled to move.
Note: when Raspberry Pi is shut down, server will be closed. You need open server again the next time.

Need support?  support@[Link]


114 Chapter 4 Robot Dog [Link] █

Calibration
You can refer to this video: [Link]
Calibrate the robot.
1. Lay the calibration paper on a horizontal hard table.
2. Install the calibration supports on the robot dog and place it on the corresponding position on the
calibration paper.

3. Connect client with server successfully, click the "Calibration" button on the client, then a calibration
window pops up. And the robot’s legs will automatically put to the following position.

Need support?  support@[Link]


█ [Link] Chapter 4 Robot Dog 115

4. Calibrate the four legs to make 4 foot points fall to the corresponding positions. Feel the contact force
between the robot dog and the ground during calibration. Future control depends on this step.

5. After all the 4 points have reached the designated position, click "Save" to save. Now calibration is
completed.
NOTE:
1. It is best to have the robot dog walk on a flat hard floor. The robot dog may not walk well on other
grounds.
2. There is an offset when controlling the robot dog to walk straightly, which is normal. It is caused by
the installation error and the error of the servo itself. As a result, the left and right legs cannot be
completely symmetrical, and may differ by 1mm or 2mm. As the walking distance accumulates, this error
is constantly superimposed. Then there will be a large offset from the original position.
3. If the calibration is not good enough, it will affect walking. You can recalibrate the robot with same steps.

Need support?  support@[Link]


116 Chapter 4 Robot Dog [Link] █

Control
After calibrating successfully, you can control the robot dog to move.

Relax mode.
a) When the robot dog moves for 3 minutes at a time, it will feel tired (the servo will get hot). In order to
protect the servo, the robot will get into relax mode for 1 minute. During this time, it won’t respond
to any motion command. You can still use the functions of LED, buzzer, real-time video and so on.
b) When the robot dog moves for less than3 minutes and rests for 1 minute. The timer will start from 0.
Then the robot can move for 3 minutes again.
c) If the robot isn’t tired and is standing, when the robot does not receive motion command for 10s, it will
get into relax mode. In this situation, it will respond to all commands.

Need support?  support@[Link]


█ [Link] Chapter 4 Robot Dog 117

You can click and drag the cross cursor in the coordinate system to adjust the yaw and pitch angle of body.

The following is the corresponding operation of the buttons and keyboards.


Button on Client Key Action
ForWard W Move
BackWard S Back off
Turn Left A Turn left
Turn Right D Turn right
Step Left Q Step Left
Step Right E Step Right
Connect/ Disconnect C On/Off Connection
Open Video/ Close Video V On/Off Video
Calibration M Open calibration interface
Buzzer/Noise Space On/Off Buzzer
Relax R Relax station
LED L Open LED control interface
Sonic U Measure and display distance from obstacle
Balance B Open/Close balance mode
Face/Ball/Close F Face recognition and ball tracking
Face ID Input images of human faces

Need support?  support@[Link]


118 Chapter 4 Robot Dog [Link] █

Input images of human faces and recognize them.

1. Click "Face ID".


2. Enter name in the box of the pop-up window.
3. Click "Read Face".
4. A picture is taken and recorded every two seconds, and a total of 30 images will be taken. Try to show
faces at different distances and angles during the shooting process. (When the face is not recognized,
the picture will not be recorded until the face is recognized again.)
5. After the 30 images are recorded, you can close the window and click "Face" on the Right to identify
the face.

Note: Do NOT use different names when re-entering images of the same person to avoid client working
abnormally.

Need support?  support@[Link]


█ [Link] Chapter 4 Robot Dog 119

The function of SliderBar is below:


SliderBar Function
Head Adjust head angle.
Height Control body height.
Horizon Make body move forward or back.
Yaw Adjust Yaw angle of body
Pitch Adjust Pitch angle of body
Roll Adjust Roll angle of body

Note:
If the robot work abnormally, please check following contents.
1. Check the battery level. Low battery level will make the server shut down.
2. Check if the wireless connection is disconnected.
3. Check if the Raspberry Pi is stuck.
4. If all three points above work well, please restart server and client. If there still is any abnormality, please
contact us by email (support@[Link]). We will help you.

Need support?  support@[Link]


120 Chapter 4 Robot Dog [Link] █

Free your innovation

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 dog 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.

Need support?  support@[Link]


█ [Link] Chapter 4 Robot Dog 121

Create a new file.

Name it with myCode as an example and save it in Server folder of robot code folder.

Need support?  support@[Link]


122 Chapter 4 Robot Dog [Link] █

Open the Server folder of the robot dog code and you can see the file you created.

Write the code in [Link] as below and click save after finished, as shown below.

Need support?  support@[Link]


█ [Link] Chapter 4 Robot Dog 123

Type the following command to enter the directory where [Link] is located.
cd ~/Freenove_Robot_Dog_Kit_for_Raspberry_Pi/Code/Server
Run [Link]
sudo python [Link]

You can see that your robot dog moves forward for 5 steps, then twists its body at 10 degrees to the right,
then 20 degrees to the left, then returns to the original attitude and move forward 5 steps and then stops.

Related py files
Some important functions included in the py files are listed below. If you want to see more detailed code
content, please open the corresponding py file to check directly.
[Link]
Function Description
power(channel) Enter 0 to return the battery voltage value.

[Link]
Function Description
run(command) Enter 0, then the buzzer will not sound. Enter 1, the buzzer will sound.

[Link]
Function Description
coordinateToAngle(x,y,z) Enter the foot coordinate then return servo angle of each joint in one
leg.
angleToCoordinate(a,b,c) Enter the leg joint angle then return the foot coordinate.
Condition() Execute corresponding action commands
map() Mapping a value from one range to another
backWard () Move backward one step
forward() Move forward one step
turnLeft() Turn left one step
turnRight() Turn right one step
stop() Stop.
setpLeft() Move to left one step
setpRight() Move to right one step
upAndDown() Adjust height of body
beforeAndAfter() Make body move forward or backward
attitude(r,p,y) Set roll, pitch, and yaw angle of the robot.
[Link]

Need support?  support@[Link]


124 Chapter 4 Robot Dog [Link] █

Function Description
imuUpdate() Update the current roll, pitch, and yaw angle of the robot.

[Link]
Function Description
ledIndex( Index, R, G, B) Turn on one LED and set color.
wheel(pos) Create different RGB values.
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 8
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) Turn the servo of the specified channel to specified angle.

[Link]
Function Description
getDistance() Obtain the distance between the obstacle in front and the ultrasound.

Need support?  support@[Link]


█ [Link] Chapter 4 Robot Dog 125

Custom Action
We have also customized some specific actions, such as push-up, greeting, etc. You can run "[Link]" to
play.

Need support?  support@[Link]


126 Chapter 4 Robot Dog [Link] █

Android and iOS app

You can download and install the Freenove Android app from below links:
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 iOS app by searching freenove in app store.

Relax mode.
a) When the robot dog moves for 3 minutes in total, it will feel tired (the servo will get hot). In order to
protect the servo, the robot will get into relax mode for 1 minute. During this time, it won’t respond
to motion command. You can still use the functions of LED, buzzer, real-time video and so on.
b) When the robot dog moves for <3 minutes and then the robot rest for 1 minute. The timer will start
from 0. Then the robot can move for 3 minutes again.
c) If the robot isn’t tired and is standing, when the robot does not receive motion command for 10s, it will
get into relax mode. In this situation, it will responds to any commands.

Need support?  support@[Link]


█ [Link] Chapter 4 Robot Dog 127

The followings are the features of this app.


First, you need to turn on the Server. Then enter your raspberry pi IP address and click connect icon.

On the top of the interface, there is a timer slider to indicate the time for moving or resting.

Raspberry Pi wlan0 IP Time slider Balance Take picture RGB Led Buzze
r

Attitude control

Connec
t

Set speed

Angle of head

Relax

Height
Control motion

Attitude control Distance Voltage


Slide one finger on the screen

Frame rate

Gravity mode

Control body
position
Need support?  support@[Link]
128 What's Next? [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.

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]

Thank you again for choosing Freenove products.

Need support?  support@[Link]

You might also like