Advertisement

█ www.freenove.com
Welcome
Thank you for choosing Freenove products!
About Battery
First, read the document
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
https://github.com/Freenove/Freenove_ESP32_Robot_Dog_SDK_for_Arduino_IDE/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:
support@freenove.com
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.
Need support?  support@freenove.com
About_Battery.pdf
in the unzipped folder.
List
1

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the ESP32 and is the answer not in the manual?

Questions and answers

Paul jeffers
February 9, 2025

robot dog esp32 wont connect to bluetooth or wifi

1 comments:
Mr. Anderson
February 11, 2025

The Freenove ESP32 robot dog may not connect to Bluetooth or Wi-Fi due to the following reasons:

1. Power or Code Upload Issues: If the power is not turned on or the code is not uploaded to the ESP32, the Bluetooth of the robot dog will not be discoverable.

2. Video Transmission Active: When using the video transmission function, Bluetooth is automatically turned off because the ESP32 shares the same antenna for both Bluetooth and Wi-Fi. This prevents interference and allows stable video transmission over Wi-Fi.

3. Wi-Fi Signal Stability: If using Wi-Fi, the connection may be affected by the stability of the router’s signal. If the router signal is weak or unstable, the robot dog may not respond properly or lose connection.

To resolve the issue, ensure the power is on, the ESP32 has the required code uploaded, and check if video transmission is enabled, which may disable Bluetooth. Also, verify that the Wi-Fi signal is stable.

This answer is automatically generated

Paul jeffers
February 9, 2025

freenove robot dog esp32 wont connect to bluetooth or wifi

1 comments:
Mr. Anderson
February 11, 2025

The Freenove ESP32 robot dog may not connect to Bluetooth or Wi-Fi due to the following reasons:

1. Power or Code Upload Issue: If the power is not turned on or the code is not uploaded to the ESP32, the Bluetooth of the robot dog will not be available for connection.
2. Video Transmission in Use: When the video transmission function is active, Bluetooth is automatically turned off because both Bluetooth and Wi-Fi share the same antenna. This prevents interference and ensures better Wi-Fi communication.
3. Wi-Fi Signal Stability: If the robot dog is using Wi-Fi and experiencing lag or connection issues, it may be due to an unstable router signal.

To resolve the issue, ensure the power is on, the code is uploaded, Bluetooth is enabled (if video transmission is not in use), and the Wi-Fi signal is stable.

This answer is automatically generated

