【Customer sharing】-- Add 2DOF camera PTZ on Jetbot 2GB AI Robot Car.

* This Blog from Muquan Zhu.

Hello everyone. This is Muquan Zhu, i like programming robot. 

Last month I purchased YahbomJetbot-mini Robot.
After a month of being fully familiar with all the features of this car, I feel like doing some upgrades. Today i will share my projects.

Background

The original Jetbotmini car camera angle can only be adjusted manually, which limits the using ofr users. The expansion board provides two servo ports, which can be effectively used. Make the camera PTZ that can be programmed.

Preparation list

Yaboom Jetbot 2GB 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 jetbotmini 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.

Effect video

(Please ignore my messy lab table,hahaha...)

 

 Code

import smbus

import time

bus = smbus.SMBus(1)

Servo_ADD = 0x1B

bus.write_i2c_block_data(Servo_ADD,3,[1,90])

time.sleep(0.1)

bus.write_i2c_block_data(Servo_ADD,3,[2,90])

time.sleep(1)

bus.write_i2c_block_data(Servo_ADD,3,[1,90])

time.sleep(0.1)

bus.write_i2c_block_data(Servo_ADD,3,[2,115])

 

Diy works

Leave a comment