LED Badges

Just after getting back from 27c3 in early January Jeffrey and myself got talking about a project for TOG’s Paddy’s Day hackaton.

Our general idea was to create a little badge with LEDs in the shape of a shamrock. We were hoping for something small, light and bright with lots of LEDs. I said that I would do some more research to see if it would work and if it did to come up with a suitable circuit design.

I knew the general idea was to use a step-up (boost converter) to increase the voltage level so to that I could drive a string of LEDs. I then began to search manufactures sites for suitable components and relevant information.

After searching all the main contenders I found a very interesting range of chips in a small five pin surface mount package from ON Semiconductor. The most interesting options were the CAT4137 LED Driver, Boost, 5 LED and CAT4238 LED Driver, Boost, 10 LED. Another option from Linear Technology was the LT1932 – Constant-Current DC/DC LED Driver in ThinSOT. As I wasn’t sure what would work I ordered a couple of each component and the suggested supporting components. Along with lots of green surface mount LEDs.

I then designed and etched a simple proof of concept board. After soldering it up and connecting up a CR2032 coin cell battery it worked but I was disappointed with the brightness of the LEDs.

I then put the project on hold. Roll on a couple more weeks and I looked at this project again.

Investigating the proof of concept board I realised I had used a wrong resistor value and was trying to supply 30 milliamperes instead of 10 milliamperes into the string of LEDS. Changing this didn’t really help increase the brightness. But it did point me in the direction that I was just trying to draw too much current from the battery.

I found the following blog post on using cr2032 coin cells from Marcus from Interactive Matter (who I meet at 27c3) very informative. Connecting up the circuit to two AAA batteries solved the brightness problem.

I have now reworked the board into a near final layout. And as a token gesture to the 14th of February (Valentines Day) I’ve created a design in the shape of a heart.

Tomorrow I’ll finish the prototype of the shamrock badge and post a picture. If I created a kit would you be interested in buying it?

Update: Here is the photo of the prototype for the shamrock badge. When we looked at it after I assembled the badge it was hard to make out the leafs also I might change the resistor value to increase the brightness.


Engineers Week 2011

Next week I’m helping to run a number of events in TOG for Engineers Week.

I’ll be helping Jeffrey with his free Arduino 101 – Learn to Blink on Tuesday, the Soldering Workshop on Saturday and I’ll be giving a new LED Dot Matrix Display Workshop on Sunday (I hope to do a write up soon).

During the week I have a number of Arduino Uno‘s boards available for €30.

Also over the weekend I’ll take part in the Synchronous Hackathon and I hope to have time to help with TOG’s Hackerspace 555 Timer Challenge entry for the 555 Contest.


Small 16×16 RGB LED Display

The photo shows a prototype of a small 16×16 RGB LED matrix display that I worked on during 27c3 in the Hardware Hacking Area.

The display is made up of four 8×8 RGB LED modules which are only 32mm by 32mm which doesn’t give much room to work with. Each module has it’s own TLC5947 a 24-Channel, 12-Bit PWM LED Driver from Texas Instruments sinking the columns and a A2982 8-Channel Source Driver from Allegro MicroSystems source the rows. The display is controlled by an mbed NXP LPC1768 micro controller. With a 74HC238 3-to-8 Decoder and a custom switch-mode power supply module rounding out the board.

Coming up with a suitable schematic and layout only took a couple of days as I’ve used all the parts before in other boards. Etching the board and drilling the holes took about two hours on xmas eve. Reviewing the board and schematic on Day 1 I discovered a problem with the way some part were connected. With a craft knife and some future solder bridges I was able to work around the problem. I’ve already corrected the schematic and layout if I decide to make the board again.

On Day 2 after Mitch Altman’s workshop on Arduino For Newbies I began to solder the board. The process was relatively straight forward with mostly surface mount packages in SOIC and TSSOP package types. The most time consuming part was creating vias by soldering a thin wire between the two sides of the board and inserting the last LED module as the drill holes were very narrow. Though in all the soldering took about six hours.

The smoke test was successful in that it found no faults in the board. So I could now move on to programming the mbed by adapting some code from a previous project. The programming results late on Day 2 weren’t great with significant flashing of the display. Though I did discover a soldering fault which didn’t show up during the smoke test.

Day 4 was much more successful after a good nights sleep. So with a fresh head, the basic operation is. Each TLC5947 contains 24 12-bit shift registers which are connected together in series and driven by one of the SPI ports on the mbed, these registers are the source of gray scale data which is controlled by additional pins connected to the mbed. The high side current coming from the A2982’s is controlled by a 3-to-8 decoder also connected to the mbed. The corrected sequence for displaying a line on the display is that the 1153 (24 * 12 * 4) bits of data is loaded into the shift registers through the SPI port, the output is blanked, then the correct row is selected on the decoder, the data latched into the gray scale registers and the output re enabled. Then repeat for the next 7 lines, to draw a full frame.

Now at the end of Day 3 the display and code can easily operate with no flashing, I’m not sure of the refresh rate. I even spent some time working on random graphics and drawing display modes, though I’m sure better results would be achieved by someone else. I’m very happy with the results as I was expecting an out right failure.

