IMG_20140301_121939

45 Minute Project – £4.10 XBMC Remote Receiver

I’m a big fan of XBMC, and have an Ouya running XBMC set up in my lounge, streaming from my NAS. I normally use XBMC remote on my phone for controlling it, but this gets annoying when the phone is on charge, or I’m using it for something else.

I noticed that the majority of my TV remote is completely unused when the TV is in HDMI mode, and had a bit of a lightbulb moment!

Remote

Almost none of these buttons are used!

I already had an Arduino Pro Micro (£3) lying about i’d bought for testing out as an upgrade path for the minimus based projects i’ve been playing with.  It is leonardo compatible, small, cheap and pretty easily available.  I added an IR Receiver (£1.10) to the weekly Hackspace Farnell order to complete the parts list.

The pinout of the IR receiver makes it very easy to connect to the pro micro, using the RAW (VUSB), GND, and A3 pins.  I just bent the OUT pin (pin 1) on the receiver to the left a bit as follows:

 

The body of the receiver fits perfectly behind the USB plug, flat against the voltage regulator.  I used the IRremote arduino library to grab data from the remote using the IRrecvDemo sketch and mushed some buttons:

8B452AD
FFFFFFFF
FFFFFFFF
8B410EF
FFFFFFFF
FFFFFFFF
FFFFFFFF
8B4D22D
FFFFFFFF
8B4926D
FFFFFFFF
FFFFFFFF

My remote uses 0xFFFFFFFF as a ‘key repeat’ code, about every 200ms when the button is held down. I found that in practice I had to ignore the first of these, as it was repeating way too fast and doing double presses.

I tweaked the IRrecvDemo sample code, added in a bit of keyboard and came up with some working code:

#include

int RECV_PIN = A3;

IRrecv irrecv(RECV_PIN);

decode_results results;

int key;
int count;

void setup()
{
  irrecv.enableIRIn(); // Start the receiver
}

void loop() {
  if (irrecv.decode(&results)) {
    switch (results.value)
    {
      case 0x8B452AD: // up
        key = KEY_UP_ARROW;
        count = 0;
        break;
      case 0x8B410EF: // right
        key = KEY_RIGHT_ARROW;
        count = 0;
        break;
      case 0x8B4D22D: // down
        key = KEY_DOWN_ARROW;
        count = 0;
        break;
      case 0x8B4D02F: // left
        key = KEY_LEFT_ARROW;
        count = 0;
        break;
      case 0x8B4926D: // enter
        key = KEY_RETURN;
        count = 0;
        break;
      case 0x8B412ED: // red
        key = KEY_BACKSPACE;
        count = 0;
        break;
      case 0x8B4B24D: // green
        key = ' ';
        count = 0;
        break;
      case 0x8B44AB5: // yellow
        key = KEY_ESC;
        count = 0;
        break;
      case 0x8B450AF: // blue
        key = 's';
        count = 0;
        break;
      case 0xFFFFFFFF:
        count++;
        break;
      default:
        key = -1;
        break;
    }
    if ((key != -1) && (count!=1))  // if count = 1, it is the first key repeat, so ignore it.
      Keyboard.write(key);
    irrecv.resume(); // Receive the next value
  }
}

Total cost £4.10, total time 45 minutes. Sorted!

IMG_20140301_121939

New Robot – Electronics

Robot Electronics

Over the weekend I ordered the mainboard for the new robot. It contains an arduino, battery voltage monitoring, battery regulation and a pair of motor driver chips.

It is designed to sit on top of a hardcase 5Ah LIPO, with short leads going into the battery power output.

New Robot – Chassis Printed

Last night I retrieved the first chassis printout and did a test assembly with the parts that have arrived.  It looks good!

The axle distance is perfect, the chunks I carved out for the pi are all the right sizes, and it looks bitchin.  The only negative was that the mount for the raspberry pi camera was slightly too small, but I managed to modify it enough to fit with some snips and needle files.  I’ll modify it slightly for the final print, including adding some LEDs for lighting up the area in front of the camera.

Next step is to print the top chassis (currently in progress) and design a PCB for power regulation and monitoring, motor control, and other IO.

New Robot – First Printed Parts

Before leaving the hackspace on saturday, I set the wheels and motor mounts for my robot printing, as I figured these parts probably wont change while I finish the rest of the design.

IMG_20131130_220248

Tonight, I cleaned up the printed parts, and did a test assembly of the track sets:

IMG_20131202_193842

They looked about right, so I set the first version of the chassis printing before I left. Hopefully its right, as each chassis half costs about £4 to print!

IMG_20131202_193909

3D printing – Bandsaw Fence

I spent some time earlier in the week getting the bandsaw at Hackspace Manchester working, so now its cutting again!  The main problem with the bandsaw is cutting straight, as it was an ebay purchase it diddnt come with a fence, so there was nothing to run the cut material against.  This model of bandsaw hasnt been made in around 30 years, so trying to buy a new one will be impossible, and ebay is too much hard work.

Though we do have a 3d printer… and a workshop.  Idea!

Step one was to have a look at the bandsaw.  It has a channel running along the front , so I took some measurements to see what I was working with.

channel

paper

So, i had the measurements, it was time to take to my CAD software and design something to fit in the channel.  My choice for this is OpenSCAD.  I used it to first create the shape of the channel, then to carve this shape out of a block.

openscad1

openscad2

