0% found this document useful (0 votes)
44 views

Client Tutorial

This document provides instructions for assembling and calibrating a robot dog kit. It includes a list of all included parts and components needed. The assembly instructions are broken into 10 steps, covering assembling the servo arms, body bracket, legs, attaching the legs to the body, adding the head and wiring, installing a cover, wiring the servos, adding a calibration bracket, and performing calibration. Safety precautions and support contact information are also provided.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
44 views

Client Tutorial

This document provides instructions for assembling and calibrating a robot dog kit. It includes a list of all included parts and components needed. The assembly instructions are broken into 10 steps, covering assembling the servo arms, body bracket, legs, attaching the legs to the body, adding the head and wiring, installing a cover, wiring the servos, adding a calibration bracket, and performing calibration. Safety precautions and support contact information are also provided.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 78

█ www.freenove.

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 have not downloaded the zip file, please download and unzip it via the link below.
https://github.com/Freenove/Freenove_Robot_Dog_Kit_for_ESP32/archive/master.zip

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:

[email protected]
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?  [email protected]


2 List www.freenove.com █

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:

http://www.freenove.com

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.

TM

Need support?  [email protected]


█ www.freenove.com List 1

Contents

Welcome................................................................................................................................................................................ 1
Contents................................................................................................................................................................................. 1
List ........................................................................................................................................................................................... 2
Robot Expansion Board for ESP32 ........................................................................................................................... 2
ESP32 ............................................................................................................................................................................. 3
Machinery...................................................................................................................................................................... 3
Transmission ................................................................................................................................................................. 4
Acrylic............................................................................................................................................................................. 4
Electronic ....................................................................................................................................................................... 5
Tools............................................................................................................................................................................... 5
Calibration..................................................................................................................................................................... 6
Required but NOT Included Parts ............................................................................................................................ 6
Preface ................................................................................................................................................................................... 7
ESP32 ............................................................................................................................................................................. 8
Pins Used for the Robot ............................................................................................................................................. 9
Robot Expansion Board for ESP32 ......................................................................................................................... 11
Chapter 0 Install CH340 and Burn Firmware................................................................................................................. 12
Check Firmware.......................................................................................................................................................... 12
Install CH340 Driver................................................................................................................................................... 14
Burn the Firmware ..................................................................................................................................................... 24
Chapter 1 Install Freenove App ....................................................................................................................................... 30
Client ............................................................................................................................................................................ 30
Chapter 2 Robot Assembly .............................................................................................................................................. 32
Step 1 Assembly of Disc Servo Arms ..................................................................................................................... 32
Step 2 Assembly of Body Bracket ........................................................................................................................... 34
Step 3 Assembly of Legs .......................................................................................................................................... 37
Step 4 Adjustment of Servo Angles ....................................................................................................................... 40
Step 5 Assembly of Legs to Body ........................................................................................................................... 46
Step 6 Assembly of Head and Wire ....................................................................................................................... 52
Step 7 Assembly of the Cover ................................................................................................................................. 56
Step 8 Servo Wiring .................................................................................................................................................. 58
Step 9 Assembly of Calibration Bracket ................................................................................................................ 59
Step 10 Calibration .................................................................................................................................................... 60
Chapter 4 Q&A ................................................................................................................................................................... 66
Development ...................................................................................................................................................................... 68
Code Repository ........................................................................................................................................................ 68
Communication Command ..................................................................................................................................... 68
Explanation of Communication Protocol Instructions ........................................................................................ 70
What's Next? ....................................................................................................................................................................... 76

Need support?  [email protected]


2 List www.freenove.com █

List
If you have any concerns, please feel free to contact us at [email protected]

Robot Expansion Board for ESP32

Top

Bottom

Need support?  [email protected]


█ www.freenove.com List 3

ESP32

ESP32 OV2640

Machinery

Need support?  [email protected]


4 List www.freenove.com █

Transmission

Servo package x12

Acrylic

Acrylic x1

Need support?  [email protected]


█ www.freenove.com List 5

Electronic

Extension board for camera HC-SR04 ultrasonic module Touch module

Tools

Cross screwdriver (3mm) x1 Cable tidy x80cm


Cross screwdriver (2mm) x1

Pry bar USB cable

FPC camera cable

3P LED cable 4P jumper wire

Need support?  [email protected]


6 List www.freenove.com █

Calibration

Calibration graph

Required but NOT Included Parts

2 X 18650 flat top batteries with 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.

Need support?  [email protected]


█ www.freenove.com Preface 7

Preface
Welcome to use Freenove Robot Dog Kit for ESP32. Following this tutorial, you can make a very cool robot
dog with many functions.

This kit is based on ESP32, a popular control panel, so you can 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 robot dog. And all of them are packaged individually. There
are detailed assembly and commissioning instructions in this book.

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

[email protected]

This book aims to help enthusiasts assemble the robot dog and download related codes. You can read and
download the codes via the link below:
https://github.com/Freenove/Freenove_ESP32_Dog_Firmware

You can refer to another esp32 kit designed for starters: Freenove_Ultimate_Starter_Kit_for_ESP32.
https://www.freenove.com/store.html

Need support?  [email protected]


8 Preface www.freenove.com █

ESP32

ESP32-Wrover comes with two different antenna packages, PCB (on-board) antenna and IPEX™ antenna. The
PCB on-board antenna is an integrated antenna in the chip module itself, so it is convenient to carry and
design. The IPEX™ antenna is a metal antenna connector, derived from the integrated antenna of the chip
module itself, which is used to enhance the signal of the ESP32 module.
PCB on-board antenna IPEX antenna

