| Author |
Message |
|
|
Posted: Mar 28, 2012 - 04:12 PM |
|


Joined: Apr 20, 2010
Posts: 110
Location: Toronto, Canada
|
|
Jan_dc, you're right, I'd missed that little point about the total VCC current.
Mondalaci, you have the IC total right, just don't forget the eight current limit resistors. If you want to keep the total current under 70mA, use at least 400 ohm resistors. 470 ohm resistors would give you a better safety margin.
While I was going over the circuit again, I spotted another potential problem. When power is initially applied, the two 74HC595 shift registers will have random contents. That makes it likely that multiple rows will be on simultaneously, along with multiple columns. Worst case, it's possible to have all the LEDs on at once, which would massively overload the power supply, at least until the CPU comes out of reset and writes correct data to the display.
To fix that, instead of grounding the output enable on the column shift register, I added a pull-up resistor to it, and connected the enable line to another CPU pin. this way, all the columns are guaranteed to be off until after the CPU has had time to fill the shift registers with valid data. As a side bonus, if that enable line is connected to a CPU pin with PWM capability, you can use PWM to control the display brightness without interfering with the display scanning code.
The big question I have now is still brightness. With the peak LED current down to under 8.75mA per LED to meet driver limits, the average current is now down to around 1mA. That's not going to be a very bright display. You could use that TD62783A source driver to drive the row lines, or you could use a bunch of P channel MOSFETs. You can use pretty much any P channel logic level MOSFETS with a drain current equal to or greater than your worst case row current. Here's what the schematic would look like with the MOSFETs, and that change to the enable line on the column shift register.
 |
|
|
| |
|
|
|
|
|
Posted: Mar 30, 2012 - 05:04 PM |
|


Joined: Dec 05, 2008
Posts: 179
Location: Hungary
|
|
Chris,
Thank you very much for your updated design! Frankly, I'd have never thought about these issues and it'd probably take me a *lot* of time to figure them out.
In my true style I have some further questions.
1) Are you really sure that the content of the 74HC595 is random upon initialization? It may easily be the case, it's just weird to me because it's not advantageous usability-wise.
2) Wouldn't using a ULN2803 in the place of the MOSFETs or the TD62783A provide the same current to the LEDs? That'd probably be a better choice purely regarding costs (pick and placing less components and/or not having to use another component).
3) How about using a BJT instead of a pull-up resistor for the Output Enable pin? I guess it'd be just as good for this purpose but probably more expensive and overly complicated. Correct?
Thanks again!
Laci |
|
|
| |
|
|
|
|
|
Posted: Apr 02, 2012 - 07:56 PM |
|


Joined: Apr 20, 2010
Posts: 110
Location: Toronto, Canada
|
|
mondalaci,
Looking through the data sheet for the 74HC595, I can't find any reference to Default values when power is first applied to the chip. Given that lack, and the fact that power-on-reset circuitry is rare in any of the 74XXX integrated circuits, it's safest to assume random until proven otherwise.
The ULN2803 won't work for the row drivers, you need something capable of sourcing current, not sinking it. The TD62783A would work. You'd have to look at parts cost, assembly cost, and board layout issues to decide which method is best.
I'm not sure how you'd go about using a BJT to hold the enable line high until the CPU is ready. It's certainly going to be more expensive than a simple resistor. During the time between power being applied, and the CPU getting around to initializing the display, the I/O pins on the CPU are high impedance inputs. The pull-up resistor is there simply to guarantee that the column drivers are off any time that the CPU input pins are high impedance. |
|
|
| |
|
|
|
|
|
Posted: Apr 03, 2012 - 01:41 AM |
|

Joined: Dec 30, 2004
Posts: 8789
Location: Melbourne,Australia
|
|
|
Quote:
1) Are you really sure that the content of the 74HC595 is random upon initialization? It may easily be the case, it's just weird to me because it's not advantageous usability-wise.
That's why they have a reset input! The suggestion of using a resistor to hold it in reset until the cpu comes alive and drives the port pin would have to be the simplest. |
|
|
| |
|
|
|
|
|
Posted: Apr 03, 2012 - 09:58 PM |
|


