PiPurr – The Remote Cat Interaction Server

PiPurr Server

PiPurr Server

All the best hacks and open-source projects come about by scratching personal itches. In fact when asked by friends and acquaintances “How do I start with coding – what should I write?“, that is my usual answer – “Find something you don’t like or would like to improve and do that“.

This brings us to the idea of PiPurr, what I like to call the Remote Cat Interaction Server.

Whenever we go on holiday, we never really get to relax, because Hannah is always asking me things like “Do you think the cats are OK?“, “What do you think the cats are up to?” etc. PiPurr is the solution to this problem.

The goal is not just to be able to keep an eye on what the cats are doing when away from home, but also to interact and play with them remotely too.

PiPurr is a simple client-server solution. The server runs on a Raspberry Pi, for low power consumption and provides the functionality – capturing images, dispensing treats, making sounds play from the speakers etc, and clients connect to this over HTTP and request those actions.

PiPurr for Android

PiPurr for Android

The server is implemented as a small Python web server, using HTTPServer that, instead of serving static files from a directory, exposes a small number of URIs that correspond to those actions. This means that all that is required to access it is a browser. A summary of the actions are:

  • /cats.jpeg – Capture and return a photo from the webcam. Uses OpenCV.
  • /sound – Play the sound out the speakers to entice the cats over.
  • /treat – Dispense a cat treat – Currently in development, and will use a PicoBorg stepper motor to drive a treat dispenser. Keep a look out for another blog post about this in the future.

The decision to use the (rather large and fiddly to get working on Raspberry Pi) OpenCV for image capture is down to the fact that in the future I am going to write a cat detector, and possibly other vision-based functionality.

A neat addition to the server is the LedBorg, which is an RGB LED add-on, set to flash different colours depending on what happens when requests come in. Red for 403s, 500s etc., green for 200 on the image URI and blue for 200 on the sound URI.

Sharing

Sharing

For ease of use, I also developed an Android client that allows easy access to PiPurr whilst out and about. The app also allows for sharing of the captured images over email, Facebook etc.

I will be adding more functionality to the solution as time goes on. Some of the things I have planned are:

  • / – Implement a web UI to control it easier with a web browser.
  • /laser – Move a laser pointer or similar cat to about with motor control.
  • /video – Stream live video.

I plan to talk about this project at BarCamp Canterbury on the 27th April 2013 if you would like to find out more, or have any cool ideas.

Posted in Hardware, Programming, Software | 7 Comments

Introducing ‘The Sin’: Edd’s YM2612 MIDI Instrument

And because I am a slacker, I forgot to thank matth for the chip holders and Mex for being a Boris. Cheers!

Posted in Arduino, Hardware | 4 Comments

OggCamp 12

OggCamp LogoHere at CantHack, we’ve always been fans of Barcamp type unconferences, and between us we have attended many Barcamps over the years, and have even organised one ourselves.

OggCamp is a Barcamp-like event that focuses on free and open culture that has just hosted its fourth annual event in Liverpool.

Some of us from CantHack had attended last year’s event in Farhham, where we delivered talks on reverse engineering and HGD, and this year two of us (Tris and Han) travelled the long journey to Liverpool to once again spend two days meeting, socialising with and learning from a wide cross-section of the geek community.

RFID

RFID Rhythm Generator

Han was on the crew for this year’s event, which meant early starts and lots of helping out, although that did mean that I got chance to wander around finding talks to go to.

There were so many interesting talks on the schedules that it was impossible to see all the talks that I wanted to.

I did get to watch about many different subjects including QR Codes, OggBox (an open hardware Ogg player) to Nanode (an Arduino clone with built in networking and RF communications, more on that in a bit).

I also really enjoyed some of the more light-hearted talks such as Alex Martindale‘s look at error messages over the years (inlcuding a huge screen showing the Sinclair Spectrum start screen – which brought back many happy memories!), and an interview with Stephen Fry which, although pre-recorded, was very engaging and more interesting than I would have initially thought it would be.

This year’s OggCamp was also the first to feature an Open Hardware Jam, where we witnessed many awesome hardware hacks like an RFID rhythm generator, DIY retro computers, 3D printing and textile hacking.

I also bought myself the awesome Nanode RF, which as mentioned before, is an embedded development platform similar to an Arduino but with integrated Ethernet and an RF transceiver for wireless connectivity to sensor nodes.

Nanode

Nanode

It is sold in kit form so I have all the fun ahead of soldering the components together to make the board. When finished, I plan to hack together some home automation/monitoring with this and a Raspberry Pi. Of course those hacks will also appear here in the near future.

I also took a few photos of the event, which are located on my Flickr page. It’s also worth searching Flickr for ‘oggcamp’ and ‘oggcamp12′ to find more.

Thanks so much to the organisers from Linux Outlaws and Ubuntu UK Podcast, and to Les Pounder for organising the crew! See you all again next year! CantHack will be back!

Posted in Events | Leave a comment

CantHack presents at Digibury.