In this tutorial, the ESP32-WROVER is designed based on PCB on-board antenna packaged ESP32-WROVER
module.

Need support?  [email protected]


█ www.freenove.com Preface 9

Pins Used for the Robot

To learn what each GPIO corresponds to, please refer to the following table.
The functions of the pins are allocated as follows:
Pins of ESP32 Functions Description
GPIO36 CSI_Y6
GPIO39 CSI_Y7
GPIO34 CSI_Y8
GPIO35 CSI_Y9
GPIO25 CSI_VYSNC
GPIO26 SIOD
GPIO27 SIOC
Camera interface
GPIO4 CSI_Y2
GPIO5 CSI_Y3
GPIO18 CSI_Y4
GPIO19 CSI_Y5
GPIO21 XCLK
GPIO22 PCLK
GPIO23 HREF
GPIO13 SDA
I2C port
GPIO14 SCL
GPIO32 Battery detection / Ultrasonic-Trig port A6 / Trig
GPIO12 Ultrasonic-Echo port Echo
GPIO33 Buzzer port Buzzer
GPIO15 Touch Sensor port Touch
GPIO0 WS2812 port WS2812
GPIO1 TX
Serial port
GPIO3 RX

Need support?  [email protected]


10 Preface www.freenove.com █

The hardware interfaces of ESP32 are distributed as follows:

Compare the left and right images. We have boxed off the resources on the ESP32 in different colors to
facilitate its understanding.
Box color Corresponding resources introduction

GPIO pin

LED indicator

Camera interface

Reset button, Boot mode selection button

USB port

Need support?  [email protected]


█ www.freenove.com Preface 11

Robot Expansion Board for ESP32

The functions of the board are as follows:

WS2812 WS2812

Touch Sensor
Buzzer Connector

WS2812
WS2812

Power
Power
Indicator

Servo Servo
Connector Connector

Ultrasonic
Connector

Servo Servo
Connector Connector

Note: Please refer to the marks on the battery holder to install batteries; otherwise, the circuit will not work.

Need support?  [email protected]


12 Chapter 0 Install CH340 and Burn Firmware www.freenove.com █

Chapter 0 Install CH340 and Burn Firmware

Check Firmware

Please note that the firmware has been burnt by default, so generally, you do not need to burn it again.
Please follow the steps below to check whether firmware has been burnt:
1. Plug the ESP32 to the expansion board.

Buzzer
LED
Indicators

USB Port

Pay attention to the orientation of the ESP32 and make sure it is plugged in correctly; otherwise, it may
damage the robot.
2. Connect ESP32 to your computer with a USB cable.
After connecting, you can see the yellow LED on ESP32 stay ON and the blue LED blink twice every second.
Meanwhile, the buzzer makes 4 warning sounds to tell you the camera has not yet been installed and then
a pleasant sound to indicate the finish of initialization.

If the above phenomenas happen, it means the firmware has been burnt.
If the firmware has been burnt on your robot, please skip to Chapter 1.
Otherwise, please continue with the following steps.

Need support?  [email protected]


█ www.freenove.com Chapter 0 Install CH340 and Burn Firmware 13

Please send emails to us ([email protected]) if you have any questions regarding the robot.

Need support?  [email protected]


14 Chapter 0 Install CH340 and Burn Firmware www.freenove.com █

Install CH340 Driver

The computer uploads codes to ESP32 via CH340, so we need to install CH340 driver on our computer before
using.
1. First, download the CH340 driver. Click http://www.wch-ic.com/search?q=CH340&t=downloads to
download the appropriate one based on your operating system.

Windows

Linux

MAC

If you would not like to download the installation package, you can open
“Freenove_Robot_Dog_Kit_for_ESP32/CH340”. We have prepared the installation package.

Need support?  [email protected]


█ www.freenove.com Chapter 0 Install CH340 and Burn Firmware 15

Next, we will explain how to install CH340 on different operating systems including Windows, Mac OS and
Linux.

Windows

Check the Installation of CH340


1. Connect esp32 to your computer with a USB cable.

2. Right-click on “This PC” on your computer desktop and select “Manage”.

Need support?  [email protected]


16 Chapter 0 Install CH340 and Burn Firmware www.freenove.com █

3. Click on “Device Manager” on the left of the pop-up window, and then click on “Ports” on the right. If
your computer has installed CH340 driver, you can see the port: USB-SERIAL CH340 (COMx).

CH340 Port

If so, you can click here to move to the next step.


If CH340 (COMx) does not show on your computer, you need to install CH340 driver.
Install CH340 Driver
4. Open “Freenove_Robot_Dog_Kit_for_ESP32/CH340/Windows/”.

5. Double click to run the file “CH341SER.EXE”, whose interface is as below:

Need support?  [email protected]


█ www.freenove.com Chapter 0 Install CH340 and Burn Firmware 17

6. Make sure ESP32 has connected to your computer and then click “INSTALL”. Wait for the installation to
finish.

The following window indicates that the installation finishes.

7. After installation, open device manager again and you can see the port USB-SERIAL CH340 (COMx).

So far, CH340 has been installed. Close all dialog boxes.

Need support?  [email protected]


18 Chapter 0 Install CH340 and Burn Firmware www.freenove.com █

Mac OS

Check the Installation of CH340


Connect esp32 to your computer with a USB cable.

Open Terminal of Mac OS, and type in the command ls /dev/cu.usb*

