Go Down

Topic: LDR with 7 seg display and PWM output (Read 13469 times) previous topic - next topic

PaulRB

#15
Mar 23, 2015, 01:03 am Last Edit: Mar 23, 2015, 01:05 am by PaulRB
Hi, I will write a longer explanation for you, hopefully tomorrow. For now, do not run your display with 20R series resistors. You may damage the Arduino.

Paul

cjcj

Yes, given I can now see the displays change intensity, before I move onto my larger project (large digits), I want to first breadboard the smaller 0.5" 7 segment displays and understand them fully before moving on.

So if looking at a single digit, I connect a current limiting resistor to each segment - based on R=V/I = (5-2.5)/0.02 = 125 ohms.  The 5V supply I connect directly to the anode pin.

I assume for full brightness, each digit should be delivered around 20mA.  As you said in an earlier explanation, when multiplexing 4 digits, the "average current" to each is a 1/4.  I don't understand why.  Is it not still 20mA per digit and only on for 1/4 of the time?  I do however understand the "time on" is only a quarter and this results as you said to probably closer to 1/2 the intensity.

So would the aim be to increase the current to 4 x 20mA (if possible) to get back to full brightness?

I understand not blowing up the arduino and using transistors - I'll do that next.  But what I don't understand is how to push the digits to the suggested max 1/10 duty cycle & 0.1ms pulse width.  I think as I said I'm running at 1/4 duty cycle.  So from the digits specs is this correct:

If specifications say 160mA max at 1/10 duty cycle @ 0.1ms pulse width, then mine run at 80mA could be:

=>160/2 mA at (1/10)/2 @ 0.1ms
=> 80mA at 1/5 @ 0.1ms
=> 80mA at 1/4 @ (0.1)x1.25ms
=> 80mA at 1/4 @ 0.125ms

If this is by any chance correct, now I understand the 1/4 duty cycle.  But how do I achieve a 0.125ms on value for each digit (in multiplexing).  The millis only works at a minimum of 1ms (1/1000th second).  The above 125ms is an 1/8 of that.  This would be 125microseconds.  I'm confused.  I'd appreciate your help here.

PaulRB

As you said in an earlier explanation, when multiplexing 4 digits, the "average current" to each is a 1/4.  I don't understand why.  Is it not still 20mA per digit and only on for 1/4 of the time?
Exactly, yes. The current is 20mA for 1/4 of the time and zero for the other 3/4, so 5mA on average. Its the average that determines the brightness.

So would the aim be to increase the current to 4 x 20mA (if possible) to get back to full brightness?

But what I don't understand is how to push the digits to the suggested max 1/10 duty cycle & 0.1ms pulse width.
I don't think you neccessarily want to do that. It won't give maximum brightness. 160mA at 1/10 duty cycle is only 16mA on average. You are aiming for 20mA average.

So from the digits specs is this correct:

If specifications say 160mA max at 1/10 duty cycle @ 0.1ms pulse width, then mine run at 80mA could be:

=>160/2 mA at (1/10)/2 @ 0.1ms
=> 80mA at 1/5 @ 0.1ms
=> 80mA at 1/4 @ (0.1)x1.25ms
=> 80mA at 1/4 @ 0.125ms

Short answer is I don't know if your calculations give an answer that is safe for the leds. Most led data sheets give a max continuous current and a max current for a specified pulse width and duty cycle. Most don't show a graph or give a formula that tells us the max current for other duty cycles and pulse widths. What else if anything does your data sheet give? Can you post a link to it?

But how do I achieve a 0.125ms on value for each digit (in multiplexing).  The millis only works at a minimum of 1ms (1/1000th second).  The above 125ms is an 1/8 of that.  This would be 125microseconds.  
Yes, that would be awkward to achieve. There is micros() but it seems overkill to get what you want.

Maybe someone on the forum with more experience can explain how to calculate the max safe current for these leds with a 1/4 duty cycle and a pulse width of, say 1ms.

cjcj

I don't think you neccessarily want to do that. It won't give maximum brightness. 160mA at 1/10 duty cycle is only 16mA on average. You are aiming for 20mA average.
In this case, even if the digits end up at 16mA rather than 20mA, that would be fine.  It would probably be hardly noticeable.  What I therefore am not clear on, is the calculation and yes if someone could answer that, I'd appreciate it.  My calculation is:

