Saturday, May 16, 2015

Intel Galileo Interactive LED Matrix

Create an interactive 8x8 LED Matrix and send pictures to be displayed from anywhere around the world!
In this project we are using an Intel Galileo board which Intel has generously provided us with (they're giving a lot of those to unis worldwide). The Intel Galileo seems to be a great device for the job, as it combines a Linux system with built-in Ethernet with an Arduino
We created this interactive project as part of our course, Multimodal Media Madness - Personal Fabrication at RWTH Aachen University, Germany. It consists of two main elements, the Intel Galileo with the LED matrix and a server side application. On the server runs a simple drawing application so anyone who has access to the site can draw pictures, and your LED matrix will display them!
A running version of the drawing app can probably still be found atben.jycomputer.com/galileo
 
Remove these adsRemove these ads by Signing Up

Step 1: Gather materials

For this Instructable you'll need:

Step 2: Install the LED Matrix and Bit Shift Register

Install the 8x8 LED Matrix on the Breadboard. Have the side with text face the left side of your Breadboard. The LED matrix has two sets of 16 Pins. The Pins for the Vcc of the LEDs are on the column and the Pins for the green LEDs are on the row to the right, the Pins for the blue and the red ones are on the rows to the left.
Place the High Voltage Source Driver close to the right side of the 8x8 LED Matrix.

Step 3: Connect the High Voltage Driver to the Matrix

Connect the High Voltage Source Driver (HVSD) to the Pins of the Vcc columns of the 8x8 LED Matrix. Output 1 goes to LED Pin 32, Output 2 to Pin 31 and so on.
Note that the column pins asadre the two outermost sets of 4 Pins(Pins 17 to 20 and 29 to 32) on one side of the Matrix. To be sure which side this is please refer to the datasheet. Pin1 is labeled as that on the bottom of the Matrix.
Make a connection from the High Voltage Source Drivers VCC and GND to the corresponding bars on your Breadboard.

Step 4: Connect the HVSD to the Galileo

To connect the Input Pins of the High Voltage Source Driver to the output Pins of the Galileo.
  • Galileo Output 6 connects to HSVD Input 1
  • Galileo Output 5 connects to HSVD Input 2
  • Galileo Output 8 connects to HSVD Input 3
  • Galileo Output 9 connects to HSVD Input 4
  • Galileo Output 10 connects to HSVD Input 5
  • Galileo Output 11 connects to HSVD Input 6
  • Galileo Output 12 connects to HSDV Input 7
  • Galileo Output 13 connects to HSVD Input 8
Make the connections as per the Description. In the Picture the cable from pin 7 has to go to the pin 5.
Note: Due to some yet unsolved issue with pin 7 that caused flickering we had to remap pin7 to pin 5. The Sketch that you upload to the Galileo already takes care of that remapping.
Connect the GND and 5V VCC Pins of the Galileo to the corresponding bars of your Breadboard

Step 5: Protect the LEDs

To protect the LEDs, connect 10 Ohm resistors to the LED pins(If you want to use the RED LEDs you have to connect Pins 1 to 8). On the end of every resistor, put a cable that we'll connect to the 8 bit shift register.
Note: If you use a different LED matrix, you'll propably need other resistors so it still lights up brightly.

Step 6: Connect the LEDs to the Shift Register

Connect every outputs of the 8 bit shift register(Q0 thru Q7) to the other ends of the resistors. If you want to connect the red LEDs as we did, you have to connect Q0 to Pin8, Q1 to Pin7 and so on.
Note, that one output of the Shift Register is not on the same side as the others (as detailed in the Data Sheet)

Step 7: Connect the Shift Register to the Galileo

To make the necessary connections to push the data into the Shift Register connect:
  • Data Pin: DS (or SI) from the ShiftRegister to Digital 2 on the Galileo (Picture Yellow)
  • Clock Pin: SHCP (or SCK) from the ShiftRegister to Digital 3 on the Galileo (Picture Blue)
  • Latch Pin (to trigger output on the Shift Register): STCP (or RCK) rom the ShiftRegister to Digital 4 on the Galileo (Picture Black)

Step 8: Setting up your Galileo

The Instructable Galileo - Getting Started should help you get set using the Galileo. You might also want to download Linux to the microSD as it enables the Sketch to start automatically whenever the Galileo gets powered on. Intel's website has a ton of resources too, but it's kinda hidden.

Step 9: Load the Code onto the Galileo

To breathe life into your LED Matrix, copy and paste our Code into the Arduino IDE and run it. You can also download the .ino file below. The Code uses Interrupts to fill the Shift Register and light up the specific LEDs. Also the "popen" command is used to communicate between the underlying Linux shell and our sketch. The binary file it gets from the server is downloaded by using curl.
NOTE: Of course you'll have to change the URL to your own server.
#include <timerone.h>

int on = 0; 
int last_on = 0;
int datapin = 2; 
int clockpin = 3;
int latchpin = 4;
byte data[8];
FILE *fp;
char input[10];

void setup() 
{
  // Initialize the digital pin as an output.
  // Pin 13 has an LED connected on most Arduino boards
  
  
  pinMode(13, OUTPUT);    
  pinMode(12,OUTPUT);
  pinMode(11,OUTPUT);
  pinMode(10,OUTPUT);
  pinMode(9,OUTPUT);
  pinMode(8,OUTPUT);
  pinMode(7,OUTPUT);  
  pinMode(6,OUTPUT);
  pinMode(5,OUTPUT);
  pinMode(4,OUTPUT);
  pinMode(3,OUTPUT);
  pinMode(2,OUTPUT);
  pinMode(1,OUTPUT);
  pinMode(0,OUTPUT);
  
  Timer1.initialize(1000); // the timer period is 100000 useconds, that is 0.1 sec  
  Timer1.attachInterrupt(timerIsr,1000); // the callback will be called on each 5th timer interrupt, i.e. every 0.5 sec
  //initLED();
  data[0] = 0b00000111;
  data[1] = 0b00000001;
  data[2] = 0b11100111;
  data[3] = 0b10110001;
  data[4] = 0b10101011;
  data[5] = 0b10101000;
  data[6] = 0b10101000;
  data[7] = 0b10101000;
            
  Serial.begin(115200);
  
}
 
void loop()
{
   
    //SWAP THE URL PLEASE
    fp = popen("curl PLEASE INSERT YOUR URL HERE/galileo/picture.txt","r");
    
    if(fp == NULL)
    {
       Serial.println("Couldnt run the curl command");
    }
    else
    {
      fgets(input,10,fp);
    }
    if(pclose(fp) != 0)
    {    Serial.println("fail");
    }
    data[0] = (byte)input[1];
    data[1] = (byte)input[2];
    data[2] = (byte)input[3];
    data[3] = (byte)input[4];
    data[4] = (byte)input[5];
    data[5] = (byte)input[6];
    data[6] = (byte)input[7];
    data[7] = (byte)input[8];
    delay(3000);
}
 
/// --------------------------
/// Custom ISR Timer Routine
/// --------------------------

void timerIsr()
{   
    if(on==6)
      on = 8;
    digitalWrite((13-last_on), LOW);
    digitalWrite(latchpin,LOW);
    if(on == 8)
      shiftOut(datapin, clockpin, MSBFIRST, ~data[6]);
    else
      shiftOut(datapin, clockpin, MSBFIRST, ~data[on]);
      
    digitalWrite(latchpin,HIGH);
    digitalWrite( (13-on), HIGH);
    digitalWrite((13-last_on),LOW);
    
    last_on = on;
    if(on == 8)
      on =6;    
   
   on = (on+1)%8; 
}

Step 10: Set up the Server Side & Connect the Galileo

On the server runs a simple php script which provides a nice drawing interface. The picture is converted to binary and stored in the file picture.txt, which the Galileo can download.
You'll need some kind of webserver setup with php installed. Just use one ofthese handy instructables if you haven't got one already!
Just put the file index.php on your server. (Remove the .txt extension first.) You might want to rename it to something like galileo.php if the folder already has an index.* file.
Don't forget to create an empty text file named "picture.txt" which the user "www-data" (or whatever user runs your webserver - Attention: This is normally not the same user that set up the server!) can read and write into. The easiest way (on a linux shell) is the following:
$ cd /path/to/index.php
$ touch picture.txt
$ sudo chown www-data picture.txt
Start up the Galileo, run the Sketch and connect it to the internet.
Now just browse to the php file in your web browser of choice and start drawing. It even works on mobile devices!

No comments:

Post a Comment

Welcome to My Blog

Popular Post

Blogger templates

Powered by Blogger.

Navigation-Menus (Do Not Edit Here!)

Opt In (Do Not Edit Here)

Followers

kc innovation we direct the fucture

Popular Posts

Social Profile Icons (Do Not Edit Here!)

Subscribe Via Email (Do Not Edit Here!)

- Copyright © Artificial Intelligence -Robotic Notes- Powered by Blogger - Designed by Johanes Djogan -