Joined: Dec 05, 2008
Posts: 179
Location: Hungary
|
|
Guys,
Thanks for elaborating on the 74HC595. Components that are not initialized by default seem weird to me because I came from the software world but your explanation makes perfect sense.
Chris,
At this point everything is pretty clear to me. The last thing that's left is deciding on the TD62783A vs MOSFETs issue.
First of all it's important to take into consideration that I wanna drive 47 LEDs, so a 8x8 (=64) matrix is overkill. A 7x7 (=49) matrix would be enough, but a 6x8 (=48) matrix is even better for this purpose because 6 MOSFETs are enough this way.
As for the component selection of the concrete MOSFET device, under the "Discrete Semiconductor Products" headline of the Digi-Key product index I can choose:
* "FETs - Single" and set the filter "FET Type" to "MOSFET P-Channel, Metal Oxide", or
* "FETs - Arrays" and set the filter "FET Type" to "2 P-Channel (Dual)"
In the former case I'll need 6 parts per device and in the latter case I'll need 3 parts per device.
As for the additional filters to be used I only have to watch for the "Current - Continuous Drain (Id) @ 25° C".
Is the above correct?
Thanks a lot! |
|
|
| |
|
|
|
|
|
Posted: Apr 04, 2012 - 06:17 PM |
|


Joined: Apr 20, 2010
Posts: 110
Location: Toronto, Canada
|
|
| mondalaci, that looks about right. |
|
|
| |
|
|
|
|
|
Posted: Apr 06, 2012 - 02:45 PM |
|


Joined: Dec 05, 2008
Posts: 179
Location: Hungary
|
|
Chris,
In the meantime I've tried to take another look at your schematics and realized that they disappeared from the external server where you uploaded them.
Could you please upload your schematics as attachments here on AVRFreaks so that those would be accessible in the future?
Thanks in advance. |
|
|
| |
|
|
|
|
|
Posted: Apr 09, 2012 - 06:55 PM |
|


Joined: Apr 20, 2010
Posts: 110
Location: Toronto, Canada
|
|
| Oops. Looks like we had a server failure that took down the images. Let me see if I can figure out how to upload the most recent one here. |
|
|
| |
|
|
|
|
|
Posted: Apr 09, 2012 - 07:34 PM |
|


Joined: Dec 05, 2008
Posts: 179
Location: Hungary
|
|
Thanks a lot, Chris!
I happen to have the first version of your schematic which I also upload now. |
|
|
| |
|
|
|
|
|
Posted: Apr 12, 2012 - 11:44 PM |
|


Joined: Dec 05, 2008
Posts: 179
Location: Hungary
|
|
Chris,
1) Could you please confirm that the BSS84,215 and BSS84 MOSFETs are good for this purpose? (I could get the former from a local supplier but ultimately I'd like to choose the latter because that's the cheapest one.
2) On a related note I'm confused about the "Package / Case" vs "Supplier Device Package" fields. It seems to me that the former lists packages that are compatible with each other. Maybe their footprint is the same or they only differ in naming (TO-236-3, SC-59, SOT-23-3 seem to be pretty much the same). Please le me know what's the situation here.
Thanks a lot! |
|
|
| |
|
|
|
|
|
Posted: Apr 13, 2012 - 12:56 AM |
|


Joined: Dec 05, 2008
Posts: 179
Location: Hungary
|
|
3) I almost forgot: What should be the value of the pull-up resistor?
Thanks! |
|
|
| |
|
|
|
|
|
Posted: Apr 18, 2012 - 03:06 PM |
|


