Difference between revisions of "Servo Driver HAT"
(Created page with " {{Infobox item |img=300px|link=https://www.waveshare.com/servo-driver-hat.htm|alt=Servo Driver HAT |platform=Servo |category=:Category:Modul...") |
|||
(3 intermediate revisions by 2 users not shown) | |||
Line 13: | Line 13: | ||
== Introduction == | == Introduction == | ||
Servo Driver HAT for Raspberry Pi, 16-Channel, 12-bit, I2C Interface | Servo Driver HAT for Raspberry Pi, 16-Channel, 12-bit, I2C Interface | ||
+ | ==How to use== | ||
+ | {{Servo Driver HAT Manual}} | ||
==Resources== | ==Resources== | ||
+ | *[https://www.waveshare.com/w/upload/1/1b/Servo_Driver_HAT_User_Manual_EN.pdf User Manual] | ||
*[https://www.waveshare.com/w/upload/a/a2/Servo_Driver_HAT_Schematic_.pdf Schematic] | *[https://www.waveshare.com/w/upload/a/a2/Servo_Driver_HAT_Schematic_.pdf Schematic] | ||
− | *[https://www.waveshare.com/w/upload/ | + | *[https://www.waveshare.com/w/upload/6/6c/Servo_Driver_HAT.7z Demo code] |
+ | ===Software=== | ||
+ | *[[:File:AlphaBot_Qt.7z|QT software for PC]] | ||
+ | *[[:File:AlphaBot_LITE.rar|App for Android]] | ||
+ | *[[:File:AlphaBot_LITE_Code.7z| App source code]] | ||
===Datasheet=== | ===Datasheet=== | ||
*[[:File:PCA96_datasheet.pdf|PCA96]] | *[[:File:PCA96_datasheet.pdf|PCA96]] |
Revision as of 08:28, 7 November 2020
| ||
Introduction
Servo Driver HAT for Raspberry Pi, 16-Channel, 12-bit, I2C Interface
How to use
Using with Raspberry Pi
To use this module, we provide python examples for test PCA9685, WiFi remote control and bluetooth remote control.
Enable I2C Interface
Open a terminal and run the following commands:
sudo raspi-config Choose Interfacing Options -> I2C -> Yes.
Reboot Raspberry Pi:
sudo reboot
Install libraries
sudo apt-get update sudo apt-get install python-pip sudo pip install RPi.GPIO sudo apt-get install python-smbus
Downalod the demo codes and unzip
You should start the Raspberry Pi, open a terminal and run the following commands:
sudo apt-get install p7zip-full wget https://www.waveshare.com/wiki/File:Servo_Driver_HAT.7z 7zr x Servo_Driver_HAT.7z -r -o./Servo_Driver_HAT sudo chmod 777 -R Servo_Driver_HAT cd Servo_Driver_HAT/Raspberry\ Pi/
Python Examples
Open a terminal and runt the following comamnds:
#For python2 cd ~/Servo_Driver_HAT/Raspberry\ Pi/ cd python/ sudo python PCA9685.py #For python3 cd ~/Servo_Driver_HAT/Raspberry\ Pi/ cd python3/ sudo python3 PCA9685.py
Expected result: Connect a servo to Channel 0, the servo will rotate.
WIFI Remote Control
Open a terminal and run the following commands:
cd Wifi-Control/ sudo python main.py
Please connect the Raspberry Pi and telephone to the same WLAN network. Data will be transmitted by TCP protocol. After running the program, the IP address will be displayed and the port number is 8000.
Open the APP and choose the WIFI control, input the IP address and the port then connect.
It enters the control page if connected successfully. You can click the button to control the four servos (Channel 0 to Channel 4).
You can also connect it with QT software on Windows PC.
Note: You can download the APP and the QT software from the Resources part.
Bluetooth Remote Program
Execute:
sudo apt-get update sudo apt-get upgrade -y sudo apt-get dist-upgrade -y sudo apt-get install pi-bluetooth bluez bluez-firmware blueman sudo usermod -G bluetooth -a pi sudo vi /etc/systemd/system/dbus-org.bluez.service sudo reboot
Start/add SPP, and turn on the Bluetooth device.
sudo vi /etc/systemd/system/dbus-org.bluez.service
After restarting the Raspberry Pi, enter the hciconfig command (similar to the ifconfig command) to check the Bluetooth service.
If you see the hci0 device, the Bluetooth has been turned on. If not then no Bluetooth device is recognized.
Run the following command to start the program.
cd Servo_Driver_HAT/python/Bluetooth-Control sudo ./Bluetooth.sh
After the program runs, you will be prompted to wait for the Bluetooth connection, choose the Bluetooth remote control on the mobile app, click scan, discovers the Raspberry Pi device, and connects.
After connecting the program, enter the control interface, and click the button to remotely control the forward and reverse rotation of the servos of channels 0~4.
Note: If the received command is incorrect, you may need to configure the command sent when the corresponding button is pressed and released in the APP.
Note: The default discovery time of Raspberry Pi is only 180s. If you want to always discover and pair, you can configure it by modifying the following files.
sudo vi /etc/bluetooth/main.conf
Find the following two statements and uncomment them.
The program is compatible with python3, just replace python with python3 when running.
For more information on Raspberry Pi wifi and Bluetooth remote control, please refer to AlphaBot2:
http://www.waveshare.com/wiki/AlphaBot2
https://www.waveshare.com/wiki/AlphaBot2
Resources
Software
Datasheet
Support
If you require technical support, please go to the Support page and open a ticket.