Monday 30 April 2012


It took longer to download and  install the software than it did to get a working example with the FTDI Vinculum II chip this evening! The IDE looks great, the C-style language looks quite nice to work with, and the inline debugging is awesome. Putting breakpoints in code and stepping through, one line at a time is a brilliant way to debug code.

Although it doesn't really make much sense at the minute, as we're not too familiar with the language itself, the actual programming environment looks very encouraging.

We've been told that the FTDI Vinculum II chip has microcontroller facilities, as well as a hardware-based USB stack (so the device itself takes care of the tricky USB stuff, rather than us having to write our own firmware for USB) and this makes it easier to work with than the PIC 24F counterpart.

Like most things, it'll probably come down to a matter of personal preference. But so far, the FTDI VNC-II looks quite promising. Let's see how we get on....

USB OTG FTDI (any other acronyms?)

A good while back, we made some miniature instruments for playing samples on a PC. They worked quite well and we got a bit of interest and sold a few kits online. But how technology marches on!
No sooner had we got them working with a computer, when users started asking when could they plug them into the mobile phones and Android tablets!

And following on from a discussion with Robot Steve the other night, we're thinking that making mobile-friendly versions of our miniature instruments would be a pretty cool intro to USB OTG.

No sooner had our PIC 24F USB development board arrived, than Jason from Stuff and Nonsense suggested a hardware-based USB stack from FTDI. So we got ourselves a debugger/programmer ( and a development module ( off the Farnell website.

That's right - next day, 8am, sure enough there was a thump-thump-thump on the front door and a beaming postie with a parcel covered in Farnell/element14 livery. I guess we really need to do something about fixing that doorbell.

Friday 27 April 2012

Awesome Farnell

Just a quick post to remind myself as much as anyone else why Farnell are still number one for me...
After chatting with Robot Steve from BuildBrighton, we were talking about creating peripheral devices for mobile phones. We've already made a few USB devices for PCs (USB/HID slave devices) but this was a whole new challenge.

Android have embraced this idea, but in a back-to-front way.
To enable developers to communicate with the widest range of devices already on the market, they've suggested creating a USB device as a host (not a slave as would be the normal way of going about things) and then having the phone act as a slave, just as it would as if it were plugged into your PC.

Sounds straightforward enough, but we've only ever created USB slave devices, not hosts.
A quick look on the Farnell website reveals that the 24F series of PICs with USB host/slave (OTG - on the go) functionality cost as much as, and sometimes less than, the 18F series of PICs we were using for our slave devices. It looks like it's finally time to think about moving up to 16-bit micros and leaving our old 8-bit friends behind....

We ordered one of these PIC development boards at teatime yesterday:

At 8am, a hefty thump-thump-thump on the front door (our postie isn't afraid to get you out of bed) and it arrived at Nerd Towers:

That's about fourteen hours from deciding to give this stuff a try to it turning up on the doorstep, ready to give it a whirl. Farnell have once again excelled themselves and are proving to be really hacker/maker friendly! We've always preferred Farnell over their rivals, because their website makes finding components really, really easy. They're not always the cheapest, but when the difference between components can be measured in pence, it's service like this that keeps customers loyal.

Thursday 26 April 2012

Non-RFID poker cards - full set

We've called these poker playing cards, but obviously they could be used for any card game.
One of the exciting ideas we came up with, was playing a game with an absent player - no longer does your regular poker night need to be disrupted because one or more players can't make it! Using these special playing cards, and a card-reading table, you can deal your friends in, and have them play over the 'net.

Anyway, that's way off in the future - we've yet to prove that the idea even works yet. But that'll be made much easier, now we've received this full deck of playing cards from Custom Stuff:

Can't wait to get making at BuildBrighton tonight, to see if we can actually read the cards using a few LDRs and a PIC microcontroller....

Wednesday 25 April 2012

Non-RFID poker cards printed and cut

Here they are, in all their printed glory!
The only thing we may need to adjust is the spacing and size of the dots on the border(s). Only because at the minute, cutting is absolutely critical (we're going to put the cards into a fixed-size holder, and it's important that the dots on the cards line up with the holes in the reader). Slightly bigger dots, slightly further apart over smaller holes will at least allow for a bit of movement/printing/cutting error from one card to the next.

But other than that, the cards are really starting to look good. All we need to know now, is whether they work or not!

Non-RFID poker cards update

Just prior to printing and cutting our newly designed poker cards for our non-RFID poker table, Nick from Custom Stuff contacted us with another (better) idea.

The face cards were ready to print, but the black outlined circles got in the way, if we want to use traditional playing card faces (we weren't too fussed and were going to use our own images, but went with "standard" just to keep things simple). So Nick moved the dots off the face of the card and put them onto the border.

The end result is yet again better than our original idea!

(print preview - before printing and cutting - of our re-designed, re-design. Note how the dots are quite inconspicuous compared to earlier attempts!)

Nick suggested keeping the dots the same colour for the other suits - so instead of black and white dots on the hearts (red) diamonds (blue) and clubs (green) we use red/white, blue/white and green/white combinations. We must admit, these cards are looking like the best yet, so how to implement these changes?

Well, if we go down this route, the first thing to do will be to flash the RGB different colours, to work out what colour the border is. Once we know the colour of the border, we simply flash the RGB a complimentary colour to read the dots. Since the dots are white, we'd expect them to reflect all colours of light. But if we're flashing, say, a green LED onto a red card, the red dots on the red border would "appear" black (they would not reflect the LED light).

It's a little bit more complicated than our original idea - but not by much.
And the final result - the finished cards - look a hundred times better than our first efforts, so it'll be worth the extra effort!

Tuesday 24 April 2012

Playing cards with binary dot values

By placing 5 LDRs in a line, and flashing a different coloured RGB LED onto the face of a card, we're hoping to read the numerical value and the suit of the card using our PIC microcontroller.

The numerical value of the card can be displayed as a 4-bit binary representation of the number. So, for example, an Ace has the numerical value 1, which is represented by 0001. Similarly, a five would be 0101 and so on. Whether we use a black dot or a white dot as a "one" in our binary representation doesn't really matter!

(yes the binary dots don't match the value on the card, and blue is traditionally associated with diamonds, not clubs, but this was just a quick mock-up provided to us to demonstrate a basic idea!)

We're going to use the colours:
  • black = spades
  • red = hearts
  • green = clubs
  • blue = diamonds
Here's a chart showing what we'd expect to see on each LDR and the card value we could deduce from it:

New poker card design

After spending hours last night updating and re-writing their printing routines, Nick from Custom Stuff emailed over some print previews of playing cards with coloured boxes in each corner, according to our latest ideas.
In short, some of them looked horrible.

With the correct photo, with the correct border, on the correct coloured background, sometimes it doesn't look ghastly (Queen of spades in the example photo) but mostly, the garish coloured blocks just distract from the images on the card and look awful (9 of spades).
Yes, we could make playing cards with "regular" card faces, pips and spades and diamonds and the like. But even then, each suit would have three picture cards with a jack, queen and king on them. So they'll still look terrible!

This morning, Nick showed us some left-over offcuts from a deck made overnight.
The customer had asked for a different coloured border around each of the cards, to signify which suit the card was (they were for teaching games to adults with learning difficulties). Apparently, thanks to the rise in internet poker and in particular, tiny graphics in mobile poker games, it's not uncommon for poker cards to use different colours for different suits - black = spades, red = hearts, blue = diamonds, green = clubs. This makes identifying your cards easier on a small-screen device (apparently).

My guess is that the programmers chose "primary" colours (let's not get into yellow being a primary colour and green a mixture of blue and yellow - we're dealing with lights, not pigments here!) to make each suit easily distinguishable from the others. Whatever the reasoning, this is quite fortuitous for us!

Having explained our card-reading idea, Nick suggested an alternative card layout:

The entire border of the card could be coloured to match the suit on the card (this was a quick mock-up, my guess is that clubs would probably be green, not blue). The numerical value of the card could be shown via a series of 4 black and white dots. Nick explained that these dots are much less conspicuous than large multi-coloured blocks, and we have to agree!

Of course, a 4-bit value gives us a range of values 0-15 (or 1-16 if you prefer).
Which is perfect: we can determine the suit of the card by detecting the colour of border, then read off the black/white dots to get the value. It does mean that we'll need 5 LDRs instead of four (the fifth will be under the border of the card, immediately to the outer edge of the dots) but the symmetrical layout of a playing card means we can just put all five in a line and the orientation of the card will make no difference.

We're quite excited by this new development.
The cards look great (we've yet to see a physical card, as Nick has a lot of work to do getting her programmer(s) to re-code their website for us!) and how it works should be quite simple.

By using black and white dots, our LDRs should be able to read a white dot value, irrespective of the colour being reflected off the face of the card - we can use this as a double-check; if we flash a red light and read back two white dots, we would expect the same response when we flash it blue and green.

Exciting stuff. We're already building prototype boards (using black tubes over the LDRs like we did with our invisible instrument last year) for reading the black/white dots, and we're pretty confident we'll have this working quite quickly. The only bit we haven't yet tried is the colour detection. More posts coming soon!

Monday 23 April 2012

Non-RFID playing cards update

It didn't take long before we started getting emails about our last post, outlining colour combinations to identify each individual card in a deck of 52 playing cards.
The messages went something like "you've got lots of repeated patterns - that'll never work!"

And the people sending them were not wrong!
In fact, there were more than a couple of repeated patterns, including those for AS+2S, AH+3H, AC+6C. There are plenty more if you care to look for them. Instead, we've re-designed the entire card deck from scratch.

Here's our latest effort. There shouldn't be any duplicates this time. But if there are, don't hesitate to get in touch and let us know!

Poker table - without RFID

Here's an idea we had quite some time ago, while proposing ideas for the HackLlan show-and-tell session in November last year. It was for a poker table which could read cards without using expensive RFID hardware.

Well, at BuildBrighton we're talking about holding our first poker night - so it'd be really cool if we could broadcast it live - complete with overlay graphics, just like they use on the telly!
The original idea for identifying cards was to use "intensities of light" and non-primary colours to determine which grid pattern was showing over a single exposure. After a bit of trial and error, we found it difficult to tell when one, two or three squares of the same colour were showing in a pattern and the card detection device failed.

That's not to say we're giving up!
Nick at Custom Stuff has arranged to create some decks of customised playing cards, entirely to our own design rather than through their online editor, so we're now thinking about a different layout. The latest idea is this:

Each card will have "index" numbers in all four corners (this is an option you can set in the custom stuff online editor) BUT we're going to put each index into a different coloured square.
We'll have an LDR under each corner of the playing card (which sits on a black plate with holes cut in the corners, so only the colour in each corner is displayed from underneath) and then flash an RGB LED through red, green and blue.

By measuring the reflected light from each corner, we should be able to work out which colour is at which corner (and thus, which card is face down on the detector)

We've come up with this pattern sequence for our playing cards. The idea is to find which corner contains the black or white square (if black, the LDR under this corner will always return zero, if white, it should always return full brightness) and then read the colour pattern off the card.
If every card has only one black or white square, then we can convert a sequence of colours into a card value and it won't matter which way around the card is placed on the detecting plate.

The beauty of this design is that we don't have to work out intensities of colour - simply set a threshold value and if that value is met, we can detect the presence of a particular colour; it turns the result into a binary operation once more.

For example, let's say we've put the six of diamonds onto our detector (for the sake of example, let's assume it's the same way around as the blocks in the diagram above).
We flash the RGB red and read the values, clockwise, from each LDR at each corner of the card (the LDRs are inside black tubes, so are only reading reflected light, not direct or ambient light from the LDR).

The first LDR (top left) reads 190 which is above our threshold value of 100.
The second LDR (top right) reads 180 which is above our threshold value.
The third LDR (bottom right) reads 30 which is below our threshold value.
The fourth LDR (bottom left) reads 54 which is below our threshold value.

We need to allow for a little bit of leeway in our threshold, in case any ambient light creeps in, or if the blue, for example, is not an exact blue with absolutely no red pigment in the ink. This is where our "intensity" approach failed last time - the inks were not perfectly exact colours and the range for error was greater than our range for detecting colour. This time, we're simply saying "is this corner red, green or blue?"

Now let's flash the RGB blue and read the values again.

The first LDR (top left) reads 43 which is below our threshold value of 100.
The second LDR (top right) reads 176 which is above our threshold value.
The third LDR (bottom right) reads 156 which is above our threshold value.
The fourth LDR (bottom left) reads 78 which is below our threshold value.

Lastly, flash the RGB green and read the values once more:

The first LDR (top left) reads 57 which is below our threshold value of 100.
The second LDR (top right) reads 185 which is above our threshold value.
The third LDR (bottom right) reads 41 which is below our threshold value.
The fourth LDR (bottom left) reads 158 which is above our threshold value.

Now collating these results, we can see that the first LDR (top left) responded only to the red light. So let's say that is red. The second LDR (top right) responded to all colours, so that must be our white square (if it was black, it would be the only one to respond to none of the RGB flashes). The third LDR (bottom right) only responded when the RGB was flashed blue and the fourth (bottom left) only responded to green light.

So we have red, white, blue, green. In our look up table, this corresponds to only one card in the deck - the six of diamonds. To look up the card in our microcontroller, we'll probably cycle the colours until we either start with black or white - so our sequence would be white, blue, green, red. This means we don't have to store all possible permutations of each colour sequence to be able to perform an accurate look-up
(we don't want to try to look up red, white, blue, green and have no matches because the microcontroller is comparing against white, blue, green red!)

Friday 20 April 2012

Digital Scalectrix Controller

For the up-coming Dublin Mini MakerFaire, the guys at BuildBrighton have come up with a brilliant idea - Scalexercise. It's a Scalectrix, hooked up to exercise equipment. The harder you exercise, the faster your car goes around the track!

To get the ball rolling, Mike has already invested in a Digital Scalectrix and we're already investigating how it works, so we can make our own, custom controllers for it.

One idea is to put a hall-effect sensor on a bicycle and use this to send throttle commands to the controller. Want to go faster? Then pedal harder!

The Digital Scalectrix looks like it's using some clever method of sending data over the power rails - a bit like the way home automation (X10?) uses your home electric wiring as a carrier to send data signals to different sockets and switches. Here's a website showing the basic principles:

Here's a photo showing Mike's scalectrix up and running at the Brighton Hackspace. It doesn't do much except send cars around the track - which is more than enough to cause us to lose most of the evening, instead of discussing and working on the new controllers, we just wasted time making cars fly off the corners!

<photo goes here>

Nerd Club is back in Brighton!

(Well, Hove Actually). In fact, it's been a busy couple of months and we've not really had time to do much nerding about. What with travelling the length of the country and back a few times in March, to find somewhere to live, then again to actually make the move in early April - and again a week ago to bring down the laser cutter, cnc, tools and nerd-gear, it feels like the last two months have been spent either in or travelling between various motorway service stations along the M6/M40!

But the great news is that we're slowing getting sorted and bringing all our tools and equipment out of storage. Which means it won't be long and we'll be back to making cool stuff again.
The haXe game development has been coming along, but was really just a time filler while we were "between homes". It's not gone to waste - we're hoping to integrate this with different electronics-based ideas over the coming weeks and months and make some homebrew hacked-up mash-up projects to show off on this very site!

As ever, the projects posted here will be a mish-mash of different ideas, started, then abandoned, then picked up again weeks later. It's a clumsy way of working - but means that we're always working on exciting new stuff, rather than getting bogged down with seeing a project through to the very end!

After a brilliant re-union with the cool kids at the BuildBrighton hackspace, we're already off on (yet) another project: A Homebrew Digital Scalectrix Controller...