Joined: Apr 20, 2010
Posts: 110
Location: Toronto, Canada
|
|
Those MOSFETs should work just fine, assuming your current stays below 130mA per row.
It appears that the Supplier Device Package is what the manufacturer calls the package the device is in, while package/case are industry equivalents, but I'm not at all sure on that. The best solution would be to ask Digikey exactly what they mean by that.
The value of the pull-up resistor is not at all critical. Pretty much any value between 1K and 100K should work just fine. |
|
|
| |
|
|
|
|
|
Posted: Apr 19, 2012 - 11:24 AM |
|

Joined: Apr 19, 2012
Posts: 1
|
|
|
mondalaci wrote:
Freaks,
I'd like to create a 8x8 LED matrix using the smallest number of pins of my AVR. It'd be great to use two shift registers, one for rows and one for columns but it doesn't seem possible because according to my understanding shift registers can only source current they cannot sink current.
How is this possible?
led strip lighting outdoor I'm open to alternative solutions as long as the pin count stays as low as possible.
Thanks in advance.
Laci
$ As this modified post seems spam I have removed the links, I have kept the original text if there is a valid reason to restore it - JS $ |
|
|
| |
|
|
|
|
|
Posted: Apr 19, 2012 - 11:49 PM |
|


Joined: Dec 05, 2008
Posts: 179
Location: Hungary
|
|
I cannot thank your help enough, Chris. Now it's my turn to build the board. I'll let you know about the final result.
On a related note I've just reported Saxena to a moderator so this spammer is gonna be taken down. |
|
|
| |
|
|
|
|
|
Posted: Apr 19, 2012 - 11:58 PM |
|


Joined: Mar 28, 2001
Posts: 20392
Location: Sydney, Australia (Gum trees, Koalas and Kangaroos, No Edelweiss)
|
|
| The spam has already been removed. |
_________________ John Samperi
Ampertronics Pty. Ltd.
www.ampertronics.com.au
* Electronic Design * Custom Products * Contract Assembly
|
| |
|
|
|
|
|
Posted: Apr 20, 2012 - 12:02 AM |
|


Joined: Dec 05, 2008
Posts: 179
Location: Hungary
|
|
| Now I see. I've had this page loaded for a long time in my browser without being updated. |
|
|
| |
|
|
|
|
|
Posted: Apr 21, 2012 - 02:44 AM |
|


Joined: Dec 05, 2008
Posts: 179
Location: Hungary
|
|
Chris,
There's one thing left that I can think of. I'd like to utilize 5 white LEDs and 42 red LEDs in this matrix.
On one hand the value of resistors should be chosen based on the specific LEDs that are being used. In this case one row should be dedicated to the red LEDs with a specific resistance value.
On the other hand the maximum current that I can provide to the LEDs is fixed so maybe I shouldn't worry and use the same resistors for all the LEDs and mix the LEDs within the matrix in any way I want.
What do you think the correct solution is?
Thank you very much in advance! |
|
|
| |
|
|
|
|
|
Posted: Apr 24, 2012 - 01:56 PM |
|


Joined: Apr 20, 2010
Posts: 110
Location: Toronto, Canada
|
|
Your circuit may be designed with a maximum current, but it's not really enforced. LEDs with higher forward voltage drops will leave less voltage across the series resistor, and thus lower current in those LEDs.
There's a couple of possible solutions to the problem. One would be to simply ignore the fact that you are mixing different LED types, and accept the fact that this would result in different brightnesses.
If you could arrange for all the LEDs in a given row to be the same colour, then you could simply adjust the resistor value for that row to give the same brightness as all the other rows.
A third solution would be to use a driver IC that has a constant current output. I found this at Digi-Key:
http://www.digikey.ca/product-detail/en/STP08DP05B1/497-6271-5-ND/1641765
It's a shift register/latch combination, with constant current output drivers. It would replace the 74HC595 and the ULN2803 driver for the columns, and have the side effect of eliminating the need for the resistors in the row lines. You'd feed the LED data to the columns, then select one row instead of selecting a column and feeding LED data to the rows, but that's a fairly simple software fix. |
|
|
| |
|
|
|
|
|
Posted: Apr 29, 2012 - 10:03 PM |
|