Digibury

Thanks to everybody who came to Digibury this week, we had a great time and we hope the people who came enjoyed the session. The slides are available below, as well as the light painting pictures you made! I am probably going to reuse the session for TinkerSoc at some point so please leave any feedback you have in the comments with any way I can improve the talk.

Posted in Arduino, Events, Hardware, Programming | 3 Comments

hgdc-x 0.5.3

I know it’s been quite a while since the 0.5.3 release of the hgd server, but I finally got around to completing the latest version of hgdc-x, the cross-platform GUI hgd client. It is compatible with any of the 0.5.x versions of the server.

hgdc-x 0.5.3

hgdc-x 0.5.3

Changes include numerous bugfixes, a redesigned GUI and a better user experience. There are pre-compiled binary versions for Linux, Windows and Mac (Universal binary for Tiger 10.4 and later).

Get it from http://hgdcx.canthack.org

Posted in Programming, Software | 4 Comments

#WolfBot

I would like to introduce WolfBot, a new IRC bot that moderates a game of Werewolf.

Werewolf is a social game in the ilk of Mafia and has become very popular at un-conferences such as BarCamps. There are many rule variants of Werewolf, but this bot probably most closely matches the rules set out in ultimate werewolf, with some changes to make it fit better to IRC, the voting system is slightly different for example.

WolfBot is based on the popular PircBot Java IRC framework. It is a collabrative project between me, Twigathy, and a number of other people. The code is avaliable on github (tpcarlson/Werewolf).

WolfBot is currently playable in #wolfbot on the boredicons irc network and. Use the command “!join” to start playing (please note if there is a game in progress you will have to wait for it to finish before you will get voice in the channel).

This post is a quick follow up to a talk I gave at BarCamp Canterbury, my original slides are available.

Posted in Programming | Leave a comment

BarCamp Canterbury recap.

Barcamp Canterbury Logo

BarCamp Canterbury 2012

Updates on the blog have been a bit thin and far between recently, but that’s because a lot of us have been busy organising BarCamp Canterbury. The event was run a couple of weekends ago (Saturday 28th and Sunday 29th of April 2012) and thankfully all our preparation was worth it as the event went without a (noticeable) hitch.

I thought it would be helpful to share what we have learned, for any one else thinking of organising a BarCamp.

Tickets

  • Use EventBrite, their service is brilliant, and made keeping track of people/tickets sold a piece of cake.
  • Oversubscribe. We have a 30% no show. If your limit is 100 people you can probably issue 120+ tickets safely.

Food and Drink

  • Fifty people got through 140 pints of Ale and 40 pints of cider.
  • Sainsburys do Catering!
  • People get grumpy without coffee.

Sponsorship

  • Follow up with sponsors. Some companies only replied to second email.
  • Make it clear what you expect from your sponsors, and what they should expect from you.
  • Ask for “stuff” many companies won’t give money but they will hand out freebies.

I hope this helps you if your thinking of running a BarCamp or similar event yourself. Please leave a comment if you think of anything else that would be helpful.

Posted in Events | Leave a comment

A brief history of my Zipit Z2

For a while now I have been playing with the idea of building my version of the perfect alarm clock. My original ideas involved the Arduino and the Arduino Ethernet Shield. This all changed when I was introduced to the Zipit Z2.

Unlike the Arduino, it comes with an integrated keyboard and chair screen. For further hardware specifications click here.

My investigations of the Z2 led me to Mozzwald’s site which contains most of what I wanted to know. There are Zipit guides on U-Booting, Ubuntu, etc.

While my Zipit was winging its way from the USA, I started work on my clock application. Using the Lazarus IDE and the Free Pascal Compiler I created the first draft. Setting up the cross compile environment was straight forward and I soon had a binary ready for the Zipit’s ARM v5 compatible processor.

After a week of anticipation, I was finally introduced to my Zipit at the Rochester Can’t Hack meet. I started by flashing the Z2 with a U-Boot image I downloaded. To get the image flashed I booted into the Z2′s stock OS and selected the reset to defaults option.

Using Mozzwald’s z2sidX image I booted into Debian Sid. Following this was a back and forth between the Can’t Hack group about keyboard layout. Needless to say I was a very happy to see X start and spent a few minutes playing Free Doom.

For the past few days I have been perfecting the sid image I am using, including changes that allow for better integration of my Clock application.

Some notes on my changes:

Installed avahi-daemon openssh-clients nfs-common

For the dbus install (avahi-deamon dependancy) I selected not to overwrite the dbus config file with the package maintainer’s version. This caused issues with dbus failing to load. To fix this I purged dbus and reinstalled avahi-daemon.

Something I noted was the MAC address used by Debian Sid was not the MAC address printed on a sticker found under the battery. To fix this I edited /etc/network/interfaces.

user@zipit:~$ cat /etc/network/interfaces
# Used by ifup(8) and ifdown(8). See the interfaces(5) manpage or
# /usr/share/doc/ifupdown/examples for more information.
auto wlan0
iface wlan0 inet dhcp
hwaddress ether 00:12:34:56:78:ab