If your Terminal prints the message similar to the above, then your computer has installed the CH340. You
can click here to move to the next step.
Otherwise, please continue with the following the steps.
Install CH340
If you would not like to download the installation package, you can open
“Freenove_Robot_Dog_Kit_for_ESP32/CH340”. We have prepared the installation package.
Open the folder “Freenove_Robot_Dog_Kit_for_ESP32/CH340/MAC/”

Run it.

Need support?  [email protected]


█ www.freenove.com Chapter 0 Install CH340 and Burn Firmware 19

Click Continue.

Click Install and wait for it to finish.

Need support?  [email protected]


20 Chapter 0 Install CH340 and Burn Firmware www.freenove.com █

Restart your PC.

Need support?  [email protected]


█ www.freenove.com Chapter 0 Install CH340 and Burn Firmware 21

If CH340 is still not installed after the above steps, please refer to the ReadMe.pdf to install.

ReadMe

Need support?  [email protected]


22 Chapter 0 Install CH340 and Burn Firmware www.freenove.com █

Linux

Check the Installation of CH340


Open the system terminal and type in the command: lsmod | grep usbserial. If your computer has installed
the driver, you should see the following information:

If the driver has been installed, you can determine the port used by ESP32 to communicate with your computer
in this way:
1. When ESP32 is not connected to your computer, open system terminal and type in the command ls
/dev/tty*
2. Connect ESP32 to your computer with a USB cable and type in the command ls /dev/tty* again.

Compare the results. As shown below, /dev/ttyUSB0 is the port that ESP32 communicates with your computer.

ESP32 not connecting to computer

ESP32 connecting to computer

If your computer has installed CH340, you can click here to skip to the next step.
Install CH340
If you connect the ESP32 to your computer but it does not detect /dev/ttyUSB0, then it has not installed
CH340 yet.
Please follow the steps below to install CH340 driver.
We have prepared the installation package for you: “Freenove_Robot_Dog_Kit_for_ESP32/CH340/LINUX/”.

Need support?  [email protected]


█ www.freenove.com Chapter 0 Install CH340 and Burn Firmware 23

1. Enter the folder on terminal: cd Freenove_Robot_Dog_Kit_for_ESP32/CH340/Linux/

2. Unzip the installation package: unzip CH341SER_LINUX.ZIP

3. Enter the unzipped folder and type in the command sudo make to compile and generate the file
ch34x.ko.

4. Use the ls command to check the file. As you can see below, the ch34.ko has been generated under the
current directory.
5. Type in the command to upload the file to the system: sudo make load

So far, the ch340 driver has been installed.

Need support?  [email protected]


24 Chapter 0 Install CH340 and Burn Firmware www.freenove.com █

Burn the Firmware

For this product, ESP32 has burned the required firmware by default. If your ESP32 does not have the firmware
or the firmware does not work, please re-burn the firmware with the following steps.
We will explain respectively for Windows, Mac OS and Linux systems.

Windows

First, connect ESP32 to your computer with a USB cable.

Second, open “windows.bat” under the directory of Freenove_Robot_Dog_Kit_for_ESP32/Code/Windows with


txt editor, and modify the COMx in the file according to the port USB-SERIAL CH340 (COMx) on your
computer.

Note: Do NOT modify other contents.


Third, save and close the file. Double-click it to run and wait for it to finish downloading.

Need support?  [email protected]


█ www.freenove.com Chapter 0 Install CH340 and Burn Firmware 25

Mac OS

1. Open Terminal on your computer and type in the command python3 --version to check whether
python3 has been installed on your computer.

If your computer has not yet installed python3, please type in the command to install: brew install python3
If you do not want to download, you can open the installation package we prepared under the directory of
Freenove_Robot_Dog_Kit_for_ESP32/Code/MAC OS/Python to install.

2. Type in the command pip3 --version to check whether python3 has integrated with pip3. If it has not,
please type in the command curl https://bootstrap.pypa.io/get-pip.py | python3 to install.

3. Enter the command to install firmware-downloading tool: pip3 install esptool

Need support?  [email protected]


26 Chapter 0 Install CH340 and Burn Firmware www.freenove.com █

4. Check whether esptool has been installed: pip3 list

5. Connect ESP32 to your computer with the USB cable.

6. Open Mac OS Terminal and type in the command to check whether ESP32 can be detected:
ls /dev/cu.usb*

The port number may vary among different computers. Here we take “/dev/cu.usbserial-14130” as an example.
Copy the serial number.
7. Open mac.py under the directory of Freenove_Robot_Dog_Kit_for_ESP32/Code/MAC OS/ with txt editor,
and modify the port number to that of your computer. Save it and exit.

Note: Please make sure only the port number is changed and other information, including space is not
changed; otherwise, the firmware may fail to burn.
Need support?  [email protected]
█ www.freenove.com Chapter 0 Install CH340 and Burn Firmware 27

8. Enter the command: cd Freenove_Robot_Dog_Kit_for_ESP32/Code/MAC OS/ and python3 mac.py one


by one to install the firmware to esp32.

9. Wait for it to finish.

Need support?  [email protected]


28 Chapter 0 Install CH340 and Burn Firmware www.freenove.com █

Linux

1. Check whether your computer has installed python3. If it has, please skip to the next step.

If it has not, please run the command to install.

2. Check whether pip3 has been installed on your computer. If it has, please move on to the next step.
Otherwise, please run the following commands to install:
sudo apt update&
sudo apt install python3-pip

3. Type in the command: pip3 install esptool

4. Connect ESP32 to your computer with the USB cable.

Need support?  [email protected]


█ www.freenove.com Chapter 0 Install CH340 and Burn Firmware 29

