LED, serial or parallel, sink or source

Support for Arduino in combination with Air Manager and Air Player

Moderators: russ, Ralph

Message
Author
User avatar
Keith Baxter
Posts: 4685
Joined: Wed Dec 20, 2017 11:00 am
Location: Botswana

Re: LED, serial or parallel, sink or source

#31 Post by Keith Baxter »

Hi,

@jph Is this what I should be looking at?

https://www.glennklockwood.com/electronics/max7219.html


Keith
AMD RYZEN 9 5950X CPU, Corsair H80I cooler, ASUS TUF GAMING B550-PLUS AMD Ryzen Mother Board,  32Gb ram Corsair Vengeance 3000Mh, MSI GTX960 4G graphics card 

User avatar
Keith Baxter
Posts: 4685
Joined: Wed Dec 20, 2017 11:00 am
Location: Botswana

Re: LED, serial or parallel, sink or source

#32 Post by Keith Baxter »

Hi,

OK in the most likely case that Corjan will not find heart to make the MAX7219 led matrix a AM feature, I hope to be surprised though. Corjan could be in a happy and cheerful mood after his cycle/walk this morning. :mrgreen:

Anyway... I have some good news.

One AM user, Tom, is using a ULN2003A to drive his LED's. He has full dimming ability on individual LED's using the hw_led_add() function.

The "S" pins on the ULN2003 are connected directly to the arduino I/O pins. The "O" pins on the ULN2003 are connected to a resistor array and then from the resistor array, wired to each LED.

The results are cool.

All full brightness.
AAbright.png
All dimmed.


AAdim.png

Some dimmed some not.

AAmulti.png
This indicates that the hw_led_add() function will drive the ULN2003A and ULN2803A and maintain the dimming feature without any additional electronic clutter.
We have a not so messy solution it looks like.Just two bits of electronics and our normal AM led code and we are cooking with gas.


So for my LED requirements I would use a ULN2803A or ULN2003A with a 16 pin 180R resistor array network connected between the ULN and to my two high power 2.7v LED's wired in parallel.

Keith
Last edited by Keith Baxter on Sun Mar 13, 2022 7:45 am, edited 3 times in total.
AMD RYZEN 9 5950X CPU, Corsair H80I cooler, ASUS TUF GAMING B550-PLUS AMD Ryzen Mother Board,  32Gb ram Corsair Vengeance 3000Mh, MSI GTX960 4G graphics card 

User avatar
Keith Baxter
Posts: 4685
Joined: Wed Dec 20, 2017 11:00 am
Location: Botswana

Re: LED, serial or parallel, sink or source

#33 Post by Keith Baxter »

Hi,

Yes I am playing the same tune over and over. It is getting boring. :lol:

Just for some useless trivia knowledge. The Zibo 737 has

In the overhead
152 LED's for annunciators That includes the "LE Devices"
Then there are 18 LED's for the Mic selector and Korry switches,

in the MIP including the glare shield
73 LED's for mip and mcp

in the pedestal.
96 LED's for radios, annunciators and switches.

So in total 339 if i counted correct.
That means if I drive all LED's at 15.5 mA we have a total current draw of 5.25 Amps. WOW.


Well 339 leds mean 339 I/O pins. Each mega can run 52 LED's so that is 6.5 megas just to run the LED's

See why I want the MAX7219 option. I could run all the LED's off a nano and all the buttons and switches off a button array and still have spare pins to start my coffee machine . :shock: :lol: :lol:

The efficiency here is less arduinos or boards, less powered USB hubs to drive all those boards and happier AM users. ;)

I have put out a call for estimates on how many Zibo 737 home built cockpits there are out there. This should an indication as to the market for what I am plugging for.

Keith
AMD RYZEN 9 5950X CPU, Corsair H80I cooler, ASUS TUF GAMING B550-PLUS AMD Ryzen Mother Board,  32Gb ram Corsair Vengeance 3000Mh, MSI GTX960 4G graphics card 

User avatar
jph
Posts: 2857
Joined: Fri Apr 10, 2020 12:50 pm
Location: Somewhere over the rainbow..

Re: LED, serial or parallel, sink or source

#34 Post by jph »

or you could use one nano, 6 pins and two of the boards I linked to to give you 512 leds. ;) - you already have the option with MP :)
Joe. CISSP, MSc.

User avatar
jph
Posts: 2857
Joined: Fri Apr 10, 2020 12:50 pm
Location: Somewhere over the rainbow..

Re: LED, serial or parallel, sink or source

#35 Post by jph »

Keith Baxter wrote: Sun Mar 13, 2022 1:33 am Hi,

@jph Is this what I should be looking at?

https://www.glennklockwood.com/electronics/max7219.html


Keith
Just use a suitable arduino Library, there are several. You only need to input a device number and a row and column number and the rest is done for you.

LedControl Lib is perfect.
Here is the main page for the functions - if you look down to the matrix part you can see the methods of setting individual leds etc etc. Very powerful. When you install the lib in the Arduino IDE it already comes with examples that will work out of the box as demos (as do all libraries for Arduino)
http://wayoda.github.io/LedControl/pages/software
Joe
Last edited by jph on Sun Mar 13, 2022 8:18 am, edited 1 time in total.
Joe. CISSP, MSc.

User avatar
Sling
Posts: 5241
Joined: Mon Sep 11, 2017 2:37 pm
Contact:

Re: LED, serial or parallel, sink or source

#36 Post by Sling »

Keith,

Just a thought but if there are a lot of users wanting this why not join forces and develop something for message port to do exactly what is needed. You could do matrix, i/o expansion, max7219 support or whatever else was wanted. This is kinda the same request as the mux board support that is asked for from time to time. It sits outside of the core AM functionality and that’s primarily why messageport was added. At least that’s my interpretation.

User avatar
jph
Posts: 2857
Joined: Fri Apr 10, 2020 12:50 pm
Location: Somewhere over the rainbow..

Re: LED, serial or parallel, sink or source

#37 Post by jph »

Keith, just whet your appetite and to show the basics of Arduino (and POWER) - here is a bare bones arduino sketch (their name for a 'script)' as such.
This would set the led attached to row 4, column 5, on 7219 64 led matrix 1 of 8 - numbered 0 - 7 , as are the rows and columns.
You do NOT need to do the heavy lift coding to communicate with the 7219 as per that crazy link you linked to. This is the absolute beauty or Arduino. You simply install and point to the library - in this case the library is 'ledcontrol' - the functions / 'commands' / options for such are in the other link I sent you.

This code you would never actually use although it works perfectly. You would of course use variables etc and a non fixed delay using other built in functions.

But, just for an example, using the board I linked to, the most basic arduino sketch. You include the library (Ledcontrol) - this does 90% of the work and you can ignore HOW it works. Create alias to library (lc in this case) then use the built in functions of the library- this is it.... nothing more. The complete arduino 'sketch that you download to the arduino - at the touch of a button on the tool bar.

Code: Select all

#include "LedControl.h"
LedControl lc=LedControl(12,11,10,4);
unsigned long delaytime=500;   
void setup() {
  lc.shutdown(0,false);
  lc.setIntensity(0,8);
  lc.clearDisplay(0);
}
void single() {
      lc.setLed(0,4,5,true);
      delay(delaytime);
      lc.setLed(0,4,5,false);
      delay(delaytime);
}
void loop() { 
  single();
}
and a slightly commented version -

Code: Select all

//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 4 MAX72XX on this board. - change the '1' at the end to - up to - 8 for 8 x 64 led matricies. (512 LEDS)
 */
LedControl lc=LedControl(12,11,10,1);

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

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 values - up to 16 levels */
  lc.setIntensity(0,8);
  /* and clear the display */
  lc.clearDisplay(0);
}

/* 
 This function will set (turn on) the LED on 7219 number zero (the 1st 7219), row 4 column 5 (rows and columns number from zero)
 Then wait 500mS and then reset it (turn it off)
 The led will blink at 500mS intervals
 */
void single() {
//    lc.setLed(0,row,col,true);

      lc.setLed(0,4,5,true);
      delay(delaytime);
      lc.setLed(0,4,5,false);
      delay(delaytime);
}


void loop() { 
  single();
}
Marvellous. ;)
Joe. CISSP, MSc.

User avatar
Keith Baxter
Posts: 4685
Joined: Wed Dec 20, 2017 11:00 am
Location: Botswana

Re: LED, serial or parallel, sink or source

#38 Post by Keith Baxter »

Sling wrote: Sun Mar 13, 2022 8:15 am Keith,

Just a thought but if there are a lot of users wanting this why not join forces and develop something for message port to do exactly what is needed. You could do matrix, i/o expansion, max7219 support or whatever else was wanted. This is kinda the same request as the mux board support that is asked for from time to time. It sits outside of the core AM functionality and that’s primarily why messageport was added. At least that’s my interpretation.
Tony,

I would be like Miss Piggy in a cesspit if I had any idea on where to start. You know me, always willing to help and make things easier for others where I can. If I just had a start I would run with it and put the hours in. But I have no idea, and afraid my community friends, out of my knowledge depth.

I think with sadness in my heart, I am going to give up on this one and bite the bullet of just purchasing a bunch of arduinos.

But one very last,last lastestestest try at convincing the SI guys.

Going by the Face Book group membership, their membership numbers are (to date)....
Home Cockpit Builders Club...........................................34.4k members
DIY Cockpit Sim builders............................................... 8.0k members
Home cockpit 737 800................................................. 3.7k members
X-Plane Homecockpit (German and English) ...................... 3,6k members

OK so most members are cross pollinated. But at worst case at least 34.3k some of those peeps have built or in the process of building and those not yet done anything considering or interested in cockpit building from those few FB groups.
I am not going to do the math statistics but clearly peeps will at some stage revisit this and decide if AM can do the job for them or not for their skill level.
Ok so if we have 0.025# of those members using AM that is 860 odd peeps.

I will leave that thought out there....

Keith.
Last edited by Keith Baxter on Sun Mar 13, 2022 11:10 am, edited 7 times in total.
AMD RYZEN 9 5950X CPU, Corsair H80I cooler, ASUS TUF GAMING B550-PLUS AMD Ryzen Mother Board,  32Gb ram Corsair Vengeance 3000Mh, MSI GTX960 4G graphics card 

User avatar
Keith Baxter
Posts: 4685
Joined: Wed Dec 20, 2017 11:00 am
Location: Botswana

Re: LED, serial or parallel, sink or source

#39 Post by Keith Baxter »

jph wrote: Sun Mar 13, 2022 9:54 am Keith, just whet your appetite and to show the basics of Arduino (and POWER) - here is a bare bones arduino sketch (their name for a 'script)' as such.
This would set the led attached to row 4, column 5, on 7219 64 led matrix 1 of 8 - numbered 0 - 7 , as are the rows and columns.
You do NOT need to do the heavy lift coding to communicate with the 7219 as per that crazy link you linked to. This is the absolute beauty or Arduino. You simply install and point to the library - in this case the library is 'ledcontrol' - the functions / 'commands' / options for such are in the other link I sent you.

This code you would never actually use although it works perfectly. You would of course use variables etc and a non fixed delay using other built in functions.

But, just for an example, using the board I linked to, the most basic arduino sketch. You include the library (Ledcontrol) - this does 90% of the work and you can ignore HOW it works. Create alias to library (lc in this case) then use the built in functions of the library- this is it.... nothing more. The complete arduino 'sketch that you download to the arduino - at the touch of a button on the tool bar.

Code: Select all

#include "LedControl.h"
LedControl lc=LedControl(12,11,10,4);
unsigned long delaytime=500;   
void setup() {
  lc.shutdown(0,false);
  lc.setIntensity(0,8);
  lc.clearDisplay(0);
}
void single() {
      lc.setLed(0,4,5,true);
      delay(delaytime);
      lc.setLed(0,4,5,false);
      delay(delaytime);
}
void loop() { 
  single();
}
and a slightly commented version -

Code: Select all

//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 4 MAX72XX on this board. - change the '1' at the end to - up to - 8 for 8 x 64 led matricies. (512 LEDS)
 */
LedControl lc=LedControl(12,11,10,1);

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

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 values - up to 16 levels */
  lc.setIntensity(0,8);
  /* and clear the display */
  lc.clearDisplay(0);
}

/* 
 This function will set (turn on) the LED on 7219 number zero (the 1st 7219), row 4 column 5 (rows and columns number from zero)
 Then wait 500mS and then reset it (turn it off)
 The led will blink at 500mS intervals
 */
void single() {
//    lc.setLed(0,row,col,true);

      lc.setLed(0,4,5,true);
      delay(delaytime);
      lc.setLed(0,4,5,false);
      delay(delaytime);
}


void loop() { 
  single();
}
Marvellous. ;)
Joe,

I am too emotional upset ATM to look at what you posted. I will take a look tomorrow when in another state of mind.

Thank you for what seems a start.


Keith
AMD RYZEN 9 5950X CPU, Corsair H80I cooler, ASUS TUF GAMING B550-PLUS AMD Ryzen Mother Board,  32Gb ram Corsair Vengeance 3000Mh, MSI GTX960 4G graphics card 

User avatar
jph
Posts: 2857
Joined: Fri Apr 10, 2020 12:50 pm
Location: Somewhere over the rainbow..

Re: LED, serial or parallel, sink or source

#40 Post by jph »

Keith Bro, it's just a new thing that YOU will have no issue with at all.
Here is a small video I knocked together - as you can see, I have no effing room to work as my bench is full of crap haha.
It is a simple UNO hooked up to the previous board I linked to with a smaller delay.
set for 4 7219 each with the matrix you can see of 64 led's. (totalling 256 on that one board !) all driven by 3 pins from the most basic Arduino.
I have just used an example of flashing 1 led on each display.
If you look at the second display from the top, the led that is flashing is 0,0 (on 7219 matrix number 2) hence (1,0,0) - as the 7219's are numbered from 0-3 here, so '1' is the second 7219 with it's own 8x8 matrix.
The others should be logical when you look although certainly confusing at first.

Sorry for the short vid.
https://drive.google.com/file/d/1fIcq8t ... sp=sharing

the sequence is -

Code: Select all

void single() {
//    lc.setLed(0,row,col,true);
      lc.setLed(0,4,5,false);
      lc.setLed(1,0,0,true);
      lc.setLed(2,6,6,false);
      lc.setLed(3,5,2,true);

                  
      delay(delaytime);
      lc.setLed(0,4,5,true);
      lc.setLed(1,0,0,false);
      lc.setLed(2,6,6,true);
      lc.setLed(3,5,2,false);
      delay(delaytime);
}
No worries, I can explain ANY aspect of that if needed.
Hey - and no 10uF caps haha :)

I feel yer pain bro - my head hurts from time to time.
Joe
Joe. CISSP, MSc.

Post Reply