Dimensi modul adalah P10: 16 led x 32 Led
Hardware/Modul
konektor antara Arduino dan modul P10 bisa dilihat :
Circuit/rangkaian modul P10
Data akan dikirm dari modul arduino secara serial via soket HUB1.2 kemudian diterima oleh IC serial to paralel 74595. Kalau ada tambahan modul akan diambil dari keluaran 74595 yg terakhir yang dihubungkan ke soket X2-OUT. Untuk suplay arus diberikan oleh ic driver penguat daya VT1,VT2 dan seterusnya. Untuk memilih kolom mana yg menyala diaktifkan oleh IC multiplexer.
penjelasan pin pada konektor
- OE: Output Enable untuk on/off semua LED
- A dan B: memilih kolomyg aktif.
- CLK: SPI clock
- SCLK: Latch data register
- R: SERIAL DATA SPI
Jikalau modul P10 lebih dari 1 , maka rangkaiannya dibentuk secara cascade seperti gambar berikut:
Gambar dilihat dari arah belakang modul P10
DMD dmd(2,2); // 2 modul P10 ke samping , 2 modul P10 ke bawah.
software
Langkah-langkah cara install library untuk menjalankan DMD P10
- Download DMD Libray untuk arduino di https://github.com/freetronics/DMD
- Extraxt dan simpan DMD library di folder ” arduino/libraries”
- download TimerOne library untuk arduino di http://code.google.com/p/arduino-timerone/downloads/list
- Extraxt dan tempatkan TimerOne di folder arduino/libarries
- Restart IDE arduino
- lihat di Arduino IDE File>Examples>DMD
- buka salah satu contoh & compile.
#include <SPI.h>
#include <DMD.h>
#include <TimerOne.h>
#include “SystemFont5x7.h”
#include “Arial_Black_16_ISO_8859_1.h”
Fungsi fungsi yg ada di library DMD yang digunakan antara lain:
//Instantiate the DMD
DMD(byte panelsWide, byte panelsHigh);
//Set or clear a pixel at the x and y location (0,0 is the top left corner)
void writePixel( unsigned int bX, unsigned int bY, byte bGraphicsMode, byte bPixel );
//Draw a string
void drawString( int bX, int bY, const char* bChars, byte length, byte bGraphicsMode);
//Select a text font
void selectFont(const uint8_t* font);
//Draw a single character
int drawChar(const int bX, const int bY, const unsigned char letter, byte bGraphicsMode);
//Find the width of a character
int charWidth(const unsigned char letter);
//Draw a scrolling string
void drawMarquee( const char* bChars, byte length, int left, int top);
//Move the maquee accross by amount
boolean stepMarquee( int amountX, int amountY);
//Clear the screen in DMD RAM
void clearScreen( byte bNormal );
//Draw or clear a line from x1,y1 to x2,y2
void drawLine( int x1, int y1, int x2, int y2, byte bGraphicsMode );
//Draw or clear a circle of radius r at x,y centre
void drawCircle( int xCenter, int yCenter, int radius, byte bGraphicsMode );
//Draw or clear a box(rectangle) with a single pixel border
void drawBox( int x1, int y1, int x2, int y2, byte bGraphicsMode );
//Draw or clear a filled box(rectangle) with a single pixel border
void drawFilledBox( int x1, int y1, int x2, int y2, byte bGraphicsMode );
//Draw the selected test pattern
void drawTestPattern( byte bPattern );
//Scan the dot matrix LED panel display, from the RAM mirror out to the display hardware.
//Call 4 times to scan the whole display which is made up of 4 interleaved rows within the 16 total rows.
//Insert the calls to this function into the main loop for the highest call rate, or from a timer interrupt
void scanDisplayBySPI();
Contoh Kode program:
/*–Includes——-*/
#include <SPI.h>
#include <DMD.h>
#include <TimerOne.h>
#include “SystemFont5x7.h”
#include “Arial_Black_16_ISO_8859_1.h”
//Fire up the DMD library as dmd
#define DISPLAYS_ACROSS 1
#define DISPLAYS_DOWN 1
DMD dmd(DISPLAYS_ACROSS, DISPLAYS_DOWN);
/*
Interrupt handler for Timer1 (TimerOne) driven DMD refresh scanning, this gets
called at the period set in Timer1.initialize();
*/
void ScanDMD()
{
dmd.scanDisplayBySPI();
}
/*————————————————————————-
setup
Called by the Arduino architecture before the main loop begins
————————————————————————-*/
void setup(void)
{
//initialize TimerOne’s interrupt/CPU usage used to scan and refresh the display
Timer1.initialize( 3000 ); //period in microseconds to call ScanDMD. Anything longer than 5000 (5ms) and you can see flicker.
Timer1.attachInterrupt( ScanDMD ); //attach the Timer1 interrupt to ScanDMD which goes to dmd.scanDisplayBySPI()
//clear/init the DMD pixels held in RAM
dmd.clearScreen( true ); //true is normal (all pixels off), false is negative (all pixels on)
Serial.begin(115200);
}
/*————————————————————————-
loop
Arduino architecture main loop
————————————————————————-*/
void loop(void)
{
dmd.clearScreen( true );
dmd.selectFont(Arial_Black_16_ISO_8859_1);
const char *MSG = “apa kabar”;
dmd.drawMarquee(MSG,strlen(MSG),(32*DISPLAYS_ACROSS)-1,0);
long start=millis();
long timer=start;
while(1){
if ((timer+30) < millis()) {
dmd.stepMarquee(-1,0);
timer=millis();
}
}
}
referensi:
http://cdn.shopify.com/s/files/1/0045/8932/files/DMD_Getting_Started.pdf?100647
http://www.freetronics.com.au/pages/using-your-freetronics-dmd#.VyRQANSLTI
https://github.com/freetronics/DMD
https://forum.arduino.cc/index.php?topic=260320.0
Semoga bermanfaat !
ConversionConversion EmoticonEmoticon