Joined: Dec 05, 2008
Posts: 179
Location: Hungary
|
|
Chris,
Let's take your last schematic as the basis and imagine a 8x6 matrix in the place of the 8x8 matrix. In columns 1-7 red LEDs will be used, 6 per column. In the rightmost (8th) column I plan to place the 5 white LEDs and leave a matrix junction empty.
At this point your first solution would involve having 6 resistors of the same resistance for the rows (or 8 resistors of the same resistance for the columns).
Your second solution would involve having 8 resistors for the columns of which 7 would have the same resistance and the 8th (rightmost) would have a different resistance.
As for your third solution I love the idea of being able to use the minimum number of parts possible but nothing seems to be able to beat the 74HC595 + ULN2803 combo price-wise.
Am I correct that brightness inconsistency across the LEDs regarding the first and especially the second solution shouldn't be noticable by the human eye? (Maybe both of these solutions would be equally good considering that the duty cycle can be set by changing the firmware.)
Given that the red and white LEDs are as evenly distributed within the rows as possible do you think that one of these two solutions is better than the other? (If not then I'd go with the first solution because its slightly simpler.)
Thank you very much in advance! |
|
|
| |
|
|
|
|
|
Posted: May 28, 2012 - 06:43 PM |
|


Joined: Dec 05, 2008
Posts: 179
Location: Hungary
|
|
Hey Freaks,
After all this time I finally managed to breadboard Chris' circuit and test it with an Arduino Mega.
I've created a video and some pictures. (I shot the video and pictures before wiring the MOSFETs correctly but I fixed the wiring and the code since then.)
Here's the Arduino sketch (also attached):
Code:
#include <SPI.h>
int enableOutput = true;
int useSPI = true;
int numberOfRows = 3;
int numberOfColumns = 2;
int latchPin = 22; // ST_CP
int clockPin = 23; // SH_CP
int dataPin = 24; // DS
int outputEnablePin = 25;
void setup() {
Serial.begin(9600);
pinMode(latchPin, OUTPUT);
if (useSPI) {
SPI.setBitOrder(MSBFIRST);
SPI.setClockDivider(SPI_CLOCK_DIV2);
SPI.setDataMode(SPI_MODE0); // Every mode works except mode 1
SPI.begin();
} else {
pinMode(clockPin, OUTPUT);
pinMode(dataPin, OUTPUT);
}
if (enableOutput) {
sendData(0);
sendData(0);
pinMode(outputEnablePin, OUTPUT);
digitalWrite(outputEnablePin, 0); // Enabled (active low)
}
}
void loop() {
for (int j = 0; j < numberOfRows*numberOfColumns; j++) {
digitalWrite(latchPin, 0);
sendData(1 << j / numberOfRows); // Column data
sendData(~(1 << j % numberOfRows)); // Row data
digitalWrite(latchPin, 1);
Serial.println(j);
delay(100);
}
}
void sendData(int data)
{
if (useSPI) {
SPI.transfer(data);
} else {
shiftOut(dataPin, clockPin, data);
}
}
void shiftOut(int myDataPin, int myClockPin, byte myDataOut) {
digitalWrite(myClockPin, 0);
for (int i=7; i>=0; i--) {
digitalWrite(myClockPin, 0);
digitalWrite(myDataPin, myDataOut & (1<<i));
digitalWrite(myClockPin, 1);
}
}
As you can see according to the value of the useSPI variable the sketch can bitbang or SPI-drive the 74HC595s.
As for now it's only a 2x3 matrix. I have yet to design the PCB featuring the full matrix containing red and white LEDs but currently everything works as expected.
Thanks a lot everybody being involved, especially Chris! |
|
|
| |
|
|
|
|
|