Giter Club home page Giter Club logo

pantilt-hat's Introduction

Pan-Tilt HAT

https://shop.pimoroni.com/products/pan-tilt-hat

Pan-Tilt HAT is a two-channel servo driver designed to control a tiny servo-powered Pan/Tilt assembly. It also controls either PWM-dimmed lights or WS2812 pixels; up to 24 RGB or 18 RGBW.

Installing

Full install (recommended):

We've created an easy installation script that will install all pre-requisites and get your Pan-Tilt HAT up and running with minimal efforts. To run it, fire up Terminal which you'll find in Menu -> Accessories -> Terminal on your Raspberry Pi desktop, as illustrated below:

Finding the terminal

In the new terminal window type the command exactly as it appears below (check for typos) and follow the on-screen instructions:

curl https://get.pimoroni.com/pantilthat | bash

Manual install:

Enable i2c:

sudo raspi-config nonint do_i2c 0

Install the library:

python3 -m pip install pantilthat

ℹī¸ Depending on your system, you might need to use sudo for the above command.

Development:

If you want to contribute, or like living on the edge of your seat by having the latest code, you should clone this repository, cd to the library directory, and run:

sudo python3 setup.py install

(or sudo python setup.py install whichever your primary Python environment may be)

In all cases you will have to enable the i2c bus.

Breakout Header Pinout

The breakout header on Pan Tilt HAT is connected directly to the GPIO pins.

Below is a map of the breakout functions and corresponding BCM pins:

SDA SCL TX RX PWM MOSI MISO SCLK CEO
2 3 14 15 18 10 9 11 8

Documentation & Support

pantilt-hat's People

Contributors

gadgetoid avatar rogerhardiman avatar roguem avatar waveform80 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pantilt-hat's Issues

RGB WS2812 LEDs do not work

A strip of 8 'standard' WS2812b RGB LEDs used as a light on a pan tilt hat just flickers random colours on the first 5 or 6 LEDs.
I don't have any RGBW LEDs to use as a comparison test.
This has been reported in the pimoroni forums by other users, but I don't think it has been resolved.

Tilt range seems incorrect

The tilt angle seems to work best in the range [0, 120] for the recommended hardware.
This library defaults to [-90, 90], which may not be ideal.

Pan angles are fine as is.

HAT power supply

Hey, I was wondering how I could control the power supply provided on the pan/tilt HAT. I want to control a laser, but the GPIO pinout is taken by the HAT. I noticed there are places to hook my laser up to the HAT, but it gives a steady supply of power, instead of being able to tweak when it comes on and off with code.

Documentation and edge pins

Hi
On the top of the Pan-Tilt HAT are some breakouts for
Power, SPI, I2C, UART, PWM and SPI.

The documentation (on GitHub) does not mention any of these pins.
The only one I wanted to check was the PWM pin.
Does that bring the "Data" line from the "LIGHT" connector to the the edge of the board or is that the unused 4th PWM Output from the PIC?

Thanks

module isnt working even afterinstall is complete

`Python 2.7.9 (default, Sep 17 2016, 20:26:04)
[GCC 4.9.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.

import pantilthat
Traceback (most recent call last):
File "", line 1, in
File "/usr/local/lib/python2.7/dist-packages/pantilthat/init.py", line 15, in
pantilthat = PanTilt(i2c_bus=SMBus(1))
File "/usr/local/lib/python2.7/dist-packages/pantilthat/pantilt.py", line 63, in init
self._set_config()
File "/usr/local/lib/python2.7/dist-packages/pantilthat/pantilt.py", line 100, in _set_config
self._i2c_write_byte(self.REG_CONFIG, config)
File "/usr/local/lib/python2.7/dist-packages/pantilthat/pantilt.py", line 191, in _i2c_write_byte
raise IOError("Failed to write byte")
IOError: Failed to write byte
import pantilt-hat
File "", line 1
import pantilt-hat
^
SyntaxError: invalid syntax
`

Those are the erros the i am facing if anybody could please help

pantilthat not available for python2

