#HELP# building an Pan-Tilt Webinterface for Pimoroni Pan-Tilt HAT FULL KIT with Webcam Server


#21

Ok, thanks for the info. Actually I’m busy doing exactly this right now. But if you’d have had a version w/o neopixel support I might have used that one. Thanks a lot anyway.


#22

Hi Dave
I do have another question though: For HTTP_PORT and WS_PORT could I use any other unassigned port numbers than 8082 and 8084 respectively or is there a requirement to use exactly these?
Thanks, Fritz


#23

No requirement other than the usual UNIX limitation that ports <1024 require root privileges to open. Other than that, use whatever you like.


#24

Great. Thanks a lot.


#25

Hi there. Thanks for the great info on this thread. Special thanks to @waveform for your work. I’ve managed to get it all up and running and it works perfectly on my local network. I’ve done the port forwarding stuff on my router but when I view it from an external computer I get the main page but not the video. It doesn’t get past the ‘loading…’ message. Any ideas?


#26

Hi Chris, you’ll need to forward both ports (HTTP and WS, i.e. 8082 and 8084 by default), and tweak the index.html so that the websocket address is external (it’s your internal IP by default). There’s a bit more info in this ticket on the pistreaming github which should point you at the right bit to modify.

Good luck!


#27

Result! Thanks Dave.


#28

I would like to integrate the pan-tilt hat + camera into home-assistant running on another pi.
I can add the video stream as a generic IP camera but to control the pan-tilt I could use a shell command or preferably MQTT. Before I reinvent the wheel I wonder if anyone has implemented this or similar?


#29

Quick update, am able to add the pan-tilt interface to the home-assistant front end as an ipanel. Works well from my wall tablet but would still be nice to add MQTT control


#30

Got basic control of the pan-tilt from Home-assistant, discussed on https://community.home-assistant.io/t/pan-tilt-zoom-pi-camera/24202/3


#31

Hi, tried this twice now and the camera works fine but don’t get the ‘Initializing HAT’ message when I run it and, sure enough, there are no pan or tilt controls. Help.


#32

All sorted. For some reason, the git clone didn’t work and the server.py file was different/corrupted from the original.

For anyone one else running this on Raspbian Stretch, you have to enable I2C through raspi-config as well.


#33

Whenever I try to run server.py I get an error that it can’t find the pantilthat. I have installed the software that’s required so, what am i doing wrong?

pi@raspberrypi:~/pistreaming $ python3 server.py
Traceback (most recent call last):
  File "server.py", line 17, in <module>
    import pantilthat as hat
ImportError: No module named 'pantilthat'

#34

Had to install the python3 library using

pip3 install pantilthat

and that got that error fixed. however, now I’m running into this:

Traceback (most recent call last):
  File "server.py", line 259, in <module>
    main()
  File "server.py", line 199, in main
    hat.servo_enable(1, False)
  File "/usr/local/lib/python3.5/dist-packages/pantilthat/pantilt.py", line 394, in servo_enable
    self.setup()
  File "/usr/local/lib/python3.5/dist-packages/pantilthat/pantilt.py", line 79, in setup
    self._set_config()
  File "/usr/local/lib/python3.5/dist-packages/pantilthat/pantilt.py", line 117, in _set_config
    self._i2c_write_byte(self.REG_CONFIG, config)
  File "/usr/local/lib/python3.5/dist-packages/pantilthat/pantilt.py", line 208, in _i2c_write_byte
    raise IOError("Failed to write byte")
OSError: Failed to write byte

Yes, I have I2C enabled.


#35

This is a new one- I wonder if you’re running a server with something like Reloader that’s causing multiple instances of the script to run simultaneously and clash horribly with each other.

If you isolate the setup script for Pan Tilt HAT into its own script without any web front-end, does it work?


#36

Yeah, on a fresh install of raspbian it works fine. Must be some latent program I was running before on that RPi.


#37

This is wonderful! Thanks! I am trying to access port forwarding via the Dataplicity remote access service. How would I configure the streaming and control functions to work with this platform?


#38

could someone please post a working Index.html with Pan Tilt Hat support (Pimoroni).

My old files for a Pan Tilt Pimoroni Web Interface no longer exist. I have now switched to a Pi 3+ and urgently needed a working Pan Tilt Web Interface for Pimoroni Pan Tilt Hat.

Thanks for your support


#39

Where do these error messages come from?

Initializing camera
Initializing websockets server on port 8084
Initializing HTTP server on port 8082
Initializing broadcast thread
Spawning background conversion process
Starting recording
Starting websockets thread
Starting HTTP server thread
Starting broadcast thread
192.168.178.31 - - [24/Sep/2018 18:51:42] “GET /index.html HTTP/1.1” 200 -
192.168.178.31 - - [24/Sep/2018 18:51:42] “GET /jsmpg.js HTTP/1.1” 200 -
192.168.178.31 - - [24/Sep/2018 18:51:42] code 404, message File not found
192.168.178.31 - - [24/Sep/2018 18:51:42] “GET /favicon.ico HTTP/1.1” 404 -