Translate

Membuat Moving Teks dan Moving Sign Menggunakan DMD Panel Led P10 Arduino (Teks Berjalan)

Membuat Moving Teks dan Moving Sign Menggunakan DMD Panel Led P10 Arduino (Teks Berjalan)


         Pada kesempatan kali ini saya akan menjelaskan mengenai bagaimana cara membuat sebuah alat yang menggunakan panel LED P10 sebagai media penampil teks, alat ini menggunakan arduino sebagai kontrollernya dan I2C untuk menampilkan jam dan tanggal. yang perlu diperhatikan yaitu power supply untuk panel P10 ini adalah 5v 3A sehingga jangan sampai kurang dari itu. untuk lebih jelasnya berikut adalah program dan skemanya.  



a. Arduino Uno




b. Led panel P10






c. Program Arduino Teks Berjalan

#include <SPI.h>       
#include <DMD.h>       
#include <TimerOne.h>  
#include "SystemFont5x7.h"
#include "Arial_black_16.h"

//Isi dengan jumlah panel DMD yang di susun dalam kolom dan baris
#define DISPLAY_COLUMN_COUNT  2
#define DISPLAY_ROW_COUNT     1

#define PIXELS_PER_COLUMN    32
#define PIXELS_PER_ROW        16


DMD dmd(DISPLAY_COLUMN_COUNT, DISPLAY_ROW_COUNT);
char Text[] = "Selamat Datang di DigiWare Unlimited Innovations";
/*--------------------------------------------------------------------------------------
  Interrupt handler for Timer1 (TimerOne) driven DMD refresh scanning, this gets
  called at the period set in Timer1.initialize();
--------------------------------------------------------------------------------------*/
void ScanDMD()
{
  dmd.scanDisplayBySPI();
}

void setup(void)
{
   //inisialisasi Timer1 untuk menginterupsi pengeksekusian prosedur pindai DMD secara periodik
   Timer1.initialize( 1000 );           //perioda eksekusi pindai DMD selama 1 ms. Nilai yang lebih besar dapat menimbulkan efek flicker.
   Timer1.attachInterrupt( ScanDMD );   //terapkan prosedur interupsi pindai DMD
   dmd.clearScreen( true );   //normalnya true (semua piksel dalam keadaan mati), false (semua piksel dalam keadaan hidup)
}

void loop(void)
{  
   dmd.clearScreen( true );
   dmd.selectFont(Arial_Black_16);
  
   dmd.drawMarquee(Text,strlen(Text),
          (PIXELS_PER_COLUMN*DISPLAY_COLUMN_COUNT)-1,0);
   long start=millis();
   long timer=start;
   boolean ret=false;
   while(!ret){
     if ((timer+30) < millis()) {
       ret=dmd.stepMarquee(-1,0); // Geser 1 karakter ke kiri
       timer=millis();
     }
   }     
}




d. Program Arduino Moving Sign / Stikman

#include <SPI.h>       
#include <DMD.h>       
#include <TimerOne.h> 

//Isi dengan jumlah panel DMD yang di susun dalam kolom dan baris
#define DISPLAY_COLUMN_COUNT  2
#define DISPLAY_ROW_COUNT     1

#define PIXELS_PER_COLUMN  32
#define PIXELS_PER_ROW    16


DMD dmd(DISPLAY_COLUMN_COUNT, DISPLAY_ROW_COUNT);

// Running stick figure pictures are loosely based on those from this tutorial:
// http://www.fluidanims.com/FAelite/phpBB3/viewtopic.php?f=10&t=102

byte const run1[] PROGMEM = {
    16, 16,
    B00000000, B00001100,
    B00000000, B00011110,
    B00000111, B11111110,
    B00001111, B11111110,
    B00011100, B11111100,
    B00000001, B11111100,
    B00000001, B11110000,
    B00000011, B11111000,
    B00000111, B00011000,
    B00001110, B01110000,
    B00011100, B01100000,
    B00111000, B00000000,
    B01110000, B00000000,
    B01100000, B00000000,
    B01000000, B00000000,
    B00000000, B00000000
};

