કોડ શોધો

8x8 LED મેટ્રિક્સ MAX7219 આર્ડુઇનો મોડ્યુલનો ઉપયોગ કરીને

8x8 LED મેટ્રિક્સ MAX7219 આર્ડુઇનો મોડ્યુલનો ઉપયોગ કરીને

આ ટ્યુટોરિયલમાં, આપણે Arduino સાથે MAX7219 મોડ્યુલનો ઉપયોગ કરીને 8x8 LED મેટ્રિક્સને કેવી રીતે નિયંત્રિત કરવું તે શીખીશું. MAX7219 બહુવિધ LED ને નિયંત્રિત કરવાનું સરળ બનાવે છે, જેનાથી આપણે અક્ષરો અને પેટર્ન સરળતાથી પ્રદર્શિત કરી શકીએ છીએ. આ પ્રોજેક્ટના અંત સુધીમાં, તમે મેટ્રિક્સ પર "ROBOJAX" શબ્દ પ્રદર્શિત કરી શકશો.

આ હાંસલ કરવા માટે, આપણે LedControl લાઇબ્રેરીનો ઉપયોગ કરીશું, જે ખાસ કરીને MAX7219 સાથે ઇન્ટરફેસ કરવા માટે બનાવવામાં આવી છે. આ લાઇબ્રેરી આપણને ન્યૂનતમ પ્રયત્ન સાથે LED મેટ્રિક્સ પર ડેટા મોકલવાની મંજૂરી આપે છે. જો તમને વાયરિંગ અને કોડની સ્પષ્ટ સમજ જોઈતી હોય, તો સંબંધિત વિડિયો ચોક્કસપણે તપાસો (વિડિયોમાં 0:30 પર).

હાર્ડવેર સમજાવ્યું

આ પ્રોજેક્ટના મુખ્ય ઘટકોમાં MAX7219 મોડ્યુલ અને 8x8 LED મેટ્રિક્સનો સમાવેશ થાય છે. MAX7219 એક ઇન્ટિગ્રેટેડ સર્કિટ છે જે LED ના પ્રદર્શનનું સંચાલન કરે છે, Arduino થી સંચાર અને નિયંત્રણ સિગ્નલોને હેન્ડલ કરે છે. તે સીરિયલ ઇન્ટરફેસનો ઉપયોગ કરે છે, જેનો અર્થ છે કે આપણે Arduino ના થોડા પિન સાથે ઘણા LED ને નિયંત્રિત કરી શકીએ છીએ.

8x8 LED મેટ્રિક્સમાં ગ્રીડમાં ગોઠવાયેલા 64 વ્યક્તિગત LED નો સમાવેશ થાય છે. MAX7219 દ્વારા યોગ્ય આદેશો મોકલીને દરેક LED ચાલુ અથવા બંધ કરી શકાય છે. આ મેટ્રિક્સ પર વિવિધ અક્ષરો અને ગ્રાફિક્સ પ્રદર્શિત કરવાની મંજૂરી આપે છે.

ડેટાશીટ વિગતો

ઉત્પાદકમેક્સિમ ઇન્ટિગ્રેટેડ
ભાગ નંબરMAX7219
લોજિક/IO વોલ્ટેજ3.3V થી 5.5V
સપ્લાય વોલ્ટેજ4.0V થી 5.5V
આઉટપુટ કરંટ (પ્રતિ ચેનલ)40 mA મહત્તમ
પીક કરંટ (પ્રતિ ચેનલ)100 mA મહત્તમ
PWM આવર્તન માર્ગદર્શન100 Hz
ઇનપુટ લોજિક થ્રેશોલ્ડ2.0V (ઉચ્ચ) / 0.8V (નીચું)
વોલ્ટેજ ડ્રોપ / RDS(on) / સેચ્યુરેશન0.2V ટાઇપ.
થર્મલ મર્યાદાઓ150°C
પેકેજ16-DIP
નોંધો / વેરિઅન્ટ્સકોમન એનોડ રૂપરેખાંકન
  • યોગ્ય પાવર સપ્લાયની ખાતરી કરો (4.0V થી 5.5V).
  • નુકસાન અટકાવવા માટે દરેક LED માટે કરંટ-લિમિટિંગ રેઝિસ્ટરનો ઉપયોગ કરો.
  • દખલ ટાળવા માટે વાયરિંગ ટૂંકું રાખો.
  • ગરમીના વિસર્જનનું નિરીક્ષણ કરો; જરૂર પડે તો હીટસિંકનો ઉપયોગ કરો.
  • ખોટા સંચાર ટાળવા માટે પિન કનેક્શન બે વાર તપાસો.

વાયરિંગ સૂચનાઓ

