Welcome to 16-channel Servo Debugging Board repository
IIC control servo
IIC control servo
1. Learning goals
In this course, we mainly learn to use Jetson NANO and 16-channel servo debugging board to control the servo through IIC.
2. Preparation
Connect the SDA and SCL of the module to the SDA and SCL pins of the Jetson NANO board. VCC and GND are connected to 3.3V and GND of Jetson NANO respectively. As shown below.
2.2 You need to open the IIC service of jetson NANO board.
2.3 Install I2Ctool
Input following command in command terminal,
sudo apt-get update
sudo apt-get install -y i2c-tools
Wait patiently for the successful installation to complete.
2.4 Check whether the installation is successfully
Input following command in command terminal,
apt-cache policy i2c-tools
If system output is as follows, the installation is successful.
i2c-tools:
Installed: 4.0-2
Candidate: 4.0-2
Version list:
*** 4.0-2 500
500 http://ports.ubuntu.com/ubuntu-ports bionic/universe arm64 Packages
100 /var/lib/dpkg/status
2.5 Scan all i2c devices on a certain bus, and print out the device i2c bus address.
sudo i2cdetect -y -r -a 1
2.6 Install smbus
Input following command in command terminal,
sudo apt-get update
sudo apt-get install -y python3-smbus
3. Module protocol
4. Code
About code, please view 16CServo-iic.py file.
4.1 Define the device address of the module
4.2 Initialize IIC communication
4.3 Set the angle of the servo S1 to 0
5. Running code
Input following command in command terminal of jetson nano.
python3 16CServo-iic.py
6. Experimental phenomena
After the program is run successfully. The servo will rotate 0°, after 2s it will rotate 180°.