byte const run2[] PROGMEM = {
    18, 16,
    B00000000, B01110011, B10000000,
    B00000000, B11111111, B10000000,
    B00000000, B00011111, B10000000,
    B00000000, B00111111, B11000000,
    B00000000, B01111011, B11000000,
    B00000000, B11110011, B10000000,
    B00000001, B11100000, B00000000,
    B00000011, B11100000, B00000000,
    B00000111, B01110000, B00000000,
    B01111110, B00111000, B00000000,
    B11111100, B00011100, B00000000,
    B00000000, B00001110, B00000000,
    B00000000, B00000111, B00000000,
    B00000000, B00000011, B10000000,
    B00000000, B00000001, B00000000,
    B00000000, B00000000, B00000000
};

byte const run3[] PROGMEM = {
    18, 16,
    B00000000, B00110000, B00000000,
    B00000000, B01111000, B00000000,
    B00000000, B00011111, B00000000,
    B00000000, B00011111, B00000000,
    B00000000, B00111111, B10000000,
    B00000000, B01111111, B11000000,
    B00000000, B11100011, B10000000,
    B00000001, B11000000, B00000000,
    B00000011, B11100000, B00000000,
    B11111111, B01110000, B00000000,
    B11111110, B00111000, B00000000,
    B00000000, B00011000, B00000000,
    B00000000, B00011100, B00000000,
    B00000000, B00001110, B00000000,
    B00000000, B00000100, B00000000,
    B00000000, B00000000, B00000000
};

byte const run4[] PROGMEM = {
    16, 16,
    B00000001, B11100000,
    B00000011, B11111100,
    B00000000, B00111110,
    B00000000, B01111110,
    B00000000, B11111100,
    B00000001, B10011111,
    B00000011, B00001110,
    B00000011, B00000000,
    B00000011, B10000000,
    B11111111, B10000000,
    B11111000, B11000000,
    B00000001, B11000000,
    B00000011, B10000000,
    B00000111, B00000000,
    B00000110, B00000000,
    B00000100, B00000000
};

byte const run5[] PROGMEM = {
    13, 16,
    B00000000, B00000000,
    B00000000, B00110000,
    B00000111, B11111000,
    B00000111, B11111000,
    B00000111, B11110000,
    B00001111, B11100000,
    B00000111, B00000000,
    B00001111, B00000000,
    B00001111, B00000000,
    B00001111, B10000000,
    B00011100, B00000000,
    B00111000, B00000000,
    B01110000, B00000000,
    B11100000, B00000000,
    B11000000, B00000000,
    B10000000, B00000000
};

byte const run6[] PROGMEM = {
    16, 16,
    B00000000, B00000000,
    B00000000, B00011100,
    B00000000, B00111110,
    B00000001, B11111110,
    B00000000, B11100000,
    B00000001, B11100000,
    B00000001, B11111000,
    B00000011, B00011100,
    B00000110, B00111000,
    B00000110, B01110000,
    B00001100, B00100000,
    B00111000, B00000000,
    B01100000, B00000000,
    B11000000, B00000000,
    B10000000, B00000000,
    B10000000, B00000000
};

byte const run7[] PROGMEM = {
    18, 16,
    B00000000, B00000011, B10000000,
    B00000000, B01111011, B10000000,
    B00000000, B01111111, B10000000,
    B00000000, B00001111, B00100000,
    B00000000, B00011001, B11000000,
    B00000000, B00110000, B11000000,
    B00000000, B01110000, B00000000,
    B00000001, B11110000, B00000000,
    B11111111, B10111000, B00000000,
    B11111111, B00011100, B00000000,
    B00000000, B00001110, B00000000,
    B00000000, B00000111, B00000000,
    B00000000, B00000011, B10000000,
    B00000000, B00000001, B11000000,
    B00000000, B00000000, B01000000,
    B00000000, B00000000, B00000000
};