MAX7219 ને Arduino સાથે વાયર કરવા માટે, નીચેના પિન કનેક્ટ કરો:

  • MAX7219 ના VCC પિનને Arduino ના 5V સાથે કનેક્ટ કરો.
  • GND પિનને Arduino ના ગ્રાઉન્ડ સાથે કનેક્ટ કરો.
  • DIN પિન (ડેટા ઇન) ને Arduino પિન 12 સાથે કનેક્ટ કરો.
  • CLK પિન (ક્લોક) ને Arduino પિન 11 સાથે કનેક્ટ કરો.
  • CS પિન (ચિપ સિલેક્ટ) ને Arduino પિન 10 સાથે કનેક્ટ કરો.

સર્કિટ ચાલુ કરતા પહેલા બધા કનેક્શન સુરક્ષિત છે તેની ખાતરી કરો. વાયરિંગ સીધું છે, પરંતુ જો તમને સમસ્યાઓ આવે, તો કનેક્શન કાળજીપૂર્વક સમીક્ષા કરો (વિડિયોમાં 1:45 પર).

કોડ ઉદાહરણો અને વોકથ્રુ

કોડમાં, આપણે LedControl લાઇબ્રેરી શામેલ કરીને શરૂ કરીએ છીએ, જે MAX7219 સાથે સંચાર કરવા માટે આવશ્યક છે. નીચેનો અંશ LedControl ઑબ્જેક્ટને પ્રારંભ કરે છે:

LedControl lc=LedControl(12,11,10,1);

આ લાઇન ડેટા પિન, ક્લોક પિન, ચિપ સિલેક્ટ પિન અને ઉપકરણોની સંખ્યા (આ કિસ્સામાં 1) સેટ કરે છે. આગળ, setup() ફંક્શનમાં, આપણે MAX7219 ને જગાડીએ છીએ અને ડિસ્પ્લે તીવ્રતા સેટ કરીએ છીએ:

lc.shutdown(0,false);
lc.setIntensity(0,8);
lc.clearDisplay(0);

આ ખાતરી કરે છે કે ડિસ્પ્લે સક્રિય છે અને અક્ષરો બતાવવા માટે તૈયાર છે. ડિસ્પ્લે ચલાવતું મુખ્ય ફંક્શન writeArduinoOnMatrix() છે, જે અક્ષરો પ્રદર્શિત કરવા માટે મેટ્રિક્સની પંક્તિઓને ક્રમિક રીતે પ્રકાશિત કરે છે.

પ્રદર્શન / શું અપેક્ષા રાખવી

એકવાર બધું વાયર થઈ જાય અને કોડ અપલોડ થઈ જાય, LED મેટ્રિક્સે "ROBOJAX" શબ્દ પ્રદર્શિત કરવો જોઈએ. જો ડિસ્પ્લે કામ ન કરે, તો છૂટા કનેક્શન અથવા ખોટી પિન સોંપણી જેવી સમસ્યાઓ તપાસો. વધુમાં, ખાતરી કરો કે પાવર સપ્લાય પૂરતો છે (વિડિયોમાં 2:30 પર).

પ્રકરણો

  • પરિચય (0:00)
  • હાર્ડવેર ઝાંખી (0:30)
  • વાયરિંગ સૂચનાઓ (1:45)
  • કોડ વોકથ્રુ (2:15)
  • પ્રદર્શન (3:00)

છબીઓ

Max7219 8x8 LED matrix large chip
Max7219 8x8 LED matrix large chip
Max7219 8x8 LED matrix large chip
Max7219 8x8 LED matrix large chip
4-8x8 LED matrix using a MAX7219 Arduino module
ભાષા: C++
/*
 * This video shows you how to use the MAX7219 module with an 8x8 LED matrix to display text or any characters on the LED.
 * Watch YouTube video: https://youtu.be/AAiDwBKs9uE
 * 
 * Written by Ahmad Shamshiri for Robojax.com
 * on February 26, 2017 in Ajax, Ontario, Canada
 * Get this code and other Arduino codes from Robojax.com
 * Learn Arduino step by step in a structured course with all materials, wiring diagrams, and libraries
 * all in one place. 
 
 ****************************
 * Get early access to my videos via Patreon and have your name mentioned at the end of every 
 * video I publish on YouTube here: http://robojax.com/L/?id=63 (watch until the end of this video for a list of my Patrons)
 ****************************
 
 * Or make a donation using PayPal http://robojax.com/L/?id=64
 
 * This code is "AS IS" without warranty or liability. Free to be used as long as you keep this note intact.
 * This code has been downloaded from Robojax.com
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.
 
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
 
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <https://www.gnu.org/licenses/>.
*/
 
 
// We always have to include the library
// Based on a project posted https://github.com/wayoda/LedControl
#include "LedControl.h"
 
 /*
  Now we need a LedControl to work with.
  // Customized for RoboJax.com on February 26, 2017 in Ajax, Ontario, Canada.
  ***** These pin numbers will probably not work with your hardware *****
  pin 12 is connected to the DataIn 
  pin 11 is connected to the CLK 
  pin 10 is connected to CS
  We have only a single MAX72XX.
  */
 LedControl lc=LedControl(12,11,10,1);
 
 /* we always wait a bit between updates of the display */
 unsigned long delaytime=600;
 
 void setup() {
   /*
    The MAX72XX is in power-saving mode on startup,
    we have to do a wakeup call
    */
   lc.shutdown(0,false);
   /* Set the brightness to a medium value */
   lc.setIntensity(0,8);
   /* and clear the display */
   lc.clearDisplay(0);
 }
 
 /*
  This method will display the characters for the
  word "Arduino" one after the other on the matrix. 
  (you need at least 5x7 LEDs to see the whole characters)
  */
 void writeArduinoOnMatrix() {
   /* here is the data for the characters */
 
   // K
   byte R[8]={B11111100,B10000100,B10000100,B11111000,B10100000,B10010000,B10001000,B10000100};
   byte O[8]={B00011000,B00100100,B01000010,B01000010,B01000010,B01000010,B00100100,B00011000};  
   byte B[8]={B11111100,B10000100,B10000100,B11111000,B10001000,B10000100,B10000100,B11111100};
   byte J[8]={B00011110,B00000100,B00000100,B00000100,B10000100,B10000100,B01000100,B00111000};
   byte A[8]={B00111000,B01000100,B10000010,B11111110,B10000010,B10000010,B10000010,B10000010};     
   byte X[8]={ B10000001,B01000010,B00100100,B00011000,B00011000,B00100100,B01000010,B10000001};
   byte love[8]={ B00000000,B01100110,B10011001,B10011001,B10000001,B01000010,B00100100,B00011000};  
 
 
   /* Letter R */
   for (int i=0; i<8; i++){
   lc.setRow(0,i,R[i]);
 
   }
    
   delay(delaytime);
   for(int i=0; i<8; i++){
       lc.setRow(0,i,0);// this is for blank
   }  
 //////////////// END of Letter R ///////
 
   /* Letter O */
   for (int i=0; i<8; i++){
   lc.setRow(0,i,O[i]);
 
   }
    
   delay(delaytime);
   for(int i=0; i<8; i++){
       lc.setRow(0,i,0);// this is for blank
   }  
 //////////////// END of Letter O ///////
 
 
   /* Letter B */
   for (int i=0; i<8; i++){
   lc.setRow(0,i,B[i]);
 
   }
    
   delay(delaytime);
   for(int i=0; i<8; i++){
       lc.setRow(0,i,0);// this is for blank
   }  
 //////////////// END of Letter B ///////
 
   /* Letter O */
   for (int i=0; i<8; i++){
   lc.setRow(0,i,O[i]);
 
   }
    
   delay(delaytime);
   for(int i=0; i<8; i++){
       lc.setRow(0,i,0);// this is for blank
   }  
 //////////////// END of Letter O ///////
 
   /* Letter J */
   for (int i=0; i<8; i++){
   lc.setRow(0,i,J[i]);
 
   }
    
   delay(delaytime);
   for(int i=0; i<8; i++){
       lc.setRow(0,i,0);// this is for blank
   }  
 //////////////// END of Letter J ///////
 
   /* Letter A */
   for (int i=0; i<8; i++){
   lc.setRow(0,i,A[i]);
 
   }
    
   delay(delaytime);
   for(int i=0; i<8; i++){
       lc.setRow(0,i,0);// this is for blank
   }  
 //////////////// END of Letter A ///////
 
   /* Letter X */
   for (int i=0; i<8; i++){
   lc.setRow(0,i,X[i]);
 
   }
    
   delay(delaytime);
   for(int i=0; i<8; i++){
       lc.setRow(0,i,0);// this is for blank
   }  
 //////////////// END of Letter X ///////
 
 
 
   /* love */
   for (int i=0; i<8; i++){
   lc.setRow(0,i,love[i]);
 
   }
    
   delay(delaytime);
   delay(delaytime);
   for(int i=0; i<8; i++){
       lc.setRow(0,i,0);// this is for blank
   }  
 //////////////// END of Letter love ///////
 
 }// writeArduinoOnMatrix()  end
 
 
 void loop() { 
   writeArduinoOnMatrix();
 
 }
5-8x8 LED Matrix using a MAX7219 Arduino Module
ભાષા: C++
/*
 * This video shows you how to use the MAX7219 module with an 8x8 LED matrix to display text or any characters on the LED.
 * Watch YouTube video: https://youtu.be/AAiDwBKs9uE
 * 
 * Written by Ahmad S. for Robojax.com
 * on February 26, 2017 in Ajax, Ontario, Canada
 * Permission granted to share this code, given that this
 * note is kept with the code.
 * Disclaimer: This code is "AS IS" and for educational purposes only.

 */

