Asked — Edited

Pimoroni Pan And Tilt HAT For Rpi 3 B+

hi

i just purchased the pan tilt hat. i know it works because i tried the python examples.

But how can i get ARC to recognize it?

I do have the ez server installed on the rpi with a camera, it connects, i tried the camera control example and the video works. i added the vertical servo, tried to set it up as D0, D1 and D2. neither will control the pan and tilt hat. i believe the pan and tilt works of of i2C but i am not certain.

information on the pan and tilt hat can be found at http://pimoroni.com/pantilthat

please help, Thank you in advance.


Related Hardware Raspberry Pi

ARC Pro

Upgrade to ARC Pro

Get access to the latest features and updates before they're released. You'll have everything that's needed to unleash your robot's potential!

PRO
USA
#33  

It was a dumb mistake i commented the pi camera code please open the file EZBCameraServer.py and remove the comments from line 48 to 53

#34  

thanks i will try it later this evening. i need to run an errend

PRO
USA
#35  

I have updated the code (post #33)

please pull the changes:

cd ~/BlueberryServer/Blueberry.Server.Python/
git pull
#36  

i had broken the clip for the camera ribbon cable on the rpi. i went and purchased a rpi4 with 4 gig ram and an adafruit 16 channel pwm hat. i loaded all the software from scratch. i changed the main.py to reflect the adafruit pwm hat by un commenting the appropiate line, connected the servos to 0 and 1 but it did not work. servos did not move.

i then used the pimoroni pan and tilt, connected the servos and it WORKED! i made the changes you suggested for the pi camera and that worked as well. better response time on the camera.

a problem though- when selecting servo tracking in the camera control; the servos goes crazy, then stops working. also the servos will no longer work even if you un-select servo tracking, also stopping the blueberry servo and restarting it does not return the servos. i was forced to reboot the rpi4. keep in mind when i say the servos dont work is by using the vertical and horiz servo control.

upon reboot and starting the blueberry server, the camera and servos work.

what i am trying to do is add robot functionality with my rover which is powered by a px4 flight controller. i like to add ML and object recognition. i have a simple robotic arm i have not mounted yet. the rover is actually a losi five-t 1/5 scale RC with an electric motor.

do you know of any issues with the adafruit 16 channel hat?

thanks again.

PRO
USA
#37   — Edited

Quote:

do you know of any issues with the adafruit 16 channel hat?
The issue is not the HAT but the implementation.

I've used the HAT only for PWM ports so there was no support for servos, but I finished a servo implementation.

pull the project again and uncomment the following line #172:

setup_i2c_PCA9685ServoController(i2c_com)

bear in mind the hat is a PWM controller there are some calculations using the board oscillator clock 25Mhz plus the required servo frequency 50 Hz, and the 12 bits resolution, in some cases you will need to adjust the servo timings ex:

def setup_i2c_PCA9685ServoController(i2c_com):
    import PCA9685Controller
    com = PCA9685Controller.PCA9685ServoController(i2c_com, logging.DEBUG)
    ComponentRegistry.ComponentRegistry.register_controller(com)
    for port in range(16):
        ComponentRegistry.ComponentRegistry.register_component("S"+str(port), ServoController.ServoPort(com, port, 560, 2140))
    #bear in mind pwm ports frequency is 50 hz used for servos (frequency is per controller) 
    for port in range(16):
        ComponentRegistry.ComponentRegistry.register_component("P"+str(port), PWMController.PWMPort(com, port))
    com.start()

the values 560 and 2140 work well with other servo controllers but they need some adjustment when used with this HAT. Adafruit has some python calibration scripts to help you with the min and max values.