5. Enter the command ls /dev/ttyUSB to check the port number.

6. Enter the command sudo chmod 777 /dev/ttyUSB0

Note: The above command is to give permission to/dev/ttyUSB0. Without this, the code may fail to download.

7. Enter the directory of Freenove_Robot_Dog_Kit_for_ESP32/Code/Linux and enter the command python3


linux.py

8. Wait for it to finish download.

Need support?  [email protected]


30 Chapter 1 Install Freenove App www.freenove.com █

Chapter 1 Install Freenove App


Here are three clients.

Client

Windows

Double click .exe file.

Mac OS

Need support?  [email protected]


█ www.freenove.com Chapter 1 Install Freenove App 31

Ubuntu

Download it in Ubuntu.
https://drive.google.com/file/d/1fjoiB1AAsy54uNjr09vAVjR43jlmw7tW/view?usp=sharing

Enter the directory where it is and run it:


sudo ./linux

Need support?  [email protected]


32 Chapter 2 Robot Assembly www.freenove.com █

Chapter 2 Robot Assembly


Please follow the tutorial to assemble the robot; otherwise, it may not function well.

Step 1 Assembly of Disc Servo Arms

1. Take out 8 disc servo arms and 32 M1.4*8 screws from servo packages.

M1.4*8screws
Disc servo arm

2. Mount two disc servo arms to the acrylic part with The front and back after assembly are as shown
eight M1.4*8 screws. below.
Below is a perspective view of the front and back.

Note: The distance between the two sets of holes is different. Please use the ones with longer distance.

Short distance

Attach this
side to the
Long distance acrylic part.

Need support?  [email protected]


█ www.freenove.com Chapter 2 Robot Assembly 33

3. After assembly, you will get the following four parts.

4. Mount two disc servo arms with eight M1.4*8 screws to the head board.

5. Mount two disc servo arms with eight M1.4*8 screws to the rear board.

Need support?  [email protected]


34 Chapter 2 Robot Assembly www.freenove.com █

Step 2 Assembly of Body Bracket

1. Mount the below two acrylic parts to the bottom body bracket with M3*12 screws and M3 nuts.

Head, mount the Rear, mount the


front board here rear board here

Bottom body
bracket

Front board

Rear board

It should look as below after assembly. Pay attention to the direction of the rear board.

Front board

M3 nut

M3*12 screw

Rear board

Need support?  [email protected]


█ www.freenove.com Chapter 2 Robot Assembly 35

2. Mount four M3*5+8 and four M3*10 brass standoffs to the top body bracket.

Head Rear

Top body
bracket

top M3*10 brass standoffs

Bottom M3*5+8 brass standoffs

3. Mount the board to the top body bracket with four M3*4 screws.

Head Rear

Bottom M3*4 screws

After assembly:

Head Rear

Need support?  [email protected]


36 Chapter 2 Robot Assembly www.freenove.com █

Rear

Head

Need support?  [email protected]


█ www.freenove.com Chapter 2 Robot Assembly 37

Step 3 Assembly of Legs

1. Mount four servos to four shanks with M2*10 screws and M2 nuts.

M2*10 screw

M2 nut

Left shank Right shank

2. Mount two servos to the below acrylic parts with M2*10 screws and M2 nuts.

Assembly diagram After assembly

M2x10 screw

M2 nut

Need support?  [email protected]


38 Chapter 2 Robot Assembly www.freenove.com █

3. Mount two servos to the below acrylic parts with M2*10 screws and M2 nuts.
Assembly diagram After assembly
M2*10 screw

M2 nut

4. Mount the two set of acrylic parts above with M3*12 screws and M3 nuts.

M3x12 screw M3 nut

5. Mount two servos to the below acrylic parts with M2*10 screws and M2 nuts.
Note: The direction is different from that in No.2!
Assembly diagram After assembly

M2x10 screw

M2 nut

Need support?  [email protected]


█ www.freenove.com Chapter 2 Robot Assembly 39

6. Mount two servos to the below acrylic parts with M2*10 screws and M2 nuts.
Note: The direction is different from that in No.3!
Assembly diagram After assembly

M2*10 screw

M2nut

7. Mount the two set of acrylic parts abovw with M3*12 screws and M3 nuts.。

M3 nut M3x12 screw

Note: The direction is different from that in No.4!


Left Right

Need support?  [email protected]


40 Chapter 2 Robot Assembly www.freenove.com █

Step 4 Adjustment of Servo Angles

1. Plug ESP32 into the driver board.

Usb port

Buzzer

Pay attention to the orientation of the ESP32. Wrong installation may lead to damage.
2. Install the batteries.

+ -

Put in the batteries according to the silkscreen. Wrong installation may result in malfunction.

Need support?  [email protected]


█ www.freenove.com Chapter 2 Robot Assembly 41

3. Plug in the servo cables to the servo connector pins randomly.

Servo connector Servo connector

Servo connector Servo connector

Pay attention to the color of the cable on each side.

G-GND (brown cable)


V-VCC (red cable)
S-Signal (orange cable)
Note: Do NOT connect the cables in reverse. Otherwise, the servos will not work and be damaged.

Need support?  [email protected]


42 Chapter 2 Robot Assembly www.freenove.com █

4. Turn ON power switch.

Power switch

5. Open the client.

Need support?  [email protected]


█ www.freenove.com Chapter 2 Robot Assembly 43

6.

7. Enter your WiFi ssid and password.

Need support?  [email protected]


44 Chapter 2 Robot Assembly www.freenove.com █

8.

9.

