Arduino Forum

Using Arduino => LEDs and Multiplexing => Topic started by: MitchSF on Aug 06, 2019, 01:39 pm

Title: 2.3" 16 segment common anode LEDs, HT16K33 and ULN2803
Post by: MitchSF on Aug 06, 2019, 01:39 pm
I'm about to breadboard a circuit to drive six displays using these components. Cathodes will be connected to the ULN2803 and it will be driven by the HT16K33 in a 16x6 multiplex configuration.

I was researching the way to calculate the series resistor value for each multiplexed row segment when I realized that anywhere from 0-6 segments in each row will be on at the same time, so I'm stuck. Can you suggest a better way to do this? I want to stay with the HT16K33.

Thanks in advance.
Title: Re: 2.3" 16 segment common anode LEDs, HT16K33 and ULN2803
Post by: MitchSF on Aug 06, 2019, 09:11 pm
I'll add that these displays use four LEDs for ten segments, each with two series LEDs in parallel, and five shorter segments use two LEDs in series.

I guess I could use 16 individual resistors on each of the displays segments for a total of 96 resistors, but I'm not sure how that would work with multiplexing and there must be a simpler way.
Title: Re: 2.3" 16 segment common anode LEDs, HT16K33 and ULN2803
Post by: PaulRB on Aug 06, 2019, 10:59 pm
Post a clickable link to the data sheet or whatever technical detail you have on the displays please.

Why do you want to use uln2803?
Title: Re: 2.3" 16 segment common anode LEDs, HT16K33 and ULN2803
Post by: MitchSF on Aug 06, 2019, 11:15 pm
Displays are common anode and I have some around, but if there is a better solution please let me know. I do want to stay with the HT16K33 because the software is working well. 
Title: Re: 2.3" 16 segment common anode LEDs, HT16K33 and ULN2803
Post by: Grumpy_Mike on Aug 06, 2019, 11:25 pm
Quote
I was researching the way to calculate the series resistor value for each multiplexed row segment when I realized that anywhere from 0-6 segments in each row will be on at the same time, so I'm stuck.
Do don't multiplex it like that. Although how you plan to multiplex it is a bit of a mystery at the moment.

The resistors go in each cathode not in the anode.
Title: Re: 2.3" 16 segment common anode LEDs, HT16K33 and ULN2803
Post by: MitchSF on Aug 06, 2019, 11:45 pm
Sorry, I see that I was not clear in my description.

The HT16K33 can't drive the big LED displays because they draw too much current. It handles the multiplexing and I have it working perfectly with smaller, .8" displays driving them directly.

I thought that using two, ULN2803s between the six, 16 segment displays and the HT16K33, would work. For that I'll need 96 (16 x 6 segments) resistors, one on each cathode. The other side of the resistors will be connected together for each segment to make the rows.

Will that work given that the displays are multiplexed? Is there a better way?

Thanks in advance for the help.
Title: Re: 2.3" 16 segment common anode LEDs, HT16K33 and ULN2803
Post by: PaulRB on Aug 07, 2019, 12:12 am
Do don't...
Did any of the bottles make it back from the supermarket unopened, Mike?
Title: Re: 2.3" 16 segment common anode LEDs, HT16K33 and ULN2803
Post by: PaulRB on Aug 07, 2019, 12:15 am
Quote
For that I'll need 96 (16 x 6 segments) resistors, one on each cathode.
No, just 16, I suspect.

