Hi, As a novice with this equipment and no coding experience I thought I would give it a try. 3 months later and few few choice words I am no nearer programming this Pi 3B with pan tilt hat with NeoPixel Stick - 8 x 5050 RGBW LEDs – Cool White - ~6000K light recommended that fits the pan tilt unit. Can someone please give me a complete code/image that I can load onto my sd card pop in the Pi 3B and it works. I’m getting to the point of just to binning it. Is that feasible or just Pi in the sky?
The function reference is here.
http://docs.pimoroni.com/pantilthat/
It lists the python commands you need to use.
If you post the code your using maybe we can see any errors.
There are neopixel examples for the Pan Tilt here to try.
I have a couple of pan tilts setup for use in Motion Eye OS, no NeoPixels in use here though.
Thanks for the info, managed to get Raspi desktop loaded and carried out all updates and had it move on individual commands. I didn’t have a picture from the camera though or LED lights. I saw an old YouTube on this: https://www.youtube.com/watch?v=wj2CmN_dLQw&t=27s I downloaded his commands and the camera came on, no lights though and no servos. From the accompanied chat, nobody could get the servos working by using the arrow keys on the keyboard. I was hopeful to get it moving using the keyboard arrow buttons. Anyone know how and can I hut download the commands and get the lights and camera to work?
The code below is code I used to find presets for Motion Eye. As posted it will center the two servo’s and do a preview of what the camera is looking at. Changing the values in
pantilthat.pan(0)
and
pantilthat.tilt(0)
will change where the servo’s move too. It goes from -90 to +90.
That video you linked to is using PWM directly from the Pi’s GPIO pins to control the servos. Its not going to work with the Pan Tilt Hat.
My pan tilts are setup to work via Action Buttons in the Motion Eye OS web interface. My camera runs headless and I access it via a Web Browser. The Web GUI has all the controls to take pictures or record video. Manually or by detecting motion in front of the camera. I added left right up down movement buttons and some preset positions. You can also add buttons to turn the LED’s on and off.
from picamera import PiCamera
from time import sleep
import pantilthat
pantilthat.pan(0)
pantilthat.tilt(0)
camera = PiCamera()
camera.rotation = 180
camera.resolution = (1280, 720)
camera.start_preview()
sleep(10)
camera.stop_preview()