Friday, August 2, 2013

MagPi 15 is out and it’s a good ‘un

MagPi 15 is out now. As usual it’s so full of Raspberry Pi goodness that I don’t know where to start: build a custom OS; XML; AdvMAME; our good friend James H riffing on camera stuff; real time clock; Arduino; RiscOS and more.

I insist that you download it immediately and soak it up like a nice big mug of beef tea.

A cover like this needs a  soundtrack. You have our permission to weep with nostalgic joy until your tear ducts dessicate.

New Asus MeMo Pad HD 7 is a Nexus 7 Alternative for $149

Asus has been busy making 7-inch tablets lately. Not only do they provide the hardware for the 2nd generation Google Nexus 7 that was released last week, they are also releasing a new 7-inch tablet under their own brand name called the ASUS MeMO Pad HD 7. You may recall that Asus released a similar [...]

Guest post #2: Peeping Tom in the toilet with Raspberry Pi

When Jeroen Danckers sent us a blog post with that title he was on to a winner. And let’s face it, who hasn’t dreamed of putting a computer in the toilet connected to a camera that reports back to a web page whether the toilet is occupied or not. I have.


There's all kind of people running around at our digital agency (Intracto, Belgium). Not only in numbers, but also in all weird forms and shapes. A simple discussion during lunch break about busy toilet usage quickly ends up in high-tech cut ‘n’ paste with webcams, Raspberry Pi and PHP trickery. So now we can check online whether our toilet is taken or not. :)

Should I stay or should I go?

The trick with the webcam
The system behind our little project has already been the subject of lively discussion amongst our competitor/colleagues of the Belgian web sector. Farfetched solutions like a pressure sensors under the toilet seat or little gnomes in a cage with a switch are sadly not true.

In all its simplicity we put a webcam in our toilet. It luckily doesn't shoot any compromising images, but measures the light intensity instead. The cam takes a boring shot of the wall in the front hall and then grants a brightness value to each pixel with PHP-GD.

From those -100 or +100 values we calculate the average, which determines if the toilet is taken or not. Almost dark means no toilet action and a lot of light probably means 'danger zone in action'. Or the cleaning lady is making her rounds.

And it also lets you play Tetris while you are otherwise engaged.

Technical set-up Toiletcam
We connected a USB-hub to the Raspberry Pi, which functions as a power source. Additionally we connected 2 USB webcams to take the pictures (2 toilets) and a USB-stick on which we installed the OS. Lastly we plugged in a SD-card to boot the Raspberry Pi.

The calculation of the state of the toilet happens like this:

  1. Linux-application Streamer takes a still with the webcam and saves it.
  2. Through PHP-GD the light intensity (brightness) of the pixels gets calculated. The average of these values determines the state of the toilet.
  3. This result gets compared to the local cache. Only if there's a difference something happens!
  4. This event gets filed away in a database log.
  5. The script pauses for one second, to give the poor Raspberry Pi some much earned rest. ;-)
  6. Switch toilets, rinse and repeat.

In the same time the Raspberry Pi offers a local website that refreshes each 5 seconds through an Ajax-call, pulls the current states of the toilets and shows them in a nice lay-out.

Surprisingly handy innovations on the working floor
Working at Intracto offers quite a few surprises. In the morning you can moan about the busy toilets on your daily sanitary strolls and in the afternoon the colleagues can already be busy working out a solution to ease the pain.

Next up on our list of innovations is the realtime level of the coffeepot! ;-)