Need to see your proposed schematic. And that link.
Title: Re: 2.3" 16 segment common anode LEDs, HT16K33 and ULN2803
Post by: MitchSF on Aug 07, 2019, 01:39 am
Thanks. I'll draw a schematic tomorrow.
Title: Re: 2.3" 16 segment common anode LEDs, HT16K33 and ULN2803
Post by: PaulRB on Aug 07, 2019, 07:38 am
Is this similar? The below is common cathode, but your displays are common anode?
(https://forum.arduino.cc/index.php?action=dlattach;topic=630110.0;attach=319493)
Title: Re: 2.3" 16 segment common anode LEDs, HT16K33 and ULN2803
Post by: PaulRB on Aug 07, 2019, 08:24 am
Quote
I have it working perfectly with smaller, .8" displays driving them directly.
Are those also common anode? I would have expected common cathode to be used with ht16k33.
Title: Re: 2.3" 16 segment common anode LEDs, HT16K33 and ULN2803
Post by: MitchSF on Aug 07, 2019, 02:34 pm
The .8" displays I'm using are common cathode. They are connected directly to the HK16K33, and working perfectly.

Paul, the 2.3" displays are exactly as in the drawing you posted, but they are common anode. I'm working on a partial schematic now. I'll post it shortly. Thanks for the help.
Title: Re: 2.3" 16 segment common anode LEDs, HT16K33 and ULN2803
Post by: PaulRB on Aug 07, 2019, 02:58 pm
I think you will need high-side drivers as well as the uln chips as the low-side drivers. Perhaps p-channel MOSFETS.

I am also concerned that the uln chip will drop too much voltage. If your supply is 5V (and maximum is 5.5V for the HT chip, so you can't go much higher anyway), the forward voltage of the segments will be at least 3.6V. The ULN chip could drop as much as 1.5V, leaving only 0.1V drop for your series resistors, which won't be enough, you need at least a volt.

Or...

Perhaps you could use a 6V supply for the displays, but still run the HT chip at 5V. Then you would have 1.1V to drop across the series resistors. But driving the p-channel MOSFETs would be tricky, you can't expose the COMM pins of the HT chip to >5V. But if you put another driver transistor in there, it would invert the signal...
Title: Re: 2.3" 16 segment common anode LEDs, HT16K33 and ULN2803
Post by: MitchSF on Aug 07, 2019, 03:32 pm
I added a P-Channel MOSFET, but the connections are probably not correct. 12v is available and preferred because the blue displays require 6v. Please let me know if this is close to a working solution.  Thanks.
Title: Re: 2.3" 16 segment common anode LEDs, HT16K33 and ULN2803
Post by: PaulRB on Aug 07, 2019, 05:55 pm
(https://forum.arduino.cc/index.php?action=dlattach;topic=630110.0;attach=319554)

The MOSFET seems to be connecting the display anode to ground, should it not be 12V?

R2 should be removed.
R3 value is not critical, maybe 220R, just to limit current sunk by COM pin of the HT chip.
R1 will need to be different value for the segments with 1, 2 or 4 leds.

Pin 10 of the ULN chips does not need to be connected to 12V. I don't think it would do any harm, but is only needed for inductive loads, not for leds.

There is nothing to switch off the MOSFET. It needs its gate to be pulled up to 12V to switch off. But this can't be done with a simple resistor, I think, because that would expose the COM pin of the HT chip to 12V, way above its Vcc, which could damage it.

But I'm no expert on P-channel MOSFETs. Maybe Mike can advise (if he is no longer hung over).
Title: Re: 2.3" 16 segment common anode LEDs, HT16K33 and ULN2803
Post by: PaulRB on Aug 07, 2019, 06:37 pm
To calculate R1:

Supply is 12V. ULN chip will probably drop around 1.5V. Segments with 2 or 4 leds will drop 6V. Decimal points only have one led so will only drop 3V. So R1 will need to drop (12-1.5-6) or (12-1.5-3).

Current for segments with 1 or 2 leds will be, lets say, 20mA. Segments with 4 leds will need 40mA.

To calculate R1, divide the required voltage drop by the required current.

So for example the segments with 4 leds, R1 = (12-1.5-6)/0.040 = 112 ohms, so maybe 120R.



Title: Re: 2.3" 16 segment common anode LEDs, HT16K33 and ULN2803
Post by: MitchSF on Aug 07, 2019, 08:27 pm
Thanks again for the help. I've made the suggested changes to the drawing.

The display specs list 20mA per LED for blue LEDs and 18ma for red, so I'll use 19ma for the calculation:

R2 = (12 - 1.5 - 6) / (.019 * 4) = 60R (4 LED segments)

R1 = (12 - 1.5 - 6) / (.019 * 2) = 120R (2 LED segments)


From the HT16K33 datasheet, the refresh rate is 11.4ms or 88Hz. Does that affect the values of the resistors? Should they be lower for multiplexed displays?

Is the NDP-6020P a good choice for the MOSFET?

If this looks correct, once the issue will pulling the gate to 12v is resolved (maybe a transistor?), I'll breadboard the circuit.
Title: Re: 2.3" 16 segment common anode LEDs, HT16K33 and ULN2803
Post by: MitchSF on Aug 07, 2019, 08:48 pm
Maybe just a blocking diode in series with the connection from the display driver Cx on the HT16K33, to the resistor, R3, and +12v to the gate of the MOSFET in series with a 10k resistor.

Title: Re: 2.3" 16 segment common anode LEDs, HT16K33 and ULN2803
Post by: PaulRB on Aug 07, 2019, 09:40 pm
(https://forum.arduino.cc/index.php?action=dlattach;topic=630110.0;attach=319580)
Title: Re: 2.3" 16 segment common anode LEDs, HT16K33 and ULN2803
Post by: PaulRB on Aug 07, 2019, 09:49 pm
This (https://www.youtube.com/watch?v=Csvw7RVc7QA) may be useful.

Quote
R2 = (12 - 1.5 - 6) / (.019 * 4) = 60R (4 LED segments)
No, it's a pair of LEDs in series, in parallel with another pair of LEDs in series. LEDs in series have the same current flowing through both of them, so the above should be .019 * 2, not .019 * 4
Title: Re: 2.3" 16 segment common anode LEDs, HT16K33 and ULN2803
Post by: MitchSF on Aug 08, 2019, 12:49 am
I see, so 120R for both 2 and 4 LED segments. The decimal point will not be used.

Attached is an updated schematic based on the Youtube video. Hopefully it is good enough to breadboard the circuit. The example load in the video is 25W.

With all 10, 4 LED segments and 6, 2 LED segments lit, total current drain is 400mA at 6v, which is 2.4W, so it seems like a smaller MOSFET can be used such as the NTR1P02T1G, rated at 1 amp, 20v. Also, it is probably best to use a 9v supply, recalculating resistor values.

Please let me know what you think about this. Thanks again for the help.

EDIT: I just noticed that nowhere is +12v connected to the display.
Title: Re: 2.3" 16 segment common anode LEDs, HT16K33 and ULN2803
Post by: PaulRB on Aug 08, 2019, 07:59 am
Quote
so 120R for both 2 and 4 LED segments.
No. Sorry, I hoped by pointing out what was wrong with one calculation you would realise the other is also wrong.
Title: Re: 2.3" 16 segment common anode LEDs, HT16K33 and ULN2803
Post by: PaulRB on Aug 08, 2019, 08:07 am
(https://forum.arduino.cc/index.php?action=dlattach;topic=630110.0;attach=319612)
Please post your schematics so they can be viewed in the post, like above. Its a 2-step process: Attach the file as you have done and post. Then copy the address of the attachment, modify the post, click insert image and paste in the copied address.
Title: Re: 2.3" 16 segment common anode LEDs, HT16K33 and ULN2803
Post by: PaulRB on Aug 08, 2019, 08:23 am
I don't think that will work. The extra transistor will logically invert the signal from the COM pins.

in your previous working circuit, the COM pins on the HT chip go low to sink current from the common cathode of each digit in turn of your 0.8" displays, turning that digit on. The other COM pins go high at the same time to switch the other digits off.

In the circuit above, when a COM pin goes low, the npn transistor will switch off, which will in turn switch the MOSFET off.
Title: Re: 2.3" 16 segment common anode LEDs, HT16K33 and ULN2803
Post by: MitchSF on Aug 08, 2019, 01:22 pm
R2 = (12 - 1.5 - 6) / (.019 * 2) = 120R (4 LED segments)
R1 = (12 - 1.5 -6) / .019 = 240R (2 segments)


I found this on an EE site, so maybe just a diode will work because the potential is 12v - 5v, well within range.
"A P channel FET is easier to switch as the gate voltage only has to range from the power voltage to around 10 V less for most FETs." Does this look like it will work?

(https://forum.arduino.cc/index.php?action=dlattach;topic=630110.0;attach=319659)
Title: Re: 2.3" 16 segment common anode LEDs, HT16K33 and ULN2803
Post by: MitchSF on Aug 08, 2019, 06:59 pm
I think I'm looking at this wrong. The row lines go high when selected, and the Darlingtons on the cathodes of the LEDs ground them since they invert the signal.

The COM lines go low when selected, so a transistor SHOULD invert the signal to turn on the MOSFET. The source side of the MOSFET should go to 12v, and the drain to the anode. The above drawing is wrong.

The issue is switching on the MOSFET when the COM lines go low.

Is this correct?
Title: Re: 2.3" 16 segment common anode LEDs, HT16K33 and ULN2803
Post by: PaulRB on Aug 08, 2019, 07:39 pm
Series resistors look ok now.

Yes, sounds like you understand the switching issue now.

I have another suggestion. An equivalent to the ULN2803 chips is UDN2981/2984. These are high-side drivers and could replace the MOSFETs. They have a high voltage drop, like ULN, but with 12V supply that's not a serious issue. But the problem is they are not inverting. ULN is inverting: a high signal on an input pulls the output low allowing it to sink current. Because you are running common anode displays with a chip designed for common cathode displays, you need inverting drivers on both high (anode) and low (cathode) sides of the display.

You could use 74hc04 hex inverters to invert the COM signals before sending them to the UDN chip to drive the anodes.
Title: Re: 2.3" 16 segment common anode LEDs, HT16K33 and ULN2803
Post by: MitchSF on Aug 08, 2019, 11:39 pm
Would this be easier with common cathode displays, and a non-inverting Darlington array? If not, I'll update the schematic with a 74HC04 between the HT16K33 and the 2N3904.  Thanks again.
Title: Re: 2.3" 16 segment common anode LEDs, HT16K33 and ULN2803
Post by: PaulRB on Aug 09, 2019, 08:13 am
I can't think of a non-inverting Darlington driver either, so you might need inverters for that idea too.

For driving the MOSFETs, use 74hc07 rather than 74hc04. The '07 is non-inverting and has open-collector outputs which are ok up to 30V.

If it were my project, I might consider abandoning the HT chip in favour of 2x tpic6b595 shift registers per digit. But that would be 12 chips and a lot of series resistors. This would not be multiplexed.

Or 2x tpic6b595 and 1x tpic6b595 driving high-side MOSFETs for the anodes. But then you have to perform multiplexing in your Arduino sketch.
Title: Re: 2.3" 16 segment common anode LEDs, HT16K33 and ULN2803
Post by: PaulRB on Aug 09, 2019, 08:27 am
This shows how to connect a p-channel MOSFET.
(https://forum.arduino.cc/index.php?action=dlattach;topic=630110.0;attach=319807)
Title: Re: 2.3" 16 segment common anode LEDs, HT16K33 and ULN2803
Post by: MitchSF on Aug 09, 2019, 01:20 pm
From what I've learned here about this circuit, and that happens to be a lot, it looks like this can work.

The only question I have, is whether R3 is necessary, and if so, are the values of R3 and R8 appropriate?

If it does work, I'll probably recalculate the R values for a 9v supply, and use a smaller MOSFET. If no glaring errors are pointed out, I'll order a few parts and will breadboard next week.

Thanks again.

EDIT: With VCC at 7v maximum, I'm not sure that the 74HC07 will turn on the MOSFET. I was thinking that it could be connected to 12v. So maybe a 2N3904 as a switch switch driven by an inverting 74HC04 will work.

(https://forum.arduino.cc/index.php?action=dlattach;topic=630110.0;attach=319843)
Title: Re: 2.3" 16 segment common anode LEDs, HT16K33 and ULN2803
Post by: HKJ-lygte on Aug 09, 2019, 02:06 pm
Can it work?

ROW pins pull high when active and high impedance when passive, the ULN2803 need input current to turn on, this looks acceptable.

COM pins pull low when active and is high impedance when passive, there is a non-inverting driver with 5V CMOS input and output. A floating input on a CMOS will often be staying in the previous state, i.e. low. The transistor input will be either 0V or 5V, but the transistor is supplied from 12V, this means it would be on all the time if it was a P-Channel transistor, but symbol shows N-Channel transistor wired to always pass current.

This is not going to work.

The problem is the two different supply voltages. A real mos driver chip could do it or a transistor more, but a transistor includes an inversion that you do not need, this has to be fixed with a transistor more or a inverter and you need a pullup on the COM outputs.
Title: Re: 2.3" 16 segment common anode LEDs, HT16K33 and ULN2803
Post by: MitchSF on Aug 09, 2019, 02:32 pm
Thank you. Are these the changes you are describing?

(https://forum.arduino.cc/index.php?action=dlattach;topic=630110.0;attach=319850)
Title: Re: 2.3" 16 segment common anode LEDs, HT16K33 and ULN2803
Post by: HKJ-lygte on Aug 09, 2019, 02:41 pm
Thank you. Are these the changes you are describing?

Exactly, you forgot to put 12V on the circuit.
It is a good schematic praxis to feed positive voltage from the top, i.e. turn you mosfet around and point S up.
Title: Re: 2.3" 16 segment common anode LEDs, HT16K33 and ULN2803
Post by: HKJ-lygte on Aug 09, 2019, 02:46 pm
And one more item, when using a BJT transistor you need a base resistor, you could use a small N-channel mosfet if you want to avoid that.
Title: Re: 2.3" 16 segment common anode LEDs, HT16K33 and ULN2803
Post by: MitchSF on Aug 09, 2019, 03:09 pm
Changes made. Thanks again.

Is the NTR1P02T1G a good choice to substitute for the NDP6020P? That one seems like overkill in this circuit.

(https://forum.arduino.cc/index.php?action=dlattach;topic=630110.0;attach=319858)
Title: Re: 2.3" 16 segment common anode LEDs, HT16K33 and ULN2803
Post by: HKJ-lygte on Aug 09, 2019, 03:32 pm
That improved the schematic, but move the gate resistor so it goes up from the gate to 12V, that way it is much faster to see it is a pullup.

What was the current? 0.6 to 0.7A? I would prefer a transistor with a bit more headroom than NTR1P02T1G, i.e. 2+A rating, but it is not really necessary.
Title: Re: 2.3" 16 segment common anode LEDs, HT16K33 and ULN2803
Post by: MitchSF on Aug 09, 2019, 03:38 pm
Thanks again.

With all 16 segments lit, maximum current is 400mA. Hopefully this will be the final drawing.

(https://forum.arduino.cc/index.php?action=dlattach;topic=630110.0;attach=319862)
Title: Re: 2.3" 16 segment common anode LEDs, HT16K33 and ULN2803
Post by: HKJ-lygte on Aug 09, 2019, 03:51 pm
I cannot see any problem with it now. I hope you agree with me that changing the transistor and resistor position makes it easier to read the schematic.

If you plan on making a PCB I would recommend making a full schematic and use a program that can coordinate PCB layout with schematic, this reduces the risk of errors.
Title: Re: 2.3" 16 segment common anode LEDs, HT16K33 and ULN2803
Post by: MitchSF on Aug 09, 2019, 04:02 pm
Very good. Thanks again for the help.

I use DipTrace to design pc boards. A full schematic will be drawn. I'll post the results after the breadboard is completed with one or two displays.
Title: Re: 2.3" 16 segment common anode LEDs, HT16K33 and ULN2803
Post by: PaulRB on Aug 09, 2019, 05:56 pm
is whether R3 is necessary, and if so, are the values of R3 and R8 appropriate?
R3 not neccessary. The inputs of 74hc07 are very high impedance, only a tiny current will flow.
R8? Did you mean R6? If so, yes, because without it, the 74hc07 output would be damaged by short circuit when it goes low.

EDIT: With VCC at 7v maximum, I'm not sure that the 74HC07 will turn on the MOSFET. I was thinking that it could be connected to 12v.
I said that 74hc07 has open-collector output, but did not explain what the benefit of that would be. The 74hc07 chip itself would be powered with 5V. Because it's outputs are open-collector, it won't be damaged if those outputs are exposed to 12V, unlike other chips (such as 74hc04 or ht16k33 or Arduino pins). Open collector outputs can only pull a signal low, they cannot source current to pull a signal high. That is why R6 is there. So to answer your question, the 74hc07 does not switch the MOSFET off. R6 does that. But the 74hc07 can turn the MOSFET on by pulling its gate low, overcoming R6 pulling it high.

Title: Re: 2.3" 16 segment common anode LEDs, HT16K33 and ULN2803
Post by: HKJ-lygte on Aug 09, 2019, 06:04 pm
I said that 74hc07 has open-collector output, but did not explain what the benefit of that would be. The 74hc07 chip itself would be powered with 5V. Because it's outputs are open-collector, it won't be damaged if those outputs are exposed to 12V

I do not agree with your, here is a schematic from the hc07 datasheet:

(http://lygte-info.dk/pic/cpf5/74hc07schematic.png)

The diode sort of spoils your explanation.
Title: Re: 2.3" 16 segment common anode LEDs, HT16K33 and ULN2803
Post by: PaulRB on Aug 09, 2019, 06:06 pm
ROW pins pull high when active and high impedance when passive...

COM pins pull low when active and is high impedance when passive...
Can you please tell us where this is explained in the data sheet?

These are the diagrams from the data sheet that show how the outputs are wired internally:
(https://forum.arduino.cc/index.php?action=dlattach;topic=630110.0;attach=319886)
Looks like COM 0-3 are different from COM 4-7.
Title: Re: 2.3" 16 segment common anode LEDs, HT16K33 and ULN2803
Post by: HKJ-lygte on Aug 09, 2019, 06:13 pm
Exactly.
(http://lygte-info.dk/pic/cpf5/HT16K33.PNG)

The two MOSFETs with a ring around is used while updated display, the other MOSFETs and resistors are for keyboard scanning.
Title: Re: 2.3" 16 segment common anode LEDs, HT16K33 and ULN2803
Post by: PaulRB on Aug 09, 2019, 06:19 pm
I do not agree with your, here is a schematic from the hc07 datasheet:
The diode sort of spoils your explanation.
Yes, I see what you mean, I am also surprised by that. Will have to do some more research!
Title: Re: 2.3" 16 segment common anode LEDs, HT16K33 and ULN2803
Post by: PaulRB on Aug 09, 2019, 07:30 pm
From this (https://en.m.wikipedia.org/wiki/List_of_7400-series_integrated_circuits) list of 7400 series logic chips:
Quote
74x07   6   hex buffer gate      open-collector 30 V / 40 mA   
This is why I was surprised by what you posted from the hc07 data sheet. They do not seem to agree. The data sheet implies the gate is inverting, but the above does not. And with that diode shown in the data sheet, it would not be safe to connect the output to a 30V source...
Title: Re: 2.3" 16 segment common anode LEDs, HT16K33 and ULN2803
Post by: HKJ-lygte on Aug 09, 2019, 07:44 pm
From this (https://en.m.wikipedia.org/wiki/List_of_7400-series_integrated_circuits) list of 7400 series logic chips:This is why I was surprised by what you posted from the hc07 data sheet. They do not seem to agree. The data sheet implies the gate is inverting, but the above does not. And with that diode shown in the data sheet, it would not be safe to connect the output to a 30V source...
It do not, you have an inverting gate followed by an inverting output transistor, result: non-inverting.

The old TTL logic could handle higher voltages, but on CMOS you often get a protection diode and that is spoiling the HC07 chip. There are CMOS chips that can handle higher voltage on input/outputs.
Title: Re: 2.3" 16 segment common anode LEDs, HT16K33 and ULN2803
Post by: MitchSF on Aug 09, 2019, 08:01 pm
Since there is no keyboard scanning necessary, in effect the outputs from the HT16K33 should be the same for this purpose, is that correct?

I did switch back to a 74HC04 and that is in the last schematic because I thought that since the 2N7000 inverts the signal from the COM line, the 74HC04 will invert it back. Is that wrong?

Based on these comments, I'm not sure what changes need to be made to the circuit. I think that R3 should be removed, the 2N7000 should be removed, and the 74HC04 should change to a 74HC07, connecting directly to the gate. Is that correct?

Title: Re: 2.3" 16 segment common anode LEDs, HT16K33 and ULN2803
Post by: PaulRB on Aug 09, 2019, 08:22 pm
It do not, you have an inverting gate followed by an inverting output transistor, result: non-inverting.
 
Ah, yes, quite correct, sorry!
 
you often get a protection diode and that is spoiling the HC07 chip.
 
I think you are correct there too. Bang goes my idea. I was trying to minimise the component count for the OP, hoping to find an easily available and cheap component to drive the MOSFETs directly.
Title: Re: 2.3" 16 segment common anode LEDs, HT16K33 and ULN2803
Post by: HKJ-lygte on Aug 09, 2019, 08:25 pm
Since there is no keyboard scanning necessary, in effect the outputs from the HT16K33 should be the same for this purpose, is that correct?
Yes, all outputs are a mos transistor pulling high or low depend on row/column output.


I did switch back to a 74HC04 and that is in the last schematic because I thought that since the 2N7000 inverts the signal from the COM line, the 74HC04 will invert it back. Is that wrong?

Based on these comments, I'm not sure what changes need to be made to the circuit. I think that R3 should be removed, the 2N7000 should be removed, and the 74HC04 should change to a 74HC07, connecting directly to the gate. Is that correct?

No, go back to my first post: COM pulls low when it want to activate a output and high impedance when not, this means a pullup is required.
Next you want the low output to activate the MOSFET output transistor (Q1). lets take is one step at a time:
Q1 is a P-channel MOSFET and needs a input a couple of volts below S to turn on and G need to be at S voltage to turn off. R6 handles the off nicely and Q3 handles the on. To turn Q3 on a high voltage is needed on Q3 G input. This is the opposite of the COM output, hence we need a inverter to fix that.
If the circuit had been 5V only two inversion could be removed (U4 and Q3), but due to the higher voltage on   Q1 we need something that is not limited to 5V. That could be a driver without strict voltage limitations (that means a real MOSFET driver) or as here a transistor with a pullup resistor and a inverter before it. There is probably some other solution that would work also, but I cannot provide a working idea at the current time*.


*Using a real MOSFET driver might be able to replace Q1, Q3, U4, R6, but that would require that I read a couple of datasheets and started thinking and I am not sure it would be cheaper.

Title: Re: 2.3" 16 segment common anode LEDs, HT16K33 and ULN2803
Post by: PaulRB on Aug 09, 2019, 08:26 pm
Based on these comments, I'm not sure what changes need to be made to the circuit. I think that R3 should be removed, the 2N7000 should be removed, and the 74HC04 should change to a 74HC07, connecting directly to the gate. Is that correct?
Not sure now, @HKJ-lygte blew a big hole in my idea! Need to re-think. My idea might work with an LS07 but not, it seems, with its more modern replacement HC07.
Title: Re: 2.3" 16 segment common anode LEDs, HT16K33 and ULN2803
Post by: MitchSF on Aug 09, 2019, 08:31 pm
I think based on these comments, that the last schematic is ready to breadboard. Is that correct? Thanks again.
Title: Re: 2.3" 16 segment common anode LEDs, HT16K33 and ULN2803
Post by: HKJ-lygte on Aug 09, 2019, 08:44 pm
I think based on these comments, that the last schematic is ready to breadboard. Is that correct? Thanks again.
You already have my meaning about that, but keep looking at the comments, I frequently makes mistakes (Like above where I initially forgot the base resistor).
I do sometimes have the smell of mistakes in my lab! I hate it when that smell comes from a $100 (or more) device! What you have to accept is that when doing many projects you will also do many mistakes.

In case you is wondering: I do not see any problems in your schematic and there is nothing in that schematic that can release any smell ;)
Title: Re: 2.3" 16 segment common anode LEDs, HT16K33 and ULN2803
Post by: MitchSF on Aug 10, 2019, 02:34 pm
I'm on version 4 of my last pc board. I think 5 will be perfect, so I agree. Thanks again.
Title: Re: 2.3" 16 segment common anode LEDs, HT16K33 and ULN2803
Post by: MitchSF on Aug 10, 2019, 05:51 pm
One final question -

Which is the better choice for the MOSFET:

https://www.mouser.com/ProductDetail/ON-Semiconductor/NTR1P02LT1G?qs=sGAEpiMZZMshyDBzk1%2FWizSW%252BwlCH%2FhMrB93zprX5ug%3D (https://www.mouser.com/ProductDetail/ON-Semiconductor/NTR1P02LT1G?qs=sGAEpiMZZMshyDBzk1%2FWizSW%252BwlCH%2FhMrB93zprX5ug%3D)

or https://www.mouser.com/ProductDetail/ON-Semiconductor/NTR1P02T1G?qs=sGAEpiMZZMshyDBzk1%2FWizSW%252BwlCH%2FhMgPGGTGRgvTM%3D (https://www.mouser.com/ProductDetail/ON-Semiconductor/NTR1P02T1G?qs=sGAEpiMZZMshyDBzk1%2FWizSW%252BwlCH%2FhMgPGGTGRgvTM%3D)

The biggest difference appears to be the gate to source voltage. One amp vs 1.3 amps doesn't matter here.


Title: Re: 2.3" 16 segment common anode LEDs, HT16K33 and ULN2803
Post by: HKJ-lygte on Aug 10, 2019, 06:06 pm
Which is the better choice for the MOSFET:
For a 9V system I would use the L version, but not for a 12V system. If you have not decided between 9/12V stay away from the L version, it is best in 5V to 9V systems.

Title: Re: 2.3" 16 segment common anode LEDs, HT16K33 and ULN2803
Post by: MitchSF on Aug 10, 2019, 06:56 pm
Thank you.
Title: Re: 2.3" 16 segment common anode LEDs, HT16K33 and ULN2803
Post by: MitchSF on Aug 12, 2019, 10:03 pm
Everything seems to be ok up to the NDP6020P. Here the scope is connected to the Drain of the 2N7000 / Gate of the NDP6020P:
(https://forum.arduino.cc/index.php?action=dlattach;topic=630110.0;attach=320196)



This one is the Drain of the NDP6020P:

(https://forum.arduino.cc/index.php?action=dlattach;topic=630110.0;attach=320198)

I tried decreasing the resistance across the NDP6020P to 560 ohms, but that did not have an effect on the output. I also tried a new NDP6020P.
Title: Re: 2.3" 16 segment common anode LEDs, HT16K33 and ULN2803
Post by: HKJ-lygte on Aug 12, 2019, 10:16 pm

For me it looks like it turns on when the gate goes low and when the gate goes high the output voltage will slowly drop, this can be due to the load.

Instead of the leds, try connecting a resistor from the D to GND, this makes it easier to see on the scope if it switches correctly.
Title: Re: 2.3" 16 segment common anode LEDs, HT16K33 and ULN2803
Post by: MitchSF on Aug 12, 2019, 10:24 pm
That was with 2 LEDs in series. Same as with no load. This is with a 560 ohm resistor from the drain to ground.

(https://forum.arduino.cc/index.php?action=dlattach;topic=630110.0;attach=320202)
Title: Re: 2.3" 16 segment common anode LEDs, HT16K33 and ULN2803
Post by: HKJ-lygte on Aug 12, 2019, 10:31 pm
This looks correct, it will pull high when the gate goes low.
Take a close look at your led/display and see if you have done something wrong there.
Title: Re: 2.3" 16 segment common anode LEDs, HT16K33 and ULN2803
Post by: HKJ-lygte on Aug 12, 2019, 10:36 pm
Remember: You have to put some data into the HT16K33 to make the other drives do something.
Title: Re: 2.3" 16 segment common anode LEDs, HT16K33 and ULN2803
Post by: MitchSF on Aug 12, 2019, 10:45 pm
I'm using two red LEDs connected in series, not the alphanumeric display. The HK16K33 is connected to an ESP32 displaying segments in a loop. I verified that by connecting a smaller display directly to the HK16K33.
Title: Re: 2.3" 16 segment common anode LEDs, HT16K33 and ULN2803
Post by: MitchSF on Aug 26, 2019, 05:03 pm
I've switched to a max626 MOSFET driver, and everything appears to work up to it's output. The Arduino is running a blink sketch on every pin and I see the PWM output on the scope showing 0v - 5v,  following an LED connected directly to the HK16K33 so I know that part is working.

When the output of the max626 is connected to the gate of the NDP6020P, the LED stays on. I appreciate any help on this. Thanks.

(https://forum.arduino.cc/index.php?action=dlattach;topic=630110.0;attach=321944)
Title: Re: 2.3" 16 segment common anode LEDs, HT16K33 and ULN2803
Post by: HKJ-lygte on Aug 26, 2019, 05:37 pm
When the output of the max626 is connected to the gate of the NDP6020P, the LED stays on. I appreciate any
The driver must be supplied with the same voltage as the MOSFET, i.e. 12V
Title: Re: 2.3" 16 segment common anode LEDs, HT16K33 and ULN2803
Post by: MitchSF on Aug 26, 2019, 05:57 pm
Thanks for the reply. The output of the max626 is now at 0v and 12v, but the LEDs are dimly lit. They are on full brightness before the sketch starts when the gate is at 0v.

Title: Re: 2.3" 16 segment common anode LEDs, HT16K33 and ULN2803
Post by: HKJ-lygte on Aug 26, 2019, 09:14 pm
There was also something with a pullup resistor to 5V on the COM pins.
Title: Re: 2.3" 16 segment common anode LEDs, HT16K33 and ULN2803
Post by: Grumpy_Mike on Aug 27, 2019, 07:38 am
From the data sheet of the NDP6020P
Quote
Absolute Maximum Ratings
V GSS Gate-Source Voltage - Continuous  ±8 V
You seem to be putting 12 volts between gate and source when the FET is on.

Title: Re: 2.3" 16 segment common anode LEDs, HT16K33 and ULN2803
Post by: MitchSF on Aug 27, 2019, 01:53 pm
That's why I originally put 5v on VCC for the Max626.

I thought the pullup resistor was only necessary when the 74HC04 was used. I'm not sure where to go from here.
Title: Re: 2.3" 16 segment common anode LEDs, HT16K33 and ULN2803
Post by: HKJ-lygte on Aug 27, 2019, 03:44 pm
That's why I originally put 5v on VCC for the Max626.
That does not work when the MOSFET is powered from 12V.

I thought the pullup resistor was only necessary when the 74HC04 was used.
The HT16K33 output is a pulldown output, it always needs something to pull it up.


I'm not sure where to go from here.
Find another mosfet that can take 20V over Gate Source, you do not need a logic level one.
Title: Re: 2.3" 16 segment common anode LEDs, HT16K33 and ULN2803
Post by: MitchSF on Aug 27, 2019, 04:05 pm
Thank you. I'll do that.
Title: Re: 2.3" 16 segment common anode LEDs, HT16K33 and ULN2803
Post by: Grumpy_Mike on Aug 27, 2019, 04:14 pm
I thought the pullup resistor was only necessary when the 74HC04 was used. I'm not sure where to go from here.
You add another 1K resistor between your FET's gate and your driver, that means your gate only drives to -6V and not -12V, which as I pointed out is too much for that FET.

Quote
That's why I originally put 5v on VCC for the Max626
Yes but that still put -12V on the gate when you pulled it down, with the added disadvantage that it would not pull it up high enough to turn off your FET anyway.

I don't know but maybe your FET is damaged it is never wise to exceed absolute maximum values.

The whole circuit seems to be a sledge hammer to crack a nut.
Title: Re: 2.3" 16 segment common anode LEDs, HT16K33 and ULN2803
Post by: MitchSF on Aug 27, 2019, 04:17 pm
Quote
The whole circuit seems to be a sledge hammer to crack a nut.
Probably true!

I'll try that when we return from our travels, but maybe I'll just find an EE to do some consulting on this, to get it done right.

Title: Re: 2.3" 16 segment common anode LEDs, HT16K33 and ULN2803
Post by: HKJ-lygte on Aug 27, 2019, 04:18 pm
You add another 1K resistor between your FET's gate and your driver, that means your gate only drives to -6V and not -12V, which as I pointed out is too much for that FET.
I forgot that resistor, it is not needed with a the MOS driver chip and a MOSFET that can handle the voltage.
Title: Re: 2.3" 16 segment common anode LEDs, HT16K33 and ULN2803
Post by: Grumpy_Mike on Aug 27, 2019, 04:22 pm
Quote
it is not needed with a the MOS driver chip and a MOSFET that can handle the voltage.
Well it is not the driver chip it is the FET. The whole thing about the driver chip seems silly as you are not trying to pull amps out of the FET so why not simply use an NPN transistor here? That will save a lot of money.
Title: Re: 2.3" 16 segment common anode LEDs, HT16K33 and ULN2803
Post by: MitchSF on Aug 27, 2019, 04:38 pm
I can go back to that but doesn't that invert the signal, requiring a 74HC04 to invert back?
Title: Re: 2.3" 16 segment common anode LEDs, HT16K33 and ULN2803
Post by: Grumpy_Mike on Aug 27, 2019, 10:49 pm
If it does then simply invert the signal in software.
But transistor on means LEDs get power, do you have it the other way round?
Title: Re: 2.3" 16 segment common anode LEDs, HT16K33 and ULN2803
Post by: PaulRB on Aug 27, 2019, 11:47 pm
I feel like this thread has gone in a circle and we are back to the problems and questions from pages 1 & 2.

I don't think the signals can be inverted in software. The multiplexing is not software driven. The OP wants to continue to use the ht16k33 to drive the multiplexing, as he did previously with some smaller common cathode displays. The larger displays he wants to use now are common anode, so I think inverting drivers are needed on both the high (anode) side and the low (cathode) side. The ULN chips provide the inverting low side drivers, but designing inverting high side drivers is proving difficult.

Title: Re: 2.3" 16 segment common anode LEDs, HT16K33 and ULN2803
Post by: PaulRB on Aug 28, 2019, 12:12 am
What about udn2981 to drive the common anodes? Unfortunately these are not inverting, so 74hc04 will be needed to invert the COM signals from the ht16k33 to feed the inputs of the udn. Pull-ups to 5V on the 74hc04 inputs to prevent them floating when the COM pins are not pulling them low.
Title: Re: 2.3" 16 segment common anode LEDs, HT16K33 and ULN2803
Post by: MitchSF on Sep 25, 2019, 03:43 pm
I switched to common cathode displays. Using a ULN2803 with a 2k resistor on each input to +5v, and a TBD62783 on the anodes with 2k resistors to ground on each input, everything appears to work fine.

I'm not sure if the value of the resistor is optimal. It was a guess. Is there a way to calculate the correct value?

For the segment series resistors, I believe the voltage drop across both the ULN2803 and TBD62783 together is around 3v. Two LEDs in series drops 6v, so 12 - 6 - 3 = 3v, 3/.04 = 75 ohms. Is that correct?
Title: Re: 2.3" 16 segment common anode LEDs, HT16K33 and ULN2803
Post by: PaulRB on Sep 25, 2019, 05:44 pm
That sounds like a good estimate. You could temporarily try something higher and very safe, like 330R or 510R, and freeze the multiplexing so that one digit is permanently lit and you can measure the actual voltage drop across the series resistors.

Then you can re-calculate the optimal resistor value to achieve the 40mA when multiplexing is enabled.
Title: Re: 2.3" 16 segment common anode LEDs, HT16K33 and ULN2803
Post by: MitchSF on Sep 26, 2019, 07:44 pm
Thanks. I will do that.
Title: Re: 2.3" 16 segment common anode LEDs, HT16K33 and ULN2803
Post by: PaulRB on Sep 26, 2019, 08:12 pm
Sorry, now I'm forgetting! You can't freeze the multiplexing because the ht16k33 is controlling it. You will need to disconnect that and connect one of the ULN2803 inputs to 5V and one of the TBD62783 inputs to 5V to light one segment, then measure the voltage drop across its series resistor.
Title: Re: 2.3" 16 segment common anode LEDs, HT16K33 and ULN2803
Post by: MitchSF on Sep 27, 2019, 09:52 pm
I'll do that. Thanks.

Is 2k an appropriate value for the pullup/down? I don't see a way to calculate the value so maybe the best way is to choose the highest value that will allow the circuit to work. With no resistor it does not work at all.
Title: Re: 2.3" 16 segment common anode LEDs, HT16K33 and ULN2803
Post by: PaulRB on Sep 27, 2019, 10:31 pm
Values of pull-up/down resistors are not usually critical. 10K or 4K7 are the most common. 2K2 is also fine, especially with higher switching frequencies or longer line lengths. Trying to find the highest value that works reliably is often not worth the effort unless you are designing a battery powered circuit.
Title: Re: 2.3" 16 segment common anode LEDs, HT16K33 and ULN2803
Post by: MitchSF on Sep 28, 2019, 07:38 pm
Thanks for all the help. I"m just waiting for the boards now.