Skip navigation
2014

 

Introduction

 

I recently submitted an idea for the Ultimate Raspberry Pi Bundle Roadtest. Unfortunately, I wasn't selected, but I will still execute my project and describe it here.


The project I plan to work on takes the Santa Catcher from previous Roadtest a few steps further.


I would like to create a home security and automation system capable of the following:

 

  • the system should simulate someone’s presence even though no-one’s at home (when leaving on holidays for example)
  • the system should detect unwanted visitors
  • it should be possible to (de)activate the security system (remotely)
  • it should scare away intruders and immediately notify the owner of the house

 

Following paragraphs cover the different aspects of the project in more detail.

 

(De)activation

 

In the Santa catcher, I used the PiFace CAD purely as an IR receiver and display for the (de)activation of the system. For this project, I would like to use the actual control feature of the PiFace CAD or those of the Adafruit RGB LCD and Keypad kit.

 

Via the LCD and buttons, I plan to provide menu navigation and the possibility to trigger certain actions such as (de)activating the security system, but also verify the state of the different sensors around the house (more on that in next paragraph), etc ...


photo 3.JPG

Adafruit RGB LCD and Keypad kit

 

 

Detection

 

It is important for a security system to monitor not just a single room, but also every possible point of entry.

 

The camera will play a big role in this, as it is possible to generate evidence by creating recordings of what is happening.

It should be able to work at night, so I'll be testing further with IR lighting, in order to improve the results of my initial tests.


photo (1).JPG photo (2).JPG

Pi NoIR, switch & PIR sensor

 

Unfortunately, this will only cover a single room.


That's why in addition to the camera, a number of wireless sensors placed at key locations around the house will be in charge of covering the rest of the house. The sensors would most likely be a mix or even combination of motion detectors and switches (to detect open doors/windows) coupled to an RF transmitter. When the sensors are triggered, they should report the changed state to the central unit: the Raspberry Pi.

 

The pi would have to listen for such events and trigger appropriate actions.

 

 

Alarming and notification

 

In the unlikely case an intruder is present (and detected !), an alarm should be sounded to scare the intruder away and the owner should be warned immediately.

 

The PiFace Digital’s relay would be used as a switch for a high power siren, making it impossible for the intruder to stay in the house, forcing him to flee.


photo 1.JPG

PiFace Digital

 

For the notification part and the fact it should be immediate, I’m thinking of a cellular shield type of solution capable of sending text messages or even calling. This should attract the attention immediately, compared to emails, tweets or other notifications that would require the owner of the house to be connected to the internet at all times.


photo 2.JPG

Arduino GSM Shield

 

 

Simulation

 

Potential intruders might be driving around the neighbourhood looking for houses without activity. In order to be a less likely target, the security system could simulate the presence of people in the house.

 

The presence would be simulated by different things:

  • turning lights on and off
  • occasional background sounds

 

For the lights, I was thinking of controlling them wirelessly from the pi by means of wireless 433MHz on/off switches. This could be time based, but with some randomness in order to avoid clear patterns, or it could be based on a light sensor turning lights on when it’s getting dark.


IMG_0868.JPG

Elro Wireless Power Socket RF433

 

For the occasional background sounds, playing some internet radio during the day will do just fine.

 

 

Testing

 

Security systems need to be very reliable, otherwise, what good are they ?  This means the system will need to be tested thoroughly.

To do that, I would like to involve my daughter once again. We had a lot of fun with the previous Roadtest and I’m sure we will again.

 

We’ll turn this project into a game where she has to play intruder and try to enter our house without being caught.


I prepared her outfit and some tools for the job ... she was very excited!

photo 3 (1).JPG

Burglar for hire


Ok ... perhaps we'll forget about the tools before she starts getting certain ideas ...


 


Stay tuned for part 2 in which I'll start building/coding on this project!



mcb1

Catch Santa Challenge

Posted by mcb1 Top Member Jan 29, 2014

I was fortunate to be selected to receive

The Bundle & the Challenge

pinoirrpi.png

For the purposes of this "RoadTest Plus", we have bundled the Pi NoIR camera with these other products:

  • Raspberry Pi 8 GB Bundle with NOOBS
  • Wi-Pi Wifi Networking Module
  • PiFace Control & Display
  • Carbon Fibre Enclosures for both the camera and PiFace Control & Display.

 

Due to foreseen problems the products didn't ship until Dec 27th, so some action was required.

 

You can read about it here

http://www.element14.com/community/roadTestReviews/1677

 

 

While this was coming, I was asked to do something using the RPi and NoIR camera for security to include in The Shed magazine

It provides a perfect solution to those expensive and very obvious security cameras.

 

I chose to use an outside floodlight and modified an outdoor movement sensor to run off 12v, as the trigger device.

DSC_3265 (Medium).JPG

These were mounted on a board for testing, but can be fitted seperately, along with lamps that never come on...

 

The text of the article has been generously provided by the publisher and is attached.

(and yes it uses the normal camera image rather than the black NOir camera, its called poetic licence)

 

The conclusion was the Piface CAD is a very useful addition to any RPi, and the NoIR camera allows images to be captured without a human being aware he can be seen.

As the article says, I (and others) had problems with the WiPi , but hopefully its now setup, although its not happy if it can't find the network and tends to go to sleep.

 

There is some fine tuning to be done on the IR light source to improve its output, and I can see some other uses for this, so this may not be the only entry.

Mark

Using the Raspberry Pi with PiCam camera as Slow Scan Television (SSTV) camera.

Updates on this project can be found here: Agri Vision - Raspberry Pi SSTV Camera

 

Introduction

In this project the Raspberry Pi with the PiCam is used as a wireless camera which can transmit images over long distances, usually tenths of kilometers. Images will be transmitted by amateur radio (ham-radio) using slow scan television (SSTV) on the 2 meter band (144.5 MHz). Since the Pi can generate the HF FM signal itself, no additional electronics are needed for low power transmissions. For a little bit more power a one or two transistor amplifier will be suitable. Furthermore a low pass filter is recommended to filter out higher harmonics of the signal. This project also contains a python script which detects movement. Using this script the Raspberry Pi can be used as a wireless security cam at distances far outside the range of normal WiFi networks. Be aware that you need a ham-radio license to use this application!

iPhoto-3.jpg