Need support?  [email protected]


█ www.freenove.com Chapter 2 Robot Assembly 45

10.

11. Tap Installation and all the servos will rotate to 90 degrees.

Note: The purpose of adjusting the angle of the servos is to ensure that there will not be too much deviation
after assembly to avoid malfunction. Therefore, this step is very important.

Need support?  [email protected]


46 Chapter 2 Robot Assembly www.freenove.com █

Step 5 Assembly of Legs to Body

Please keep power ON and all the servo cables connecting to the board during assembly.
We need to ensure servos remain at 90 degrees when assembling. (Servo cables are not shown in the following
instructions.)
1. Assemble the servos to the acrylic parts with black screws in servo packages.
Assemble them as close to 90 degrees as possible. Angles at 70 – 110 degrees are acceptable.

Black screw 90 degrees

Need support?  [email protected]


█ www.freenove.com Chapter 2 Robot Assembly 47

2. Assemble the servos to the acrylic parts with black screws in servo packages.
Assemble them as close to 90 degrees as possible. Angles at 70 – 110 degrees are acceptable.

Black screw 90 degrees

Repeat the above step to make two same left legs.

3. Similar to the above steps, assemble two right legs.

Need support?  [email protected]


48 Chapter 2 Robot Assembly www.freenove.com █

4. Mount one left and one right legs to the rear board with black screws in the servo package.

Head

Right leg
Left leg

Assemble them as close to 90 degrees as possible. Angles at 70 – 110 degrees are acceptable.

90 degrees 90 degrees

Need support?  [email protected]


█ www.freenove.com Chapter 2 Robot Assembly 49

5. Mount the rear board to the rear of the brackets with two M3*12 screws and two M3 nuts.

6. Mount one left and one right leg to the front board with black servo screws in the servo package.
Assemble them as close to 90 degrees as possible. Angles at 70 – 110 degrees are acceptable.

90 degrees

Note: After installing all Servo at 90 degrees, power can be turned off.

Need support?  [email protected]


50 Chapter 2 Robot Assembly www.freenove.com █

7. Mount two M3*10 standoffs to the front board with two M3*8 screws.

8. Mount the front board to the head of body bracket with a M3*12 screw and a M3 nut.

Need support?  [email protected]


█ www.freenove.com Chapter 2 Robot Assembly 51

9. Fix the body brackets with eight M3*8 screws and four M3*20 brass standoffs.

Need support?  [email protected]


52 Chapter 2 Robot Assembly www.freenove.com █

Step 6 Assembly of Head and Wire

1. Connect the camera to its extension board.

Gently pull up the lock with your fingernail or a plastic stick.


Remember to keep power OFF when assembling the head to avoid damaging the camera.
2. Mount the camera and ultrasonic modules to the head acrylic part.

3.

Plug one end of the camera cable into the camera extension board. Pay attention to blue side.

√ ×
Need support?  [email protected]
█ www.freenove.com Chapter 2 Robot Assembly 53

Plug the other end into the ESP32.

√ ×

Need support?  [email protected]


54 Chapter 2 Robot Assembly www.freenove.com █

4. Connect the ultrasonic module to driver board with the 4P DuPont cable.

Need support?  [email protected]


█ www.freenove.com Chapter 2 Robot Assembly 55

5. Mount the two acrylic parts for head to the body with two M3*12 screws.

Need support?  [email protected]


56 Chapter 2 Robot Assembly www.freenove.com █

Step 7 Assembly of the Cover

1. Mount the touch sensor to the cover with four M1.4*5 screws.

2. Use a 3P wire to connect the touch module to the robot dog drive board. The figure below does not
show the acrylic part.

Need support?  [email protected]


█ www.freenove.com Chapter 2 Robot Assembly 57

3. Mount the cover to the robot with four M3*8 screws.

Need support?  [email protected]


58 Chapter 2 Robot Assembly www.freenove.com █

Step 8 Servo Wiring

Reconnect the servo cables in accordance with the sequence below.

14 1

13 15 0 2

9 6

10 7 5
8

G-GND (brown cable)


V-VCC (red cable)
S-Signal (orange cable)
Note: Servo ports 3, 4, 11 and 12 are not connected by default.

At this point, the robot dog has been assembled and can walk, but because it has not been calibrated, it
cannot walk properly. Calibration is a very important task that determines whether your robot dog can walk
perfectly. Please be patient with the next steps.

Need support?  [email protected]


█ www.freenove.com Chapter 2 Robot Assembly 59

Step 9 Assembly of Calibration Bracket

1. Assemble the calibration bracket with two M3*12 screws and two M3 nuts.

2. Insert the calibration bracket into the robot dog to suspend the four legs.

Need support?  [email protected]


60 Chapter 2 Robot Assembly www.freenove.com █

Step 10 Calibration

1. Take out the calibration graph.

Head

Calibration
bracket

Calibration
bracket

Choose one leg each


time to calibrate.

Need support?  [email protected]


█ www.freenove.com Chapter 2 Robot Assembly 61

2. Put the robot on the calibration graph.

Head

Calibration bracket

3. Turn ON the power switch on the driver board. (Batteries are not included. Please buy them yourself.)

Power switch

Need support?  [email protected]


62 Chapter 2 Robot Assembly www.freenove.com █

4. Tap Installation Position and all the servos will rotate to 90 degrees.

5. The robot dog turns all Servo into 90 degree position, as shown in the figure below.
Note: after pressing the button, if the Servo position in a different position from the following image,
disassemble the Servo and install it in the correct position. The smaller the deviation Angle, the better.