byte const run8[] PROGMEM = {
    18, 16,
    B00000000, B00000110, B00000000,
    B00000001, B11101111, B00000000,
    B00000001, B11111111, B00000000,
    B00000000, B00111110, B00000000,
    B00000000, B01111111, B11000000,
    B00000000, B11100011, B10000000,
    B00000001, B11000000, B00000000,
    B00000011, B11100000, B00000000,
    B11111111, B01110000, B00000000,
    B11111110, B00111000, B00000000,
    B00000000, B00011100, B00000000,
    B00000000, B00000110, B00000000,
    B00000000, B00000110, B00000000,
    B00000000, B00000111, B00000000,
    B00000000, B00000011, B00000000,
    B00000000, B00000001, B00000000
};

byte const run9[] PROGMEM = {
    16, 16,
    B00000000, B00000000,
    B00000000, B01001110,
    B00000001, B11101110,
    B00000011, B11111110,
    B00000011, B11111110,
    B00000001, B10111100,
    B00000011, B00000000,
    B00000111, B00000000,
    B11111111, B10000000,
    B11111100, B11000000,
    B00000000, B11000000,
    B00000000, B11000000,
    B00000000, B11000000,
    B00000000, B11000000,
    B00000000, B11000000,
    B00000000, B11000000
};

byte const run10[] PROGMEM = {
    13, 16,
    B00000000, B00000000,
    B00000000, B00110000,
    B00000000, B01111000,
    B00000111, B11111000,
    B00001111, B11111000,
    B00000111, B11000000,
    B00001110, B00000000,
    B00001100, B00000000,
    B00001100, B00000000,
    B01111100, B00000000,
    B11111100, B00000000,
    B00011000, B00000000,
    B00110000, B00000000,
    B01110000, B00000000,
    B01100000, B00000000,
    B01000000, B00000000
};

PGM_VOID_P frames[] = {
    run1,
    run2,
    run3,
    run4,
    run5,
    run6,
    run7,
    run8,
    run9,
    run10
};
#define NUM_FRAMES  (sizeof(frames) / sizeof(frames[0]))
unsigned int frame = 0;

#define ADVANCE_MS  (1000 / NUM_FRAMES)
unsigned long lastFrame;
int runStep, runStepMax;

void ScanDMD()
{
  dmd.scanDisplayBySPI();
}

void setup() {
    //inisialisasi Timer1 untuk menginterupsi pengeksekusian prosedur pindai DMD secara periodik
   Timer1.initialize( 2000 );           //perioda eksekusi pindai DMD selama 2 ms. Nilai yang lebih besar dari 5ms (5000) dapat menimbulkan efek flicker.
   Timer1.attachInterrupt( ScanDMD );   //terapkan prosedur interupsi pindai DMD
   dmd.clearScreen( true );   //normalnya true (semua piksel dalam keadaan mati), false (semua piksel dalam keadaan hidup)
   lastFrame = millis() - ADVANCE_MS;
   runStepMax = PIXELS_PER_COLUMN * 5;
   runStep = -13;
}

void loop() {
    if ((millis() - lastFrame) >= ADVANCE_MS) {
        dmd.clearScreen( true );
        int x = (runStep - pgm_read_byte(frames[frame])) / 2;
        runStep+=4;
        if (runStep > runStepMax)
          runStep = -PIXELS_PER_COLUMN; 
        dmd.drawBitmap(x, 0, frames[frame],1);
        lastFrame += ADVANCE_MS;
        frame = (frame + 1) % NUM_FRAMES;
    }
}





e. Cara Menyambungkan Arduino ke Led Panel P10








f. VIDEO HASILNYA










No comments:

Post a Comment