Bus Servo Driver HAT (A)

From Waveshare Wiki
Jump to: navigation, search
Bus Servo Driver HAT (A)
Bus Servo Driver HAT (A).jpg

UART/USB/TTL/RS485
{{{name2}}}

{{{name3}}}

{{{name4}}}

{{{name5}}}

{{{name6}}}

Introduction

It is a driver board designed specifically for bus servos, integrating ESP32 and bus servo control circuits, and onboard RS485 and TTL bus servo interfaces. We have open-sourced the bus servo control demo, allowing users to connect via Wi-Fi and control the bus servos through a web interface, while also obtaining feedback from the servos (such as torque, speed, position, etc.).

Users can also redevelop it and use it as a lower computer for robot projects.


Specifications

  • Controller: ESP32-WROOM-32
  • Power supply port: XT60, 5.5×2.5 mm DC
  • Power supply: 9~25V (Input voltage must match the servo voltage)
  • Communication interface: UART, Type-C × 2
  • Wireless communication: 2.4G WiFi
  • Mounting hole diameter: 3 mm
  • Mounting hole spacing: 58×49 (mm)
  • PCB size: 65×57 (mm)


Features

  • Allows controlling up to 253 ST / RSBL series serial bus servos at the same time (sufficient power supply required)
  • 9~25V wide voltage input (the input voltage and the servo voltage must be matched)
  • Based on the ESP32-WROOM-32 module, supports wired and wireless communication
  • Provides multiple control demos for different host controllers
  • Supports controlling the serial bus servos directly via onboard USB Type-C port
  • Supports connecting to Raspberry Pi, powering the Pi via integrated 5V buck regulator circuit and communicating through GPIO UART interface, neat cable management


Open Source Project

You can download the related open-source robot models in the product documentation to build your own project.

Servo-Driver-with-ESP32-details-3.jpg

Product Usage

USB Mode

When the driver board is in USB mode, you can use the Python example provided to control the bus servo directly. We will describe the steps to run the Python example in this section.

Python Environment Deployment On Windows

First, go to Python official website to download the latest version of Python installation package. You can download it according to your operating system, I downloaded it here for Windows, the version is 3.11.5.
Python安装.png

After downloading, double-click the installation program python-3.11.5-amd64, click "Customize installation" to enter the "Optional Features" optional feature interface. Keep "Next" checked in the interface to enter the "Advanced Options" interface. Be sure to keep "Add Python to environment variables" checked, and click "Browse" to modify the installation address. Here is the default installation address. Click "Install" to install after setting, and then just wait for the installation to be completed.
Python安装1.png

Once installed, let's move on to the Python project compilation example.

ST Series Servo Python Demo

Download ST serial bus servo control library (Python) demo, unzip, and then input "cmd" in the start menu bar to open the Windows command prompt interface, type "cd folder path" to enter the STServo_Python project folder, where the virtual environment has been created, the name is stservo-env, and then enter:

stservo-env\Scripts\activate.bat

This command is to activate the virtual environment.
Python编译.png

In the STServo_Python project, you can see the "requirements.txt" file, which is used to store the list of installation packages that the project will use. After entering the virtual environment, input:

python <nowiki>-m<nowiki> pip install -r requirements.txt

Use this command to install the installation package used by the project. As you can see, the only installation package used here is "pyserial" and installed.
Python编译1.png

Connect the ST series servo to the bus servo interface on the driver board, and supply it with 9~12.6V power. In the Start menu bar, search for Device Manager to view the newly connected port number.
Python编译-4.png

Next, change the name of the device in the demo you want to run to the access port number, in my case COM11 (different computers have different access port numbers).
Python编译2.png

Once modified you can run it, here is an example of the ping.py file, enter:

python ping.py

You can see it runs successfully and the servo with ID 1 is connected successfully.
Python编译3.png

These is a simple tutorial for the Python demo.

ESP32 Mode

ESP32 Transparent Transmission Mode​

Click Servo transparent transmission mode ESP32 download tool link to download, unzip it after downloading, and double-click to open the "flash_download_tool_3.9.5.exe" program. After opening, two windows will pop up, we need to operate the UI interface of the download tool, and the other window will act as a terminal to show the working status of the download tool.

  • In the "DOWNLOAD TOOL MODE" interface, select ChipType as ESP32 and WorkMode as Factory. When calling the binary file using Factory, relative paths will be used, so there is no need for the user to manually input the binary file path, click OK after selection.

300px-STServo1.png

  • In this software interface, keep "LockSettings" checked, the right side indicating that programs can be uploaded to 8 boards simultaneously. Then use a USB cable to connect the servo driver board with the computer, click "COM", and select the new COM (the new COM here is COM3); BAUD is used to set the download speed, the higher the speed, the faster it is, ESP32 can use up to 921600.

1000px-STServo2.png

  • After selection, click START to start the upload process, after the upload is completed, "IDLE" will change to "FINISH".

STServo3.pngSTServo4.png

After flashing the above firmware, when the driver board is in the ESP32 mode, it can be controlled via the Raspberry Pi serial port. The driver board is alternately connected to the Raspberry Pi RX-TX and TX-RX, and a common ground connection is required.

ST Series Servo Raspberry Pi Demo

Download ST/SC serial bus servo control library (Linux) demo, unzip it, and then remotely upload it to the Raspberry Pi. Next enter "cd folder path" in the Raspberry Pi terminal to enter the SCServo_Linux project folder, then enter:

cmake .

The command is used to generate the Makefile.
600px-舵机1.png

Then enter:

make SCServo

This command generates the libSCServo.a static library file.
600px-舵机2.png

Then enter "cd folder path" to enter the directory of the WritePos demo file, and enter:

cmake .

The command is used to generate the Makefile.
600px-舵机3.png

Then enter according to the port of your device (here take the 40Pin port of Raspberry Pi 4B as an example):

sudo ./WritePos /dev/serial0

This command is used to drive the servo to rotate, and it is necessary to select the appropriate test example according to the servo model.
600px-舵机4.png


Support



Technical Support

If you need technical support or have any feedback/review, please click the Submit Now button to submit a ticket, Our support team will check and reply to you within 1 to 2 working days. Please be patient as we make every effort to help you to resolve the issue.
Working Time: 9 AM - 6 PM GMT+8 (Monday to Friday)