pantilthat refuses to show up in my available modules for python2.
I have run sudo apt-get install python-pantilthat and I am able to verify that pantilthat is installed for python3, but no matter what I try I am unable to get it to install for python2

pan() and tilt() with no delay between leaves servos stuck

I've found that if I call pan() and tilt() right after each other, with no delay in between, both servos seem to get stuck.

import pantilthat
import time

dir = 1
while True:
  try:
    pantilthat.pan(dir*90)
# Without this sleep, the servos get stuck most of the time
#    time.sleep(0.1)
    pantilthat.tilt(dir*45)
    dir *= -1
    time.sleep(2)
  except KeyboardInterrupt:
    break

py3.5 install error

On attempting to install in a python 3.5 environment (Stretch desktop on pi3) I receive the following error, any ideas?

  File "/home/pi/.homeassistant/deps/lib/python3.5/site-packages/pantilthat/pantilt.py", line 415, in get_servo_one
    return self._servo_us_to_degrees(us, us_min, us_max)
  File "/home/pi/.homeassistant/deps/lib/python3.5/site-packages/pantilthat/pantilt.py", line 131, in _servo_us_to_degrees
    self._check_range(us, us_min, us_max)
  File "/home/pi/.homeassistant/deps/lib/python3.5/site-packages/pantilthat/pantilt.py", line 120, in _check_range
    max=value_max))
ValueError: Value 51200 should be between 575 and 2325

python3-smbus required

on raspbian, all updated/upgraded.
library works fine with hat in python2
when I try to import in python3 it kicks out with needing python3-smbus and that i should install it.
reinstalled both python3-pantilthat & python3-smbus using apt-get --reinstall ... no joy.

thoughts? i may try the pip3 install for kicks?

Looking to make this work with pca9865 module

Hey I've been looking all over to get face tracking servos on pca9865 16 servo driver but can't seem to find any projects that work is there any way that I can modify this one or can anyone help me??

apt-get install pimoroni does not work

The README for this project suggests installing a Pimoroni dashboard with:

apt-get install pimoroni

but that package isn't in the Raspberry Pi OS repository. Presumably it is necessary to add another repository to the apt configuration.

pantilthat 0.0.7 in pip fails.

Hi.

I've tried to install pantilthat 0.0.7 from pip inside a virtual env. It installs but you cannot use it since it gives you an error at import.

The problem is that your library uses smbus, but there is no smbus for pip, so it wont work in virtual envs.

The solution is to replace the use of smbus for smbus2 in your library (all references)

Maybe you can use this library instead since its more common everyday to use virtual envs with pip.

Upgrade from rPi3 to rPi4 no more movement

Hi,
I used my pan tilt HAT with great succes on my Raspberry Pi 3B+ bur now I moved to a Pi 4 and somehow the pan tilt HAT won't respond anymore. When I plu in the power to the Pi, the servos do move some bit. I installed the pan tilt software. When I want to test an example I get the following error:

python timeout.py
Traceback (most recent call last):
File "timeout.py", line 10, in
pantilthat.pan(-90)
File "/usr/lib/python3/dist-packages/pantilthat/pantilt.py", line 466, in servo_one
self.setup()
File "/usr/lib/python3/dist-packages/pantilthat/pantilt.py", line 80, in setup
self._set_config()
File "/usr/lib/python3/dist-packages/pantilthat/pantilt.py", line 118, in _set_config
self._i2c_write_byte(self.REG_CONFIG, config)
File "/usr/lib/python3/dist-packages/pantilthat/pantilt.py", line 209, in _i2c_write_byte
raise IOError("Failed to write byte")
OSError: Failed to write byte

What goes wrong here?

raise IOError("Failed to read byte")

I have the Pimoroni pantilt hat attached to a raspberry pi 4 8gb with the neopixel stick. In the program I am working on, I use Tensorflow and Opencv to track objects. The program works, but within minutes of starting I get the error:

OSError: failed to write byte

Earlier in the message that is spit out when the program crashes, it says "failure to read byte." I believe it has something to do with i2c, even though I am not using i2c in my code or set up. I can provide more information, I'm just not sure what more is relevant.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤ī¸ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.