Summary of Contents for Freenove ESP32

  • Page 1 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 https://github.com/Freenove/Freenove_ESP32_Robot_Dog_SDK_for_Arduino_IDE/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 ...
  • Page 2 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.
  • Page 3: Table Of Contents

    List █ www.freenove.com Contents Welcome ....................................... 1 Contents ........................................ 1 List ........................................... 3 Robot Expansion Board for ESP32 ............................3 ESP32 ......................................4 Machinery ....................................4 Transmission ....................................5 Acrylic ......................................5 Electronic ...................................... 6 Tools ......................................6 Calibration ....................................7 Required but NOT Included Parts ............................
  • Page 4 Chapter 12 Basic Motion ................................119 Chapter 13 BLE ....................................124 Chapter 14 Camera Web Server ...............................129 Chapter 15 Dog ....................................138 Development ....................................149 Code Repository ..................................149 Communication Command ...............................149 Explanation of Communication Protocol Instructions ....................151 What's Next? ....................................157 Need support?  support@freenove.com...
  • Page 5: List

    List █ www.freenove.com List If you have any concerns, please feel free to contact us at support@freenove.com Robot Expansion Board for ESP32 Bottom Need support?  support@freenove.com...
  • Page 6: Esp32

    List www.freenove.com █ ESP32 ESP32 OV2640 Machinery Need support?  support@freenove.com...
  • Page 7: Transmission

    List █ www.freenove.com Transmission Servo package x12 Acrylic Acrylic x1 Need support?  support@freenove.com...
  • Page 8: Electronic

    █ 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?  support@freenove.com...
  • Page 9: Calibration

    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?  support@freenove.com...
  • Page 10: Preface

    █ 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.
  • Page 11: Esp32

    █ 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.
  • Page 12: Pins Used For The Robot

    Preface www.freenove.com █ 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...
  • Page 13 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...
  • Page 14: Robot Expansion Board For Esp32

    Preface www.freenove.com █ Robot Expansion Board for ESP32 The functions of the board are as follows: WS2812 WS2812 Touch Sensor Connector Buzzer 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.
  • Page 15: Chapter 0 Install Ch340 And Burn Firmware

    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.
  • Page 16: Install Ch340 Driver

    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. First, download the CH340 driver. Click http://www.wch-ic.com/search?q=CH340&t=downloads download the appropriate one based on your operating system.
  • Page 17 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?  support@freenove.com...
  • Page 18 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?  support@freenove.com...
  • Page 19 Chapter 0 Install CH340 and Burn Firmware █ www.freenove.com 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).
  • Page 20 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...
  • Page 21 Chapter 0 Install CH340 and Burn Firmware █ www.freenove.com Click Continue. Click Install and wait for it to finish. Need support?  support@freenove.com...
  • Page 22 Chapter 0 Install CH340 and Burn Firmware www.freenove.com █ Restart your PC. Need support?  support@freenove.com...
  • Page 23 Chapter 0 Install CH340 and Burn Firmware █ www.freenove.com If CH340 is still not installed after the above steps, please refer to the ReadMe.pdf to install. ReadMe Need support?  support@freenove.com...
  • Page 24: Burn The Firmware

    █ 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.
  • Page 25 Chapter 0 Install CH340 and Burn Firmware █ www.freenove.com 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.
  • Page 26 Chapter 0 Install CH340 and Burn Firmware www.freenove.com █ So far, the ch340 driver has been installed. Need support?  support@freenove.com...
  • Page 27 Chapter 0 Install CH340 and Burn Firmware █ www.freenove.com 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/Firmware/Windows with txt editor, and modify the COMx in the file according to the port USB-SERIAL CH340 (COMx) on your computer.
  • Page 28 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?  support@freenove.com...
  • Page 29 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.
  • Page 30 Chapter 0 Install CH340 and Burn Firmware www.freenove.com █ 8. Enter the command: cd Freenove_Robot_Dog_Kit_for_ESP32/Firmware/MAC OS/ and python3 mac.py one by one to install the firmware to esp32. 9. Wait for it to finish. Need support?  support@freenove.com...
  • Page 31 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?  support@freenove.com...
  • Page 32 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/Firmware/Linux and enter the command python3 linux.py 8. Wait for it to finish download. Need support?  support@freenove.com...
  • Page 33: Chapter 1 Install Freenove App

    Chapter 1 Install Freenove App █ www.freenove.com Chapter 1 Install Freenove App Here are three installation methods. You can choose any one of them. Install Freenove App Method 1 Open Google Play on your phone and search “Freenove” to download. Need support?  support@freenove.com...
  • Page 34 Chapter 1 Install Freenove App www.freenove.com █ Method 2 Visit the website https://www.freenove.com/app.html with your computer and choose the one corresponding to your phone system to download, and then transfer it to your phone to install. Need support?  support@freenove.com...
  • Page 35: Ios

    Chapter 1 Install Freenove App █ www.freenove.com Method 3 Use your phone or computer to visit the website: https://github.com/Freenove/Freenove_app_for_Android, click Download ZIP under Code. Open the iPhone’s APP Store, search Freenove and install it. Freenove Install Need support?  support@freenove.com...
  • Page 36: Introduction To Freenove App

    Chapter 1 Install Freenove App www.freenove.com █ Introduction to Freenove App Open the app and select the ESP32 robot Dog. Click it Before using the phone App to control the robot dog, we need to understand the interface first. WiFi...
  • Page 37: Chapter 2 Robot Assembly

    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?  support@freenove.com...
  • Page 38 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?  support@freenove.com...
  • Page 39: Step 2 Assembly Of Body Bracket

    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?  support@freenove.com...
  • Page 40 2. Mount four M3*5+8 and four M3*10 brass standoffs to the top body bracket. Head Rear Top body bracket M3*10 brass standoffs M3*5+8 brass standoffs Bottom 3. Mount the board to the top body bracket with four M3*4 screws. Head Rear M3*4 screws Bottom After assembly: Rear Head Need support?  support@freenove.com...
  • Page 41 Chapter 2 Robot Assembly █ www.freenove.com Rear Head Need support?  support@freenove.com...
  • Page 42: 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?  support@freenove.com...
  • Page 43 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?  support@freenove.com...
  • Page 44 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?  support@freenove.com...
  • Page 45: 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.
  • Page 46 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?  support@freenove.com...
  • Page 47 Chapter 2 Robot Assembly █ www.freenove.com 4. Turn ON power switch. Power switch 5. Open Freenove App and select robot dog. Select robot dog Need support?  support@freenove.com...
  • Page 48 Chapter 2 Robot Assembly www.freenove.com █ 6. Turn ON Bluetooth of your phone and tap the Connect button on the app. Connection 7. Select “Freenove-Dog-XXXXXXXX”. 8. Tap the calibration button. Calibration Need support?  support@freenove.com...
  • Page 49: Step 5 Assembly Of Legs To Body

    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?  support@freenove.com...
  • Page 50 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?  support@freenove.com...
  • Page 51 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?  support@freenove.com...
  • Page 52 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?  support@freenove.com...
  • Page 53 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?  support@freenove.com...
  • Page 54 Chapter 2 Robot Assembly www.freenove.com █ 9. Fix the body brackets with eight M3*8 screws and four M3*20 brass standoffs. Need support?  support@freenove.com...
  • Page 55: Step 6 Assembly Of Head And Wire

    2. Mount the camera and ultrasonic modules to the head acrylic part. Plug one end of the camera cable into the camera extension board. Pay attention to blue side. √ × Need support?  support@freenove.com...
  • Page 56 Chapter 2 Robot Assembly www.freenove.com █ Plug the other end into the ESP32. √ × Need support?  support@freenove.com...
  • Page 57 Chapter 2 Robot Assembly █ www.freenove.com 4. Connect the ultrasonic module to driver board with the 4P DuPont cable. Need support?  support@freenove.com...
  • Page 58 Chapter 2 Robot Assembly www.freenove.com █ 5. Mount the two acrylic parts for head to the body with two M3*12 screws. Need support?  support@freenove.com...
  • Page 59: 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?  support@freenove.com...
  • Page 60 Chapter 2 Robot Assembly www.freenove.com █ 3. Mount the cover to the robot with four M3*8 screws. Need support?  support@freenove.com...
  • Page 61: Step 8 Servo Wiring

    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?  support@freenove.com...
  • Page 62: Step 9 Assembly Of Calibration Bracket

    Chapter 2 Robot Assembly www.freenove.com █ 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?  support@freenove.com...
  • Page 63: Step 10 Calibration

    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?  support@freenove.com...
  • Page 64 Chapter 2 Robot Assembly www.freenove.com █ 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?  support@freenove.com...
  • Page 65 5. Turn ON Bluetooth of your phone and tap the Connect button on the app. Connection 6. Select “Freenove-Dog-XXXXXXXX”. If you do not turn ON the power or upload code to ESP32, you cannot find the Bluetooth of robot dog. Need support?  support@freenove.com...
  • Page 66 9. 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?  support@freenove.com...
  • Page 67 Chapter 2 Robot Assembly █ www.freenove.com 10. Introduction to the interface. Select the leg to be calibrated. Servo position Submit servo calibration after parameters calibration Servo position before calibration Calibrating button Servo rotating to 90° Back to control interface Need support?  support@freenove.com...
  • Page 68 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. By now, all the preparation work for robot dog has been done. You can now play the robot for fun. Need support?  support@freenove.com...
  • Page 69: Chapter 3 Functions Of Freenove App

    Chapter 3 Functions of Freenove App █ www.freenove.com Chapter 3 Functions of Freenove App Introduction to Main Interface Bluetooth Photo WiFi Moving Obstacle Battery RGB LED Gestures Connection Transmission Setting Modes Avoidance Level Setting Speed Distance Measured Screenshot Servo Speed...
  • Page 70: Wi-Fi Configuration

    Chapter 3 Functions of Freenove App www.freenove.com █ Wi-Fi Configuration 1. Tap Wi-Fi Setting button. 2. Introduction to Wi-Fi configuration interface. A. To connect the robot dog to a Wi-Fi network, please select STAMode, which can connect the robot to a designated Wi-Fi.
  • Page 71 Chapter 3 Functions of Freenove App █ www.freenove.com 4. The interface of successful connection is as below. 5. To use APMode, please tap the switch below and then connect your phone to the Wi-Fi shown on the right. 6. Tap Back to exit the configuration interface.
  • Page 72 Chapter 3 Functions of Freenove App www.freenove.com █ 7. After the robot dog connects to Wi-Fi network, tap the video transmission and your phone will display the frames captured by the robot. Video Transmission Interface Setting Tip: Tap the Interface Settings button and you can adjust the frames displayed on the phone.
  • Page 73: Rgb Led Control

    Chapter 3 Functions of Freenove App █ www.freenove.com RGB LED Control 1. Tap RGB LED control function. 2. The left and right arrows are used to switch the LED modes, the slider to control the brightness and the color palette to set the color.
  • Page 74: Interaction Function

    Chapter 3 Functions of Freenove App www.freenove.com █ Interaction Function 1. Tap the Interaction button. Tip: Tapping the up and down arrow icon can make the robot dog lie down and unload the servos. 2. The robot dog can do different actions with different actions being tapped.
  • Page 75: Chapter 4 Q&A

    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.
  • Page 76 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.
  • Page 77: Chapter 5 Arduino Software

    First, install Arduino Software (IDE): visit https://www.arduino.cc, click "Download" to enter the download page. Select and download corresponding installer according to your operating system. If you are a Windows user, please select the "Windows Installer" to download and install the driver correctly. Need support?  support@freenove.com...
  • Page 78 When it popes up, please allow the installation. After installation is completed, an Arduino Software shortcut will be generated in the desktop. Run the Arduino Software. The interface of Arduino Software is as follows: Need support?  support@freenove.com...
  • Page 79 Chapter 5 Arduino Software █ www.freenove.com Menus Toolbar Text editor Message area Console Configured board and serial port Need support?  support@freenove.com...
  • Page 80 Open the serial monitor. Additional commands are found within the five menus: File, Edit, Sketch, Tools, Help. The menus are context sensitive, which means only those items relevant to the work currently being carried out are available. Need support?  support@freenove.com...
  • Page 81: Environment Configuration

    Chapter 5 Arduino Software █ www.freenove.com Environment Configuration First, open the software platform arduino, and then click File in Menus and select Preferences. Second, click on the symbol behind "Additional Boards Manager URLs" Need support?  support@freenove.com...
  • Page 82 Chapter 5 Arduino Software www.freenove.com █ Third, fill in https://espressif.github.io/arduino-esp32/package_esp32_index.json in the new window, click OK, and click OK on the Preferences window again. Fourth, click Tools in Menus, select Board: "Arduino Uno", and then select "Boards Manager". Need support?  support@freenove.com...
  • Page 83 Chapter 5 Arduino Software █ www.freenove.com Fifth, input "esp32" in the window below, and press Enter. Select version 2.0.2. Click "Install" to install. When finishing installation, click Tools in the Menus again and select Board: "Arduino Uno", and then you can see information of ESP32-WROVER.
  • Page 84: Chapter 6 Battery

    An ADC is an electronic integrated circuit used to convert analog signals such as voltages to digital or binary form consisting of 1s and 0s. The range of our ADC on ESP32 is 12 bits, that means the resolution is 2^12=4096, and it represents a range (at 3.3V) will be divided equally to 4096 parts.
  • Page 85 Battery/Trig is about 1/4 of the battery voltage, 8.4 / 4 = 2.1V, which is within the voltage acquisition range of GPIO32. Sketch In this section, we will use GPIO32 of ESP32 to read the voltage value of the batteries and print it on serial monitor. Open “Sketch_01_Battery” folder in “Freenove_Robot_Dog_Kit_for_ESP32\Sketches” and then double-click “Sketch_01_Battery.ino”.
  • Page 86 Chapter 6 Battery www.freenove.com █ Sketch_01_Battery Click the upload button in the upper left corner to upload the code to esp32. Open the serial monitor in the upper right corner and set the baud rate to 115200. Need support?  support@freenove.com...
  • Page 87 The getBatteryVoltage() function is used to obtain the voltage value of the battery in millivolts. The Serial.printf() function can print the content processed by ESP32 to the serial monitor through the serial port.
  • Page 88 = adc_reading*3300/4096; We know from the previous introduction that the voltage at the ESP32 pin is 1/4 of the battery voltage. Therefore, the voltage value of the battery can be obtained by multiplying the voltage value measured by the ADC by VOLATAGE_RATIO(4).
  • Page 89: Chapter 7 Built-In Led

    As shown in the figure above, when the ESP32 outputs a high level, the onboard indicator will light up. When the ESP32 outputs a low level, the onboard indicator light will be off. We can use it to indicate the running state of our code.
  • Page 90 █ Sketch_02_BuiltInLed Click the upload button in the upper left corner to upload the code to esp32. The LED on the ESP32 board will turn on and off every 1 second for 5 times, and enter the flash mode.
  • Page 91 The LED light on the control board turns on and off every 1 second, which repeats 5 times. (int i = 0; i < 5; i++) { setBuiltInLed(HIGH); delay(1000); setBuiltInLed(LOW); delay(1000); BuiltInLed.h #ifndef _BUILTINLED_h #define _BUILTINLED_h #include "Arduino.h" #define LED_BUILT_IN void setupBuiltInLed(); void setBuiltInLed(bool state); void task_showBuiltInLed(void *pvParameters); #endif Need support?  support@freenove.com...
  • Page 92 (uint8_t)ledStatus); lastLedStatus = ledStatus; bitDiff++; bitIndex++; (bitIndex >= 10){ intervalTime = 600; ledRunnigStatus = 1; bitDiff = 0; bitIndex = 0; break; case // off intervalTime = 100; ledRunnigStatus = 0; break; default: break; Need support?  support@freenove.com...
  • Page 93 If the previous shift cycle is completed, set the time for entering the if condition to 100ms each time and proceed to the next shift cycle. case // off intervalTime = 100; ledRunnigStatus = 0; break; Need support?  support@freenove.com...
  • Page 94: Chapter 8 Buzzer

    Schematic As shown in the figure below, we connect a buzzer to GPIO33 of ESP32. When GPIO33 outputs high level, the buzzer circuit is turned on; when GPIO33 outputs low level, the buzzer circuit is turned off. Since the buzzer is a passive buzzer, when we switch quickly between high and low levels, we can control the passive buzzer to make a sound.
  • Page 95 Chapter 8 Buzzer █ www.freenove.com Sketch Open “Sketch_03_Buzzer” folder in “Freenove_Robot_Dog_Kit_for_ESP32\Sketches” and then double-click “Sketch_03_Buzzer.ino”. Sketch_03_Buzzer Upload the sketch and the buzzer will beep three times at a fixed frequency and then emit a pleasant sound. Need support?  support@freenove.com...
  • Page 96 Buzzer.h #ifndef _BUZZER_h #define _BUZZER_h #include "NoteFrequency.h" #include "Arduino.h" #define MELODY_POWER_UP #define MELODY_LOW_POWER #define MELODY_NO_POWER #define MELODY_WIFI_CONNECT_SUCCESS #define MELODY_WIFI_CONNECT_FAILED #define MELODY_WIFI_DISCONNECT #define MELODY_BLE_CONNECT_SUCCESS #define MELODY_BLE_DISCONNECT #define MELODY_CAM_CONNECT_SUCCESS #define MELODY_CAM_DISCONNECT #define MELODY_CAM_FAILURE #define MELODY_BEEP_1 #define MELODY_BEEP_2 Need support?  support@freenove.com...
  • Page 97 0); ledcWriteTone(BUZZER_CHN, 0); template<int N> //Non-type template parameters void playMelody(const int (&tune)[N], const float (&beat)[N], float speed) { (int i = 0; i < N; i++) { setBuzzer(tune[i]); delay(beat[i] * speed); setBuzzer(0); Need support?  support@freenove.com...
  • Page 98 300); break; case MELODY_WIFI_CONNECT_FAILED: playMelody(tuneWifiFailed, beatWifiFailed, 300); break; case MELODY_WIFI_DISCONNECT: playMelody(tuneWifiDis, beatWifiDis, 300); break; case MELODY_BLE_CONNECT_SUCCESS: playMelody(tuneBleSucc, beatBleSucc, 100); break; case MELODY_BLE_DISCONNECT: playMelody(tuneBleDis, beatBleDis, 100); break; case MELODY_CAM_CONNECT_SUCCESS: playMelody(tuneCamSucc, beatCamSucc, 100); break; case MELODY_CAM_DISCONNECT: Need support?  support@freenove.com...
  • Page 99 MELODY_BB_CLEAR_1: playMelody(tuneBb1, beatBb1, 100); break; case MELODY_BB_CLEAR_2: playMelody(tuneBb2, beatBb2, 100); break; default: break; vTaskDelete(xTaskGetCurrentTaskHandle()); Define the pin for the buzzer. ESP32's PWM channel, number of bits, and frequency. #define BUZZER_PIN (33) #define BUZZER_CHN #define BUZZER_BIT (10) #define BUZZER_FREQ (5000) Configure the pin to control the buzzer: 1.
  • Page 100 "task_Buzzered", 2048, NULL, 1, &taskHandle_Buzzered, 0); Buzzer thread callback function. Each time the thread is executed, the vTaskDelete(xTaskGetCurrentTaskHandle()) function is automatically called to close its own thread. void task_Buzzered(void *pvParameters) { (enableBuzzered) { switch (melody) { …… vTaskDelete(xTaskGetCurrentTaskHandle()); Need support?  support@freenove.com...
  • Page 101: Chapter 9 Ws2812

    If you have any concerns, please feel free to contact us via support@freenove.com Schematic As shown in the figure below, we connect the WS2812 to GPIO0 of ESP32. In this way, we can havel the WS2812 to display various colors by controlling GPIO0. Sketch This code uses a library named "Freenove_WS2812_Lib_for_ESP32".
  • Page 102 █ Open “Sketch_04_WS2812” folder in “Freenove_Robot_Dog_Kit_for_ESP32\Sketches” and then double- click “Sketch_04_WS2812.ino”. Sketch_04_WS2812 Upload the sketch to the esp32, the four WS2812 LEDs on the robot board will switch a colored light display mode every 5 seconds. Need support?  support@freenove.com...
  • Page 103 When i=1, control the RGB LEDS to display the specified color. When i is not equal to 1, other patterns of colored lights are displayed. setRGBLED(i, m_color[j][0], m_color[j][1], m_color[j][2]); RGBLED_WS2812.h #ifndef _RGBLED_WS2812_h #define _RGBLED_WS2812_h defined(ARDUINO) && ARDUINO >= #include "Arduino.h" #else #include "WProgram.h" #endif #include "Freenove_WS2812_Lib_for_ESP32.h" #define LEDS_COUNT #define LEDS_PIN #define CHANNEL Need support?  support@freenove.com...
  • Page 104 = true; u32 lastStripUpdateTime = 0; void setupRGBLED() { strip.begin(); strip.setBrightness(255); xTaskCreateUniversal(task_RGBLeds, "task_RGBLeds", 4096, NULL, 1, NULL, 1); void setRGBLED(uint8_t mode, uint8_t uint8_t uint8_t b) { ledConfig_t.mode = mode; ledConfig_t.r = r; ledConfig_t.g = g; Need support?  support@freenove.com...
  • Page 105 (blinkStateUp) { blinkStateUp = false; (int i = 0; i < LEDS_COUNT; i++) { strip.setLedColorData(i, ledConfig_t.r, ledConfig_t.g, ledConfig_t.b); strip.show(); else blinkStateUp = true; (int i = 0; i < LEDS_COUNT; i++) { strip.setLedColorData(i, 0, 0, 0); Need support?  support@freenove.com...
  • Page 106 += 2; (rainbowStep >= 255) { rainbowStep = 0; j = rainbowStep; (int i = 0; i < LEDS_COUNT; i++) { strip.setLedColorData(i, strip.Wheel((i * / LEDS_COUNT + & 255)); strip.show(); lastStripUpdateTime = millis(); break; default: Need support?  support@freenove.com...
  • Page 107 *pvParameters) { switch (ledConfig_t.mode) { case LED_MODE_OFF: … …… break; case LED_MODE_RGB: … …… break; case LED_MODE_FOLLOWING: … …… break; case LED_MODE_BLINK: … …… break; case LED_MODE_BREATHING: … …… Need support?  support@freenove.com...
  • Page 108 Chapter 9 WS2812 www.freenove.com █ break; case LED_MODE_RAINBOW: … …… break; default: break; Thread callback function, when the thread starts, it will execute the color light display function cyclically. void task_RGBLeds(void *pvParameters) { while (1) { task_showRGBLeds(NULL); Need support?  support@freenove.com...
  • Page 109: Chapter 10 Ultrasonic Ranging

    At the same time, the Echo pin is pulled up. When the module receives the returned ultrasonic waves from encountering an obstacle, the Echo pin will be pulled down. The duration of high level in the Echo pin is the total time of the ultrasonic wave from transmitting to receiving, s=vt/2. Need support?  support@freenove.com...
  • Page 110 Chapter 10 Ultrasonic Ranging www.freenove.com █ Sketch In this chapter, we use GPIO32 of ESP32 as the Trig pin of the ultrasonic module, and GPIO12 as the Echo pin of the ultrasonic module. Open “Sketch_05_Ultrasonic” folder in “Freenove_Robot_Dog_Kit_for_ESP32\Sketches” and then double- click “Sketch_05_Ultrasonic.ino”.
  • Page 111 Get the data value of the ultrasonic module, the unit is cm. float dist = getSonar(); UltrasonicRanging.h #ifndef _ULTRASONICRANGING_h #define _ULTRASONICRANGING_h defined(ARDUINO) && ARDUINO >= #include "Arduino.h" #else #include "WProgram.h" #endif #define PIN_TRIG //Ultrasonic trig pin #define PIN_ECHO //Ultrasonic echo pin void setupSonar(); float getSonar(); #endif Need support?  support@freenove.com...
  • Page 112 / 10000; else distance = MAX_DISTANCE; return distance; // return the distance value Ultrasonic module initialization function. void setupSonar() { pinMode(PIN_TRIG, OUTPUT); // set trigPin to output mode pinMode(PIN_ECHO, INPUT); // set echoPin to input mode Need support?  support@freenove.com...
  • Page 113 Arduino pin on which you want to read the pulse. Allowed data types: int. value: type of pulse to read: either HIGH or LOW. Allowed data types: int. timeout (optional): the number of microseconds to wait for the pulse to start; default is one second. Need support?  support@freenove.com...
  • Page 114: Chapter 11 Touch

    32K_XP GPIO32 The touch pin number is already defined in ESP32's code base. For example, in the code, you can use T0 to represent GPIO4. The electrical signals generated by touch are analog data, which are converted by an internal ADC converter.
  • Page 115 Sketch_06_Touch Upload the code to esp32, and the robot dog obtains the status of the touch sensor every 100 milliseconds and prints it out through the serial port. Touch the position circled in the figure below with your finger, and observe the changes in the content printed by the serial port.
  • Page 116 #include "WProgram.h" #endif #include "driver/touch_pad.h" #define PIN_TOUCH_PAD (TOUCH_PAD_NUM3) #define TOUCH_THRESH_NO_USE #define TOUCH_THRESH_PERCENT (80) #define TOUCHPAD_FILTER_TOUCH_PERIOD (10) void setupTouchPad(void); void __attribute__((weak)) isr_touchpad(void *arg); extern void isr_touchpad(void *arg); void isr_touchpad(); void task_TouchPad(void *pvParameters); void task_Touch(void *pvParameters); getTouch(void); #endif Need support?  support@freenove.com...
  • Page 117 TOUCH_THRESH_NO_USE); // Initialize and start a software filter to detect slight change of capacitance. touch_pad_filter_start(TOUCHPAD_FILTER_TOUCH_PERIOD); // Set thresh hold tp_example_set_thresholds(); // set isr trigger mode touch_pad_set_trigger_mode(TOUCH_TRIGGER_BELOW); // Register touch interrupt ISR touch_pad_isr_register(isr_touchpad, NULL); // enable isr Need support?  support@freenove.com...
  • Page 118 // release time > 50, press time < 700, short press, enter short pressed state touchMechineStatus = 2; break; case // short press Serial.printf("short press: %dms\n", t3); touchMechineStatus = 0; break; case // Wait for release after long press. (touchPadVal) { t1 = millis(); Need support?  support@freenove.com...
  • Page 119 (1) { task_TouchPad(NULL); getTouch(void) { return touchMechineStatus; ESP32 touch function pin initialization. void setupTouchPad(void) { // Initialize touch pad peripheral, it will start a timer to run a filter ESP_ERROR_CHECK(touch_pad_init()); // If use interrupt trigger mode, should set touch sensor FSM mode at 'TOUCH_FSM_MODE_TIMER'.
  • Page 120 = false; void isr_touchpad(void *arg) { // uint16_t touchVal = 0; uint32_t touchStatus = 0; touchStatus = touch_pad_get_status(); // TOUCHPAD3 : 0000 1000 = 0x08 (touchStatus == 0x08) // TOUCHPAD3 touchPadVal = true; touch_pad_clear_status(); Need support?  support@freenove.com...
  • Page 121: Chapter 12 Basic Motion

    Schematic As shown in the picture, we connect the SDA and SCL pins of PCA9685 chip to GPIO13 and GPIO14 of ESP32 respectively. In this way, we can communicate with PCA9685 through IIC, and control the servo through PCA9685 to rotate to any angle.
  • Page 122 Chapter 12 Basic Motion www.freenove.com █ Sketch_07_Action Upload the code to esp32 and the robot dog will make various actions. Please note: If your robot dog has not been calibrated, please navigate back to Chapter 2 to calibrate the robot dog first.
  • Page 123 = 0; j < repeatCounts; j++) { (int i = 0; i < 360; i += 30) { * sin((double)i * PI / 180); * cos((double)i * PI / 180); twist_any(x, y, z); twist_any(0, 0, 0); //Normal standing Need support?  support@freenove.com...
  • Page 124 Robot dog movement function, by modifying the parameters, control the robot dog to go forward at any direction, any step length, any rotation Angle, and any speed. @brief Walk command, any direction, any step length, any spin angle, any speed Need support?  support@freenove.com...
  • Page 125 Servo unloading function. Each time this function is called, the servos will lose torque pca.releaseAllServo(); Robot dog standing function. Every time this function is called, the robot dog will return to the standing position. standUp(); Need support?  support@freenove.com...
  • Page 126: Chapter 13 Ble

    Sketch_08_BLE Upload the code to esp32. Open the serial monitor and set the baud rate to 115200. Connect the mobile APP to the robot dog, and you can see all the commands sent by the mobile terminal on the serial monitor.
  • Page 127 "); (rxValue.length() > 0) { (int i = 0; i < rxValue.length(); i++) { bleInputString += rxValue[i]; (rxValue[i] == '\n') { Serial.println(bleInputString); /*You can do something with the information you receive*/ bleInputString = ""; //Clear bleInputString. Need support?  support@freenove.com...
  • Page 128 = ""; //Clear bleInputString. BluetoothService.h #ifndef __BLUETOOTHSERVICE_H #define __BLUETOOTHSERVICE_H #include "Arduino.h" #include <BLEDevice.h> #include <BLEServer.h> #include <BLEUtils.h> #include <BLE2902.h> class BLEServer; class BLECharacteristic; class BLEServerCallbacks; void bleSetup(); void bleStop(); void bleSend(std::string msg); extern void onBleReceived(BLECharacteristic *pCharacteristic); #endif Need support?  support@freenove.com...
  • Page 129 // disconnecting (!isBleConnected && oldBleConnected) { oldBleConnected = isBleConnected; Serial.println("Ble Disconnect"); delay(500); // give the bluetooth stack the chance to get things ready pServer->startAdvertising(); // restart advertising class MyCallbacks : public BLECharacteristicCallbacks void onWrite(BLECharacteristic *pCharacteristic) { onBleReceived(pCharacteristic); Need support?  support@freenove.com...
  • Page 130 Chapter 13 BLE www.freenove.com █ void bleSetup() { // Create the BLE Device String s = String("Freenove-Dog"); BLEDevice::init(std::string(s.c_str())); BLEDevice::setMTU(512); // Create the BLE Server pServer = BLEDevice::createServer(); pServer->setCallbacks(new MyServerCallbacks()); // Create the BLE Service BLEService *pService = pServer->createService(SERVICE_UUID); // Create a BLE Characteristic pTxCharacteristic = pService->createCharacteristic(...
  • Page 131: Chapter 14 Camera Web Server

    Chapter 14 Camera Web Server In this section, we'll use ESP32's video function as an example to study. Connect ESP32 using USB and check its IP address through serial monitor. Use web page to access IP address to obtain video and image data.
  • Page 132 Chapter 14 Camera Web Server www.freenove.com █ Compile and upload codes to ESP32, open the serial monitor and set the baud rate to 115200, and the serial monitor will print out a network link address. If your ESP32 has been in the process of connecting to router, but the information above has not been printed out, please re-check whether the router name and password have been entered correctly and press the reset key on ESP32-WROVER to wait for a successful connection prompt.
  • Page 133 Chapter 14 Camera Web Server █ www.freenove.com enter IP address select pixel of the picture adjust camera parameters set camera left and right, up and down crop the picture turn on video transmission Need support?  support@freenove.com...
  • Page 134 Click on Start Stream. The effect is shown in the image below. Note: If sketch compilation fails due to ESP32 support package, follow the steps of the image to open the CameraWebServer. This sketch is the same as described in the tutorial above.
  • Page 135 #include <WiFi.h> // WARNING!!! PSRAM IC required for UXGA resolution and high JPEG quality Ensure ESP32 Wrover Module or other board with PSRAM is selected Partial images will be transmitted if image exceeds buffer size // Select camera model #define...
  • Page 136 // initial sensors are flipped vertically and colors are a bit saturated (s->id.PID OV3660_PID) { s->set_vflip(s, 1); // flip it back s->set_brightness(s, 1); // up the brightness just a bit s->set_saturation(s, -2); // lower the saturation // drop down frame size for higher initial frame rate Need support?  support@freenove.com...
  • Page 137 { // put your main code here, to run repeatedly: delay(10000); Add procedure files and API interface files related to ESP32 camera. #include "esp_camera.h" #include <WiFi.h> // WARNING!!! PSRAM IC required for UXGA resolution and high JPEG quality...
  • Page 138 = RESET_GPIO_NUM; config.xclk_freq_hz = 20000000; config.pixel_format = PIXFORMAT_JPEG; ESP32 connects to the router and prints a successful connection prompt. If it has not been successfully connected, press the reset key on the ESP32-WROVER. WiFi.begin(ssid, password); while (WiFi.status() WL_CONNECTED) { delay(500);...
  • Page 139 = 10; config.fb_count = 2; Reference Image resolution Sharpness Image resolution Sharpness FRAMESIZE_QQVGA 160x120 FRAMESIZE_VGA 640x480 FRAMESIZE_QQVGA2 128x160 FRAMESIZE_SVGA 800x600 FRAMESIZE_QCIF 176x144 FRAMESIZE_XGA 1024x768 FRAMESIZE_HQVGA 240x176 FRAMESIZE_SXGA 1280x1024 FRAMESIZE_QVGA 320x240 FRAMESIZE_UXGA 1600x1200 FRAMESIZE_CIF 400x296 FRAMESIZE_QXGA 2048x1536 Need support?  support@freenove.com...
  • Page 140: Chapter 15 Dog

    Download and install Python3 package. https://www.python.org/downloads/release/python-381/ Choose the one matching to your computer version to download and install. Please note that “Add Python 3.8. to PATH” MUST be check. Check all the options and then click “Next”. Need support?  support@freenove.com...
  • Page 141 Chapter 15 Dog █ www.freenove.com Here you can select the installation path of Python. We install it at D drive. If you are a novice, you can select the default path. Wait for it to finish installing. Need support?  support@freenove.com...
  • Page 142 You can download it directly by clicking the link below, and unzip it manually. https://github.com/Freenove/Freenove_ESP32_Robot_Dog_SDK_for_Arduino_IDE/archive/master.zip Or download via the command git clone https://github.com/Freenove/ Freenove_ESP32_Robot_Dog_SDK_for_Arduino_IDE.git Here we take window installation as an example. Same steps for Linux and Mac. Find the unzipped file directory, as shown in the figure below.
  • Page 143 Chapter 15 Dog █ www.freenove.com Type python setup.py in the cmd. Wait for it to finish installation. Restart Arduino IDE as per the prompt. Need support?  support@freenove.com...
  • Page 144 Open “Sketch_10_Dog” folder in “Freenove_Robot_Dog_Kit_for_ESP32\Sketches” and then double-click “Sketch_10_Dog.ino”. Sketch_10_Dog Upload the sketch to esp32 and you can control the robot dog to make any action as shown in Chapter 3. Please note: If your robot dog has not been calibrated, please navigate back to Chapter 2 to calibrate the robot dog first.
  • Page 145 // Info message queue, Important, can not ignore. void setup() { Serial.begin(115200); Serial.println("\n\nProgram begin ... "); bleSetup(); prefs.begin(NMSPC_STORAGE); pca.begin(); pca.releaseAllServo(); getServoOffsetFromStorage(); getLedConfigFromStorage(); cs.begin(); setupAdc(); setupBuzzer(); setupSonar(); setupRGBLED(); setupBuiltInLed(); setupTouchPad(); Serial.println("setup finished!\n\n"); startTask(TASK_MOTION_SERVICE); startTask(TASK_SECONDRAY); // loop2 Need support?  support@freenove.com...
  • Page 146 (1) { task_BatteryPowerListener(NULL); task_showRGBLeds(NULL); task_AutoWalking(NULL); task_BuzzerService(NULL); task_TouchPad(NULL); vTaskDelay(50); vTaskDelete(xTaskGetCurrentTaskHandle()); void serialEventRun() { static String serialInputString = ""; while (Serial.available()) { char inChar = (char)Serial.read(); serialInputString += inChar; (inChar == '\n') { enterMessageQueue(serialInputString); serialInputString = ""; Need support?  support@freenove.com...
  • Page 147 += rv[i]; (rv[i] == '\n') { Serial.print(wifiInputString); enterMessageQueue(wifiInputString); wifiInputString = ""; void onWiFiCmdTrasmit(WiFiClient *client) { (!mqTx.isEmpty()) { client->write(mqTx.out().c_str()); void enterMessageQueue(String msg) { Serial.print("msg : "); Serial.print(msg); switch (msg.charAt(0)) { case ACTION_INSTALLATION: case ACTION_CALIBRATE: case ACTION_UP_DOWN: Need support?  support@freenove.com...
  • Page 148 Serial.println("setup finished!\n\n"); Receive commands by Serial. void serialEventRun() { static String serialInputString = ""; while (Serial.available()) { char inChar = (char)Serial.read(); serialInputString += inChar; (inChar == '\n') { enterMessageQueue(serialInputString); serialInputString = ""; Need support?  support@freenove.com...
  • Page 149 Divide the commands into robot dog action commands and other commands according to the types and send them into the corresponding message queue. void enterMessageQueue(String msg) { Serial.print("msg : "); Serial.print(msg); switch (msg.charAt(0)) { case ACTION_INSTALLATION: case ACTION_CALIBRATE: case ACTION_UP_DOWN: case ACTION_BODY_HEIGHT: case ACTION_MOVE_ANY: case ACTION_TWIST: Need support?  support@freenove.com...
  • Page 150 - lastT > 1000) { // Serial.printf("Total heap: %d\r\n", ESP.getHeapSize()); // Serial.printf("Free heap: %d\r\n", ESP.getFreeHeap()); lastT = millis(); Events handled by the task thread. void loopSecondary(void *pvParameters) { while (1) { task_BatteryPowerListener(NULL); task_showRGBLeds(NULL); task_AutoWalking(NULL); task_BuzzerService(NULL); task_TouchPad(NULL); vTaskDelay(50); vTaskDelete(xTaskGetCurrentTaskHandle()); Need support?  support@freenove.com...
  • Page 151: Development

    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” 2. Parse of Commands Need support?  support@freenove.com...
  • Page 152 #define ACTION_UP_DOWN #define ACTION_BODY_HEIGHT #define ACTION_RGB #define ACTION_BUZZER #define ACTION_TWIST #define ACTION_MOVE_ANY #define ACTION_CAMERA #define ACTION_ULTRASONIC #define ACTION_GET_VOLTAGE #define ACTION_CALIBRATE #define ACTION_SET_NVS #define ACTION_INSTALLATION #define ACTION_AUTO_WALKING #define ACTION_NETWORK #define ACTION_DANCING #define ACTION_SET_ROBOT #define ACTION_TEST #define ID_CHECK Need support?  support@freenove.com...
  • Page 153: Explanation Of Communication Protocol Instructions

    LEDs blink. Color and brightness can be adjusted through the LED_MODE_BLINK parameters. LEDs ON and OFF like breathing. Color and brightness can be LED_MODE_BREATHING adjusted through the parameters. LEDs show the color of rainbow and change slowly. LED_MODE_RAINBOW Need support?  support@freenove.com...
  • Page 154 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?  support@freenove.com...
  • Page 155 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?  support@freenove.com...
  • Page 156 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?  support@freenove.com...
  • Page 157 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?  support@freenove.com...
  • Page 158 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:...
  • Page 159: What's Next

    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?  support@freenove.com...

Table of Contents

Save PDF