HOWTO: make a big sensitive adjustable button.

Upplagd av Jalvemo

This is how we made a button with adjustable depth needed for pushing it.
A & B: screws
C: metallic plate mounted under the button surface
D: cables mounted in the screw and metallic plate (if they connect the button is pressed)
E: Foam pushing the surface up towards screw A.
F: The button surface with a hole for screw A

note: This assembly is to be built in all 4 corners of the button.

It's easy to have as many LED's as you have outputs on your microcontroller but what happens when you need more of them?

In our project we used the Sun SPOT which has five I/O ports of which one had to be used for input leaving us with only four ports. This would have been fine if we had only four LEDs but we had in total 18 (three colours multiplied by six sides). Well, actually we had 3x9x6 LEDs which makes it a total of 162 LEDs. They were connected in parallell of nine so only 3x6 outputs were needed.

This is where shift registers come in handy. They allow you to store multiple digital values (1/0) for later reading using only one output (well, three actually, but the other two are not data as such, only control for the shift register).

  • STR makes the shifted bits appear on the outputs.
  • CP is used for telling the shift register to "shift" all values one step further.
  • D is used for the data that you want to shift out. It is read by the shift register when CP is cycled.
Shifting out an array of bits goes like this:

Pseudo code
  1. Set STROBE to 0

  2. For each LED

  3.   Set CLOCKPULSE to 0

  4.   Set DATA to either 0 or 1 (LED on or off)

  5.   Set CLOCKPULSE to 1

  6. End for

  7. Set STROBE to 1

On the Sun SPOT, you'd do this:

byte[] data = { 0, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 0 };
static IIOPin D = EDemoBoard.getInstance().getIOPins()[EDemoBoard.D0];
static IIOPin CP = EDemoBoard.getInstance().getIOPins()[EDemoBoard.D1];
static IIOPin STR = EDemoBoard.getInstance().getIOPins()[EDemoBoard.D2];

for (int i = data.length - 1; i >= 0; i--) {
  D.setHigh(data[i] > 0);

Note that the loop is actually going backwards because the first bit you send will actually be available on the last pin of the shift register, something we didn't realize until after the circuit was soldered.

Shift registers for RGB LEDs

The shift register we used is called HEF4894B and is a "12-bit store and shift register" which is a nicer way of saying it can hold 12 bits. Here's the datasheet (PDF).

We connected it like this:

Three of the ports on the Sun SPOT was connected to STR, CP and D respectively. These were used for controlling the shift register.

The LEDs were connected on the outputs of the shift register in triples of RGB for each side.

For getting all LEDs to work, we had to daisy-chain two shift registers making the total number of bits expand up to 24 bits. Connecting two shift registers was quite easy. Just connect the same STR and CP from from the first one and connect the first ones OS' (Output Serial on negative clockcycle, should work with regular OS but we tried OS' first and didn't dare tamper with it) output to the seconds D input.

The power feed for the LEDs was connected on the VDD input on the shift register. Ground was connected to VSS.

As you can clearly see in this demonstration video, the RGB values are shifted out in triplets for the effect of wandering colours. Normally you wouldn't send the STR before all bits are sent but if you want this effect, send it after each triplet.

All was good.

HOWTO: Diffuse LEDs

Upplagd av Jalvemo


Once testing our new multi coloured RGB LEDs, we ran in to some problems with the direction of the light. When mixing the different colours the red, green and blue light components all went in different, quite straight directions instead of blending in to one colour.


We simply used sandpaper on them. The result was LEDs with more multidirectional light which made the different colours blend more smoothly together. Not perfect but a great improvement. One minor effect on the downside is that the light intensity decreased a notch.

HOWTO: Calibrating RGB LED's

Upplagd av Joakim Bergman

The cheap RGB LEDs aren't exactly even in colour. The red can be much brighter than the green and blue or vice versa.

There's a simple fix for this. Just use different resistors for each colour. One way to determine what resistors you should get is to try first with potentiometers, preferably one with high granularity (depending on how your LED's are connected, you will need different values).

Our setup was 9 LED's connected in parallell per resistor which means that the combined resistance should be about ~5 Ohms according to some guide we found online (google for LED calculator). We had three of these ELFA 64-721-61. They can be rotated 20 times from ~0 to ~200 Ohm which gives you a resolution about 10 Ohms per rotation. It was enough to get the values we were looking for (although in retrospect we should have gone with the 0–50 Ohms for even higher resolution).

Just hook all the LED's up and put the resistor between the current and the LED's and start screwing. Use some simple switches to turn each colour off as you try to match their respective brightness.

When the brightness is to your liking, just measure the resistance of each potentiometer to find out what regular resistors you should use in your circuits.