Space Invaders Button

April 13, 2009

in Projects

The reason I started all this microcontroller stuff was that I wanted to create an animated button displaying space invaders characters. Preferably the same size as an normal button (the ones you put on your jacket, not your panel).
Now here it is:

If you do not see the electronics for this small display read on after the click. And no, I will not stop tinkering.


Update: You can get your own Blinken Button (aka Space Invaders Button).

The whole project was inspired by Alex, especially his LED matrix projector and his tiny 64 pixel project. After some beers with Alex I claimed: “I can do it much smaller in SMT”. Silly me! Not that it was hard enough to build it in SMT, but I also wanted to do it in bi-color (I just got some small bi-color LED matrix laying around, waiting for a project) and I made some real design mistakes (but that is a story for another article). Additionally I wanted an design which still allows me to use the LEDs of the display as light sensor. That was nearly too much – but only nearly!

To give you an imagination how it will look like lets take a look at a video:

At the end I attached a fixing pin at the battery holder, to wear it as a ‘real’ button:

My girlfriend loves it! Of course she got some special animations and texts.

Schematics

After some research I choose the ATmega164P as platform. It had enough input pins to drive all the 24 pins of the matrix and still some spare for programmer. The current is supplied to the rows by a transistor (a conveniently prebiased one: DDTC123TUA, it comes with an built in base resistor), the ATmega controls the column diodes by sinking its current. In the I came up with an very simple schematics:

Space Invaders Button

The port usage and layout of the connection was optimized for easy PCB layout. I decided to do all the mapping in software.

PCB

If you layout on an PCB, you end up with some real trouble, but it ends up in something like this:

It dimension are a bit smaller than the matrix. It features a nice little SMT switch (C&K Components AYZ0102AGRLC ) on the edge of the board. As you can see the SOT323 format is perfectly small. The current limiting resistors are 4*0402 arrays. The decoupling capacitors are 0402 SMT capacitors. And the PCB is still dirty from flux and solder spots.

This is the whole unit in comparison to an one Euro coin:

Code

The implementation is basing heavily on the code of Alex’ 64 pixel project. But instead of rendering a bit buffer I used an buffer which contained all pin settings (so 4 bytes for PORTA to PORTD).During load time of an sprite its bits are converted into the various port configurations. This allows me to use an really fast update routine of about 800 Hz.This reduces massively any flicker (which is critical if you want to go dancing with the button on).

Beside from that, and some real mistakes it is nothing special. Therefore no code posting here. You can find it on Alex’ site.

Learnings

Avoid 0402 capacitors whenever you can. They are just too small. And if you use them never place vias in the pads. Since the vias suck up the solder and the capacitor stands up, literally. I ended up with more than one capacitor going 90°.

The 4*0402 resistor arrays are great. You need an hot air rework station to solder them, but they are easy to solder and in an very convenient package. I just stock up on them – they are really nice!

The SOT323 transistor package is perfect for small signal transistors. It is considerably smaller than SOT23 or TO92 and still quite easy to solder. This will be my preferred transistor packaging!

The pre-biased transistors are neither very handy nor very practical. But they are expensive, you have to choose the biasing resistor wisely and always order the wrong parts. There would have been some space for some resistors left – so no real reason to use the pre-biased stuff. I will never use them again.

{ 18 comments… read them below or add one }

Alex April 13, 2009 at 13:28

Ok, you won. :D
You’ve convinced me, I have to try SMT. And the board really looks great. I’ve seen it for real. Great job.

Reply

Marcus April 13, 2009 at 13:51

Thanks for your kind words. SMT is great. But going tiny is much work and I respect erverybody who does it. And mostly anybody still does it better than me ;)

Reply

Jeff April 13, 2009 at 20:00

One thing that helps a lot with surface mount soldering is to use two soldering irons. You can use both of them like tweezers to move around small components (like those 0402 capacitors) and get them to lay flat. I know what you mean about them wanting to flip up 90 degrees if you’re not careful. It’s called “tombstoning in the industry, because the capacitor looks like a little tombstone sticking up out of the PCB. :-)

I have never seen transistors with built in bias resistors before, I’ll have to look at those! Nice way to save some components!

Reply

Barry April 15, 2009 at 11:54

looks great mate ;o)

Reply

Nermal April 15, 2009 at 16:01

Hello – excellent writeup for a very cool project. What program do you use to draw the schematics ?

Reply

Marcus April 15, 2009 at 17:12

Thanks. Hopefully it is useful for anything. The schematics and board are done with the freeware version of CadSoft Eagle. It is a bit bulky, but quite ok for me. Others suggest using gEDA – an complete open source suite.

Reply

Marc April 15, 2009 at 16:24

Marcus,

Awesome project! Thanks for posting and sharing the schematics.

http://blog.makezine.com/archive/2009/04/compact_led_matrix_wearable.html

- Marc

Reply

Steven April 15, 2009 at 20:23

Hi Marcus,
Very nice work and looks like with a bit of coding you could do all kinds with it!
Here is one idea from me!
1. Use the corners for sensing and effectively turn them into 2 buttons.
2. Code some simple ‘Breakout’ style game and use the 2 buttons to move!

Oh, and if you think Eagle is bulky you should give Altium Designer a try – its what I use on a daily basis at work. It takes a few GB for a full install but its worth it ;-)

S

PS> Are you going to be selling these?

Reply

Marcus April 15, 2009 at 22:11

Yeah, using the corners as input areas is very interesting. Perhaps there is a way to make them availlable. If so everybody can tinker with them! I think the Space Invader Button got myrriads of possiblities (thinking about adding a accelerometer. That would be fun!!)

Reply

LabibBaroudi April 16, 2009 at 10:55

I am interested, please contact me lbaroudi@gmail.com

Reply

Tommy April 18, 2009 at 10:10

If you ever decide to make a small run of these, I’ll definitely get one!

Reply

Alex April 29, 2009 at 02:32

I will buy a kit if you decide to make one.

Reply

Chris June 23, 2009 at 02:41

Marcus, what sort of run time are you getting from the CR2032 battery?

Reply

Marcus June 23, 2009 at 08:22

Roughly a night out. I think 5-6 hours are possible. But after 3-4 hours it gets darker.

Reply

Sergio July 8, 2009 at 16:50

Great project!
I’m about to build one for myself…
some questions, I see a crystal in the schematic, but have you actually used one? did you use the internal oscillator?
Where did you get that resistor arrays? I don’t see them in farnell.com

Reply

Marcus July 8, 2009 at 16:59

The crystal (or better resonator) was optional – I left it out. The next version will be Arduino compatible – then it will be necessary. The resistor arrays are from the Rohm MNR14 Series – but you will get the more or less generic from everywhere.

Reply

Sergio July 9, 2009 at 10:14

An arduino version would be awesome! and much easier to develop.
I can’t wait to see it :-)

Reply

maddeviceman July 18, 2010 at 13:51

Actually, 0402 caps are perfectly doable – just hold them suckers with a tweezer while soldering them, otherwise, yes, surface tension will get the better of them… Put a blob of solder on the first pad, then place capacitor, heat the blob until the cap sinks in, then solder the other end.

Reply

Leave a Comment

{ 10 trackbacks }