// We always have to include the library
// Based on a project posted on https://github.com/wayoda/LedControl
#include "LedControl.h"

/*
 Now we need a LedControl object to work with.
 // Customized for RoboJax.com on February 26, 2017 in Ajax, Ontario, Canada.
 ***** These pin numbers will probably not work with your hardware *****
 pin 1 is connected to the DataIn 
 pin 4 is connected to the CLK 
 pin 53 is connected to CS
 We have only a single MAX72XX.
 */
LedControl lc=LedControl(1,4,53,1);// this line determines if this code can work with Arduino Mega or Arduino UNO

/* we always wait a bit between updates of the display */
unsigned long delaytime=600;

void setup() {
  /*
   The MAX72XX is in power-saving mode on startup,
   we have to do a wakeup call
   */
  lc.shutdown(0,false);
  /* Set the brightness to a medium value */
  lc.setIntensity(0,8);
  /* and clear the display */
  lc.clearDisplay(0);
}

/*
 This method will display the characters for the
 word "Arduino" one after the other on the matrix. 
 (you need at least 5x7 LEDs to see the whole characters)
 */
void writeArduinoOnMatrix() {
  /* here is the data for the characters */

  // K
  byte R[8]={B11111100,B10000100,B10000100,B11111000,B10100000,B10010000,B10001000,B10000100};
  byte O[8]={B00011000,B00100100,B01000010,B01000010,B01000010,B01000010,B00100100,B00011000};  
  byte B[8]={B11111100,B10000100,B10000100,B11111000,B10001000,B10000100,B10000100,B11111100};
  byte J[8]={B00011110,B00000100,B00000100,B00000100,B10000100,B10000100,B01000100,B00111000};
  byte A[8]={B00111000,B01000100,B10000010,B11111110,B10000010,B10000010,B10000010,B10000010};     
  byte X[8]={ B10000001,B01000010,B00100100,B00011000,B00011000,B00100100,B01000010,B10000001};
  byte love[8]={ B00000000,B01100110,B10011001,B10011001,B10000001,B01000010,B00100100,B00011000};  


  /* Letter R */
  for (int i=0; i<8; i++){
  lc.setRow(0,i,R[i]);

  }
   
  delay(delaytime);
  for(int i=0; i<8; i++){
      lc.setRow(0,i,0);// this is for blank
  }  
/////////////// END of Letter R ///////

  /* Letter O */
  for (int i=0; i<8; i++){
  lc.setRow(0,i,O[i]);

  }
   
  delay(delaytime);
  for(int i=0; i<8; i++){
      lc.setRow(0,i,0);// this is for blank
  }  
/////////////// END of Letter O ///////


  /* Letter B */
  for (int i=0; i<8; i++){
  lc.setRow(0,i,B[i]);

  }
   
  delay(delaytime);
  for(int i=0; i<8; i++){
      lc.setRow(0,i,0);// this is for blank
  }  
/////////////// END of Letter B ///////

  /* Letter O */
  for (int i=0; i<8; i++){
  lc.setRow(0,i,O[i]);

  }
   
  delay(delaytime);
  for(int i=0; i<8; i++){
      lc.setRow(0,i,0);// this is for blank
  }  
/////////////// END of Letter O ///////

  /* Letter J */
  for (int i=0; i<8; i++){
  lc.setRow(0,i,J[i]);

  }
   
  delay(delaytime);
  for(int i=0; i<8; i++){
      lc.setRow(0,i,0);// this is for blank
  }  
/////////////// END of Letter J ///////

  /* Letter A */
  for (int i=0; i<8; i++){
  lc.setRow(0,i,A[i]);

  }
   
  delay(delaytime);
  for(int i=0; i<8; i++){
      lc.setRow(0,i,0);// this is for blank
  }  
/////////////// END of Letter A ///////

  /* Letter X */
  for (int i=0; i<8; i++){
  lc.setRow(0,i,X[i]);

  }
   
  delay(delaytime);
  for(int i=0; i<8; i++){
      lc.setRow(0,i,0);// this is for blank
  }  
/////////////// END of Letter X ///////



  /* love */
  for (int i=0; i<8; i++){
  lc.setRow(0,i,love[i]);

  }
   
  delay(delaytime);
  delay(delaytime);
  for(int i=0; i<8; i++){
      lc.setRow(0,i,0);// this is for blank
  }  
/////////////// END of love ///////

}// writeArduinoOnMatrix()  end


void loop() { 
  writeArduinoOnMatrix();

}

તમને જોઈતી વસ્તુઓ

સંસાધનો અને સંદર્ભો

ફાઇલો📁

અન્ય ફાઇલો