Wednesday, 10 April 2013

Hacking a PacMan Lamp

I recently got given a PacMan Lamp (which can be bought from Firebox) from microsoft because I published a windows store app (called Space Race for those who are interested - its a phonics game for young children learning English!)

The lamp comes with a little remote that lets you select any colour. I just had to figure out how to control this thing with an arduino!

I took the remote to bits, but quickly realized I was going to have to solder a wire per button at least, and this would hardly scale - so I decided the next best option would be to simulate the IR the remote produces.

Lady Ada has a brilliant guide I used to read the IR signals via the arduino. To do this you will need a IR Detector, which I found to hand

Well, I say to hand... No kids toys were (permanently) broken you will be happy to hear

After hooking it all up to the Arduino I was able to pull out the timings of the "On" periods vs the "Off" periods. As advised you ignore the first off, and then look at the time periods for on vs off. It became pretty apparent that most times were around 530 µs, or 1620 µs, and the on periods were always the short time.

Once I had profiled several of the buttons I turned the "Off" periods into binary with the short period representing 0s, and the long periods representing 1s (as shown by column J in the screenshot above.

With enough codes it became fairly obvious that the first 16 bits where always "0000000011110", and the final 3 bits were always "111". After scratching my head for a bit I realised that the first 5 bits, and the last 5 bits where the only things that changed (the middle bits where always "000", and once I had pulled the bits that changed out it was really obvious that they were just the inverse of each other

Now all I had to do was write an arduino script that would take 5 bits, and translate it into the code, and then correctly send it to the IR pins. Heavily borrowing from the sample code Lady Ada provided I was pretty easily able to implement the algorithm. Feel free to grab the code from my GitHub repository. Once you have uploaded your code you will need to add an IR Diode to your arduino as shown in this image (ignore the stuff to the right of the image - thats for hooking up the IR Detector)

(Image from Lady Ada's site)

Now with everything loaded I needed to create a little app that would fire some commands at it. I created the following little library class that wraps everything up.

To use it simply construct the object (passing in the com port the arduino is connected to, then call do command passing in a command you want) as shown below

I'd love to hear what you use this for - I have just hooked mine up to Lync (its like skype for business). It now flashes white and blue when I get a call and when I'm not getting called it's coloured the same as my lync presence. I'll get a video up asap.

Thursday, 22 December 2011

A BBSB Online controller clone (for £26)

I love home automation (as I'm sure any geek does!), so when I saw the BBSB online controller I knew I needed it in my life but could really justify the £90, plus I figured why not try and build one myself. I mean, how hard can it be?

First thing I needed was some programmable hardware and since I have done so many arduino based projects before, the choice was obvious. Or was it? I noticed a new arduino clone had popped onto the market called a Nanode. Acting much like an arduino but at an incredible £22 from SK Pang (a similar arduino is over £44!). Now I actually ended up getting the upgraded model (Nanode RF) which includes the following extra features:-

  • A Hope RF RFM12B (supplied with 868MHz module) transceiver for 2 way communications with other boards.
  • A microSD card for general datalogging storage, storing applications and webpages. microSD card not supplied.
  • A realtime clock IC with alarm function which also holds a unique ID. not supplied.
  • An 8 pin socket (under the H logo) to allow you to add non volatile RAM for program download. Supplied with 23K256 256kb SRAM and DIL socket.

This allows me to use it to talk to other devices, but more on that in a later blog post!

To simulate the bye bye standbye online controller I needed to know 2 things. 1 how does it talk to the sockets, and 2 how does it receive commands from app such as the brilliant remote for Bye Bye Standbye.

Well thankfully both problems have been solved, and well documented many times before!

Arduino actually have a playground for all of the HomeEasy integration code - so that was the easy bit. The only additional thing I needed was something that could "talk" over the 433 frequency. Thankfully Farnell sell one for a smidge of £4.

Once I proved I could get this working nicely (using code sample 3 from the playground) I moved on to problem 2 - how does the BBSB controller talk to other software?

Again this was (unusually) well published by bye bye standanby (hats off to you for that!). So all I had to do was get the nanode to "talk" UDP.

Well this was a tad harder! The Nanode does not use the same Ethernet chip as the Ardiuno Ethernet stuff - so you can't use the standard "Ethernet" Library. Arduino recently released a new version of their IDE (V1) this means a lot of the code samples online have changed so it's a tiny bit harder to get good samples, but with some great help from the nanode community (get involved on irc) I was able to pull apart the tftp sample and just handle the udp packets I needed.

So without further ado here is my code hosted on github (my first open source code!) https://github.com/rossdargan/Arduino-Projects/blob/master/BBSBControllerImpersonator/BBSBControllerImpersonator.ino

And here is the final solution:-

Testing

BBSB also provide a really handy application to test to see if everything works fine - you can grab that from the forums

Future changes

Well the Nanode RF already includes a transmitter so it's a bit daft not to be using it - unfortunately it's the wrong frequency - but you can easily by a compatible 433 transiever from farnell.

Tuesday, 1 November 2011

Announcing WHS Drobo Status!

I have always loved Microsoft's Windows Home Server and sing its praises whenever possible; however with the most recent version Microsoft decided to remove what I always thought was one of the best features - the drive extender!

Drobo as a product is a perfect fit for this gap. The product allows you to add multiple hard drives and collates the space, making it easy for a home user to expand their storage space on demand.

I always wanted a Drobo so when I saw a competition running on the Home Server Show's website to win one I knew I had to enter!

The competition required the development of an add-in for Windows Home Server (something I have always wanted to do but couldn't quite think of anything to build!) So, having put sleep aside for a few days I'm very pleased to announce the public beta of my WHS Drobo plugin!

The plugin allows you to at-a-glance view how much space you have available, and the status of the drives as shown below:-


The screenshot below shows the drive information if for example you remove a disk:-


You can find the beta here: WHSDroboStatus.wssx. Simply install the add-in as normal from any WHS client computer.

Please note you must have the Drobo dashboard software installed on your Windows Home Server for the plugin to work (you probably have it installed already! If not you can find the right version from the drobo website).

Any request for new features/feedback can be added here: http://whsdrobo.uservoice.com

Please also leave a comment to let me know how you get on with it!

Friday, 3 September 2010

B&Qs Cubo Colour changing LED cube

I was in b&q and I spotted one of these:

IMG_0184IMG_0187IMG_0186IMG_0185IMG_0183

It was reduced down to £1.50 – but I can only find them in store not on the web, so no linky I’m afraid!

The cube light is pretty small at around 5cm each side, but produces a fairly nice light.

To remove the bottom part requires a bit of force as its glued in place but once you do pry it apart you are presented with a single LED with two legs connected to a switch, then a 22 ohm resister +/-5% followed by 3 * 1.5v AG13 batteries. It looks like this:

IMG_0189

At this point I realised something clever must be happening– all of them colours via only 2 pins! If you look very closely at LED you will notice on the top of the anode leg inside the led a tiny black dot. That dot is what controls the colour, so hacking this is going to be extremely limited if you intend on using this LED.

Whilst it’s currently driven from the 4.5v provided by the batteries I did successfully drive the unit from the 3.3v from a neduino board , so you could very easily use it as some form of output. Powering it externally also means it will last a lot longer than the 6-8 hours the leaflet expects it to last from the batteries – and given the batteries cost £1.89 from Amazon (more than the device cost!) it’s a good job!

I think that the best bet if you were hacking this device would be to replace the current in place IC controlled LED with a RGB LED. The plastic Plug holding all the gubbings also comes with a hole which could easily fit any cables you needed to bring out of the device!

Happy Hacking!