I wanted to stream video from the Dalek camera to whatever browser was looking at it. I asked t’Internet and it provided the answer. Mr Miguel Grinberg has provided a nice tutorial on the matter, which I’ll now rip the bits I need from.
Install what you need and link header file.
$ apt-get install libjpeg8-dev imagemagick libv4l-dev
$ ln -s /usr/include/linux/videodev2.h /usr/include/linux/videodev.h
As an ex-Unix admin who spent 10 years with a root prompt without anything going wrong, I fail to see the point of “sudo”. Just go to root and save the typing. You can be just as destructive either way.
Anyway, rant over.
Download, build and install MJPG-Streamer
$ wget http://sourceforge.net/code-snapshots/svn/m/mj/mjpg-streamer/code/mjpg-streamer-code-182.zip
$ cd mjpg-streamer-code-182/mjpg-streamer
$ make mjpg_streamer input_file.so output_http.so
$ sudo cp mjpg_streamer /usr/local/bin
$ sudo cp output_http.so input_file.so /usr/local/lib/
$ sudo cp -R www /usr/local/www
Thats it all done. To start it up, run the code snippet from rc.local below.
And to get the streaming running from boot time, you’ll need this is /etc/rc.local before the exit 0:
# start camera module for web server
/usr/bin/raspistill --nopreview -w 320 -h 240 -q 5 -o /tmp/stream/pic.jpg -tl 100 -t 9999999 -th 0:0:0 &
LD_LIBRARY_PATH=/usr/local/lib mjpg_streamer -i "input_file.so -f /tmp/stream -n pic.jpg" -o "output_http.so -w /usr/local/www" &
So far so good. You can view the video streaming from your camera by pointing your browser thusly:
You will have to put the ip address of your pi in there if you haven’t fettled your DNS/hosts file to refer to it.
Next comes some hardware work on the case to get all the bits bolted/glued into place.
I’ve decided on what interfaces the Pi-Dalek will mounted on the rear of the case.
- USB-B socket to accept power for charging the internal battery (a mobile phone emergency charger. Internally the socket offers a USB-A socket which is connected to the Pi with a short USB-A-to-microUSB-B cable, then the emergency charger, then another short USB-A-to-microUSB-B cable.
- USB-A socket for memory sticks etc. Connected to the UTG socket with a short UTG cable.
- HDMI socket. Connected to the miniHDMI socket on the Pi with a short adapter cable.
These will be mounted on the arse-end of the Dalek. Two on the 3rd row up of the Dalek-bumps on the rear panel (both USB ports), with the HDMI socket on one of the rear flank quarters (3rd row up).
Ideally I’d like them all on the back, but the bumps on row 1 are blocked by the motor housing, while rows 2 and 4 have far too many structual bits behind it.
This still leaves me with the issue of mounting the camera. While I’d love to have the camera mounted to the eyestalk, this is impractical. Mainly as the eyestalk is missing, but also because the camera module is a huge square blob that wouldn’t look right.
The best I can hope is to mount the camera on the Glacis, between the Whisk and Plunger, just above the top of the skirt. It will still mean that some cutting will have to be done, but it will probably not look as awful.
I’ve also decided that instead of mounting the Pi and Motozero directly to the base chassis, I’ll mount them upside down hanging from the internal ceiling at the top of the skirt. This shortens the distance to where I want the camera to be, and means only 6 wires need to be run down to the base (motor power +/-, motor left +/- and motor right +/-). Everything else will be skirt mounted. So the 40pin GPIO header connection twixt Pi and Motozero forms the split in the arrangement.
A sort of split between the head and body, if you want to make up some sort of analogy up.
I’m sure there’ll be some photos of it when its done.
At last I can paraphrase a Doctor Who serial title again.
This time I’m going to be using a Raspberry Pi-Zero W with MotoZero control board. Gone are the attempts at bashing by own circuitry (which are already in the Model Railway control system anyway), and this time IT WILL WORK!
So, the ingredients for *this* incarnation of the Dalek are:
For now I’ll forego the distance sensors, as I’ve already bashed them into a sort of thermin idea.
Anyway, the key stages for this project are:
- Getting the Pi and making it boot and connect to the Wifi network. – DONE
- Stripping the unwanted circuits from the Dalek chassis – DONE
- Deciding on the port that are to be fitted to the outside of the case – DONE
- Getting the Motozero and wiring it up, and getting simple control from the command line
- Designing the web interface optimized for the Tesco HUDL and getting that to work.
- Finding a camera, fitting it and getting that running.
To make things easier to track, the new Category Pi-Dalek has been created.