Originally this blog was part of  the Raspberry Pi Santa Catcher with Pi NoIR and PiFace CAD road test (http://www.element14.com/community/roadTests/1220).

I already did a review, mainly on the spectral and spatial resolution aspects of the camera (http://www.element14.com/community/roadTestReviews/1660).

Latest info on the project: Agri Vision - Raspberry Pi SSTV Camera

 

Capturing the image

First thing to do is capturing the image we want to transmit. This can easily be done with raspistill:

raspistill -t 1 --width 320 --height 256 -e png -o /tmp/image.png
























For sstv we need a smallmimage, of 320 x 256, it is saved into the /tmp directory as png.

 

Converting the image to a SSTV sound file

Next we need to convert the image to a sound file which can be transmitted over the air. There are several SSTV implementations available for the Raspberry Pi.

 

PySSTV

First I had a look at PySSTV, a Python implementation which can be installed using pip:

pi@rpicamera ~/sstv $ sudo apt-get install python-setuptools
pi@rpicamera ~/sstv $ sudo apt-get install python-imaging
pi@rpicamera ~/sstv $ sudo easy_install pip
pi@rpicamera ~/sstv $ sudo pip install setuptools --no-use-wheel --upgrade
pi@rpicamera ~/sstv $ sudo pip install PySSTV























This works, but it is very slooooooooooooow, it takes many minutes to convert a single image. So I continued to search for another option.

 

C implementation

Next I found a plain C implementation here: https://sites.google.com/site/ki4mcw/Home/sstv-via-uc. Unfortunately there were some errors in the preamble tones, but those were easy to fix. I also made it a little bit more flexible so that you can set the audio sample rate from the commandline line. Source of my implementation can be found on GitHub.

To compile the source code:

pi@rpicamera ~/sstv $ sudo apt-get install libgd2-xpm-dev
pi@rpicamera ~/sstv $ sudo apt-get install libmagic-dev
pi@rpicamera ~/sstv $ gcc -lm -lgd -lmagic -o pisstv pisstv.c





















 

To run the program:

pi@rpicamera ~/pisstv $ ./pisstv /tmp/image.png 22050
Constants check:
      rate = 22050
      BITS = 16
    VOLPCT = 20
     scale = 6553
   us/samp = 45.351474
   2p/rate = 0.000285


  Checking filetype for file [/tmp/image.png]
  File is a PNG image.
Input  file is [/tmp/image.png].
Output file is [/tmp/image.png.wav].
FILE ptrs opened.
Image ptr opened.
Adding VIS header to audio data.
Done adding VIS header to audio data.
Adding image to audio data.
Done adding image to audio data.
Adding VIS trailer to audio data.
Done adding VIS trailer to audio data.
Writing audio data to file.
Got a total of [2589556] samples.
Done writing to audio file.
Created soundfile in 4 seconds.




















As you can see the SSTV sound file is created in just 4 seconds. So far so good, next step, how to transmit the audio over the air.

 

Transmitting the sound file with PiFm

You can add a radio transmitter, like a portable radio transceiver, but its much more fun to let the Pi itself generate the high frequency signal. Thanks to Oliver Mattos and Oskar Weigl this is possible. You can find their code here: Turning the Raspberry Pi Into an FM Transmitter - Imperial College Robotics Society Wiki.

Their code has evolved considerably. The first version was very simple, but used all cpu cycles, and the signal was hampered by glitches when other processes were active.

The last version uses dma and works pretty good, without eating up all cpu cycles. Nevertheless the code is much more complex now.

Oliver and Oskar did a very good job, but out of the box the software is not suitable for ham-radio and SSTV. There are mainly two problems. First the bandwidth is to high and secondly the timing which is very important for SSTV was a little bit off.

 

Reducing the bandwidth

Reducing the bandwidth appeared to be very simple. As every ham knows, for frequency modulation the bandwidth can be set with the modulation index, which is equal to the volume of the audio signal which modulates the hf carrier. In the source code it is just one value it can be found in the consume function of the Outputter class.

 

Here is the original code:

void consume(float* data, int num) {
        for (int i=0; i<num; i++) {
            float value = data[i]*8;  // modulation index (AKA volume!)

















 

I made a command line parameter of this value, the new code looks like:

void consume(float* data, int num) {
        for (int i=0; i<num; i++) {
            float value = data[i]*modulation_index;  // modulation index (AKA volume!) (original 8)

















Unfortunately this does not work very well, very strong sidebands persists, so this needs some focus in future versions of the software.

Gqrx_2_2_-_rtl_0-3.jpg

This figure shows a spectral plot of the full bandwidth FM signal.

Gqrx_2_2_-_rtl_0.jpg

This is the reduced bandwidth, tuning on the peak in the middle shows a nice and clean signal, but we need to get rid of the sidebands.

Gqrx_2_2_-_rtl_0-2.jpg

This is the reduced bandwidth signal of the first version of PiFm, nice bandwidth, but the signal is hampered by clicks due to cpu activity in other processes.

 

Fixing the timing

When the sample rate of audio transmitted by PiFm is slightly larger or smaller, a listener hardly notice any difference. For SSTV this is not the case, SSTV timing is very precise. A slightly off sample rate results in slanted images, as can be seen below on the left. The right image is the same sound file properly sampled.

MultiScan_3B__version_1_9_5__and_Downloads_—_pi_rpicamera____pisstv_—_ssh_—_134×30-2.jpgMultiScan_3B__version_1_9_5_-3.jpg

 

Fixing the timing appeared to be straight forward.

//        clocksPerSample = 22500.0 / rate * 1373.5;  // for timing, determined by experiment
        clocksPerSample = 22050.0 / rate * timing_correction;  // for timing, determined by experiment














 

As you can see I replaced the timing constant (1373.5) in the code with the variable 'timing_correction' which can be set from the command line.

I expect a different value for each individual Rpi. In my case the value is 1414.0. I'm just curious which is the proper value for you, please comment your value on this blog post.

For all other adaptions to the code, see the source file at GitHub.

 

Adding call-sign

When you start transmitting SSTV signals using your ham-radio license, you are required to transmit your call-sign in every transmission, so we need to add this information to the image. This can easily be done either from the command line using imagick, or from python using the python image library (PIL). Both are used in this project.

In sstvcam.sh mogrify which is part of imagick is used. sstvcam.sh is a simple shell script to just capture and transmit an image. In sstvcatch.py I used PIL.

 

Catching movement

Now we are able to grab an image and send it properly over the air using we now need to focus on triggering the image capture when something interesting happens in front of the camera. I have implemented this in python, using PIL. The code can be found in sstvcatch.py. It works quite straight forward, it just compares the pixels of the previous image with the current image. When the difference is to large, the current image is transmitted. Here is a code snippet:

# loop forever
while (True):
        # grab comparison image
        imgnew, bufnew = captureImage()

        # Count changed pixe
        changedPixels = 0
        for x in xrange(0, 320):
                for y in xrange(0, 256):
                        # Just check red channel as it's dominant for PiCam NoIR
                        pixdiff = abs(buf[x,y][0] - bufnew[x,y][0])
                        if pixdiff > threshold:
                                changedPixels += 1
               
        # Transmit an image if pixels changed
        if changedPixels > sensitivity:
                # Swap comparison buffers
                img = imgnew
                buf = bufnew
                transmitImage(img.copy())













 

The full code can be found on GitHub.

Of course this is rather simple, and I'm thinking of using opencv to do some fancy image processing, for instance to detect the hat of Sinterclaas, or the face of one of his servants. But that is future work which can't be done before the deadline of this challenge.

 

Video of the camera in action

 

 

 

GitHub

Sources can be found on github: https://github.com/AgriVision/pisstv.

 

Credits

Credits to KI4MCW (sstv), Oliver Mattos and Oskar Weigl (pifm).

When I got my Pi NoIR camera, I didn't have any IR LEDs to play with, so instead I used my TV's remote control for testing (Road Test review).

This was enough to demonstrate the functionality of the Pi NoIR, but it wasn't a permanent solution.

 

In the mean time, I managed to get my hands on a couple of IR LEDs.

 

The voltage drop across the IR LEDs I got is approx. 1,5V for a current rating of 60mA, meaning that with a 5V power supply I could put a resistor and 3 LEDs in series.

The resistor's value would have to be approx. 8 ohms (0,5V / 0,060A), but the closest resistor value I had lying around was 10 ohms.

 

I ended up with following circuit of two times three LEDs, in order to place three LEDs on each side of the camera board:

Screen Shot 2014-01-24 at 19.42.13.png

 

I downloaded a camera holder that I found on thingiverse (Raspberry Pi Camera Holder by gryphius - Thingiverse), modified it in Sketchup to be able to hold the LEDs and printed it.

photo 1.JPG photo 2.JPG photo 3.JPGphoto 4.JPG

 

The circuit was powered with a separate 5V supply for this test, but ideally I'd like to power this from the pi itself.

Perhaps someone knows if it's ok to use the 5V/GND pins on the GPIOs to do this ? I'll have to look into this ...

 

With the LEDs powered, and the Pi NoIR running, it was time to take pictures and videos in the dark.

 

These are the results (at night, with all lights turned off except for power switches, etc ...):

 

raspistill -o file.jpg


test.jpg test2.jpg

 

raspivid -o file.h264 -t 20000


 

 

The raspivid utility saves .h264 format files. Some programs need this in a .mp4 wrapper to use, which you can do in several ways. One is to use "MP4Box" which is in the 'gpac' package.

 

sudo apt-get update
sudo apt-get install gpac
MP4Box -add filename.h264 filename.mp4


(info from: http://elinux.org/Rpi_Camera_Module)

 

pi@raspberrypi ~ $ MP4Box -add testnoir2.h264 testnoir2.mp4

AVC-H264 import - frame size 1920 x 1080 at 25.000 FPS
AVC Import results: 594 samples - Slices: 10 I 584 P 0 B - 0 SEI - 10 IDR
Saving to testnoir2.mp4: 0.500 secs Interleaving


 

Using these IR LEDs, I was able to light the room up to 1.5 to 2m away with a limited field of vision.

 

Perhaps I should try some high power IR LEDs and compare the results, but that will be for next time

Project background

Element 14 has just shaken me out of winter hibernation by awarding me an Ultimate Pi bundle to help pursue my aim of using the Raspberry Pi as a low-cost 'nerve centre' from which I can automatically control my powerboat.

Complete automatic control would be a very tall order indeed, so I'll have to approach it in stages.  One obvious and apparently 'doable' first task is to link the Pi to a GPS receiver and servo motors controlling the helm position so that a course can be set and maintained automatically.  This is my first stage project objective.

I have two major incentives for making this my first priority:

(1)     There is almost nothing more miserable than standing at the helm for hours on end in the cold and rain of a British summer.  It can be a very pleasant occupation (see any glossy ever produced on the subject) but my experience suggests that at least 50% of the helmsman's time will be spent exposed to our least clement weather.

(2)     Of course, commercial suppliers are well aware of this and offer ready-made solutions.  These, however, are not 'mass market' products so prices are high and functionality is constrained by a number of commercial considerations which generally have very little to do with my requirements, the characteristics of my boat and the very limited depth of my pocket.

So, for the cost of a little effort in software writing, some minimal 'boning-up' on modern electronics and a little application of workshop practice (extending no further that wielding a soldering iron and spanner), it looked like the Pi was the answer to this maiden's prayer - and Project AutoPiLot was born!

 

Previous work
I acquired my Pi about a year ago so have had some time to get acquainted.  Attaching a GPS chip directly (via the UART) and providing software to parse and interpret the GPS input proved (fairly) simple.  Supplying a GUI which allowed for easy (and reasonably weatherproof) onboard interaction with this system was similarly straightforward and limited sea trials were carried out towards the end of the last sailing season.

A number of problems came to light (weatherproofing, VDU visibility in high ambient light conditions) but the main problem anticipated in taking development forward was the apparent need to change from RISC OS and BBC Basic, in which my software had been written, to Raspbian OS and C/Python which were the 'recommended options' used to provide software support for most of the hardware packages I was going to need.

These I knew nothing about.  I have resisted 'object orientated' programming for more years than I care to mention and what I had seen of Raspbian and Python in the course of setting up my Pi had not been reassuring ('bloatware' seemed too kind a description: this project will eventually require me to store digital charts on the Pi SD card, so space could be at a premium).

Then the Ultimate Pi bundle arrived.  Well, beggars can't be choosers, so it's roll up your sleeves time, Jim lad!

Which brings us up to date....

 

Current tasks

First, I must get to grips with the Ultimate Pi bundle.  It offers several possibilities for steering servo motor control and system state display.  Which will be best?  Turns out, that is not an easy question to answer: I'm still struggling with software downloads and steep learning curves.  And, depending on how that works out, I have a choice of helm control mechanisms: mechanical or hydraulic.  So the detailed design of my system has still to be finalised - but I'm looking forward to a bit of 'right first time' top-down design.  That'll be nice!

I'll keep you posted.

Jim Gibb

I've learned quite a bit more since my last post.  First, I want to just mention how cool it is that Raspberry Pi uses Duck Duck Go for searches.  I just started using Duck a few months ago because I was sick of everyone using my info for marketing, and just wanted to have a little privacy.  Who knew Pi had a partnership there?  Go open source!  Okay, back to the project... so, I decided that it was too much trouble to keep unhooking the keyboard on my computer for the Pi, so I visited a nearby computer recycling center and got myself a compact USB keyboard for $1.  Works for me.  Next on the list was figuring out what the mysterious connector was in the Adafruit Pi accessory pack.  It ends up it was part of the Pi Cobbler set.  Basically this PCB gives you access to the Pi pins on a breadboard (and they are labeled as well).  So, no more counting pins to figure out which one is which on the Pi.  You just plug one end of the ribbon cable into the Pi and the other end on the connector at the breadboard.  It's definitely a tidy way to handle all those connections.  You can see that I had the cute red LED hooked up here.

 

PiCobblerL.JPGPi Cobbler CUL.JPG

 

 

It was time for some fun.  I found a tutorial for a Twitter monitor online, so I pasted the code in Idle, the Python editor.  However, the code was not working properly.  I noticed that it called for the incorrect pin number for the LED compared to the diagram.  So, I tweaked that only to still have errors.  Finally, I thought it wasn't happy about the order of how things occurred in the program, so I tried switching some setup information around.  Granted this took a few hours to figure out, but I finally got it working!  The next step was to try plugging in some fun Valentine style searches.  Here's my first attempt.

 

 

 

 

Some of the searches I tried included "love", "I love you", "I love",  and "ILU" --  the results were pretty hysterical.  Someone posted how much they love someone based on the fact that they both hate dogs, others posted their affections for sports teams, many were trading their love for a follow from Justin Bieber,  and quite a few of them looked a lot like this "*F!&%$#".  Needless to say, this really wasn't what I had in mind for my Valentine's project.  Luckily, amongst the trash I found @LoveQuotes.  This is a fairly tasteful collection of classical and more practical modern quotes.  Of course on Twitter you can never be sure, but so far I'm sticking with it.  Yeah, yeah,  Twitter monitors have been done, but this one will have a special redeeming quality.  Just give me some time.  Oh yes, concerning the heart box, even with the new white paint, I'm still not happy.  I can still see the tiniest of brush marks and that isn't going to do.  I'm going to do what others have suggested and go for the spray paint.  Off again to the art store!

I've started blogging about my experience in Road Test reviewing the Ultimate Raspberry Pi Bundle. As a part of this Road Test I'm creating a Fridge/Freezer Temperature Alarm system for our local food shelf, Channel 1. You can see where this Road Test started for me here

 

Installing Raspian on the Raspberry Pi

That is a slightly misleading statement, as the Pi doesn't have any local storage. More precisely what I did (while the NFC playoff game was paused) was use the provided NOOBS SD card to select my choice of Linux flavor to run on my Pi.

NOOBS stands for New Out of the Box Software. It's meant to make setting up Linux on your Pi easy, and it avoids the need for a network connection. When NOOBS boots up, I was presented with the following options

  • Archlinux, - very configurable linux distro, but probably not recommended for newbies
  • OpenELEC - Open Embedded Linux Entertainment Center (OpenELEC) is a small Linux distribution built from scratch as a platform to turn your computer into an XBMC media Center

  • Pidora - Pidora is a Fedora Remix optimized for the Raspberry Pi computer
  • RaspBMC (the XBMC interface I had been using in my last blog post),
  • Rasbian (Recommended) Raspbian is a free operating system based on Debian optimized for the Raspberry Pi hardware
  • RiscOS - RISC OS is a British operating system which was designed specifically for the ARM processor by the same team who created the original ARM

 

I'm still getting used to this wireless touchpad that came with the XBMC, so when I picked Raspbian I almost pressed proceed faster than I could read the reminder that my SD card was going to be formatted...but that's ok, that's what we're trying to do.

 

After the formatting I was presented with the configuration screen and I:

  • Picked the Expand Filesystem (but found I didn't need to because NOOBs already configured things so my entire SD card can be used)
  • Change from the default ID and password of pi / raspberry
  • Did not enable boot to desktop, because I may use SSH to access this Pi for a while, and I can always run startx to start the desktop
  • Used the Advanced options to enable ssh and check the system name
  • After I picked finish on the config menu I ran startx to bring up the graphical desktop
  • Next I wanted to configure the Wi-Pi device. I know I do this with the WiFi Config Icon...but oops the Wi-Pi is not currently plugged in...when I put the Wi-Pi in the USB, it caused the machine to reboot ..scary..why??

 

Configuring the Wireless Network

  • This part should be easy, there is a WIFI Config icon, I used it to scan the networks, found mine and entered in the password information
  • I kept getting an error Failed to initiate AP Scan- this message would appear when I would try to connect to any of the wireless connections I found when scanning. I'm not sure if I was typing the password wrong (verified it was typing correctly by typing it in a terminal window) or if I was choosing my authentication parms wrong
  • When I came back to this again I decided to try using commandline and it worked...found this set of instructions on the Adafruit website.
  • And now the Wi-Pi works great, and it gives off a nice blue glow when it is communicating.

 

The blue glow of the Wi-Pi:

20140120_194051.jpg

 

After the connection was made, I was able to surf the internet, and I also used Winscp to connect from my Windows 7 box to the Pi

 

Screen Options

Since I currently only have one TV that can use HDMI, I've ordered a HDMI to DVI cable, I'll soon be able to use my computer monitor

I also installed vncserver. Vnc is a process that allows me to use Graphical applications without connecting any screen up to the Pi itself. To use it we start the vncserver on the Pi (usually by using ssh or winscp to long on commandline style to the Pi). When you start the server, it will have you create a password that allows you to connect to the server and it will tell you the port number to connect to (usually 1 in this situation) Then from your PC, run the command vncviewer, when prompted, specify the ipaddress and port (ie 198.162.2.12:1 (you can find out your PC Ipaddress by running the command ipconfig) and finally specify the connection password when prompted.

 

To install vncserver on raspbian, you can run the following command from the Terminal window:

sudo apt-get install tightvncserver

When I ran it it warned me that it would use 9988 kB of additional disk space

 

Here's what VNCviewer looks like running on my Pc

vncserver.JPG

 

Review Comments:

  • It was very easy to use NOOBS, I like it. It might be nice to have some indication of what the various flavors are useful for.
  • I wonder if I should have copied off the NOOBS SD card before I used it to make it easier to try another flavor? But I guess I can just download another copy from Downloads | Raspberry Pi
  • Slight glitch trying to install Wi-Pi, the commandline technique worked very easily though.
  • Super easy to install vncserver and connect via vnc

 

Next step....LCD display connection

Hi all,

 

Just thought I would share my Raspberry Pi Thermostat Project with the community. I have been working on this since catching the Raspberry Pi bug back in October 2013. I was feeling a little rusty in the software department and decided I needed the incentive to learn. The Raspberry Pi seemed an ideal starting point and as winter was approaching a WiFi enabled Thermostat seemed the ideal project. Nothing better than a real project to set your teeth into none of this "Hello World" boring stuff.

 

IMG_0768.JPG

 

I decided the first thing I needed was make the Raspberry Pi able to retain the time so I added a real time clock module which conveniently had a temperature sensor and EEPROM built into the same addon.

 

http://docs.ciseco.co.uk/B025%20-%20POD%20RTC-EEPROM-TMP%20V1.0.pdf

 

This killed 3 birds with one stone giving me a Real Time Clock a Temperature Sensor and a data store for configuration data.

 

I initially bought a Piface I/O board and had dabbled with using its input and output functions. I soon learned the basics with this and then became aware of the PifaceCad board and decided this was the way to go due to the display and built in keys plus the bonus of the IR sensor. Soon after finding the PifaceCad I was pleased to see custom cases being sold for it. This cemented my choice and as you can see it makes a good looking package.

 

I soon realised during the development of the project that the Pi gets quite hot at approximately 55°C this would mean that the temperature sensor would need to be external to the case. I had also bought a PifaceCam board and case and could see that the RTC board would fit inside the camera case and the hole in the front would allow air to circulate. This bolts nicely on the side of the case and gives an element of isolation from the Pi. I also added a calibration offset value in the software to take care of any temperature rise in the sensor due to the self-heating effect of the Pi.

 

To keep the power consumption down I decided to add a PIR sensor to the design which you can see on the right hand side of the Pi. To mount this I removed the Ethernet port to accommodate the sensor which is connected to the 5V supply and ground and its 3.3V output connected to a spare GPIO line. The PIR sensor was then used to activate the back-light on approaching the Pi.

 

In order to drive the central heating you will need to know the type of interface used by your boiler in my case this was a 240V powered thermostat with switched live signal to the boiler. If this is the case please make sure that any interface used is adequately isolated from the Pi and is also fitted by a qualified person. The circuitry for the interface resides in the separate enclosure below which contains an encapsulated mains powered 5V supply to power the Pi and a 5V powered relay with mains rated contacts in excess of the current switching specification of the original thermostat. Ensure that the mains supplies for the relay feed to the boiler and the supply to the Pi are fused accordingly. The relay is driven by and open-collector transistor drive circuit mounted on a vero-board in the Pi driven by a GPIO line.

 

The main display shows the actual temperature on the top line with the time and thermostat set-point on the second line. The top navigation switch alters the set-point or allows the user to scroll through menu settings if the bottom right key is pressed. The left bottom key is currently programmed for a boost function which overrides the timer functions for two hours. The timer settings, set-point and calibration offset are stored in the EEPROM on the RTC module. These are read on power up to restore the thermostat when the power is interrupted.

 

The software is written in Python3 and the OS is Raspbian Wheezy. I am looking to learn how to add web functionality so that I can stream data from the thermostat and control it remotely

Wow! Thank you Element 14! I had come up with the idea to use the Raspberry pi to make a retro mechanical arcade game Coin Dozer, but of course being a college student sometimes funds aren't always in abundance when you get an awesome Raspberry Pi project idea. HERE is an example of a coin dozer arcade game if you don't know what one is....I plan on making one out of the bundle.

So on a hope and a whim I sent in my application for the Ultimate Raspberry pi Bundle just to see. Then Bam!  Before i know it one night after coming home from classes and there was a box from element14  in front of my DOOR! Thank you Element 14 not only for the opportunity to make this project but also for the SUPER FAST shipping wow that was

IMG_0073.JPGIMG_0069.JPGIMG_0072.JPG

quick! I just hope the other parts i ordered for the project get here soon enough so i can begin to build it.

 

Below is a video of me un-boxing the contents of the Ultimate Raspberry
Pi Bundle. I was surprised on how much actually came with the bundle!!!

 

 

I will continue with post's as i make progress! If you can get your hands on one of these bundles or just one piece of the bundle i would say go ahead it will help out your project so much and since everything is so compatible with the rpi you won't be wasting a bunch of time reinventing the wheel.

 

 

Second Post: The Ultimate Raspberry Pi bundle Pi Dozer Post 2

 

I recently worked with the PiFace Control and Display for my Santa Catcher, in which I used the PiFace CAD as an IR receiver and display without using any of the local controls.

So I decided to create an Internet Radio player which could be controlled using the PiFace CAD's buttons.


The result is mainly a software project, but I had fun diving a little deeper into the Python programming language.

 

Project Components

 

For this project, I used following components:

 

  • Raspberry Pi Model B running Raspbian
  • PiFace Control and Display
  • Enclosure for Pi and PiFace CAD
  • Wi-Pi
  • Portable speaker
  • 5V 1A micro USB power supply

IMG_3150.JPG

 

Required Software

 

As mentioned earlier, I started off by using Raspbian with wifi and ssh enabled.

 

These were the modifications on top of Raspbian to get everything I needed up and running:

  • Updated Raspbian to latest version
    • sudo apt-get upgrade
      sudo apt-get update
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
  • Enabled SPI support for the PiFace CAD
    • sudo raspi-config
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
    • Select option 8: "Advanced options"
    • Select option A5: "SPI"
    • Select "Yes"
    • Select "Finish" to exit
  • Installed the mpd (music player daemon) and mpc (music player controller) applications
    • sudo apt-get install mpd mpc
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      

 

Python Script

 

From this point on, everything is done via Python.

 

Using Python, I am able to control the mpc application using the PiFace CAD's buttons and display the status on its LCD.

 

Code explanation

 

You can find the full code a bit further down, but I'll try to explain some bits of code here.

 

Custom bitmaps

 

I wanted to display some icons on the LCD to clarify the meaning of some values being displayed or to visualise the current state.

It is possible to define "custom bitmaps" to be displayed. This tool comes in very handy to create your own. (be sure to select 5x8 when using PiFace CAD)

 

Following function defines and stores custom bitmaps:

 

def custom_bitmaps():
    speaker = pifacecad.LCDBitmap([1,3,15,15,15,3,1,0])
    play = pifacecad.LCDBitmap([0,8,12,14,12,8,0,0])
    stop = pifacecad.LCDBitmap([0,31,31,31,31,31,0,0])
    playlist = pifacecad.LCDBitmap([2,3,2,2,14,30,12,0])

    cad.lcd.store_custom_bitmap(0, speaker)
    cad.lcd.store_custom_bitmap(1, play)
    cad.lcd.store_custom_bitmap(2, stop)
    cad.lcd.store_custom_bitmap(3, playlist)













 

The custom bitmaps can then be displayed on the LCD as follows, using the id of the corresponding bitmap:

 

cad.lcd.write_custom_bitmap(0)












 

MPC status

 

In order to display correct information on the LCD (volume & playlist position and size), I rely on the information coming from the mpc application itself.

 

A sample output looks as follows:

 

pi@piRadio ~ $ mpc status

mms://streaming.q-music.be/QBE_HI
[playing] #1/2 1187:22/0:00 (0%)
volume:100%   repeat: off   random: off   single: off   consume: off












 

Using Python, it is possible to execute that command, take the output and parse the interesting bits of information.

 

Playlist:

 

def display_playlist():
    playlist = subprocess.check_output("mpc status | grep playing", shell=True, stderr=subprocess.STDOUT)
    playlist = playlist[playlist.find("#")+1:playlist.find("/")+2]


    cad.lcd.set_cursor(4, 1)
    cad.lcd.write_custom_bitmap(3)
    cad.lcd.write(playlist)












 

This bit of code executes the "mpc status" command and only keeps the part of the output containing the word "playing".

Then, it parses the output and keeps the part after "#" and up to two character after the "/". This covers playlists of up to 99 items.

 

The playlist information is then written to the LCD, with an icon to clarify the meaning of the value.

 

Volume:

 

def display_volume():
    volume = subprocess.check_output("mpc status | grep volume", shell=True, stderr=subprocess.STDOUT)
    volume = volume[7:volume.find("%")+1]

    cad.lcd.set_cursor(12, 1)
    cad.lcd.write(volume)












 

Similar to the playlist parsing, this bit of code takes the output of the "mpc status" command containing the word "volume".

It parses the characters after the word "volume" up to and including the "%" character.

 

The volume is then written to the LCD.

 

Event listener

 

The script needs to know when a button on the PiFace CAD has been pressed and trigger the appropriate action.

 

I recuperated this bit of code from one of the PiFace examples and extended it to fit my application.

 

First, a listener is defined which will register which button has been pressed:

 

listener = pifacecad.SwitchEventListener(chip=cad)

for i in range(8):
        listener.register(i, pifacecad.IODIR_FALLING_EDGE, update_pin_text)

listener.activate()











 

The listener executes the specified function in which it execute different actions depending on the button that was pressed:

 

def update_pin_text(event):
        global channel_pos
        global status
        if(event.pin_num == 0):
                status = "playing"
                os.system('mpc play')
                event.chip.lcd.set_cursor(0, 1)
                event.chip.lcd.write_custom_bitmap(1)
                event.chip.lcd.write(" ")
                display_channel()
                display_playlist()

        elif(event.pin_num == 1):
                status = "stopped"
                os.system('mpc stop')
                event.chip.lcd.set_cursor(0, 1)
                event.chip.lcd.write_custom_bitmap(2)
                event.chip.lcd.write(" ")
                clear_channel()

        elif(event.pin_num == 2 and status == "playing" and channel_pos > 1):
                os.system('mpc prev')
                clear_channel()
                display_channel()
                display_playlist()

        elif(event.pin_num == 3 and status == "playing" and channel_pos < len(channelLink)):
                os.system('mpc next')
                clear_channel()
                display_channel()
                display_playlist()

        elif(event.pin_num == 4):
                global backlight
                if(backlight == 1):
                        event.chip.lcd.backlight_off()
                        backlight = 0
                else:
                        event.chip.lcd.backlight_on()
                        backlight = 1

        elif(event.pin_num == 5):
                sleep(1)

        elif(event.pin_num == 6):
                os.system('mpc volume -5')
                display_volume()

        elif(event.pin_num == 7):
                os.system('mpc volume \+5')
                display_volume()

        else:
                sleep(1)











 

Above actions correspond to following button mapping:

IMG_3152.JPG

 

Full code

 

The code still requires to be cleaned up a little, but it should be clear what I'm trying to do.

 

 

Autostart

 

The script needs to be started automatically after the system booted. This is done by adding following entry to /etc/rc.local:

 

sudo python /home/pi/radio.py &






 

Demo

 

IMG_3148.JPG

 

When I applied for the Ultimate Raspberry Pi Bundle, I took a little time to peek at the products included in the package. I've seen Raspberry Pi's before, seen friends make them into cool projects, but have not actually used one myself. I have worked with a few different flavors of Arduino, a Parallax Propeller Board of Education and done a tiny bit with ATTiny micro controllers, but I am a software engineer at heart, so I'm still learning the hardware game. My first reaction to the bundle was one of intrigue, lots of gadgets to try, some I had not even read about. Next I noticed there appeared to be some overlap of function, for example an LCD display and another LCD display that needs to be soldered together ...that's ok, displays are good.

Anything appear to be left out of the "Ultimate Bundle"?  Well, there's no case I guess, but that's a style thing and for my project I will probably need a custom case anyway. No cable or wall wart (er I mean power adapter) maybe, we'll see. A super minor thing would be the cobbler needs a breadboard to be useful, that's fine, I have those. 


Those all seemed like pretty minor issues, the real challenge is to come up with a project that fits this eclectic package, here's what I proposed:

As I said in my first blog post, I wanted to design a temperature sensor for the local food-shelf.  It seems the Ultimate Pi Bundle would allow me to pretty much implement this worthy project, provide reviews for element14 and probably add some creative bells and whistles...also know as feature creep...adding on requirements that the customer did not really ask for.

I understand the base requirement to be simply monitor temperature range in the refrig and freezer unit, then use either the available wifi connection and or a cellphone interface to notify the appropriate Channel One employees of issues. By using Pi, I'm sure I could allow easy configuration of settings and viewing history information from an on-board web-server...boom done!

But wait, there's more, now with the Ultimate Raspberry Pi Bundle...could I add more?, let's see

  • WiPi - wifi is essential for my current base design
  • Adafruit RGB Positive 16X2 LCD & Keypad Kit - a beautiful solution to add an onsite Temperature Status display
  • PiFace™ Digital plugs could allow us to add sensors to the display case doors and signal an alarm if the door is open for too long of a time (something that has caused problems in the past)
  • PiCamera could be useful to see who or what is blocking the door, or for security if someone opens the door during off-hours.
  • ChipKit Pi could be used to provide custom configuration slides/buttons on site as opposed to, or in addition to the proposed web based configuration options
  • Gertboard and Pi Cobbler would allow easier prototyping and debugging of our design.

 

So in order to not get carried away, I visited ChannelOne to check on their real requirements.

I met John on a Friday afternoon just as the Food-Shelf was closing, he was happy to talk to me especially since he likes the idea of a free temperature monitoring system and the only thing on his agenda for the day was cleaning :-)

We looked over the refrigerator system, looked for power sources, checked the wifi signal and inspected the larger cold storage warehouse to see what their monitoring system looked like.

 

ChannelOneIMG_2809.JPG

FridgeUnitIMG_2802.JPG

 

There are two units like the above, one is a refrigerator unit and one is a freezer unit. I'll need to monitor the temperature range of each separately.

 

Here's what we decided:

- the base requirement is a bit more complicated, the valid temperature target (33F in the fridge unit, and -10F in the freezer unit) needs to vary depending on the time of day and probably the time of year. During business hours, and especially in the summer, since the doors are opened by customers and stocking personnel the fridge could possibly fluctuate all the way to 60F. So we agreed we need a Business Hours Range and an Off Hours Range, and a way to indicate what business hours are. (Another reason for these 2 ranges is reaction time to the problem. Becuase if 60F is occasionally allowed during the day, if the cooler hits 60F at night, this is not acceptable because it will likely soon hit 70F and it may take a while till someone can address the problem)

- the door ajar alarm - my parents used to have a car with a voice chip that literally said "The door is ajar" when the door was left open. While this may seem cute at first it can be kind of annoying. That's what we decided about the door ajar sensor I originally proposed...customers and stockers have a ligament reason to keep the door open. So instead we realized we need an audible temp range alarm. Originally we were just going to send an email or text message to someone when the range is out of hand, but we decided that during the day, an audible alarm when the temp is out of range is also obviously needed.

- Snooze Alarm - a good use of sensors on this project would be a snooze alarm. If the range is out of wack, it's probably going to take people a while to fix the problem...we'll need a way to silence the annoying alarm. A button on the unit would be preferred.

- Text don't just email - the original design was to send an email when the temp range is not correct. After talking to John and Mike in the warehouse they pointed out that most people don't read email at midnight (really?) and a text message would be much more effective. Of course this should go to more than one person due to vacations etc.

- Location of display - we carved out a good spot to mount the finished product, a power source is available, we'll be outside of the cold of the unit (figuring the Pi would probably not last as long in extreme temp conditions) and the LCD will be visible to staff.     

- Power Outage Warning - the original brainstorming on this project thought assuming Channel One has a UPS on their computers and wifi, we might be able to have a battery backup Pi, detect a power outage and send a warning. However we decided Channel One has generators and a system set up for power outage notification.

- Security Camera Function - another bell and whistle that isn't needed. While we could take a picture and send an alert if someone opens the freezer unit after hours, this would require is to add door sensors or motion sensors and isn't really needed since the building is already under multi-camera surveillance

 

Ok, I think that is about it, KISS Keep It Simple Stupid...let's get working on these requirements before there is more wasted milk.
I'll figure out another way to review the entire kit of parts...I've wanted to buy a Pi for a while anyway :-) 

 

Oh, I this week I also took some photos of the products I received:

 

PiIMG_2784.JPGWiPiIMG_2786.JPGChipKitIMG_2789.JPGEmbeddedPiIMG_2787.JPG

 

CameraPi_IMG_2779.JPGPiFaceSmIMG_2790.JPG

xbmcSmIMG_2801.JPGLCDIMG_2793.JPG

IMG_2792.JPG

CobblerIMG_2798.JPGAdafruitIMG_2796.JPG

PiRackIMG_2795.JPGPiFaceControllerIMG_2791.JPG

Wow! be careful what you wish for you just may get it :-)

I applied for and just received via UPS the Ultimate Raspberry Pi Bundle from element14!

Thanks very much!

Now comes the daunting job of not only blogging and reviewing these great products, but putting them into production for a local Food Shelf!

 

Embedded image permalink

 

You see over Christmas vacation, I volunteered for a local food shelf called Channel One. I was chatting with the warehouse manager and I mentioned my hacker space The Rabbit Hole has quite a bit of experience with various micro-controller projects and wondered if there might be something our club could contribute to Channel One. He mentioned that their large freezer and cooler rooms are protected by commercial monitoring systems, but he'd really like a temperature monitor for their walk-in display-case cooler and freezer. The Rabbit Hole jumped on the idea right away, and began some brainstorming how best to build this type of monitor. We were leaning towards a Raspberry Pi solution as a powerful, flexible and inexpensive answer. Two weeks later, the aforementioned cooler blew a fuse over the weekend and caused a ton of milk to go to waste. Next thing you know I was checking the Road Test progress of fellow RabbitHole member Peter Shabino and noticed the element14 Ultimate Raspberry Pi Bundle Road Test applied and was selected Yeah!

I'm new to blogging, but there's more to follow, I'd appreciate comments and suggestions from the element14 community

 

More to Come: I'll create a series of posts as I review these products, here's the next in the series: Getting the Requirements Right - The Ultimate Raspberry Pi Bundle

Well, look what arrived today!

IMG_20140117_160851998.jpg

Thats right, my RoadTest bundle has finally arrived, and it has a heck of a lot of stuff inside it.

Sadly, some of it (Adafruit LCD Pi Plate Kit, Embedded Pi, PiFace etc) I cannot currently use due to my lack of equipment, and the Pi Camera was not included, so that is being shipped over now.

Currently I have the Control & Display working, and the Gertboard is setup and running with the Arduino "Button" example.

Anyway, my main question: What project should I build? I want your ideas down below in the comment section, and the best idea will be built.

 

Look out for my review and more updates soon, everyone!

Electronics & Design Projects

Enter Your Electronics & Design Project to earn a $100 Shopping Cart to any element14 transactional site!

Back to The Project14 homepage

Project14 Home
Wacky Automation Devices
Solar Powered Yard Gadgets

 

Before you watch this project... see my others:

- The "Scary Door"

- "Project Goldie"

- "New Year’s Eve Countdown Timer With Fireworks Launching Ability"

 

 

I am building kits of all the parts used on the Drinkmotizer. Private message me here at element14 or Twitter if you are interested.

Thank you for the support and furthering development on the bot.

- C http://twitter.com/Cabe_Atwell

 

UPDATE: Drinkmo upgraded for the holidays! See video below:

 

 

 

 

“Make me a drink, Drinkmo.”

 

On every engineer’s senior design short list is/was a drink mixing robot. One of the few projects that’s fun at parties. You want the Drinkmotizer at your party… You need the Drinkmotizer at your party… At some point, dexterity for drink mixing is lost at a gathering. Drinkmo is your designated, sober, mixologist. Your enabler. Your friend.

 

I know what you are thinking, “hey, there are other drink mixing bots out there, what makes this one different?” This one doesn’t break the bank. It’s DIY, Open, expandable. Artistically speaking, It isn’t just a nozzle that sprays alcohol at objects, it uses the actual bottle, and gravity.

 

The concept is based on a CNC lathe I built. My goal was to make something a bit faster, slightly less precise, and upgradeable. Drinkmo is all that. In the video I show six bottle stations and one chaser spout. That particular setup, being four feet long, can have up to sixteen bottles and still have the chaser spot. Technically, I could build a Drinkmo that is twenty feet long having 80 bottles on it! I thought that would be cool to see at a bar somewhere.

 

Here were my requirements of

- Use the original drink bottles

- Be expandable

- Single button interface

- Be inexpensive (relatively to the other bot options)

 

Drinkmo full.jpg

 

Project by sections

 

- Motor control

There is a stepper motor driving the Drinkmotizer table via a drive belt. With CNC applications, directly coupling a stepper motor to the drive shaft is never a good idea. Most stepper motors are not designed to handle lateral forces. Although this is only driving a small platform and a cup, there still is resistance.

 

The Arduino receives the serial drink protocol (Recipe) from the Raspberry Pi and controls the motor routine based on the recipe. We are using the Centipede shield to expand the I/O of the Arduino Uno. The Centipede Shield uses the Wire I2C interface on analog pins 4 and 5 of the Uno to provide 64 general purpose I/O pins. The program starts off with importing the libraries. The Centipede shield comes with a library that is imported along with Wire.h library in order to communicate with I2C devices. The SoftwareSerial.h Library is imported to allow serial communication from the Pi. We then setup all the variables and subroutines.

 

The main program runs in a loop waiting to receive serial data from the Pi based on the protocol setup. The Arduino receives the values separated by commas. We use the Serial.parseInt() function to place each comma separated value into an array. We then parse out the array and assign individual variables. Once these variables are assigned, we check the values of these variables and move the motor accordingly to each drink module position. The positions are fixed and have a set number of steps in order to move the motor until the cup is directly under the pour spout. The program will check the number of shots in the recipe and dispense the first shot then wait about 4 seconds for the drink module chamber to refill and pour the second shot before moving on to the rest of the recipe. The program also checks whether or not there is any more drink modules left to pour when executing the recipe. When no more drinks are left to pour, the program considers the drink complete and returns to the first position (home). The number of steps are added when the platform passes under the drink dispensers. When the program considers the drink complete, it takes the total number of steps added at its current position and moves the motor, that many steps, in the opposite direction. The platform returns to the exact place when it started the drink.

The protocol includes pour durations for the chasers based on the recipe received. The chasers are poured last, after the liquor. The protocol value for the chaser is a time in milliseconds. This variable is passed directly into the delay for the solenoid that allows the chaser to flow. Once the drink has returned to home, the loop starts over waiting for drink data from the Pi.

 

The Motor has an acceleration and deceleration routine which is used to achieve top speed and come to a gradual rest instead of abruptly stopping the motor. Starting the motor at top speed will cause it to stutter when under the load of the lead screw. A gradual start makes for smooth operation and achieving top speed without problems.   

 

- GUI

 

Tkinter is a built in GUI library for python. Although not the prettiest themed GUI, It’s easy to use. Especially for our application using the raspberry pi for running the GUI which is as simple as running the python script in IDLE which comes with Raspbian OS. 

I decided to use a grid view for drink selections. Each drink would be displayed with a picture of the drink with the name then a short list of the ingredients following. Last would be a button to activate the machine to start making the drink. I decided to make the button big for the touch screen so it was easier for the user to click the button on the first try. I embedded the picture and Drink name into the button which flowed well with having a big button. The tkinter library only accepts .gif, .pgm, or .ppm picture formats. After finding the picture I wanted to use I resized the image and converted it to a .gif. I saved the picture into the project folder alongside the .py file. When running the script the code looks for the image file in the same folder as the .py file.

The script starts with importing the necessary libraries. The Tkinter Library is imported along with the Pyserial library for serial communication. The serial port is then set up telling the Pi to use the USB port as the serial port at 9600 baud. Next we set up the GUI’s attributes. We assign the GUI as dgui. i.e. dgui = Tk(). The GUI is displayed as fullscreen and the geometry is set to the 7” screen resolution. The text/label fonts are set to be used elsewhere in the program. The program has a cut out canvas frame placed inside the main window to display the grid of drink selection buttons.

 

The buttons are embedded with an image and text of the drink described. To achieve this we created a Tkinter button and assigned it a variable. We used Tkinter’s PhotoImage Class Function to import the .gif picture as a variable as well. Once the image is assigned as a variable we can configure the button to have the variable be the button’s image.  A text label of the drink name is then packed under the image inside of the button. The ingredients list text is then placed under the button.

When the button is pressed is calls the appropriate function to start the progress bar and open the serial port to the Arduino. Before sending the drink information to the Arduino, we set the serial port DTR to level 0 or False. This is to ensure proper serial communication with the Arduino via USB cable. Setting the DTR to 0 or False prevents the Arduino from resetting its communication on the USB port. Without setting the DTR we had intermittent connections.

The Raspberry Pi sends the Arduino the Recipe/Instructions to make the drink selected. It does this by sending our custom protocol. Which are just 9 values separated by commas. The Arduino parses out the values and assigns them variables.        

 

- Relays

 

For this iteration of the Drinkmotizer, I am using 10 relays off of a SainSmart relay board. Six for the drink module actuators and four for the chaser station.

Each bottle module uses a 12VDC car door lock actuator. When activated, the draw spikes to 12V @ 5A. So, depending if I want a full shot or a partial, I activate the relay time accordingly.

The chaser station operates differently. The chaser bottles are pressurized by a paintball gun tank. What stops the chaser fluids from spraying everywhere are four solenoid valves. Then one valve is actuated, it opens, allowing the pressure to push fluid through the solenoid. For the record, the solenoid is designed for fluids.

 

The difficulties

 

- The bottle modules started out quite differently. Originally, a cheaper metering bottle actuator was used, but they would easily break and were difficult to actuate. After several different types of bottle actuators were tested out, the ones used in the final Drinkmo were the clear winners.

- A lot of I/O was needed. The only expansion shield with enough pins was the Centipede board by Macetech. At the time of building the Drinkmotizer, the Centipede board was sold out. Honestly, nothing else was a viable option. Luckily, the people at Macetech were able to find a couple for me. Overnight shipping, and the day was saved.

- Some bottle spouts were too small for the bottle modules. Supreme force was the only solution.

- The whole system had to reset often. It turned out to be a faulty USB hub. Eventually, no hub was used at all, and there were no issues.

 

Schematic and Design

 

drink-mo wiring 2.jpg

(SEE THE PDF ATTACHED TO THIS POST FOR HIGHER RESOLUTION!)

 

What is not pictured is provisions for hall effect sensors... But, they would be on the Centipede board.

 

 

BOM

 

QuantityPriceVendorPart #Description
1$35$35element1443W5302Raspberry Pi Model B
1$26.82$26.82element1478T1601Arduino Uno
1$17.99$17.99element1497W1422PRE PROGRAMMED, MICROSD, 8GB, RASPBERRY PI
1$49.95$49.95element1456T0249BREADBOARD, SOLDERLESS, 400 TIE POINTS
2$25.00$50.00MacetechMTCEN001Centepede Arduino IO breakout board http://macetech.com
1$48.60$48.60Amazon4x DC 12V 1/4 Inch Electric Solenoid Valve
1$67.50$67.50Amazon5 x 1PCS 12V DC 1/8" 2way 2position Electric Solenoid Valve Water Air Gas N/C Gas Water Air 2W025-06 BSP Normal Closed
1$45.12$45.12Amazon2x Oggi Professional 4-Bottle Revolving Liquor Dispenser
1$50.35$50.35Amazon5x  Install Essentials 524T 2 Wire Standard Door Lock Actuator Kit
1$11.00$11.00AmazonInstall Essentials 524T 2 Wire Standard Door Lock Actuator Kit
1$18.49$18.49AmazonNema 23 (57 series) stepping motor mount
1$174.00$174.00AmazonLilliput 7" 619AT 1080P Camera Touch Screen Monitor VGA/AV/HDMI/DVI Input
1$101.08$101.08Amazon7 of Wood Upside Down Dispenser - Lighted Dispenser Units - 30 ML
4$7.76$31.04Mcmaster47065T178Aluminum Inch T-Slotted Framing System, 90 Degree Plate, Single, 5-Hole, for 1-1/2" Extrusion
4$4.06$16.24Mcmaster47065T224Aluminum Inch T-Slotted Framing System, 90 Degree Bracket, Single, 2-Hole, for 1-1/2" Extrusion
1$5.00$5.00Mcmaster5905K21Steel Needle-Roller Bearing, Open for 1/4" Shaft Diameter, 7/16" OD, 5/16" Width
2$2.76$5.52Mcmaster6655K33Steel Thrust Ball Bearing, Stainless Steel Washers, for 1/4" Shaft Diameter, 9/16" OD
1$4.00$4.00Mcmaster1257K113Miniature 303 Stainless Steel Drive Shaft, 1/4" OD, 3" Length
2$7.48$14.96Mcmaster57105K13Acetal Pulley for XL-Series Timing-Belt, for 1/4" & 3/8" Belt Width, 1.00" OD, 12 Teeth
1$2.95$2.95Mcmaster1679K27Trapezoidal Tooth Urethane Timing Belt, .200" Pitch, Trade Size 160XL, 16" Outer Circle, 1/4" W
tax$43.30
shipping$5.25
3$30.33$90.99Mcmaster47065T103Aluminum Inch T-Slotted Framing System, Four-Slot Single, 1-1/2" Solid Extrusion, 4' Length
4$4.06$16.24Mcmaster47065T224Aluminum Inch T-Slotted Framing System, 90 Degree Bracket, Single, 2-Hole, for 1-1/2" Extrusion
1$56.56$56.56Mcmaster99030A7161018 Carbon Steel Precision Acme Threaded Rod, 1/2"-8 Size, 1/4" Travel/Turn, 6' L, Right-Hand Thread, 2 Starts
2$4.51$9.02Mcmaster47065T145Standard Type 302 Stainless Steel End-Feed Fastener for 1-1/2", Aluminum Inch T-Slotted Framing System, Packs of 4
tax$13.82
shipping$20.78
1$5.89$5.89Mcmaster8947A137118 Degree Point High-Speed-Steel Short-Length Drill Bit, Bright Finish, 7/16", 3-7/16" L Overall
4$7.90$31.60Mcmaster8702K487Impact-Resistant UHMW Polyethylene Rectangle Bar, 3/8" Thick, 3" Width, Black
1$13.33$13.33Mcmaster98089A336Metric 18-8 Stainless Steel Shim, 0.5MM Thick, 8MM ID, 14MM OD, Packs of 50
tax$5.17
shipping$9.84
1$4.76$4.76Mcmaster91292A202Type 18-8 Stainless Steel Socket Head Cap Screw, M6 Thread, 70MM Length, 1MM Pitch, packs of 10
1$11.23$11.23Mcmaster3846K1Multipurpose Gauge, Steel Case, 1-1/2" Dial, 1/8 NPT Bottom, 0-15 PSI
1$8.73$8.73Mcmaster91828A251Metric 18-8 Stainless Steel Hex Nut, M6 Size, 1MM Pitch, 10MM Width, 5MM Height, packs of 100
8$2.23$17.84Mcmaster5779K104Push-to-Connect Tube Fitting for Air, Straight Adapter for 5/32" Tube OD X 1/8 NPT Male
tax$3.84
shipping$5.10
1$18.00$18.00ebay2pcs SK20 Size 20mm CNC Linear Rail Shaft Guide Support
1$34.95$34.95ebayPBB20MM x 4 (four) 20mm Linear Bearings Pillow Block Bearing CNC Bushing SC20UU
1$133.15$133.15ebayStandard Type 302 Stainless Steel End-Feed Fastener for 1-1/2", Aluminum Inch T-Slotted Framing System, Packs of 4
1$11.50$11.50ebayClippard MAR-1 regulator
TOTAL$1,346.50

 

 

Other uses of the system

- I suppose any sort of liquids could be dispensed. Soup-motizer, juice-motizer, paint-motizer… fill in the blank –motizer.

 

When I have more time and money

- Going to attach the stepper motor without using a drive belt. I only used the belt to avoid having too much sticking out the side. But, I think shaft coupling would be safer. No place to catch your hand.

- Getting the touchscreen working properly. Raspian does not work with the screen, despite the vendor stating otherwise. Works great with XBMC.

- I plan on designing and manufacturing my own bottle modules. I want to meter smaller amounts of liquid. I want the modules to be “hot-swappable.” Of course, more compact and cheaper.

- Another option I am considering is changing out the leadscrew for a magnetic drive system. No visible spinning leadscrews is what I want to avoid. You know, the ones that crush fingers? With a magnetic system, we should habe quicker movement and easier adjustments.

- Originally, I wanted sensors along the line to detect bottle stations. I did not have to add them. However, it absolutely necessary. Especially when more bottles are added or removed on a whim.

- Bottle detectors. I want to detect if a bottle is in a station. Also reading the label/barcode could detect what it is too. That should take any thinking out of the mix. Keep in mind, those who use this are probably drunk.

- I want the cup platform/table to also shake/stir the beverage too. I have a few ideas on this one…

 

Oddities and observations

- Drinkmo made some powerful beverages. With the ease of beverage creation, one could easily develop a problem.

 

C

http://twitter.com/Cabe_Atwell

Wow, I've been having lots of fun getting the Pi together.  First off, I think it looks great in its new little box.  Considering I had roofers pounding flecks of tar into my loft, I was mighty thankful for the protection.  Between hooking it up to a monitor and attaching a keyboard and mouse, I started to have a memory recall.  This felt just like when my brother and I were connecting our first computer, a Timex Sinclair!  You can laugh, it's okay.  My brother and I spent many a late night sneaking onto the computer when my parents were asleep.  Anyway, I merely followed the Element 14 tutorials for set-up, and I'll say right now that the NOOB (New Out Of The Box Software) was perfect for me.  I chose the Raspbian OS, and in a few minutes I had a start screen, with some fun surprises -- games, games, Python games!  I can tell you right now that I love "Squirrel Eat Squirrel".  Check out the "omega" squirrel that got created.

Pi M.JPGPiScreen M.JPGSquir True M.JPG

After getting sidetracked with that, I moved onto another program I like -- Scratch, from MIT.  I've been wanting to play with this for quite some time, as I heard it's good for teaching code to young people.  In fact, some use it as an intro to writing games, and I can see why.  Moving the cat around is instant gratification, and I know I'll certainly be spending more time here once my project is finished.  If you are a parent, definitely get your kids involved with this one and they'll be ahead of the curve.  Finally, it was time to unplug from the games for some craft work.

 

Box M.JPGPaint M.JPG

 

I wanted to house the Pi in an appropriate Valentine fashion, so a traditional candy box seemed best.  Of course the stores didn't have any in stock yet, so I had to order mine from a professional box company minus the chocolates.  It was a tragedy, yes, but I'll get over it. The box I chose has a gold matte finish, which I thought would be easy to cover with paint.  In fact, it is probably best that I ordered my box this way because most boxes have a ton of branding on them making them more difficult to cover.  I chose some acrylic matte paint in a Pearl White color and used a sponge brush to make sure the layers would be thin, as cardboard doesn't like to be wet.  I made it through three coats so far, but the color is a bit too silvery for my liking.  I want the box to be a frame, not the focus of the piece.  So, I will purchase some pure white paint next time I go to the art store.  It's a minor issue, and I have two other heart boxes just in case this one fails.  I'm all about choices, and so far, so good.

See my original blog here Raspberry Pi car computer | Flamelily I.T


I have always loved those old TV series with futuristic tech in those futuristic vehicles, like Knight Rider, Air Wolf, Street Hawk etc. So it got me thinking about how easy it would be to add a computer to a vehicle. Now I know its been done before and a quick Google search shows multiple websites and companies making very complex car and other vehicle computers, but at a large cost.

carcomputer.jpg

Well I thought my Raspberry Pi is the perfect device for this.

  • Its cheap
  • its very small
  • small power requirements (runs off a micro USB car charger)
  • flexible video and audio outputs (HDMI and Composite RCA for video, HDMI and 3.5mm audio jack for audio)
  • and best of all you can change operating systems by simply switching out SD cards

 

Below is a photo of the Raspberry Pi running the excellent media centre type operating system Raspbmc which is perfect for browsing and playing your media collection using a media centre remote or something similar, as shown in my ‘shopping list’ below.

carcomputer1.jpg

What I did

Well firstly I had the Xtron car DVD player for the Ford already fitted and it can be found on this site here http://www.xtrons.co.uk/ and there are DVD/Radio players for a number of car manufacturers. However you don’t actually need one of these if you can place a TFT screen elsewhere. I also have one of these..

carcomputer2.jpg

Which can be found on Ebay for about £23 at this link. http://stores.ebay.co.uk/SainSpeed This 7″ TFT can be placed in a headrest or on the dash somewhere as it comes with a stand. Both of these devices have a composite RCA video input and for audio I have a basic 3.5mm audio cable from the Raspberry Pi to the auxiliary port of the radio. So all audio is played via the car speakers which sounds really good and clear. I placed the Raspberry Pi in the centre console as shown below and routed all cables under the centre console so no cables are lying around.

carcomputer3.jpgcarcomputer4.jpg

I used the brilliant little Xenta Wireless Keyboard with mouse touchpad built-in. This works perfectly with both Raspbian and Raspbmc. It even has an on/off button on the back to save batteries when not in use (it takes 2xAA batteries).

carcomputer5.jpg

So this can now connect to any wireless network and I connect it to my mobile phone by using the portable wi-fi hotspot, giving my Raspberry Pi an internet connection even on the move (obviously don’t try browse the internet or watch videos whilst driving).

Materials Used :

  1. Raspberry Pi (Obviously)
  2. Xtrons Car DVD player
  3. 7″ TFT monitor (for back seats or main monitor)
  4. Extra composite video cable and 3.5mm audio cable
  5. Wireless N USB dongle from Amazon
  6. Xenta Wireless Mini Keyboard from Ebuyer
  7. Micro USB car charger

Update pictures of the headrest's in next blogpost here http://wp.me/p2G9uP-8j

Just how can you use a small computing device to spice up your party?

 

How about using it to play music, capture and display the action, and saving evidence for the days to come?

 

Sound good? Well read on.

 

There are four main parts to this accomplishing this.

1)   Playing music

2)   Capturing the action

3)   Displaying the action

4)   Saving the evidence

 

But first there’s step zero, that is, set up the beast.

 

As mentioned in the attached video, the included XBMC SD card did not play nicely with my network settings (for some reason, things wouldn’t stick).

Tried a few backend tweaks, but I ended up going to a bog standard install of Raspbian. There are plenty of guides available if you’re going to do this yourself so I won’t cover it here.

 

So lets get into it.

After installing Raspbian I enabled ssh using the raspi config editor, expanded the file system to fill the entire SD card, and set it to boot straight to the desktop.

 

For the music player I installed OMXplayer and a freely available front end. It was then simple to play a set of files off the inserted USB flash drive.

 

Capturing the action and saving the evidence.

I was using the PiCam. More specifically, the PiCam that had the IR filter removed. This was enabled in the raspi config. Using a python script I took a photo once per minute, set the filename to the current time/date, and made a copy called latest.jpg

 

cap.py

#!/usr/bin/env python3

import sys

import os

import subprocess

from time import sleep

import pifacecad

import datetime

import shutil

 

dt = str(datetime.datetime.now())

name = '/usr/share/nginx/www/<your-folder>/images/IMG_'+dt+'.jpg'

from subprocess import call

call(["raspistill","-o",name,"-w","1280","-h","960","-rot","90"])

shutil.copy2(name,'/usr/share/nginx/www/<your-folder>/images/latest.jpg')

 

 

Displaying the action.

I originally intended to have a looping slideshow going, however this didn’t eventuate. Instead I installed a lightweight webserver (nginx) to show a simple auto-refreshing page pointed at the latest.jpg file which gave the effect of a slideshow, but only when the image updated.

The other displaying shown in the video was on the LCD display.

This was the PiFace CAD. Although I didn’t use the CA part, the display was perfectly reasonable for my task.

Using a second python script the PiFace CAD display was updated with the current image count, as well as the disk/SD card usage.

The python script was an edited version of the script distrbuted with the piface samples to show system info.

 

photostaken.py

#!/usr/bin/env python3

import sys

import subprocess

from time import sleep

import pifacecad

import datetime

from sys import exit

 

TIME_CMD =" str(datetime.datetime.now())"

UPDATE_INTERVAL = 60 * 5  # 5 mins

GET_IP_CMD = "hostname --all-ip-addresses"

GET_TEMP_CMD = "/opt/vc/bin/vcgencmd measure_temp"

TOTAL_MEM_CMD = "free | grep 'Mem' | awk '{print $2}'"

USED_MEM_CMD = "free | grep '\-\/+' | awk '{print $3}'"

PHOTO_COUNT_CMD = "ls '/usr/share/nginx/www/<your-folder>/images' | grep .*.jpg | wc -l"

 

temperature_symbol = pifacecad.LCDBitmap(

    [0x4, 0x4, 0x4, 0x4, 0xe, 0xe, 0xe, 0x0])

memory_symbol = pifacecad.LCDBitmap(

    [0xe, 0x1f, 0xe, 0x1f, 0xe, 0x1f, 0xe, 0x0])

temp_symbol_index, memory_symbol_index = 0, 1

photo_symbol = pifacecad.LCDBitmap([

0b11111,

0b11011,

0b11011,

0b11111,

0b11000,

0b11000,

0b11000,

0b11000

])

 

time_symbol = pifacecad.LCDBitmap([

0b11111,

0b00100,

0b00100,

0b00100,

0b00000,

0b11111,

0b10101,

0b10101

])

 

photo_symbol_index = 2

time_symbol_index = 3

 

def run_cmd(cmd):

    return subprocess.check_output(cmd, shell=True).decode('utf-8')

 

 

def get_my_ip():

    return run_cmd(GET_IP_CMD)[:-1]

 

 

def get_my_temp():

    return run_cmd(GET_TEMP_CMD)[5:9]

 

 

def get_my_free_mem():

    total_mem = int(run_cmd(TOTAL_MEM_CMD))

    used_mem = int(run_cmd(USED_MEM_CMD))

    mem_perc = used_mem / total_mem

    return "{:.1%}".format(mem_perc)

 

def get_photo_count():

    all_images = int(run_cmd(PHOTO_COUNT_CMD))

    taken_photos = all_images-1

    return taken_photos

 

def wait_for_ip():

    ip = ""

    while len(ip) <= 0:

        sleep(1)

        ip = get_my_ip()

 

def get_time():

            dt=int(run_cmd(TIME_CMD))

            return dt

 

def show_sysinfo():

    while True:

        cad.lcd.clear()

        #cad.lcd.write_custom_bitmap(time_symbol_index)

        #cad.lcd.write(":{}".format(get_time()))

 

        #cad.lcd.write_custom_bitmap(photo_symbol_index)

        cad.lcd.write(":{}images ".format(get_photo_count()))

 

        cad.lcd.write_custom_bitmap(memory_symbol_index)

        cad.lcd.write(":{}".format(get_my_free_mem()))

        #sleep(UPDATE_INTERVAL)

        exit(0)

 

if __name__ == "__main__":

    cad = pifacecad.PiFaceCAD()

    cad.lcd.blink_off()

    cad.lcd.cursor_off()

 

    if "clear" in sys.argv:

        cad.lcd.clear()

        cad.lcd.display_off()

        cad.lcd.backlight_off()

    else:

        cad.lcd.store_custom_bitmap(temp_symbol_index, temperature_symbol)

        cad.lcd.store_custom_bitmap(memory_symbol_index, memory_symbol)

            #cad.lcd.store_custom_bitmap(time_symbol_index, time_symbol)

            #cad.lcd.store_custom_bitmap(photo_symbol_index, photo_symbol)

        cad.lcd.backlight_on()

        cad.lcd.write("Updating")

        show_sysinfo()

There is a lot of unneeded code in the above, but I couldn't be bothered trimming it down.

 

Both of these python scripts were coordinated using the crontab set as follows

use sudo crontab -e to edit this

* *   * * *  python3 /usr/share/nginx/www/<folder-name>/cap.py

*/5 *  * * * python3 /usr/share/nginx/www/<folder-name>/photostaken.py

 

This runs both scripts at startup, takes and stores one image per minute (or rather, on the minute, every minute), and refreshes the LCD display every five minutes (every time a minute occurs which is a multiple of 5).

 

Now for the TV display. This was controlled using the below php file, which was placed in the folder that contained my scripts, which happened to be a folder in the web server directory.

 

index.php

<?php header("refresh: 10;");?>

<html>

<head>

<title>MERRY CHRISTMAS</title>

</head>

<body>

<?php exec("sudo -u root -S python3 cap.py < pass"); ?>

<Center>

<img src="images/latest.jpg" width="1280" height="960">

</center>

</body>

</html>

‘pass’ is the path to a text file containing your sudo password. This means you can run it even though it required sudo access.

 

This particular code runs the python code to capture/name/save an image, and displays an image. If using this code, the line relating to cap.py in the crontab is not really required.

 

 

So what about this video?

Initially you see the physical setup, then the LCD display, a timelapse generated from some images taken using the python code (and turned into a movie using mencoder), and finally a few snippets of NYE. I didn’t have the pi capturing the party though.

 

VIDEO TO COME WHEN I GET ONTO MY OTHER COMPUTER

Today was the day "The Ultimate Raspberry Pi Bundle" RoadTest closed.

Now, morning rolls around and they have not been announced yet.

No problem there.

 

Thanks to me still being a student, I had some time to check the site during my spare time.

 

Then it hit me.

 

I was selected for the roadtest. I was ecstatic, and I could not believe it. I am currently contemplating what to do with all this new gear.

Anyways, thanks to the judges who chose me and the other Roadtesters, and I cannot wait to make the world a better place using technology.

 

It is a massive bundle, and I am extremely grateful that Farnell/Element14 have the generosity to allow us to have such an opportunity.

The next post will be when everything arrives in the mail, which I will then post an unboxing video and explain my plans.

 

Again, thanks to Farnell and Christian DeFeo and crew for picking us lucky souls.

To those who did not get in, I urge you to apply for another roadtest!

 

Cya all around, engineers!

Thanks to element14's RoadTest program, I managed to get my hands upon a Raspbmc bundle. I can definitely say that it has bought much smiles to my face, as I appreciate the value and flexibility afforded by the open source media centre software XBMC. While the bundle has almost everything you need as a foundation for a media centre, if you don't dare to venture past what is provided, you might never come to fully appreciate the flexibility and power that lies within.

 

In this blog post, I will try to cover some of the things you might want to consider to complete and add the finishing touches to your Raspbmc based media centre.

 

What do YOU need in your system?

I think the first thing you should consider is your actual needs. The Raspbmc kit is not for everybody, as it does take a bit of patience to use (due to the slightly underpowered nature of the Raspberry Pi) and requires a bit of tweaking to establish a stable, optimized configuration for your needs.

 

If what you need is a basic media centre to play a very limited number of formats, but you need it to be simple, reliable, aesthetically pleasing and stable out of the box - maybe you should consider a dedicated commercial media centre. These although limited will offer you the simplicity which you're looking for. If you need something that will drive TV tuners, do your TV recording for you, serve large banks of hard drives filled with media content or to play Blu-Ray content on a regular basis, then you are probably better served by a Home Theatre PC.

 

The Raspbmc kit serves the niche which sits in-between the two. Maybe you have a smaller media library, in a variety of formats. Maybe you want some flexibility, but don't want a full-blown home theatre PC. You might also be a more advanced user, one who is willing to approach configuration settings to tweak things to their liking. If so, then you're just the person who would appreciate the kit.

 

Once you have established that the Raspbmc kit is right for you, it's time to think about which accessories you will need. Part of doing this will involve envisioning usage scenarios. Remember that your Raspbmc setup can be completely different from anyone else's in order to meet your needs!

 

Ideally, my home theatre set-up will be to my HDMI based TV, and will allow the use of USB connected storage (bus powered hard drives, self-powered hard drives and USB flash drives) as well as networked streaming. I'd probably opt for wireless initially, with a view to transfer to wired once I get the cabling in. As my room is fairly big, I will probably need a USB extension lead to keep the keypad receiver in range.

Image-1.jpg

Knowing this, I would definitely need to consider purchasing a powered USB hub to provide the power to the drives, an USB extension lead for the keyboard receiver, and a Wi-Fi card. Additionally to this, purchasing a case for the Raspberry Pi is also a good idea.

 

Other users may find it necessary, depending on their needs, to purchase HDMI to DVI cables for monitors, HDMI to VGA adapters (for older monitors and TVs), powered speakers (say, for use with the 3.5mm audio output with connectivity that doesn't include audio), longer Ethernet leads or an Ethernet switch to hook up several Ethernet based devices in the home theatre cabinet or even external optical drives to play content directly from optical disc. They might also wish to upgrade or change their remote control setup and opt for a different keyboard/mouse set-up which they prefer.

 

It's important to visualize exactly how you will use the system to ensure you have the hardware you need to implement it (or that you know that you will need to get it). The Raspberry Pi itself will not be able to power bus-powered drives and is likely to reboot upon hot-plugging of any USB devices into its downstream ports, hence the recommendation for a quality powered hub (preferably one which does not back-feed the Raspberry Pi with power, otherwise you may see strange behaviour and SD card corruption).

 

Something else you will probably need depending on your media library are optional codecs from the Raspberry Pi store. These keys are tied to the CPU serial number and may be purchased in order to enable hardware-based decoding of MPEG-2 and VC-1 codecs and are inexpensive. I recommend that you purchase these if you wish to watch such content (e.g. if you have DVDs you wish to play through it, or MPEG/TS recordings, or Blu-Ray images).

 

Configure It Up!

Plugging the system together is pretty easy as you can tell from my RoadTest, however, configuring it up takes some time. Here are some common configuration tasks which you might want to look at in order to get the most out of your system:

 

Raspbmc Settings Applet

This applet provides you access to many of the settings which are specific to the Raspberry Pi distribution. The first thing new users to the kit should do is to start by ensuring you have reliable network connectivity and selecting Update Now, and OK. Allow Raspbmc to reboot.

 

The update process will take about 20 minutes on the first time, and will result in a loop of reboots. Don't worry. This is normal. Just be patient and wait for it to complete - if you don't, you may break your installation.

 

Once it has finally settled down, settings you will likely want to change inside the applet include:

- Your wireless adapter's SSID, encryption mode and encryption key settings

- Overclocking Settings (Pre-set or Custom)

- Codec License Keys (enter them in the dialogue to enable use of the decoders)

- Services which are enabled

 

System Settings

Other than that, there is a plethora of system settings available under the System -> Settings dialogue which are worthy of mention. Likely settings you would change are:

- Video Output Resolution and Refresh Rate

- Video Calibration (allows you to move subtitles, compensate for overscan so that your edges aren't cut off and correct for pixel aspect ratio)

- Audio Output type

- Device Name

- Services (e.g. Airplay)

- Power Saving/Sleep settings

- Time-zone/Locale/Language

- Weather Location

- Add-ons

- Skins

 

Config.txt

On the first FAT partition of your SD card (by default, mounted first when plugged into a desktop machine), there is a configuration file called config.txt which holds many settings which may be tweaked. Adjusting settings related to HDMI modes may be necessary in some cases to get some adapters going. If you can see the screen, you will not likely have to deal with it at all, but if not, do give some settings a tweak. A full list of settings are included here.

 

Parameters worth being aware of include that which are related to overclocking - for example, if your Pi will not boot anymore, you may remove this from your config.txt and have it "return to life" without losing everything. Likewise, if you get some noise or sync difficulties, playing with config_hdmi_boost may increase the signal drive sufficiently to enable longer cables to be driven.

 

For example, after some hard pushing at custom overclocking, adding my licenses in, this is what my config.txt looks like:

configtxt-settings.jpg

 

I've made a pretty basic video walking through some of these menus (by no means complete) just to show my system in action, however, this was taken really early on (so I hadn't even got the video calibration completed at that time), and nor did I get around to putting in that powered hub yet. Rest assured, now I can see from edge to edge on the screen!

(Please bear with me - I'm on a slow connection, and the video may still be uploading when you view this post - ETA is ~25 minutes from post time)

 

Don't be afraid to explore and tweak some of these settings, and keep Raspbmc up to date for the latest bug fixes and new features.

 

Update: I've put up another video which covers Advanced Overclocking, Video Calibration and Airplay - which works. I've also managed to get Live TV streaming from my mumudvb as well (via IPTV Add-on, although not video).

 

Mix it Up

The best part of the whole Raspberry Pi experience is that it's not all or nothing. If you don't like Raspbmc, you can try OpenELEC, another XBMC based media centre built for the Raspberry Pi (amongst others). It's as simple as re-imaging the card by downloading an image off the Raspberry Pi Organization's website and writing it to your card using dd (under Linux) or W32DiskImager (under Windows). If you don't want to use it as a media centre, you can explore many other options which are opened to you in the embedded form factor.

 

In Closing

Raspbmc based media centres can come in a variety of different shapes and sizes. If you're interested in getting one going and want to read a few more tips, check out my RoadTest review of the kit offered by element14, or visit my personal blog for more random technology posts.

 

---

Thanks to element14 for providing the unit for review and for their support of the community.

The holidays are over and it's time to have some maker fun!  Get ready for my next adventure starring Raspberry Pi....

 

Original Goal:

The original goal I set out to achieve was to find a media center application that would keep my kids and those of my new years party guests entertained. The application need to be intuitive, stable and engaging.

In order to achieve this I set out to test the major players in this area, namely,

  • RaspBMC
  • GeeXBOX
  • OpenELEC
  • RasPlex

 

Outcome:

 

The detailed review of these OSes is contained in the previous blogs.

 

The outcome of these test was that the best candidate for my Raspberry Pi babysitter was OpenELEC.

 

Implementation:

The entire kids DVD collection (mine and others) was ripped and stored on to my NAS. This ensured the DVDs weren't going to be scratched on the night. The Raspberry Pi was hidden in the lounge room close to the TV and the wireless keyboard given to eldest child. The parents then ventures out to the back deck and left the kids alone. The Raspberry Pi babysitter did its job very well. The only issues on the night were the occasional fight to sort who's movie should be watched next.

 

Videos:

Since I didn't feel it was a good idea to further pollute YouTube with my sub-standard videos. I thought it more worthwhile instead to find some good videos that highlight the OSes tested above. So to clarify these are not my videos.

 

Before I begin

I realize that some people may feel very passionate about a certain brand of XBMC on their Raspberry Pi, and I would like to make it very clear that what is written here is my own personal experience with these Operating Systems (OSes). My experience could very easily differ from the one you have had.

 

In this comparison I have used the latest currently available version version of

  • RaspBMC (Latest as of the 1/1/2014),
  • OpenELEC (v3.2.4), and
  • GeeXBox (v3.1)

 

XBMC in General

Since the interface provided by each of these OSes is XBMC. I will begin this comparison with the features that all of the above OSes provided.

XBMC was originally an attempt to recreate the XBox Media Center, however I believe is has not only succeed, but superseded the original. XBMC is a media center (MC) application that has the ability to index your media, download associated artwork and information about your media. But most importantly, organize it in a way, that makes it easy to find, and a joy to watch.

 

Commonality Amongst OSes - Boot Screens

 

Each Os provided its own unique set of boot screens, so I guess that is not really something they had in common. But, they each had one.

RaspBMC

2014-01-01 08.36.06.jpg

Figure 1: RaspBMC boot screen. Not a very exciting boot screen and out those reviewed, it would have to be the worst.

GeeXBox

2014-01-06 19.01.37.jpg

Figure 2: The GeeXBox boot screen. This clearly shows that the grunt behind this OS is Linux.

 

OpenELEC

2014-01-05 19.21.21.jpg

Figure 3: The OpenELEC boot screen. A very nice boot screen.


Commonality Amongst OSes - The XBMC Application

Each of the Oses used the XBMC application as their primary application, each began with a similar setup application which was set out in exactly the same way. However GeeXbox incorrectly labelled the WifI  security WPA2-PSK as WPA. This added a few minutes of confusion. All of the OSes supported the AUS Pi Wifi dongle and once the network was set up the RSS feed scrolled across the bottom of the screen.

 

Next thing to do was to connect the Raspberry Pi to my NAS, and get it to index my media. Once some media was index I took the system for a spin.

 

2014-01-05 09.28.57.jpg

Figure 4: Home screen (Confluence Skin)

 

2014-01-05 20.12.12.jpg

Figure 5: The Weather screen (Confluence Skin).

2014-01-05 19.57.59.jpg

Figure 6: Movie Selection Screen (Aeon NQX Skin).

2014-01-05 19.59.29.jpg

Figure 7: Movie playing in full screen mode.

2014-01-05 20.01.25.jpg

Figure 8: Home Screen with a Movie playing in the background (AEON NQX Skin).


2014-01-05 21.28.16.jpg

Figure 9: XBMC Configuration Screen (AEON NQX Skin)

 

The ease of use of XBMC is remarkable, it is so easy to set up and most of it takes care of itself. The concept of skins is also a nice feature, the entire look and feel of XBMC can change in an instant. All of the OSes tested had the same features and add-ons and they didn't differ by much in that aspect. However, RaspBMC and GeeXbox did have limited Airplay functionality, allowing only audio connections and not video. So when you threw a video to them from an iOS device only the audio played. But the major characteristic that really set these OSes apart was their responsiveness.

 

What set them apart- Quantitative Measures

 

The first difference you notice between the Oses is there boot times.

 

OSBoot Time (From power on to XBMC Interaction)
RaspBMC50.6 seconds
OpenELEC37.8 seconds
GeeXbox38 seconds
Boxee Box (commercial comparison)25 seconds

 

All these OSes were tested using a 8Gb Class 6 SD Card, when I booted RaspBMC on the card supplied by Element14, it took 1 minute and 37 seconds to boot. So having a fast SD Card is really important, if you want to get the most out of these MC applications. In future I shall be purchasing a class 10 SD card.

 

What set them apart- Qualitative Measures

 

So once the OSes have booted, and boot times aren't really a major issue, as you can turn it on in advance of requiring it. The major impact factor is how smooth the interaction is with XBMC. I began with RaspBMC and also came back at the end to test it once more. I thought I had better confirm my experience with this OS before putting pen to paper (words to text box). RaspBMC was very disappointing, I became very frustrated using this OS. Navigating the Home Screen had responsiveness issues. At least half a second latency existed between button presses and graphical responses. This was not there in either GeeXBOX or OPENELEC. These latencies were scaled on later events. If GeeXBOX or OpenELEC had a one second delay on completing a task, then RaspBMC had a two second delay. My frustration peaked after having to type things in multiple times as RaspBMC would drop letters. Out of the three OSes this was the most disappointing. I have a feeling that RaspBMC needs some more work on its kernel, the responsiveness of the system really lets it down. However it installation is really straight forward and simple.

 

When it came to OpenELEC and GeeXBOX, there was very little between these two, there responsiveness was equally matched. The interface responded nicely to button presses and artwork loaded up very quickly when media was selected (even over a WiFi connection). However, the one thing that did disappointed me with GeeXBOX, was the seemingly out of date setup add-on and many other add-ons. It was missing many of the features of the other OSes and had improperly labelled options. Installation of this OS also required a bit of work. The SD card had to formatted, partitions made and tar balls extracted. Not the kind of thing a beginner should be doing.

 

I find it difficult to find fault with OpenELEC. Not only was this OS responsive, it appear to be running newer versions of many of the add-ons, including the setup. OpenELEC also had an installation script that could be run under Linux. This made the installation process extremely easy. My experience with OpenELEC was very pleasant.

 

Conclusion

If your going to install a media center application on to your Raspberry Pi, save yourself a lot of heart ache and tears and just install OpenELEC.

 

To Complete this four part blog head over to "New Year’s Party Pack - To entertain the masses or just babysit the kids - Concluding Remarks"



Project Description

 

This is my interpretation and approach to the Catch Santa project for the Catch Santa & Pi NoIR RoadTest (http://www.element14.com/community/roadTests/1220?CMP=SOM-ROADT-PINOIR-CATCHSANTA).

 

I divided the project in different parts:

  • Installation: get everything up and running
  • Detection: detect movement and log it
  • Activation: Ensure the system can be (de-)activated
  • Notification: notify me when movement is detected
  • Visibility: the security system should be subtle and not easily noticeable


All of the above wrapped in a Christmas theme ...

 

Installation

 

First off, I started with the assembly and installation of the components provided for the RoadTest.

 

The kit contained following components:

photo 1 (1).JPG

 

Hardware

 

The SD card, WiPi dongle and PiFace were straightforward to connect to the Raspberry Pi. The enclosure was a different story though.

 

There were no instructions provided on how to assemble the case for the Raspberry Pi with PiFace C&D and Camera. Even though the case consists only of two pieces, it was slightly more tricky than expected. After fiddling with the case for some minutes, I searched for instructions and found the following guide:

 

http://cpc.farnell.com/images/en_CC/PiFacecontrol&displayinstructions.pdf

 

Making use of those instructions, assembling the case went smoother.


I also had the pleasure to work with a lovely assistant: my 3,5 year old daughter.

She helped me put the different bits together. A fun introduction to electronics!


image.jpeg


image (1).jpeg

 

The result: a very good looking Pi!

photo 3.JPG

 

Software


With the hardware connected, it was time to move on to the software portion of the project.

 

Raspbian

 

Using the preinstalled NOOBS SD card, getting the Pi up and running was a piece of cake:

  • boot the pi with the provided NOOBS SD card
  • select the desired distribution to be installed >> I chose Raspbian
  • installing Raspbian took approximately 10 minutes
  • after installation, the pi was rebooted and the freshly installed OS started

 

Once installed, Raspbian presented me with the "Raspberry Pi Software Configuration Tool". This allows to configure certain settings or perform certain actions more easily.

 

I have used this tool for several things:

  • expand filesystem, in order to use the full size of the SD card: this is already covered automatically by the NOOBS installation
  • enable the camera module
  • enable SSH access
  • upgrade the software to the latest version
  • enable SPI (required for PiFace, option was only available after upgrading to latest version)

 

WiPi

 

Installing the WiPi to allow wireless connectivity was easy: plugged in the stick, configured the network interface and I was good to go.

 

I edited my /etc/network/interfaces file over the wired network via SSH as follows:

 

pi@santaCatcher ~ $ sudo nano /etc/network/interfaces 

iface wlan0 inet static
        address 192.168.0.150
        netmask 255.255.255.0
        gateway 192.168.0.1
        dns-nameservers 195.130.130.2,195.130.131.130
        wpa-ssid “ssid"
        wpa-psk “password” 





                      

 

I chose a fixed IP address in order to always know on exactly which IP I can reach the Pi.

 

Pi Camera

 

After enabling camera support via the "Raspberry Pi Software Configuration Tool", the camera was ready to be used.

 

You can find more information and detailed instructions in my Pi NoIR RoadTest review: http://www.element14.com/community/roadTestReviews/1638

 

PiFace CAD

 

I installed the necessary software dependencies and modified the appropriate configuration files to get the PiFace CAD up and running by following the instructions provided.


User guide can be found here: http://www.element14.com/community/community/raspberry-pi/raspberry-pi-accessories/controlanddesign

 

Implementation

 

This part covers my "development" done on top of the standard installation as performed in previous steps.

 

I have split it in the different areas involved in the project, in an attempt to keep everything clear.

 

Detection

 

In order to detect and capture Santa on film, I used the Pi NoIR in combination with the “motion” application.

 

This application makes use of the camera to detect movement. When movement is detected, it starts recording until all motion stopped and generates a still image of the moving object/person.

The camera stream can also be visualised remotely as a live stream, using the pi's wireless connectivity with WiPi.

 

There was a post on raspberrypi.org not so long ago where someone used the Pi, in combination with the camera and motion to create an affordable security system.

Instructions were clearly documented and easy to follow and can be found here: http://www.codeproject.com/Articles/665518/Raspberry-Pi-as-low-cost-HD-surveillance-camera

 

Using those instructions, I managed to set up motion properly. The installation and configuration were tested by accessing the live stream via http://<ip_of_pi>:8081.

 

Activation

 

Enable/Disable motion picture and movie generation

 

Since for this challenge the system was going to be used indoors (in the living room more precisely) and I didn't want it to keep recording and logging all day, I came up with a way of enabling/disabling the image and video output of the motion application.

 

Motion offers a web interface to modify the running configuration of the application. Unfortunately this didn't seem to rewrite the configuration file, meaning a restart of the application would lose the changes made.

In order to have my config changes persisted, I decided to use the "sed" command to find and replace certain patterns in the motion config file and restart the application to apply.

 

There are two parameters I was interested in persisting:

 

  • output_pictures: generate a still image of the object/person moving
  • ffmpeg_output_movies: generate a movie as long as there is movement

 

Initial config file state for relevant parameters:


pi@santaCatcher ~ $ cat /etc/motion.conf | grep -e output_pictures -e ffmpeg_output_movies

output_pictures best
ffmpeg_output_movies on





                      

 

Then, using "sed" I search for those parameters (and respective value) and replaced them with the new value. In this case, turn off picture and movie generation:


pi@santaCatcher ~ $ sudo sed -i -e 's/output_pictures.*/output_pictures off/g' -e 's/ffmpeg_output_movies.*/ffmpeg_output_movies off/g' /etc/motion.conf





                      

 

Verifying the changes have been applied:


pi@santaCatcher ~ $ cat /etc/motion.conf | grep -e output_pictures -e ffmpeg_output_movies


output_pictures off
ffmpeg_output_movies off





                      

 

Finally, to change from off to on:


pi@santaCatcher ~ $ sudo sed -i -e 's/output_pictures.*/output_pictures best/g' -e 's/ffmpeg_output_movies.*/ffmpeg_output_movies on/g' /etc/motion.conf





                      

 

Verifying the changes have been applied:


pi@santaCatcher ~ $ cat /etc/motion.conf | grep -e output_pictures -e ffmpeg_output_movies


output_pictures best
ffmpeg_output_movies on





                      

 

LCD message

 

As a visual indication of the system being (de-)activated, I wanted to display a message on the PiFace's LCD screen.

 

I started off by using an existing example (sysinfo.py) and edited it. Following parts of the example script were most relevant to my project:


import pifacecad #piface cad library
cad = pifacecad.PiFaceCAD() #create piface cad object
cad.lcd.clear() #clear all text
cad.lcd.write("") #write something





                     


Script

 

Next, I combined the "sed" and the LCD display commands into a single script which could be called with one parameter: "on" or "off"

 

I'm a Python novice, so I'm not familiar with best practices and so on. There are however many tutorials to be found on the web. This is the script I came up with:

 

import os
import sys
import pifacecad
from time import sleep

status = sys.argv[1]

cad = pifacecad.PiFaceCAD()
cad.lcd.blink_off()
cad.lcd.cursor_off()
cad.lcd.clear()

def activate(cad):
  cmd = "sudo sed -i -e 's/output_pictures.*/output_pictures best/g' -e 's/ffmpeg_output_movies.*/ffmpeg_output_movies on/g' /etc/motion.conf && sudo /etc/init.d/motion restart"
  execute(cmd)
  writeLcd(cad,"System\n   activated !")
  sleep(10)
  clearLcd(cad)

def deactivate(cad):
  cmd = "sudo sed -i -e 's/output_pictures.*/output_pictures off/g' -e 's/ffmpeg_output_movies.*/ffmpeg_output_movies off/g' /etc/motion.conf && sudo /etc/init.d/motion restart"
  execute(cmd)
  writeLcd(cad,"System\n   deactivated !")
  sleep(10)
  clearLcd(cad)

def execute(cmd):
  os.system(cmd)

def writeLcd(cad,msg):
  cad.lcd.backlight_on()
  cad.lcd.write(msg)

def clearLcd(cad):
  cad.lcd.clear()
  cad.lcd.backlight_off()

if status == "on":
  print "Activating"
  activate(cad)
elif status == "off":
  print "Deactivating"
  deactivate(cad)
else:
  print "Invalid value"





                     


Remote (de-)activation

 

As I planned on hiding the setup somewhere subtle and perhaps not easily accessible, the (de-)activation should be possible remotely (without the need for a computer).

The IR receiver of the PiFace came in handy for that purpose: using the TV's remote control I wanted to trigger the script above by entering a specific key combination.

 

The documentation of the PiFace CAD provides instructions on how to setup a remote to interface with it.

 

Using the link provided in the instructions, I was able to find a configuration file for the remote I was planning to use.

I downloaded the config, renamed and moved it to the correct location:

 

pi@santaCatcher ~ $ wget http://lirc.sourceforge.net/remotes/telenet/DB-AD110
pi@santaCatcher ~ $ sudo cp DB-AD110 /etc/lirc/lircd.conf





                     


By running the “irw” application, I tested the numeric buttons to verify the mapping.

The button presses were properly detected, but sometimes resulted in repeated values (pressing KEY_1 once would trigger two events):

 

000000000000001b 00 KEY_1 Telenet_DB-AD110
000000000000001c 00 KEY_2 Telenet_DB-AD110
000000000000001c 01 KEY_2 Telenet_DB-AD110
000000000000001d 00 KEY_3 Telenet_DB-AD110
000000000000001e 00 KEY_4 Telenet_DB-AD110
000000000000001f 00 KEY_5 Telenet_DB-AD110
000000000000001f 01 KEY_5 Telenet_DB-AD110
0000000000000020 00 KEY_6 Telenet_DB-AD110
0000000000000020 01 KEY_6 Telenet_DB-AD110
0000000000000021 00 KEY_7 Telenet_DB-AD110
0000000000000022 00 KEY_8 Telenet_DB-AD110
0000000000000023 00 KEY_9 Telenet_DB-AD110
0000000000000023 01 KEY_9 Telenet_DB-AD110
0000000000000024 00 KEY_0 Telenet_DB-AD110  





                     

 

I then created a lircrc config file meant to listen for specific keys or key combinations and trigger an action depending on the combination.

 

My config is as follows:

 

pi@santaCatcher ~ $ nano ~/.lircrc

begin
        prog = irexec
        button = KEY_1
        button = KEY_2
        button = KEY_3
        button = KEY_5
        button = KEY_6
        config = sudo python /home/pi/santaCatcher.py on
        repeat = 0
end
begin
        prog = irexec
        button = KEY_1
        button = KEY_2
        button = KEY_3
        button = KEY_6
        button = KEY_5
        config = sudo python /home/pi/santaCatcher.py off
        repeat = 0
end





                     

 

Specifying the "button" parameter multiple times allows to check for combinations. In above config it checks for following combinations: "12356" and "12365"

Sometimes key presses result in duplicate values (pressing the "1" button could result in a "11" being received. To ignore duplicates, the "repeat = 0" is used.

 

To be able to listen, the "irexec" application should be running. To ensure this is done at startup, I added an entry to "/etc/rc.local" to do just that:

 

pi@santaCatcher ~ $ sudo nano /etc/rc.local

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

sudo -u pi irexec -d

exit 0





                    


After these changes, I was able to remotely configure the "motion" application to generate pictures and movies or not.

 

Demo

 

The different elements of the "activation" part of the project can be witnessed below:

 

Santa Catcher - Remote activation

Santa Catcher - Remote deactivation

 

Notification

 

I split the notification into following parts:

  • offer content via webserver
  • periodic checks for new content
  • send email (via gmail) with links to new content

 

Webserver

 

Offering the media files generated by "motion" via a webserver is straightforward.

 

I started by installing apache webserver:

 

pi@santaCatcher ~ $ sudo apt-get install apache2

 

Once installed, I linked the media folder where "motion" stores the media files to the a folder on the webserver by using a symbolic link:

 

pi@santaCatcher ~ $ sudo ln -s /path_to_media_files/ /var/www/media

 

The files were then accessible by browsing to http://<ip_of_pi>/media

 

Check new media

 

In order to notify me of new content generated by motion and available on the webserver, I had to check for new content first.

 

pi@santaCatcher ~ $ find /path_to_media_files -type f -mmin -5  | grep -e "avi" -e “jpg"

 

Above command returns a list of “jpg" and/or “avi" files which have been modified in the last 5 minutes.

 

Script

 

To allow easy execution of the different checks and the email notification, I created another Python script which:

  • check for new media content
  • if new content is available, generate an email with links to media on webserver.

 

The script:

 

pi@santaCatcher ~ $ sudo nano santaCatcherNotifier.py


import subprocess
import re
import smtplib
from email.MIMEText import MIMEText

def sendMail():
  gmail_user = "sender@gmail.com"
  gmail_pwd = "password"
  FROM = 'sender@gmail.com'
  TO = ['recipient@mailprovider.com']
  SUBJECT = "SantaCatcher: Movement detected"
  TEXT = "SantaCatcher detected movement. Evidence below:\n\n" + content

  # Prepare actual message
  message = """\From: %s\nTo: %s\nSubject: %s\n\n%s""" % (FROM, ", ".join(TO), SUBJECT, TEXT)

  try:
  #server = smtplib.SMTP(SERVER)
  server = smtplib.SMTP("smtp.gmail.com", 587)
  server.ehlo()
  server.starttls()
  server.login(gmail_user, gmail_pwd)
  server.sendmail(FROM, TO, message)
  #server.quit()
  server.close()
  print 'successfully sent the mail'
  except:
  print "failed to send mail"

content = ""
cmd = subprocess.Popen('find /tmp -type f -mmin -5 | grep -e avi -e jpg', shell=True, stdout=subprocess.PIPE)

for line in cmd.stdout:
        line = re.sub('/tmp/','http://192.168.0.150/media/',line)
        content = content + line

if content != "":
        sendMail()





                   

 

The code to send an email via gmail in Python was found here: http://stackoverflow.com/a/12424439

 

Periodic check

 

Above script needs to be executed to trigger the new media check and possible mail notification.

 

This was tackled with a cron job which executes the script at regular intervals. In my case I aligned the new media check and the cron job to a 5 minute interval.

 

pi@santaCatcher ~ $ crontab -e

# m h  dom mon dow   command
*/5 * * * * python /home/pi/santaCatcherNotifier.py





                  


The expression can easily be modified to check at different intervals.

 

Demo

 

Having all notification elements in place, a small test was in order. The output mail looks like this:

 

Screen Shot 2014-01-02 at 14.30.10.pngEmail example

 

Visibility

 

The best place to hide my Santa Catcher was the Christmas tree itself, as that is the place Santa is heading for.


As I cannot just throw the Pi and camera in the tree, I created some ornaments and had my daughter decorate them. This was a fun and creative way of involving her in the project.

 

photo 2 (1).JPGDrew the shape on some pieces of wood.

 

photo 3 (1).JPG

Cut out the shapes, ready for painting and decoration.

 

photo 4.JPG

Artist at work.

 

photo 5.JPG

Painting: done.

 

photo 2 (2).JPG

Massacred the wood when cutting and drilling ...

 

photo 3 (2).JPG

The decorated result.

 

photo 4 (1).JPG

End result with Pi installed at the back.

 

photo 5 (1).JPG

Can you spot the Pi ?


With everything ready, it was just a matter of patience and not forgetting to activate the system before going to bed on Christmas eve.


Caught ... something


The system worked, and it triggered a notification. The only thing is, we didn't seem to have gotten Santa on film.

Instead, all we got is what appears to be one of Santa's little helpers sneaking in our living room, heading towards the Christmas tree.

 

This is the evidence (captured using Pi NoIR & motion):


01-20140101154402-00 copy.jpg

The curtain is opening, triggering "motion" to start recording


Santa Catcher - Little helper caught on film



Background

The Plex project has been around almost as long as XBMC and was a fork of the original XBMC project. The focus of the Plex project was to give users a complete media center solution.

Plex is generally considered by the Plex community as a superset of XMBC, meaning it is everything that XBMC is, plus heaps more. Like XBMC, Plex indexes your media and downloads the cover art and associated text from IMDB for your movies and TV shows. It downloads the the theme music also. So while your browsing which TV show to watch next, the theme music is blaring through the speakers. I am sure the same functionality can be provided by XBMC via an add-on, but this is provided out of the box.

 

With XBMC the media server and the client exist on the same platform. This has both advantages and disadvantages. Having the server on the same platform reduces latency when browsing media. However if you have a fast network, then this is not a big issue. The biggest advantage of splitting the two systems is that you can have a centralized media server, providing media for multiple thin clients. Therefore only one media server needs to index your media and not a heap of media servers with local copies of the media index.

 

Plex Server

So in order to use RasPlex, you will required a Plex Server. The server can be downloaded for free from the Plex site (https://my.plexapp.com/). It is free and can be installed on many PC platforms (Windows, MAC, Linux, FreeBSD). It can also be downloaded to many NAS platforms also, like Synology DSM. When I firstly set up my Synology DS1813+ NAS, I installed the Plex server. It was available via the Synology DSM desktop and as simple as clicking a button. Running the Plex Server on the  NAS that houses your media frees up your network bandwidth and reduces network latency. Once the Plex server is up and running and configured (via a wed interface), you are then able to access your media via a thin Plex client. You can purchase  a Plex client for any android or iOS based platforms via Google Play or the Apple App Store respectively. I currently run the Plex app on both my Sony Xperia phone and my iPad.

 

Plex on the Raspberry Pi

The Plex client that is available for the Raspberry Pi is called RasPlex. I recommend you head over to the  website, to get hooked up with this OS (http://rasplex.com/). You need to be aware that this is a beta project so it isn't 100% complete just yet. But they are eager for beta testers, the more the merrier. The installation is fairly straight forward. Being a MAC user, I downloaded the MAC version of the installer. The installer is written in python, so I believe it is the same installer as the Linux one.

Install1.jpgInstall2.jpg

Figure 1: Installer DMG (left) and the installer GUI including terminal in the background (right).

 

The installer will require an administrator password and the destination SD card inserted (via a USB SD reader). Clicking a few buttons on the installer gets the image written to the SD card. Even thought the installer is in its Beta version, it was very nicely polished.

After transferring the SD card to the Raspberry Pi it was time to test the systems performance. RasPlex was tested on a Model B Raspberry Pi using a WiFi link (See New Year’s Party Pack - To entertain the masses or just babysit the kids - Introduction for details).

 

Boot

Boot times -

          Version 9.9.16 (Bleeding Edge Experimental) : 1 minute to 1 minute 20 seconds.

          Version 0.3.1 (Stable) : 1 minute flat

 

2014-01-02 20.17.42.jpg2014-01-02 20.10.37.jpg

Figure 2: The boot screens: primary boot screen (visible for the first 10 seconds) (left), the main boot screen (right).

It needs to be said that the first boot is by far the longest and subsequent boots are much quicker. The boot times mentioned above represent the average boot time not including the first boot.

 

Plex Client

2014-01-02 20.12.32.jpg2014-01-02 20.14.34.jpg

Figure 3: Initial Configuration Screens: Wifi Network selection (left), MyPlex login screen (right)

2014-01-02 20.50.31.jpg

Figure 4: Home Screen: Scrolling up or down can select the various media options.

2014-01-02 21.01.12.jpg2014-01-02 21.02.51.jpg

Figure 5: Movie based screens: Movie overview (left), Movie playing (right).

2014-01-02 20.50.56.jpg2014-01-02 20.49.57.jpg

2014-01-02 20.55.23.jpg2014-01-02 20.56.22.jpg


Figure 5: TV Show based screens: Hovering on the TV show link (top left), TV series selection page(top right), 

                    Season selection (bottom left) and, Episode choice screen (bottom right).

 

Conclusion

Even though version 9.9.16 is experimental and claimed to be almost polished enough to be version 0.4. It was still fairly obvious that more work need to be done before it could be considered stable. Both the experimental and stable versions tested, show great promise. However neither were at a level suitable to be used as a stable responsive media center operating system. The time between buttons presses and media center responses were a little on the large side for my liking. But I would like to make it very clear that this is a beta version that appears to be very infant. With this in mind I will be keeping an eye on this project as it shows great promise once the latency issues and minor bugs are overcome. So in the short term not my choice for the Raspberry Pi babysitter's OS, but in the future who knows. If this level of progress continues in this project, then it could very easily be the OS of choice for media centers in the future.

 

Continue this Raspberry Pi media center journey with "New Year’s Party Pack - To entertain the masses or just babysit the kids - XBMC: RaspBMC, OpenElec and GeeXBox go head to head"

Filter Blog

By date: By tag: