2024-11-20 04:38 AM - edited 2024-11-20 04:39 AM
Friends, which algorithm do you use to control the LEDs in this structure? I need your ideas. I have prepared a table of the LEDs' turn on order.
2024-11-20 05:52 AM
As I said 250us is very short, need to increase it to at least 5ms.
2024-11-20 05:52 AM
There is a real circuit. There is a transistor for common cathodes in the circuit. There are also forward resistors for the LEDs. There is no mistake in the design. I can also share the full design. I did not want to consult about the design. I opened this title to ask your ideas for coding and maximum efficiency of the brightness of the LEDs.
2024-11-20 05:57 AM
In LED display, segments are sent at once. Scanning is done as many times as the number of digits. In my design circuit, you have to scan 24 LEDs one by one. 24x5ms= 120ms causes very large flicker.
2024-11-20 06:03 AM
@XooM wrote:There is a transistor for common cathodes in the circuit. There are also forward resistors for the LEDs.
So why didn't you say that?
Again, all we have to go on is what you post - if you post a schematic without essential parts, there's no way for us to tell if that's a genuine mistake, or just a simplification.
You could simply have said, "There is a transistor for common cathodes in the circuit. There are also forward resistors for the LEDs. These have been omitted for clarity"
@XooM wrote:I opened this title to ask your ideas for coding and maximum efficiency of the brightness of the LEDs.
Again, you didn't say that.
2024-11-20 06:06 AM - edited 2024-11-20 06:25 AM
@XooM wrote:
. In my design circuit, you have to scan 24 LEDs one by one. 24x5ms= 120ms causes very large flicker.
No. You need to keep the 24LEDs to lit for 5ms at the same time.
For that you need to shift all these 16bit followed by a LATCH enable to keep the data during 5ms.
You need to check that with an oscilloscope.
2024-11-20 06:10 AM - edited 2024-11-20 06:19 AM
@XooM wrote:In LED display, segments are sent at once.
How, exactly?
First, you need to clock the data into the shift registers.
Then you need to latch that data onto the outputs.
What do you mean by "segments" here?
@XooM wrote:Scanning is done as many times as the number of digits.
What do you mean by "digits" here?
@XooM wrote:In my design circuit, you have to scan 24 LEDs one by one.
Why "one by one"?
@XooM wrote:24x5ms= 120ms causes very large flicker.
What is the 5ms?
Again, Show a minimum but complete code example.
PS:
Do you have access to something like Proteus?
It might help you to be able to simulate the hardware independently of the software.
That way you could concentrate on working out what needs to happen in the hardware, and then implement that in your software...
2024-11-20 06:34 AM - edited 2024-11-20 06:51 AM
A lot has already been said in this topic. I'd like to ask a few questions:
The LED's need to be controlled via strobing if you want to allow all LEDs to be controlled individually (due to persistence of vision at sufficient strobing rates). Otherwise you cannot get all combinations working.
In this case you have 8 groups of 3 (or 3 groups of 8 depending on how you see it)
So I would implement the algorithm the following way:
If you don't want any glitch you need write zeros to one of the shift registers prior to changing (dead time) the other or daisy chain them and Latch them synchronously (no overlap).
The LEDs that need to be on are only on 1/3 of the time. For instance for 333us if you want a strobing rate of 1kHz. So you need to increase the current. If 10mA is the desired continuous current you need to use 30mA. But check the datasheet for maximum pulsed current for the LEDs.
You can use a loop and simple bitshifting to check which group has an LED on. You can store all LEDs in a single uint32_t led_states . group_state[x] = led_states & 1<<(x*3+led_shift)
2024-11-20 06:51 AM
@unsigned_char_array wrote:In this case you have 8 groups of 3 (or 3 groups of 8 depending on how you see it)
I don't think that's true?
I think one 11-bit pattern can be used to turn on any number of LEDs - including all or none?
@XooM show the full schematic - transistor, all resistors, etc - for one group of three LEDs
Or confirm if @SofLit guessed correctly with this:
Is there really only one R1 per group of 3, or is there a separate series resistor for each LED ?
2024-11-20 06:57 AM - edited 2024-11-20 07:00 AM
@Andrew Neil wrote:
@unsigned_char_array wrote:In this case you have 8 groups of 3 (or 3 groups of 8 depending on how you see it)
I don't think that's true?
I think one 11-bit pattern can be used to turn on any number of LEDs - including all or none?
The groups are connected in parallel. So you cannot have:
LED0: 1
LED1: 0
LED2: 0
LED3: 0
LED4: 0
LED5: 1
simultaneously.
Because group 0 has LED0 on and group1 has LED3 off and group0 has LED2 off and group1 has LED5 on. Since both groups have active LEDs they need to be selected.
With strobing it is possible because the eyes see fast pulsed LEDs as on. Either in 8 steps of 3 or 3 steps of 8. The latter is quicker and requires less peak current.
2024-11-20 07:01 AM - edited 2024-11-20 07:04 AM
@Andrew Neil wrote:
@unsigned_char_array wrote:
In this case you have 8 groups of 3 (or 3 groups of 8 depending on how you see it)
I don't think that's true?
I think one 11-bit pattern can be used to turn on any number of LEDs - including all or none?
@XooM show the full schematic - transistor, all resistors, etc - for one group of three LEDs
Or confirm if @SofLit guessed correctly with this:
Is there really only one R1 per group of 3, or is there a separate series resistor for each LED ?
Just missed one resistor per LED to limit the current. Need to remove R1 in this case.