I extruded this to a few mm wide, then printed it to test.  There was a bit of tweaking needed to get it to fit exactly, so i ended up doing 4 iterations with the sizes tweaked slightly.

testpieces

testprint

test

Once i had one that fitted, i printed it out extruded to 20mm to check it would fit and slide correctly.

testfits

It did, so i moved onto designing the actual fence.  Step one was to cut some aluminium extrusion to size, and measure it.  A month or so ago I had managed to womble a nice straight piece of 16mm x 16mm  3.2mm thick L channel, which was pretty much the perfect size.  I cut this to size, and modelled it in openscad.

cad

The actual cad modelling took a couple of hours of tweaking, but i the above picture shows the basic steps.

First off i extruded my clamp to 50mm wide, and added a wedge to the side of it.  50mm gives enough width for it to sit in the runner, and counteract twisting force from the back of the fence being pushed on.  The wedge is to give support to the top part of the L channel.

Second, I added two captive nuts and holes for M5 bolts.  Mainly because we have a massive bag of M5 hex-head bolts that are perfect for printed thumbscrews. Theoretically i could have threaded into the ABS directly, but i felt this wouldnt last, so embedding a nut seemed like the best option.

Third, i carved out the hole for the L channel.  This leaves a bit of an odd shaped unsupported piece, which may be weak. Because this piece will be in the channel, i decided to leave it, as it’ll make measuring up on the built-in ruler more accurate.

Lastly, i added some pilot holes for attaching the aluminium to the 3d printed part.  i decided to use 3mm x 12mm self tapping screws for this, because i had them on hand, and they can be countersunk fairly easily.

printed

I test-assembled the whole thing in the vice, it fitted nicely in the channel, so it was ready for connecting together.  I marked, center punched, drilled and countersunk the holes for the 3 screws that hold the whole thing together.  Add some screws and we’re sorted!

fits

Of course, i had to do a test cut at this point, so some of the scrap acrylic pile was chopped into little strips.

cutting

Woohoo, it worked!  All it needed to be complete is some knobs.  So i headed over to thingiverse to find a knob that’ll fit nicely over an m5 nut… and found nothing useful.  No worries, i just OpenSCADdded one up.

knob

finished

So there it is, a useful thing i’ve made on the 3d printer that wasnt a part for a 3d printer!

 Source files (stl, openscad) are available on My GitHub 

The PANIC Button

Ok, bit of explanation first.  We have an iMac set up as a ‘democratic jukebox’ at HAC:Manchester.  The idea being that anyone can put music on it, and it plays the entire library on shuffle during our hack sessions for a bit of background music.

The problem is, of course, some people have an… odd taste in music, so sometimes the jukebox ends up flipping between Aqua and Cannibal Corpse for ten minutes, and the horror of this was just too much!

Enter the PANIC button.

 

The button uses a minimus board. The minimus is a carrier for the AT90USB162, an AVR microcontroller with onboard USB hardware, which means it can be programmed to show up as any USB device.  Before getting the button I modified one of the pieces of LUFA demo software, a media keyboard, and stripped it down to just read the one button on the minimus.  When the button is pressed, it sends the keycode for next track. 

The button’s housing is a joke button that played an alarm and flashed when pressed, I ripped its guts out to get to the switch.  After finding the switch contacts on the original board, i soldered on two wires to connecto to the AVR.

Next,  I stripped off the USB connector  from the minimus, and added a 1m USB lead directly to the pads, to make it fit in the old speaker housing section of the button.  I connected the leads from the button to PD7 and GND on the minimus, the same as the onboard button.  This has the handy side effect that if the button is pressed while being plugged in, it boots into DFU mode, allowing me to upgrade the firmware easily.

I cut a slot in the casing for the wire to escape, and added a couple of cable ties for strain relief.

Press Button, Song Skips, Panic averted!

 [Download Code] – AVR C

Dealextreme: Cheap GPS modules & Buyer’s Guide

Found these the other day, may be handy for anyone doing something they want GPS assisted. I’m considering the em-411 for the quadcopter’s GPS assist (as its the only self contained unit).

Datasheets

http://www.globalsat.com.tw/manual.php?menu=3

Hints for buying from DX:

  • The prices are including shipping!
  • If you’re getting lots of things, do it in smaller orders. DX get everything you order shipped to them, then package it all up and ship it to you. Smaller packages means you’ll get some items far quicker.
  • Dont browse, you’ll end up spending about £900 if my experience is anything to go by :P
  • Some of the stuff will be fake, or crappy, but its largely cheap enough you can forget about it.

Other Cool stuff

Speak and Spell – Keyboard Matrix

Tonight i spent some time at HAC:Manchester reverse engineering the keyboard matrix on our speak and spell, in preparation for hooking it up to an MBED.  Since nobody else has released this information (as far as i can tell), here is the pinout:

pin 3 4 5 6 7 8 9 10
1 u k off a f ? p z
2 v l go b g & q `
11 w m <- c h ??? r #
12 x n d i :) s /
13 y o _ e j on t return

This means that when the ‘off’ button is pressed, for example, pin 1 and pin 5 will be connected together.

To read a matrix keyboard like this, we write some code that steps through the ‘down’ set of pins (1, 2, 11, 12, 13), holding them low one at a time, then checks each of the other pins (3-10) to see if anything is being held low. If so, we perform a lookup on the table above.

Code to follow next week!