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


Hi FolkZ,

can anyone help me building an Pan-Tilt Webinterface for Pimoroni Pan-Tilt HAT FULL KIT with Webcam Server for the Pi-Camera Module 2.1.

I’m not so good at programming, and will donate for this Project.


Pan and Tilt hat, enable pan and tilt controls with RPi-Cam-Web page
Web interface for pan-tilt HAT
How would I go about controlling pan tilt hat and pi camera over LAN?
Pan-Tilt HAT software

I was working on an example of this but @waveform has done better with a port of Pi Streaming that’s compatible with Pan Tilt HAT: https://github.com/waveform80/pistreaming/tree/pantilthat


mmmh, i can’t start the Webserver.


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

================================ RESTART ================================

Traceback (most recent call last):
File “/home/pi/pistreaming/server.py”, line 12, in
from http.server import HTTPServer, BaseHTTPRequestHandler
ImportError: No module named http.server

I have startet the script like usage but the console will not start???


Run the Python server script which should print out a load of stuff to the console as it starts up:


http.server only exists in Python 3. You’ll need to sudo apt-get install python3 and run it with python3.


okay, thanks i’m testing it


I can only apologise for the web interface - the pantilthat branch is literally a 15 minute hack on top of the main pistreaming project. But it’s a reasonable foundation to build upon given it works with all browsers I’ve tried (including firefox and chrome on android) and uses an honest-to-goodness video format (okay, MPEG1, but that’s still preferable to streaming everything full-frame like all the MJPEG stuff out there).

Still … the web interface needs some work! Feel free to open PRs against the project - I’m happy to incorporate suggestions even on non-master branches like pantilthat (I can’t really merge pantilthat into master given that most people who use the project won’t have one, but I’m happy to keep it around indefinitely).


@waveform, I’m trying to get this working on a fresh install of jessie but get the following error when loading up the web server…

Any ideas?

Pic here


Just an observation that might help someone at some point; make sure you clone the pantilthat branch and not the master!

A ‘friend’ spent a while working out why the pan-tilt controls weren’t visible, then realised they had cloned the master branch!

Thanks to @waveform for the web interface, great to have a working example to build on.




clone the pantilthat branch and not the master, how am I to understand that?

Could someone give a more detailed guide with the complete Pythonj code?

I get the webinterface not reasonable to run.



git status will tell you what branch you are on. If not on the pantilthat branch you can switch to it with git checkout pantilthat (as long as you didn’t make a shallow copy of the master branch only i.e you followed instructions in the repo).

… there’s quite a lot of info in Dave’s repo, and the code is entirely available there, but I’m sure if there’s anything that is unclear you could ask here and get an helpful answer.


Have any User here an full working webinterface with mpeg Streaming for the PIMORONI Pan-Tilt Kit for Raspian Jessie (Pixel)?

Sorry, I can not get any further.

Greetz from Germany



@boxgr0ve Interesting. Looks like Safari (at least, I’m assuming that’s Safari, given it looks Mac-ish) uses some websockets header that ws4py doesn’t know about. I’ll see if I can figure out what’s going on, but I can’t promise much (I don’t have any Mac stuff to play with). Try using Chrome / Firefox instead in the meantime.

@Joey73 As @RogueM mentioned you need the pantilthat branch. The following instructions should install everything, clone the repo, switch to that branch and run the server:

$ sudo apt-get install libav-tools git python3-picamera python3-ws4py python3-pantilthat
$ git clone https://github.com/waveform80/pistreaming.git
$ cd pistreaming
$ git checkout pantilthat
$ python3 server.py

Then once it’s fired up you simply visit http://your-pi-address:8082/ and you should see the (crude) interface. As for the complete code - it’s all in the repo - nothing hidden. If you’ve got any specific questions about the code, I’m happy to try and answer them.



Many thanks, you have helped me a lot.

The web server runs perfectly and the PAN TILT function is also great.

Many thanks again for your help, perfect job.

Greetings from Germany


Works great using chrome - cheers.


Does anyone have an idea how to access the pan-tilt control over the Internet? I would like to access the stream from outside.


Hi Joey, the stream access over the internet should be normal port forwarding stuff (as WAVEFORM mentioned, port 8082), I will have a try of control over the internet in the next couple of days and report back (I have VPN access too, so I can look at it in multiple ways (no pun intended))


Uuuuh, so I messed mine up! I was trying to add a password to the streaming page and edited something I waaaay shouldn’t have. So, is there a way to completely remove and reinstall it? Excellent work, by the way @waveform.
I can now spy on my doggies AND freak them out a little with the servos while at work! Thank you!


No prob, first I’d recommend checking out what you’ve actually changed to see if you can figure out what’s gone wrong:

cd pistreaming
git diff

This’ll show you what you’ve changed compared to the original clone (assuming you haven’t committed anything yourself). Use “q” to quit the diff-viewer. If you want to reset back to the original anyway use the following command in the same directory:

git reset --hard

This should undo all your changes so you can start again.


Hi waveform
I have a PanTiltHAT with NO Neopixels installed. Would you by any chance have a “pistreaming” version where the neopixel support is not included?
Thanks, fritz24


You should be able to use the pantilthat branch on a HAT with no neo-pixels out of the box. With nothing connected to the neopixel pins, the control signals will just go nowhere.

I haven’t got a branch that removes the controls from the web-page, but that’s not exactly hard to do: just chopping the relevant bits of HTML out of index.html would do the job (you can remove the handlers from server.py if you really want, but it won’t hurt to leave them in there).