Do it.
Preparation list
Yahboom Jetbot mini AI Robot Car *1
2DOF camera PTZ package *1
Steps
1) Assemble the servo PTZ, initialize the servo to 90° before installation.
2) Fix the assembled servo PTZ on the chassis of the trolley by screwing the copper column.
3)Fix the Jetson NANO camera on the PTZ. (only one screw is needed, looks a bit odd, but barely usable.
Programming
Here, I am using SDG90 servo, which needs to be controlled by PWM.
Since the pins of Jetson NANO cannot directly generate PWM, the stm8 MCU is integrated on the Jetbot-mini expansion board as a co-processor to output PWM and then control the servo.
Send data to IIC according to the communication protocol. The parameters in the write_i2c_block_data function are (coprocessor address, servo register address, [steering gear number, servo angle]), of which the coprocessor address and servo register address are fixed value.
Number 1 corresponds to the servo connected to the S1 port on the expansion board.
Number 2 corresponds to the servo connected to the S2 port on the expansion board.
Servo angle is set between 0-180.
Next, we can start to use the write_i2c_block_data function to control the rotation of the servo PTZ on Jupyter lab.