Need support?  [email protected]


█ www.freenove.com Chapter 2 Robot Assembly 63

Need support?  [email protected]


64 Chapter 2 Robot Assembly www.freenove.com █

6. Select the leg to calibrate. Calibrate the legs by adjusting the X, Y and Z axes to make the tiptoe match
the point on the calibration graph.

Operation process of robot dog leg calibration:


1. Select the leg to calibrate. Tap the calibration button to adjust the position until the tiptop match the
point on calibration graph.
2. Tap “Submit” to upload the data after calibration to robot dog. Without this process, the result will not
be saved.
3. Repeat the above steps until all the four legs complete calibration.
The robot after calibration is as shown below:
During the adjustment process, you can click the Verify button to Verify that the calibrated leg is accurate.
If it is not accurate, the leg needs to be recalibrated. The corrected leg is allowed to have a certain error.
The error of +-5mm is allowed in the XZ direction. The Y direction needs to hit the ground right, not jacking
up the robot dog, and not hanging off the ground.

Need support?  [email protected]


█ www.freenove.com Chapter 2 Robot Assembly 65

By now, all the preparation work for robot dog has been done. You can now play the robot for fun.

Need support?  [email protected]


66 Chapter 4 Q&A www.freenove.com █

Chapter 4 Q&A
1. The buzzer makes four warning sound after powered ON.
Reason: The robot makes the sounds indicating that data cannot be obtained from the camera.
Troubleshooting:
a. The camera does not contact well with the extension board.
Please remove and reconnect the camera to try again.

b. The FPC cable does not contact well with the extension board.
Please remove and reconnect the cable.

c. The FPC cable does not contact well with the extension board.
Please remove and reconnect the cable.

d. The camera may be damaged. Please try to connect the camera to esp32 directly to test.
If the issue remains, then the camera module is damaged.
Please send us an email ([email protected]) to solve the issue.

Need support?  [email protected]


█ www.freenove.com Chapter 4 Q&A 67

2. When using the video transmission function, the Bluetooth is disconnected.

Reason: As the Bluetooth and WIFI of ESP32 share the same antenna and a large amount of data is
transmitted through WIFI during video transmission, turning off Bluetooth can better reduce the
interference with WIFI communication. Therefore, once the video transmission function is used, the robot’s
Bluetooth is turned off by default, and both commands and video transmission are communicated through
WIFI.
3. When using the video transmission function, sometimes the response of the robot dog is not timely.

Reason: When the robot dog uses video transmission, only WIFI is enabled for communication. Whether it
has a lag depends on whether the signal of the router connected to the robot dog is stable. If the WIFI
signal is poor at some point, it will cause the robot dog to be stuck.
4. It is better to control the robot dog using Bluetooth rather than WIFI when not using video transmission.

Reason: When not transmitting videos, little data is transferred between the mobile APP and the robot dog.
In this case, both WIFI and Bluetooth can control the robot dog well, but the WIFI function may be affected
by the router signal, while the Bluetooth function does not have such problem, as it is directly sent by the
robot dog to the mobile phone. Therefore, it is strongly recommended to use the Bluetooth function to
control the robot dog, and turn off WIFI to increase the stability of the Bluetooth function when video
transmission is not used.
5. Q: Which mode is better? Can both modes be enabled simultaneously?

A: When not using video transmission, you can turn on Bluetooth and WIFI at the same time. However, they
share the same control commands, so we recommend turning off WIFI and only enabling Bluetooth, which
almost causes no lag.
When using video transmission, the robot’s Bluetooth is turned off by default to avoid interference to the
WIFI function.
6. Q: The WIFI has STA and AP modes, which one should I choose when using video transmission?

A: If there is a router with great signal available, we recommend using STA mode; otherwise, AP mode is
recommended.
Note: In AP mode, you need to connect your phone to the robot’s hotspot, whose SSID and password are
as follows:

Need support?  [email protected]


68 Development www.freenove.com █

Development

Code Repository

The main purpose of this tutorial is to explain how to assemble and use the robot dog. If you want to learn
more about the code, please visit:
https://github.com/Freenove/Freenove_ESP32_Dog_Firmware
There is a more detailed explanation of the code in the code repository, please download and learn by yourself.

Communication Command

If you do not want to understand the underlying code of the robot dog, but want to develop a control
platform software for the robot dog, you can refer to the following communication commands, which
explain each control command of the robot dog in detail.

Ways of Communication

The robot support three ways of communication, namely, serial port, Bluetooth Low Energy (BLE) and TCP
Socket communication, as follows:
Ways Description
Serial Port Baud rate 115200
BLE Bluetooth GATT
TCP Socket Port 5000 is the command transmission port, and port 8000 is the video transmission
port.
Note: All commands are valid once they are sent. It is recommended not to send too many commands
repeatedly in a short period as the processing capacity of the robot dog is limited. All commands only need
to be sent once.

Communication Command Format

1. Each command consists of four parts: command word, delimiter, parameter and terminator, among
which, the number of command word is one and the parameters is variable, from 0 to n, depending on
the specific command.
A. The first character of each command is the command word, used to distinguish the major category
of the command, such as "A".
B. The character "#" is the delimiter between the command word and the parameter, used to separate
the string.
C. Each command is terminated with "\n", which is used to separate each command.
Example: “A#10#20#30#40#50#\n”

Need support?  [email protected]


█ www.freenove.com Development 69

2. Parse of Commands
When parsing commands, first separate the commands with "\n", and then separate the command word
and parameters of each command with“#”. The characters after "\n" are divided to the next command for
parsing.

