March 2015

Sun Mon Tue Wed Thu Fri Sat
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31        


« 3D printing Star Wars weaponry using an AutoCAD model | Main | Stripping XData from offset AutoCAD entities using .NET »

February 05, 2013

Blinking lights with a Digispark

I talked about some of the fun I’ve been having with Arduino in this previous post. I eventually added a pushbutton and a potentiometer to that particular circuit, modifying the code to watch for a hardware interrupt – to blink the LEDs only when the button is pressed – but also to apply a variable delay to the blinking (speeding it up or slowing it down depending on the direction in which you turn the knob of the potentiometer).

I’ve now ordered an edge connector that will fit my ZX Spectrum: my next stage for the Arduino-based work is to try to apply signals through it to simulate the pressing of keys on the ZX Spectrum’s membrane keyboard. Once I’ve done that, I know I’ll be able to fire off keystrokes based on external conditions. At which point I’ll just have to see whether my newer 512Mb Raspberry Pi has enough capacity and horsepower to do something meaningful with the data coming from Kinect (via libfreenect, of course, which may make it tricky to get skeleton data… we’ll see if that ends up being a deal-breaker). I’m not sure whether I’ll be able to use the R-Pi directly for all this – it may well make sense to invest in a Gertboard… that looks like a handy add-on to have around, in any case.

So, assuming I can detect basic movements – left, right and jump – I’ll then be able to control Manic Miner and Jet Set Willy (classic platform games) on an original ZX Spectrum using Kinect. At least that’s the plan.

But in the meantime, I received a long-anticipated package through the post, yesterday. It contained three Digisparks and some laser-cut cases for them: the results of funding a project on Kickstarter.

The Digispark is a “teeny tiny, Arduino-compatible, dirt cheap, USB development (and production) platform”. And as you can see here, it really is tiny (trust me – I have fairly average-sized hands ;-).

The Digispark - it's really tiny

The chip itself is largely compatible with the Arduino standard and toolset: the driver download comes with the 1.0.3 version of the Arduino IDE (which I was already using for my Arduino projects – replacing it with this version also allows me to target the Digispark subset). The Digispark has an ATtiny85 microcontroller (while my Arduino Uno R3 has an ATmega328P, for comparison), and in general clearly has less capability than the full Arduino.

But for small projects such as my blinking lights – this time with 6 LEDs, as there are fewer pins to work with – it does very well:

Digispark blinking LEDs

You can see here that I’ve used a USB extension cable to avoid connecting the device directly to my PC: when developing with the Digispark you need to unplug the device before each compile and upload – plugging it back in only when this is has been done – which would certainly wear the connector if not using an extension to bear the brunt of this. This extra step makes it a bit fiddly, at first, but you soon get used to it. It’s also worth bearing in mind that given the nature of the Digispark, it’s naturally less robust than a full Arduino, so care should be taken when working with it: a short circuit could damage it irreparably, for instance.

I went ahead and assembled the laser-cut acrylic cases I ordered along with the Digisparks:

Building the laser-cut cases

And then tried out a small one as part of this project:

Inside one of the acrylic cases

The fit was fairly good, although the modest amount of inexpert soldering I performed to attach the pin headers did mean the slot for the USB connector forced the Digispark to be at an angle. I could probably flatten the bottom by cutting the pins and soldering a bit more carefully, I expect.

blog comments powered by Disqus


10 Random Posts