Welcome to 16-channel Servo Debugging Board repository
IIC control servo
1. Learning goals
In this course, we mainly learn to use Raspberry Pi and 16-channels servo debugging board to control the servo through IIC.
2. Preparation
Connect the SDA and SCL of the module to the GP20 and GP21 pins of the Raspberry Pi board. VCC and GND are connected to 3.3V and GND of Raspberry Pi board respectively. As shown below.
!Tip: Raspberry Pi needs to enable I2C service.
2.2 After the Raspberry Pi I2C is enabled, input command lmusb in the terminal to check whether the I2C is successfully started.
2.3 Download i2c-tools, the software can monitor the usage and faults of hardware devices.
Input command: sudo apt-get install i2c-tools
Input command: i2cdetect -y -a 1 in the terminal.
Check if there is an IIC device: 0x52 or 0x29
3. About code
Please refer to 16CServo-iic.py
IIC control servo function
Set the servo S1 angle to 0
4. Running code
Input following command in the terminal to run the program.
python 16CServo-iic.py
5. Phenomenon
After the program is run successfully. The servo will rotate 0°, after 2s it will rotate 180°.