To change the host name to “zipit” I used the hostname command and also edited /etc/hostname and the /etc/hosts file.

Note: I installed avahi-daemon to enable machines on the local network to find the Zipit on the network using the .local domain. i.e. ping zipit.local will resolve. This is why /etc/hosts contains the information below.

127.0.0.1 localhost.localdomain localhost zipit

I then configured samba by editing  /etc/samba/smb.conf and used pdbedit to add a samba user login.
# pdbedit -a -u user

I have noted that the EWOC script provided on the z2sidX image has trouble configuring the wireless network when SSID’s contain spaces. I have fixed this issue and informed Mozzwald.

My work then shifted to my Clock application. I started adding features including a five day weather report, a week day alarm, timer and reminders. Another feature I wanted to add, was the ability to play music from a NFS share. I tested mpg123 and found that mp3′s played well when they were on the local flash drive but streaming off the NFS share was unworkable due to stuttering.

After adding the MP3 playback feature to Clock, I purchased a 32GB Sandisk Micro SDHC card to use for Zipit music storage. To my disappointment the card did not work with the Zipit Z2. The boot precess ended with I/O errors.

It seemed my dreams of adding music to the Zipit were in tatters, but then the word “buffers” popped into my head. When mpg123 plays back MP3′s on the Zipit it only uses about 15% of the processor’s capabilities. The stuttering had to be related to networking because local playback worked, the solution had to be buffering.

I changed the mpg123 command line for Clock to include a 2MB output buffer. Problem solved.

Clock's main window showing five day weather report.

The original idea was to open-source Clock under GPL, the problem is that the site I scrape weather information from prohibits scraping. Perhaps the solution is to get information from another source. I am willing to implement this alternative and release the source and binary for Clock. Suggestions are welcome.

My remaining issues include a long reboot time which I believe is related to the error – libertas failed to find firmware.

On boot up I get the error “boot wlan0 link not ready” from addrconf
and 200 second boot time.

Thanks go to Tristan and the Can’t Hack group, Mozzwald and all those that contributed to z2sid, Lazarus, FPC, Linux, GNU, etc …

Posted in Hardware, Programming, Software, Unix | 4 Comments

Hama bead madness…

Well it’s been a long time since an update on hackery, and a lot has happened! So here goes, an attempt at covering the last 3 or so months…

I found a new hobby! Crafty but not too difficult (unlike sewing/knitting/jewellery making malarkey). I’m not very patient, and I find fiddly things too…well…fiddly! So I’ve found something on my level. According to Wikipedia, “plastic fusible beads are also known as Perler Beads, or called “melty beads” by young children. These small colorful beads can be placed on a solid plastic-backed peg array to form designs and then melted together with a clothes iron; alternatively, they can be strung into necklaces or bracelets, or woven into keychains. Fusible beads come in many colors and degrees of transparency/opacity, including varieties that glow in the dark or have internal glitter; peg boards come in various shapes and several geometric patterns.”

The main thing to note here is that this is usually a hobby for children. This means that it’s not fiddly (yippee!) and you don’t need to be very patient (hooray!!) so it suits me down to the ground.

I started off making coasters, by copying patterns I found online and filling in the space around the pattern and making it into a square. I then began going “freestyle” and making up patterns, as well as interpreting cross-stitch patterns to make other designs. Then I came across how much 8-bit art has been made with these beads. There’s an amazing amount!

Some hama bead creations

Some of my hama bead creations

I then had a go at turning my creations into necklaces, brooches and magnets, which worked well. I have since sold some of them at various craft fairs, and have plans for giant 8-bit art as well as more different types of wearable geekery :)

Posted in Crafting | Tagged , , , , | Leave a comment

RickRolling The Trolls

This post is inspired by a video a friend (Reashlin) sent to me (embedded below). In their company it is policy to lock computers when users are away from them, and if a machine is left unlocked it is customary to tell the supervisor in a “friendly” email from the account of the person in who left their machine unlocked.

Knowing this, Reashlin’s colleague wrote a C# application that leaves the computer running whatever it was before until the mouse is moved, when it switches to a full screen RickRoll video with the machine locked.

A whole C# application to do this seemed a bit much, so I distilled the whole thing into the following 4 line bash script. The script is quite simple. It simply waits for input from /dev/input/mice then spawns full screen mplayer in the background, and xtrlock in the foreground. xtrlock is a handy little program that captures all keyboard/mice events until the users password is entered, a bit like a transparent xlock. There is an issue with this script if the user is proficient in keyboard short-cuts they might never touch the mouse… but that’s something for another day.

If the others at canthack.org try and do this to me again they will be getting a surprise (well not that much; they do read this after all).

#!/bin/bash
sudo cat /dev/input/mice | read -n 1
mplayer -fs rick.flv &
xtrlock



Posted in Programming, Unix | 2 Comments