Hello AAC forum,
Working on using the Arduino Uno and Maxim 7219
to control three hundred LEDs.
Using the schematics and LEDControl library from
http://playground.arduino.cc/Main/MAX72XXHardware
Hooked up a 7219 to 64 LEDs got anomalous result.
So broke it down to three LEDs as shown in this schematic
This would operate the first LED turing it on and off
but does nothing to the second and third LEDs.
A friend who has some electronics engineering
experience said a different sketch should be used
because
'The built in arduino library doesnt like that chip the one
they provide..the reason it doesnt work is the Uno and the Max have different clock speeds.
I'm sure if you tinker with the library you can find where to divide the clock speed inside it.
The arduino library was written for the previous version of the arduino'
The sketch provided by the friend is copied herewith below as sketch two.
Problem is I have studied it and do not understand it.
For instance, it sort of indidcates that the DataIn, Clock
and Load pins are 11, 12, and 13 on the Arduino but
there is no indication of which is which. (Found the SPI.h
file in the libraries folder to fibgure out the Arduino pins
but it is even more cryptic than the sketch.)
Have studied a dozen different articles on Arduino to Maxim7219. Examples:
http://tronixstuff.com/2013/10/11/tutorial-arduino-max7219-led-display-driver-ic/
http://www.planetarduino.org/?cat=435
http://www.instructables.com/id/16x8-LED-dot-matrix-with-MAX7219-module/
https://www.npmjs.com/package/max7219
http://www.plingboot.com/2017/01/max7219-and-common-anode-displays/
http://www.gammon.com.au/forum/?id=11516
Most of these use the LEDControl library and are on how
to use the 7219 to do scrolling matrices and/or seven segment
displays.
Question: Can anyone provide a simple sketch to turn on and then off
the first three LEDs as shown in the schematic?
Willing to remit $100 to first person able provide a simple,
working sketch.
Thanks.
Allen in Dallas
++++++++++++++++ begin Sketch 1+++++++++++++++++
#include "LedControl.h"
LedControl lc=LedControl(12,11,10,1);
unsigned long delaytime=500;
void setup() {
lc.shutdown(0,false);
/* Set the brightness to a medium values */
lc.setIntensity(0,8);
/* and clear the display */
lc.clearDisplay(0);
}
void loop() {
lc.setLed(0,0,0,true);
delay(delaytime);
lc.setLed(0,0,2,true);
delay(delaytime);
lc.setLed(0,0,3,true);
delay(delaytime);
lc.setLed(0,0,0,false);
delay(delaytime);
lc.setLed(0,0,2,false);
delay(delaytime);
lc.setLed(0,0,3,false);
delay(delaytime);
}
++++++++++++++++ end Sketch 1+++++++++++++++++
++++++++++++++++ begin Sketch 2+++++++++++++++++
/* program to put message on a MAX7219s.
Set up in No Decode mode.
*/
// ************************************ //
//a_presetup
#include <SPI.h>
// define pins usage
// D11-12-13 SPI interface
byte ss0 = 10;
byte x;
// define variables
// bytes to send to MAX7219s, with some initial data
byte displayArray[] = {
0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa}; //16 bytes
// define 7219 register addresses for setup
byte decode_mode = 0x09; // 0x00 = No decode for digits 7-0
byte intensity_level = 0x0A; // 0x08 = mid level. Range is 0x00 to 0x0F
byte scan_limit = 0x0B; // 0x07 for all columns
byte shutdown_normal = 0x0C; // 0x00 - shutdown, 0x01 = normal
byte display_test = 0x0F; // 0x00 = normal, 0x01 = display test mode all on full
// ************************************ //
// b_setup
void setup(){
pinMode (ss0, OUTPUT);
digitalWrite (ss0, HIGH);
Serial.begin(38400);
// turn on SPI port
SPI.begin();
/* set up MAX7219 registers */
// decode to No decode mode
digitalWrite (ss0, LOW);
SPI.transfer (decode_mode);
SPI.transfer (0x00);
digitalWrite (ss0, HIGH);
Serial.println("No decode mode");
// intensity to mid level
digitalWrite (ss0, LOW);
SPI.transfer (intensity_level);
SPI.transfer (0x0F);
digitalWrite (ss0, HIGH);
Serial.println("Intensity");
// scan limit to all 7 columns
digitalWrite (ss0, LOW);
SPI.transfer (scan_limit);
SPI.transfer (0x07);
digitalWrite (ss0, HIGH);
Serial.println("Scan Limit");
// dispay test On
digitalWrite (ss0, LOW);
SPI.transfer (display_test);
SPI.transfer (0x01);
digitalWrite (ss0, HIGH);
delay(2000);
Serial.println("Display test on");
// dispay test to normal
digitalWrite (ss0, LOW);
SPI.transfer (display_test);
SPI.transfer (0x00);
digitalWrite (ss0, HIGH);
delay(200);
Serial.println("Display test off");
// shutdown to Normal mode
digitalWrite (ss0, LOW);
SPI.transfer (shutdown_normal);
SPI.transfer (0x01);
digitalWrite (ss0, HIGH);
Serial.println("Normal mode");
delay(250);
Serial.println("setup done");
}
// ************************************ //
// c_loop
void loop(){
// ************************************ //
Serial.println("slaveSelect0 low "); // put data in registers 1 to 9. 16 bit transfer - address/data
for (x = 1; x<9; x=x+1){
digitalWrite (ss0, LOW);
SPI.transfer (x);
SPI.transfer(displayArray[x-1]);// array 0 to 7
digitalWrite (ss0, HIGH);
}
delay(1000);
Serial.println("slaveSelect0 high");
for (x = 1; x<9; x=x+1){
digitalWrite (ss0, LOW);
SPI.transfer (x);
SPI.transfer(displayArray[x+7]); // array 8 t0 15
digitalWrite (ss0, HIGH);
}
delay(1000);
} // end loop
++++++++++++++++++end sketch 2++++++++++++++++++++++
Working on using the Arduino Uno and Maxim 7219
to control three hundred LEDs.
Using the schematics and LEDControl library from
http://playground.arduino.cc/Main/MAX72XXHardware
Hooked up a 7219 to 64 LEDs got anomalous result.
So broke it down to three LEDs as shown in this schematic
This would operate the first LED turing it on and off
but does nothing to the second and third LEDs.
A friend who has some electronics engineering
experience said a different sketch should be used
because
'The built in arduino library doesnt like that chip the one
they provide..the reason it doesnt work is the Uno and the Max have different clock speeds.
I'm sure if you tinker with the library you can find where to divide the clock speed inside it.
The arduino library was written for the previous version of the arduino'
The sketch provided by the friend is copied herewith below as sketch two.
Problem is I have studied it and do not understand it.
For instance, it sort of indidcates that the DataIn, Clock
and Load pins are 11, 12, and 13 on the Arduino but
there is no indication of which is which. (Found the SPI.h
file in the libraries folder to fibgure out the Arduino pins
but it is even more cryptic than the sketch.)
Have studied a dozen different articles on Arduino to Maxim7219. Examples:
http://tronixstuff.com/2013/10/11/tutorial-arduino-max7219-led-display-driver-ic/
http://www.planetarduino.org/?cat=435
http://www.instructables.com/id/16x8-LED-dot-matrix-with-MAX7219-module/
https://www.npmjs.com/package/max7219
http://www.plingboot.com/2017/01/max7219-and-common-anode-displays/
http://www.gammon.com.au/forum/?id=11516
Most of these use the LEDControl library and are on how
to use the 7219 to do scrolling matrices and/or seven segment
displays.
Question: Can anyone provide a simple sketch to turn on and then off
the first three LEDs as shown in the schematic?
Willing to remit $100 to first person able provide a simple,
working sketch.
Thanks.
Allen in Dallas
++++++++++++++++ begin Sketch 1+++++++++++++++++
#include "LedControl.h"
LedControl lc=LedControl(12,11,10,1);
unsigned long delaytime=500;
void setup() {
lc.shutdown(0,false);
/* Set the brightness to a medium values */
lc.setIntensity(0,8);
/* and clear the display */
lc.clearDisplay(0);
}
void loop() {
lc.setLed(0,0,0,true);
delay(delaytime);
lc.setLed(0,0,2,true);
delay(delaytime);
lc.setLed(0,0,3,true);
delay(delaytime);
lc.setLed(0,0,0,false);
delay(delaytime);
lc.setLed(0,0,2,false);
delay(delaytime);
lc.setLed(0,0,3,false);
delay(delaytime);
}
++++++++++++++++ end Sketch 1+++++++++++++++++
++++++++++++++++ begin Sketch 2+++++++++++++++++
/* program to put message on a MAX7219s.
Set up in No Decode mode.
*/
// ************************************ //
//a_presetup
#include <SPI.h>
// define pins usage
// D11-12-13 SPI interface
byte ss0 = 10;
byte x;
// define variables
// bytes to send to MAX7219s, with some initial data
byte displayArray[] = {
0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa}; //16 bytes
// define 7219 register addresses for setup
byte decode_mode = 0x09; // 0x00 = No decode for digits 7-0
byte intensity_level = 0x0A; // 0x08 = mid level. Range is 0x00 to 0x0F
byte scan_limit = 0x0B; // 0x07 for all columns
byte shutdown_normal = 0x0C; // 0x00 - shutdown, 0x01 = normal
byte display_test = 0x0F; // 0x00 = normal, 0x01 = display test mode all on full
// ************************************ //
// b_setup
void setup(){
pinMode (ss0, OUTPUT);
digitalWrite (ss0, HIGH);
Serial.begin(38400);
// turn on SPI port
SPI.begin();
/* set up MAX7219 registers */
// decode to No decode mode
digitalWrite (ss0, LOW);
SPI.transfer (decode_mode);
SPI.transfer (0x00);
digitalWrite (ss0, HIGH);
Serial.println("No decode mode");
// intensity to mid level
digitalWrite (ss0, LOW);
SPI.transfer (intensity_level);
SPI.transfer (0x0F);
digitalWrite (ss0, HIGH);
Serial.println("Intensity");
// scan limit to all 7 columns
digitalWrite (ss0, LOW);
SPI.transfer (scan_limit);
SPI.transfer (0x07);
digitalWrite (ss0, HIGH);
Serial.println("Scan Limit");
// dispay test On
digitalWrite (ss0, LOW);
SPI.transfer (display_test);
SPI.transfer (0x01);
digitalWrite (ss0, HIGH);
delay(2000);
Serial.println("Display test on");
// dispay test to normal
digitalWrite (ss0, LOW);
SPI.transfer (display_test);
SPI.transfer (0x00);
digitalWrite (ss0, HIGH);
delay(200);
Serial.println("Display test off");
// shutdown to Normal mode
digitalWrite (ss0, LOW);
SPI.transfer (shutdown_normal);
SPI.transfer (0x01);
digitalWrite (ss0, HIGH);
Serial.println("Normal mode");
delay(250);
Serial.println("setup done");
}
// ************************************ //
// c_loop
void loop(){
// ************************************ //
Serial.println("slaveSelect0 low "); // put data in registers 1 to 9. 16 bit transfer - address/data
for (x = 1; x<9; x=x+1){
digitalWrite (ss0, LOW);
SPI.transfer (x);
SPI.transfer(displayArray[x-1]);// array 0 to 7
digitalWrite (ss0, HIGH);
}
delay(1000);
Serial.println("slaveSelect0 high");
for (x = 1; x<9; x=x+1){
digitalWrite (ss0, LOW);
SPI.transfer (x);
SPI.transfer(displayArray[x+7]); // array 8 t0 15
digitalWrite (ss0, HIGH);
}
delay(1000);
} // end loop
++++++++++++++++++end sketch 2++++++++++++++++++++++