Remember back in the good old day, when tobacco was sold in 12.5g, 25g and 50g pouches, and cigarettes by the 10 or twenty?
Back in those great times, feckless dipshits with no will-power could happily buy a 12.5g pouch ar a 10 pack for the day, and if they ran out the chances are they were too idle to go out to the shops for more.
Then, on May 20th 2016, the dark times began. In the defiance of all logic, tobacco became restricted to 30g and 50g pouches, and fags to 20 packets. And all the branding was removed, meaning that the poor buggers working in shops couldn’t easily find the correct products – but thats another issue.
The “plan” behind this was to help cut down smoking, by what appeared to be attempting to price poor smokers out of the market. And as, statistically, more poor people smoke that rich people, it was destined to his the less affluent harder.
There was also supposed to be a knock-on effect with fewer smoking related diseases causeing less of a drain on the NHS (at a time when the same goverment were starting to strip the NHS base.
So now the weak-willed numpties are buying a minimum of 30g tobacco or 20 ciggies a day. And do you think that the remained will go unsmoked and held over? No of course it fucking won’t. Nicotine addicts, like any other addicts, will use what they have available.
Some from about a fiver a day to over a tenner a day. Can you work out how much TAX on tobacco that comes to?
And the extra smoking causes and increase in diseases. Double Whammy!
So… controlling the Dalek over the web.
I decided that the target device was to be a Tesco HUDL2, so the layout was to fit on that size screen without scrolling.
It decided it would need a virtual key pad, enough to give basic control and some spare buttons, and that I would need a feed from the camera.
So, a little bit of design fettling, image searching and pissing about, I came up with this control panel (caution: may include Dalek POV of beardy halfwit):
Obviously its not perfect (the wonky looking buttons are a design choice to reflect the general wonkiness of the whole thing though) and spaces have been left for other bits, but it will do for now.
I’ll put up the code behind it once i’m finished and happy with it (which might me another year or three). Ask me for it and I might send it you though…
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.