How to control simple 10 LED Bar Graph with MAX7219?

I'm trying to figure out how to control any of individual LEDs in the simple bar graph (datasheet here).
Bar graph is essentially 10 individual LEDs, it's not in any kind of matrix configuration. It seems that LedControl library meant to control matrix or 7 segment displays, but I can't figure out how to address simple LEDs...
I wired all cathodes together to GND. Connected MAX's Digita0-7 to LED1-8 and SEGA-B to LED9-10...

bratan:
I wired all cathodes together to GND. Connected MAX's Digita0-7 to LED1-8 and SEGA-B to LED9-10...

Well then you are not following the wiring for a MAX7219 and will get exactly nowhere.

If you have 10 LEDs, you connect the cathodes of the first eight to the digit 0 drive line, and the cathodes of the last two to the digit 1 drive line. You connect the anodes of the first eight to the respective eight "segment" drive lines and the anodes of the last two to the first two segment drive lines.

You now have your matrix. You set the current limit for 20 mA (or less if it turns out to be too bright)with a 27k resistor, and in programming, set the scan limit register to 1 - which means it scans only the two "columns" you have wired.

Paul__B:

bratan:
I wired all cathodes together to GND. Connected MAX's Digita0-7 to LED1-8 and SEGA-B to LED9-10...

Well then you are not following the wiring for a MAX7219 and will get exactly nowhere.

If you have 10 LEDs, you connect the cathodes of the first eight to the digit 0 drive line, and the cathodes of the last two to the digit 1 drive line. You connect the anodes of the first eight to the respective eight "segment" drive lines and the anodes of the last two to the first two segment drive lines.

You now have your matrix. You set the current limit for 20 mA (or less if it turns out to be too bright)with a 27k resistor, and in programming, set the scan limit register to 1 - which means it scans only the two "columns" you have wired.

Brilliant! I didn't think of making a matrix out it, thank you very much! I will give it a try! :slight_smile:

Got it working, well kind of :slight_smile: I do have weird issue and not sure why it's happening.
I can light up any of the 10 LEDs directly but for some reason I cannot light up more than in a row :frowning: When I try to light up several they blink for a second and go out.
I'm attaching schematic.

//We always have to include the library
#include "LedControl.h"

/*
 Now we need a LedControl to work with.
 ***** 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 LOAD 
 We have only a single MAX72XX.
 */
LedControl lc=LedControl(9,8,7,1);

void setup() {
  lc.shutdown(0,false);
  /* Set the brightness to a medium values */
  lc.setIntensity(0,15);
  /* and clear the display */
  lc.clearDisplay(0);
  lc.setScanLimit(0,1);
    
}

void loop() { 
  //  lc.setLed(0,0,1,true);  // THIS WORKS
  // lc.setRow(0,0,B10000000); // THIS WORKS
 // lc.setRow(0,0,B00001000); // THIS WORKS
 lc.setRow(0,0,B10001000); // THIS DOESN'T WORK
}

LED_Bar_Graph.png

Got it fixed!
I thought caps were option on chip's VCC line, but I guess it's necessary. After I added 10uF and .1uF caps, it started to work.

Edit: Oops, it was actually Rset resistor value that got it working, I didn't realize I was using 10K resistor and replaced it with 33K at the same time as added caps. More LEDs are lit, large resistor value needed. With 10K resistor I'm able to light up around 4 LEDs before chip resets itself and it all goes out...
I'm still having small issue because my LED bar is has both Green and RED LEDs, so greens are bright, but reds are dim :frowning: But I guess there's nothing I can do about this other than using second MAX7219 chip to control REDs, and that would be a waste...