Data sheet says max 160mA at 1/10 duty cycle at 0.1ms pulse width, so  is this correct:
160mA : 1/10 dc : 0.1 pw, is the same as...
 80mA : 1/5 dc   : 0.1 pw, which is the same as...
 80mA : 1/4 dc   : 0.08 pw
 (Sorry, different to my previous calculation).

If 0.08ms pulse width is correct, how is this achieved in arduino code when cycling.  Do I specify the delay duration in micros?

Ps.  The link to the data sheet for these 7 segment displays is in this thread, post #12.



PaulRB

The link to the data sheet for these 7 segment displays is in this thread, post #12.
No, I think that's the DS for the 8000 round leds you bought from China, not the 0.5" 4-digit display...

cjcj

No, I think that's the DS for the 8000 round leds you bought from China, not the 0.5" 4-digit display...
Oops, I'm so sorry.  I'll attach the link to the 7 segment display in this reply.

cjcj

Hi.

I'm wondering if someone can still answer my question above - I think it may have got lost in the thread.

There is a specification sheet attached in the note above for common cathode 7 segment digits I'm experimenting with.  I'm trying to multiplex 4 digits and attain near max (safe) brightness.  The spec sheets says the digits can go to 160mA max at 1/10 duty cycle and 0.1ms pulse width.  I'm trying to convert this to my 4 digits (hence 1/4 duty cycle).

As each digit can be 20mA max, then to get this cycling 4 digits it should be around 4 x 20mA = 80mA (I think).

Interpolating the spec sheet figures, would this be the equivalent then of 80mA peak at 1/4 duty cycle and 0.08ms pulse width?

If so, how do you do a delay of 0.08ms.  Does this mean I have to do delays between each common 80uS?

cjcj

#22
Mar 26, 2015, 10:33 am Last Edit: Mar 26, 2015, 02:22 pm by cjcj Reason: Trying to insert images correctly
Can someone please answer this ...

I've done a bit more reading of related threads and still haven't resolved my dilemma, so I've tried to do this graphically.

Can someone please tell me if my thinking is correct for working out max intensity I can push a 7 segment display based on peak forward current, duty cycle and pulse width (also refer attached specification sheet for this display).  I'm really stuck...









PaulRB