Command Words

We have defined the following 18 command words.


#define ACTION_UP_DOWN 'A'
#define ACTION_BODY_HEIGHT 'B'
#define ACTION_RGB 'C'
#define ACTION_BUZZER 'D'
#define ACTION_TWIST 'E'
#define ACTION_MOVE_ANY 'F'
#define ACTION_CAMERA 'G'
#define ACTION_ULTRASONIC 'H'
#define ACTION_GET_VOLTAGE 'I'
#define ACTION_CALIBRATE 'J'
#define ACTION_SET_NVS 'K'
#define ACTION_INSTALLATION 'L'
#define ACTION_AUTO_WALKING 'M'
#define ACTION_NETWORK 'N'
#define ACTION_DANCING 'O'
#define ACTION_SET_ROBOT 'R'
#define ACTION_TEST 'T'
#define ID_CHECK 'W'

Need support?  [email protected]


70 Development www.freenove.com █

Explanation of Communication Protocol Instructions

ACTION_UP_DOWN
Control the robot to stand up or lie down with one parameter. When lying down, the servos will be unloaded
to reduce battery power consumption
App command Action
A#0#\n Switch between standing up and lying down
A#1#\n Stand up
A#2#\n Lie down
No return,

ACTION_BODY_HEIGHT
Set the robot dog's body to any height. This function has not been added to the app yet, but the robot dog
can receive this command.
App command Action
B#50#\n Make the robot stand up and set the height to 50 cm.

ACTION_RGB
Set the running mode and color of the LEDs on the robot dog.
App command Action
C#mode#red#green#blue#\n Set the RGB LEDs to “mode” mode and specify the color values of
the three channels(0-255)
C#1#255#0#0#\n
The value range and meaning of #define LED_MODE_OFF 0
mode, among which, in modes 2 and #define LED_MODE_RGB 1
5, the color cannot be changed. The #define LED_MODE_FOLLOWING 2
parameters can be any value in the #define LED_MODE_BLINK 3
range of 0-255. #define LED_MODE_BREATHING 4
#define LED_MODE_RAINBOW 5
Introduction to “mode” function
Macro Definition Parameter Description
LED_MODE_OFF 0 Turn OFF LEDs
LED_MODE_RGB 1 Static LEDs display. Color and brightness can be adjusted through
the parameters.
LED_MODE_FOLLOWING 2 The LEDs alternately display four colors of red, green, yellow and
blue.
LED_MODE_BLINK 3 LEDs blink. Color and brightness can be adjusted through the
parameters.
LED_MODE_BREATHING 4 LEDs ON and OFF like breathing. Color and brightness can be
adjusted through the parameters.
LED_MODE_RAINBOW 5 LEDs show the color of rainbow and change slowly.

Need support?  [email protected]


█ www.freenove.com Development 71

ACTION_BUZZER
Set the frequency of the buzzer.
App command Action
D#freq#\n “freq” refers to the frequency of the buzzer.
D#2000#\n Make the buzzer sound at the frequency of 2000
D#0#\n Stop the buzzer.

ACTION_TWIST
Make the robot twist itself.
App command Action
E#pitch#roll#yaw#\n
E#20#0#0#\n The robot is tilted by 20 degrees in the pitch direction.
E#10#10#10#\n The robot is tilted by 10 degrees in three directions.
Unit: degree, ranging from 0 to 20 degrees.

ACTION_MOVE_ANY
F#alpha#stepLength#gama#spd#\n
Make the robot move sideways for alpha degrees counterclockwise in its forward direction while rotating
alpha degrees at each step, with the step length of stepLength and the speed of spd.
/**
* @brief The command for walking, in any direction, at any step length and any
speed, with any rotation angle.
*
* @param alpha The moving direction, with the x-axis direction as 0 degrees,
counterclockwise as positive and clockwise as negative. Unit: degree [0-360]. The x-
direction means moving forward .
* @param stepLength The length of each step (<=20)
* @param gama The rotation angle. Rotate in place with Rotate in place, with
counterclockwise as positive and clockwise as negative, and the unit is degrees. [0-
360].
* @param spd The moving speed. Unit: mm / 10ms [1, 8]
*/
App command Action
F#0#20#0#5#\n Moving forward at the speed of 5 and step length of 20mm.
F#90#10#-10#5#\n The robot moves sideways to the left while rotating 10 degrees to
the right at each step, with a step length of 10 and speed of 5.
F#0#0#0#5#\n Stop moving
This command also only needs to be sent once. Once commanded, the robot keeps walking until it receives
a new command, such as a command to stop walking or to twist its body.
ACTION_CAMERA
This is the command sent to the app to determine whether the camera is malfunctioned. The phone app
receives and parses the command.
Robot command Action

Need support?  [email protected]


72 Development www.freenove.com █

G#100#\n The camera works fine, not need to process.


G#101#\n The camera is malfunctioned, prompting via Toast.
If the camera is faulty, the robot will periodically send reminders to the app, and the app will send a prompt
to the user after receiving the message.

ACTION_ULTRASONIC
Once the obstacle avoidance mode is turned ON, the robot will actively send the current distance measured
by the ultrasonic wave to the app and the app needs to parse this command.
The App can also actively send this command for the robot dog to print out the distance measured by the
ultrasonic wave through the serial port. Note that the command does not contain parameters, and there is
currently no Action.
App command Action
The robot obtains the distance measured by the ultrasonic module
H#\n
once, and prints it out through serial port.

Robot command Action


H#dist#\n “dist” refers to the distance measured by the ultrasonic module
H#101#\n The current measured distance is 101 cm.

