#10. Output Devices

LEDs Matrix

So for this week i though i might do something in terms of my final project, so i went into the examples and choosen the second version of the "LED Array" and maybe understand better the concept.
Grabbed the layout files, went into CorelDraw so that i could trace it's lines and save the files as SVG. After this imported it in the Easel software so that i could fabricate the pcb. Also i trace the squares so that i could cut it in the vinyl cutter to serve as a mask to be able to have wires over the traces and no short circuits.

Before glueing the vinyl protection i went and check it all the carved pcb was good and found some small wires touching the contacts that could be a problem later so grabbed some tweezers the removed all.

After this part i went and appplyed the vinyl, looked great, and here it is with a detailed photo as well.

Then i just soldered everything as it should be (i think) and unfortunately i didn't work, search for the problem but could find it and just gave up.
Since the idea was only to make an aproach to the matrix, so with that in mind i went and start to research on this topic for my final project, so i'll redirect now the rest of the output to the LED matrix of my final project. Nevertheless, here's a video of what resulted of my atempt to reproduce the LED Array, there's some shorts under the vinyl, probably due to some not so precise soldering.

The code i used was Neil's, unfortunately due to the soldering problems i had "hidden" i could fix it later and so the code didn't worked properly. It wasn't very easy to understand how the code would activate the LEDs individualy but the changing of polarity between the pins was really cool. Didn't risk myself on doing this for my matrix due to its dimension.


// hello.array.44.c
//
// Charlieplex LED array hello-world
//
// Neil Gershenfeld
// 11/13/10
//
// (c) Massachusetts Institute of Technology 2010
// This work may be reproduced, modified, distributed,
// performed, and displayed for any purpose. Copyright is
// retained and must be preserved. The work is provided
// as is; no warranty is provided, and users accept all 
// liability.
//

#include 
#include 

#define output(directions,pin) (directions |= pin) // set port direction for output
#define input(directions,pin) (directions &= (~pin)) // set port direction for input 
#define set(port,pin) (port |= pin) // set port pin
#define clear(port,pin) (port &= (~pin)) // clear port pin
#define pin_test(pins,pin) (pins & pin) // test for port pin
#define bit_test(byte,bit) (byte & (1 << bit)) // test for bit set

#define led_delay() _delay_ms(1) // LED delay

#define led_port PORTA
#define led_direction DDRA

#define A (1 << PA1) // row 1
#define B (1 << PA2) // row 2
#define C (1 << PA3) // row 3
#define D (1 << PA4) // row 4
#define E (1 << PA5) // row 5

void flash(uint8_t from, uint8_t to, uint8_t delay) {
   //
   // source from, sink to, flash
   //
   static uint8_t i;
   set(led_port,from);
   clear(led_port,to);
   output(led_direction,from);
   output(led_direction,to);
   for (i = 0; i < delay; ++i)
       led_delay();
   input(led_direction,from);
   input(led_direction,to);
   }

void led_cycle(uint8_t number, uint8_t delay) {
   //
   // cycle through LEDs
   //
   uint8_t i;
   for (i = 0; i < number; ++i) {
      flash(B,A,delay);
      flash(C,A,delay);
      flash(D,A,delay);
      flash(E,A,delay);
      flash(A,B,delay);
      flash(C,B,delay);
      flash(D,B,delay);
      flash(E,B,delay);
      flash(A,C,delay);
      flash(B,C,delay);
      flash(D,C,delay);
      flash(E,C,delay);
      flash(A,D,delay);
      flash(B,D,delay);
      flash(C,D,delay);
      flash(E,D,delay);
      flash(A,E,delay);
      flash(B,E,delay);
      flash(C,E,delay);
      flash(D,E,delay);
      }
   }

int main(void) {
   //
   // set clock divider to /1
   //
   CLKPR = (1 << CLKPCE);
   CLKPR = (0 << CLKPS3) | (0 << CLKPS2) | (0 << CLKPS1) | (0 << CLKPS0);
   //
   // main loop
   //
   while (1) {
      led_cycle(1,100);
      led_cycle(3,20);
      led_cycle(100,1);
      }
   }

                                

Files to download:

Design files