#23
Mar 26, 2015, 01:24 pm Last Edit: Mar 26, 2015, 01:44 pm by PaulRB
No one's answering me  :'( ...
In my experience of this forum, the most likely reason is that no-one here knows.

Can someone please tell me if my thinking is correct for working out max intensity I can push a 7 segment display based on peak forward current, duty cycle and pulse width (also refer attached specification sheet for this display).  I'm really stuck...
I'm not sure you are even asking the right question.

I would phrase the question like this:

"We know the max continuous current is 30mA.
We know the max current is 160mA with pulse width 0.1ms and 1/10 duty cycle
What is the max current at pulse width 2ms and 1/4 duty cycle?"

And one answer you might get from the forum would be "if maximum brightness is really so important, don't multiplex".

I think its all to do with heat dissipation. The higher the current, the faster you are heating the leds. The temperature they reach depends on the length of the pulse, what temperature they were at the start of the pulse, and how fast they loose heat during the pulse. The temperature at the start of the pulse depends on what rate they cool. The rate at which they cool depends on the temperature at any instant. Its all horribly complicated.

But every time the led heats up and cools again, it looses a tiny part of its life. The hotter it gets, the larger that part of life is lost.

My advice would be that if you are building something for you own use, you can afford to push the limits. If you are designing something to be mass-manufactured and sold, you have to be much more conservative if you can't get a definitive answer to your question.

If it were me, I would go to maybe double the max continuous current with a 2ms pulse and 1/4 duty cycle, and be prepared for the possible consequences, but take comfort in the knowledge that the manufacturer's data sheet figures will be conservative.

CrossRoads

If you exceed this on-time and current
Peak Forward Current [1] 160 mA
1. 1/10 Duty Cycle, 0.1ms Pulse Width.

you will burn the parts out.
If you want 20mA all the time, use daisy chained, high current shift registers, TPIC6C595 or TPIC6B595. Can then use them for higher voltage (multiple LEDS/segment) with a larger display as well.

Also makes the coding easier - just shift out 4 bytes whenever you need the display updated.
I'd use SPI for that:
Code: [Select]

// time for a display update?
digitalWrite (latchPin, LOW); // RCLK from SS on pin 10
for (x=0; x<4; x=x+1){
SPI.transfer(displayData[x]); // data from MOSI pin 11, SRCLK from SCK on pin 13
}
digitalWrite (latchPin, HIGH); // SS on pin 10

If you are sending font characters, can pull data from a look up table
Code: [Select]

// time for a display update?
digitalWrite (latchPin, LOW); // RCLK from SS on pin 10
for (x=0; x<4; x=x+1){
SPI.transfer(fontArray[displayData[x]]); // data from MOSI pin 11, SRCLK from SCK on pin 13
}
digitalWrite (latchPin, HIGH); // SS on pin 10

Code: [Select]

byte fontArray[] = {
0b00111111, // 0, with 1 = segment on, DP-g-f-e-d-c-b-a
0b00000110, // 1        a
0b01011011, // 2    f        b
0b01001111, // 3        g
:                            e        c
:                                d         dp
0b01101111, // 9
0b01110111, // A
: // etc.
};
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

PaulRB

This may be of interest, although it doesn't really answer my version of your question.

cjcj

Paul, thanks for re-wording my question- yes it wasn't clear.

Your absolutely right about that if I want bright, consider not multiplexing.  Originally I just used a heap of outputs, but then I learnt about multiplexing, so that seemed to work well for saving pins.  However the compromise is dimmer display.  You have a valid point that if I want the digits to last, the lower the current the better.  This is therefore more academic exercise.  I'll do some experimenting.

Your link to bryanduxbury yes is relevant and I already read it last week.  This is what I'm trying and I think I have enough info to experiment.

Crossroads, I do agree that the way forward on my ultimate project is with shift registers for the reasons both you and Paul outlined.

I will soon need some help with my 24v common anode digits and driving them with shift registers (and MOSFETS).  I might start up another thread when I'm up to that.  Thanks guys. :)

PaulRB

#27
Mar 27, 2015, 11:11 am Last Edit: Mar 27, 2015, 11:22 am by PaulRB
24v common anode digits and driving them with shift registers (and MOSFETS)
Before you purchase components, work out the current the digits will draw. The tpic6*595 shift registers have built-in mosfets, so as long as the current is within their capability, you can keep the circuit really simple. Wiring lots of leds in series with 24V supply should help keep the current down.

tpic6c595: 100mA per segment
tpic6b595: 150mA per segment
tpic6595: 250mA per segment
tpic6a595: 350mA per segment

Note: these chips can only sink this current, they cannot source any current.

cjcj

#28
Mar 27, 2015, 12:12 pm Last Edit: Mar 27, 2015, 02:05 pm by cjcj
Thanks Paul.  Yes, I definately will check currents before hand.  You did mention earlier also about using the  tpic6c595 high-current shift registers.  In - built mosfets - excellent.  Before I order anything, I'll run through the specs with you if that's ok.

Right now I'm just experimenting with multiplexing single LEDs, checking strobing and currents.  I'm finding it just flickers at 50Hz, but stops at 60.  So I assume 100Hz would be safe.  I read somewhere that it should be 1000Hz

I've attached a sheet that I drew up earlier outlining how my 24V 7 segment displays are setup along with current draw, etc.  From your notes above, I assume I will use tpic6b595's?  I would assume then that I'd be using 2 of these per 4 digits. (ultimately I have 15 digits - timer, clock, home score, away score and temperature).

PaulRB

I've attached a sheet that I drew up earlier outlining how my 24V 7 segment displays are setup along with current draw, etc.  From your notes above, I assume I will use tpic6b595's?  I would assume then that I'd be using 2 of these per 4 digits. (ultimately I have 15 digits - timer, clock, home score, away score and temperature).
You forgot the attachment!

If not multiplexing you will need one shift register per digit. If multiplexing, one for every 2, 4 or perhaps even 8 digits, but you know the penalty for doing that. Also if multiplexing, you will need some high-side p-channel mosfets with high-current capacity, along with something to drive the mosfets (e.g Arduino pins + pnp transistors, or an extra tpic chip).

Bob (CrossRoads) is the real expert in these chips. He may even have a suitable product you could use.

Go Up