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

Take control of your robot's destiny by subscribing to Synthiam ARC Pro, and watch it evolve into a versatile and responsive machine.

PRO
Canada
#1  

Hello @j98221,

Unfortunately, you are correct, the pan and tilt hat communicates via I2C (found the pinout here). If you are able to setup those pins as regular GPIO maybe it could work with ARC. Otherwise, you may have to write an EZ-Script with I2C commands to make it work. Writing your own I2C commands is tricky business, but not impossible.

#2  

can i execute a python script from EZ-Script?

PRO
Canada
#3  

It's theoretically possible. If you have a python script running on the Pi and it's waiting for a signal from ARC (like a high signal on GPIO7 for example) you could likely make it work. I don't have a code example for you but others here in the Synthiam community might be able to help.

#4  

i will look into executing a python script with parameters from ez-script. if anyone can help i would very much appreciate it.

PRO
USA
#5  

@J98221,

I have a python solution compatible with ARC, I'll post more details later.

What model of Raspberry PI and Linux distro do you have ?

#6  

i have model 3 b+ running the latest distro which is buster.

thanks

PRO
USA
#7  

@j98221: clone the repository on your raspberry pi home folder:

cd ~/
git clone https://github.com/ppedro74/BlueberryServer.git

edit the file to match your hat controller:

vi ~/BlueberryServer/Blueberry.Server.Python/Main.py

uncomment the line 158 (setup_i2c_PimoroniPanTiltHatServoController):

###Pimoroni Pan-Tilt HAT  https://shop.pimoroni.com/products/pan-tilt-hat
###Used to map servo ports D0..D1
setup_i2c_PimoroniPanTiltHatServoController(i2c_com)

start the server (EZB and Camera Server):

cd ~/BlueberryServer/Blueberry.Server.Python/
python3 Main.py

Then use the ARC connect to the Server (you can use the Antenna to discover  the address and port) add two servo controls D0 and D1 and test the movements.

PS: Due to limited time the instructions are minimal. I'll provide more details later.

#8  

after editing line 158 and saving the file, started EZB, then i started another terminal session and started cd ~/BlueberryServer/Blueberry.Server.Python/ python3 Main.py. i received the following error;

pi@saripi:~ $ cd ~/BlueberryServer/Blueberry.Server.Python/ pi@saripi:~/BlueberryServer/Blueberry.Server.Python $ sudo python3 Main.py & [1] 1314 pi@saripi:~/BlueberryServer/Blueberry.Server.Python $ 1319-root-INFO-Starting... platform=linux hostname=saripi Traceback (most recent call last): File "Main.py", line 178, in main() File "Main.py", line 139, in main setup_PyAudioPlayerController() File "Main.py", line 129, in setup_PyAudioPlayerController import PyAudioPlayerController File "/home/pi/BlueberryServer/Blueberry.Server.Python/PyAudioPlayerController.py", line 7, in import pyaudio ModuleNotFoundError: No module named 'pyaudio'