ACTION_GET_VOLTAGE
The robot actively sends the current voltage value and battery percentage to the app every 3 seconds without
the need of the app to inquire.
The unit of voltage is mV.
Robot command Action
I#voltage#percent#\n “voltage” refers to the current voltage of the batteries, and
“percent” is the battery percentage.
I#8400#100%\nI The current voltage is 8400mV, 100%.

ACTION_CALIBRATE
Calibrate the robot. This command must contain only five parameters.
Parameters Action
J#legn#SSC#x#y#z#\n
Legn Leg number, numbered counterclockwise from left front to right
front, 0,1,2,3
S:Select 1: Set the position of the legs without overlaying calibration
S:Set information.
C:Confirm 2: Confirm the calibration information.
3: Select one leg to calibrate.
x、y、z They refer to the coordinates of the tiptoe of the robot dog, with
the calibration point as the relative value of the origin. If the leg
does not need calibration, then it is 0 0 0.
Examples:
App command Action

Need support?  [email protected]


█ www.freenove.com Development 73

J#2#3#0#0#0#\n Leg 2 is selected to calibrate and the other legs are unloaded to
prevent interference.
J#2#1#10#20#-10#\n Set leg 2 to the relative position of 10 20 -10
J#2#2#10#20#-10#\n Confirm and save the calibration information of 10 20 -20 to the
robot.

ACTION_SET_NVS
Save data. This command is a debug command without the need to be sent by the app.
App command Action
K#1#\n Save the mode and color of the LEDs
K#2#\n Clear all data in NVS.

ACTION_INSTALLATION
Put the robot into an installation or calibration pose.
App command Action
L#1#\n Put the robot in the installation pose, and place all servos at 90
degrees
L#2#\n Put the robot in the calibration pose without overlaying the
calibration information.

ACTION_AUTO_WALKING
Put the robot into automatic obstacle avoidance mode.
App command Action
M#0#\n Turn OFF obstacle avoidance mode.
M#1#\n Turn ON obstacle avoidance mode.

Need support?  [email protected]


74 Development www.freenove.com █

ACTION_NETWORK
The robot’s network related commands.

App sending
App command Action
N#0#\n The robot starts to scan WIFI and returns the results one by one in
the following form:
N#0#SSID#\n
N#1#ssid#psd#\n The robot uses the password psd to connect to the WIFI hotspot
named SSID and returns the result:
Success: N#103#\n
Failure: N#104#\n
Later, regardless of success or failure, the WIFI status is sent again.
(see the robot sending below)
N#2#\n Disconnect the robot’s WIFI connection, and then send the WIFI
status.
N#3#\n Establish a WIFI hotspot on the robot with the SSID as
"FreenoveDog-RobotId” and the password as 12345678. Without
this it will not success, The following results will be returned:
N#301#AP_SSID#IP#Password#\n
The above parameters are hotspot name, robot IP address and
hotspot password respectively.
N#4#\n Turn OFF the robot’s hotspot.
N#5#\n Obtain the robot WIFI and camera status and return them once.

Robot sending:
Robot command Action
N#0#SSID#\n Return the robot’s WIFI scanning results one by one.
N#101#SSID#IP#\n Robot’s WIFI status: WIFI is connected. The parameters are the WIFI
SSID and IP address of the robot in STA mode
N#102#\n Robot’s WIFI status: WIFI is not connected.
N#103#\n The robot connects to WIFI successfully.
N#104#\n The robot fails to connect to WIFI.
N#301#AP_SSID#IP#Password#\n The robot’s WIFI status: AP has been established. The parameters are
the robot’s WIFI SSID, IP address and password in AP mode.
N#302#\n The robot’s WIFI hotspot has been turned OFF.
N#5#\n Obtain the robot WIFI and camera status and return them once.

Need support?  [email protected]


█ www.freenove.com Development 75

ACTION_DANCING
Make the robot dance at some fixed actions.
App command Action
O#n#\n n refers to the fixed action modes.
O#0#\n Say hello
O#1#\n Push up
O#2#\n Stretch itself
O#3#\n Turn around
O#4#\n Sit down
O#5#\n Dance
The value and meanings of parameter n are as follows
#define DANCE_SAY_HELLO 0
#define DANCE_PUSH_UP 1
#define DANCE_STRETCH_SELF 2
#define DANCE_TURN_AROUND 3
#define DANCE_SIT_DOWN 4
#define DANCE_DANCING 5

ACTION_SET_ROBOT
Reserved.

ACTION_TEST
Reserved. Develop to use.

ID_CHECK
Check the basic information of the robot, which is used for verification in the future.
App command Action
W#0#\n Obtain the firmware version and robot name. The result returned are as follows:
W#0#100#FREENOVE-DOG#\n
among which,
100 refers to the version of V1.0.0 and the name of FREENOVE-DOG.
W#1#\n Obtain the robot’s firmware version with the result returned as follows:
W#1#100#\n
among which,
100 refers to the version of V1.0.0
W#2#\n Obtain the robot’s name with the result returned as follows:
W#2#FREENOVE-DOG#\n
referring to the name as FREENOVE-DOG
W#3#\n Obtain the internal code with the current result returned as follows
W#3#FNK006201#\n
W#4#FREENOVE#\n Fixed command to check whether the source of the controller is valid.

Need support?  [email protected]


76 What's Next? www.freenove.com █

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:
[email protected]
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.
http://www.freenove.com/

Thank you again for choosing Freenove products.

Need support?  [email protected]

You might also like