Now what? I’ve got some small changes I could make to the board including reducing the brightness of the LEDs by changing some current controlling registers and the software can always be worked on. This was a proof of concept project for a 16×16 display I’ve been working on similar to the cool [Projekt:Bunt] a large 10×10 RGB matrix. So this prototype and any software developed for it should help the testing or running of a larger display.


I Come In Peace

I’m attending the 27th Chaos Communication Congress – We Come In Peace conference in Berlin for the next couple of days.

I plan to hang out in the Hardware Hacking Area for most of the conference. I brought lots of Mini Mood Light v1 kit’s, which I’ll be selling for €15 at the conference, along with some other stuff to sell.

Also on day one I’m giving an Introduction to gEDA workshop. Where I’ll be showing participants how to use some of the open source electronics design tools from the gEDA project.


Linux development environment for TI LaunchPad

The MSP430 LaunchPad development kit from Texas Instruments is very interesting. It includes a development board, two DIP micro controllers, a Mini USB cable, four headers connectors, a crystal and two stickers. But the most exciting part is that you get all this for $4.30 from TI.

I’ve also been using the LaunchPad to program the MCU in the Mini Mood Light v1 which also uses a MSP420G2211.

To get the LaunchPad working with Linux you need a suitable toolchain (assembler, compiler, library and debugger) and flash programing software. Unfortunately the required software isn’t packaged with current Linux distributions, so we need to compile the software ourselves.

In the past it was a complex task setting up a cross compiler. Having to download individual source archives, finding required patches, providing suitable command line options and all that in a specific order. Today we have the MSPGCC4 project which provides and maintains an interactive script which preforms most of the heavy lifting required. We can also use the MSPDebug tool to program and debug the flash on the LaunchPad.

My preferred distribution is Debian but I hope my description is significantly generic to be useful to other distribution users.

The first step is to install as root the required programs, libraries and dependencies which are required to compile the toolchain. On Debian the following command can be used to install the required packages.

# apt-get --no-install-recommends install bzip2 dialog gcc gcc-4.4 \
gzip libc6-dev libncurses5-dev libreadline6-dev libusb-dev \
make patch tar texinfo wget zlib1g-dev

If you want to use the graphical interface to gdb call Insight, also install the X windows libraries. The libx11-dev package on Debian.

My preference is to install and run toolchains inside a sub directory of my home directory, which also allows for easier backups and upgrades in the future.

~$ cd ~
~$ mkdir msp430
~$ cd msp430
~/msp430$ wget
~/msp430$ tar jxf mspgcc4-20101114.tar.bz2
~/msp430$ cd mspgcc4-20101114
~/msp430/mspgcc4-20101114$ perl

We now need to answer some questions about what versions of tools we will include in our toolchain.

Select GCC version to build: gcc-4.4.5
Select GDB version to build: gdb-7.1
Select Insight version to build: none
Select libc version to build: ti_20101114
Strip debug information from executables after install? Yes
Enter target toolchain path [HOME]/msp430/toolchain (Replace [HOME] with the full path of your home directory i.e. /home/robert)
Create binary package after build? No
Do you want to start build right now? Yes

The build script will now download, configure and compile the required source packages which might take some time depending on the speed of you internet connection and computer.

Once the script as finish you can save some space by deleting the build directory.

~/msp430/mspgcc4-20101114$ rm -rf build
~/msp430/mspgcc4-20101114$ cd ..

Now we’ll install the flash programmer.

~/msp430$ wget
~/msp430$ tar zxf mspdebug-0.13.tar.gz
~/msp430$ cd mspdebug-0.13
~/msp430/mspdebug-0.13$ make PREFIX=[HOME]/msp430/toolchain all install
~/msp430/mspdebug-0.13$ cd ..

So that we can compile code for the LaunchPad we’ll add the toolchain executables to our path.

~/msp430$ export PATH=$PATH:[HOME]/msp430/toolchain/bin

We can make the toolchain permanently accessible by adding the above export command to our ~/.bashrc startup file.

To test our new toolchain we’ll compile a very simple example program which just blinks the red and green LEDs on the LaunchPad. Save the following as blink.c.

#include "msp430g2231.h"
#include "signal.h"

void main(void) {
        WDTCTL = (WDTPW | WDTHOLD);  // Disable Watchdog timer+

        P1SEL = (0x00);              // Port 1 Select GPIO
        P1DIR |= (BIT6 | BIT0);      // Direction 1.[60] Output
        P1OUT |= (BIT6);

        TACCTL0 = (CCIE);            // Enable interrupt on compare match
        TACCR0 = (0xFFFF);           // Compare value
        TACTL = (TASSEL_2 | MC_1);   // Sub system clock source | Up mode

        _BIS_SR(GIE | CPUOFF);       // General interrupt enable | Turn off CPU

interrupt(TIMERA0_VECTOR) TIMER_A0(void) {
        P1OUT ^= (BIT6 | BIT0);

To compile the code you can use the following command.

~/msp430$ msp430-gcc -g -mmcu=msp430x2231 -o blink.elf blink.c

To flash the MCU we can use the following command as root.

# [HOME]/msp430/toolchain/bin/mspdebug rf2500 "prog [HOME]/msp430/blink.elf"

If the programming is successful the red and green LEDs should now rapidly turn on and off.