Hello everyone,
I'm using below attachment 4x4 led matrix, it's working fine in proteus. when i try on real hardware, led's brightness is very low i don't know why?
please guide me how do i increase led's brightness?
Hello everyone,
I'm using below attachment 4x4 led matrix, it's working fine in proteus. when i try on real hardware, led's brightness is very low i don't know why?
please guide me how do i increase led's brightness?
thanks for your response.
larryd:
Pin 9 of the ULN2803 must be connected to GND!
it has connected to ground. not increasing brightness
here is the that i'm using.
#define latchPin A1
#define clockPin A0
#define dataPin A2
void setup() {
//set pins as output
pinMode(latchPin, OUTPUT);
pinMode(clockPin, OUTPUT);
pinMode(dataPin, OUTPUT);
}
void matrixWriteBit(int row, int column) {
byte Data = B11110000;
bitWrite(Data, row, 1);
bitWrite(Data, column+4, 0);
digitalWrite(latchPin, LOW);
//shiftOut(dataPin, clockPin, LSBFIRST, rowData);
shiftOut(dataPin, clockPin, MSBFIRST, ~Data);
//set latch pin high- this sends data to outputs so the LEDs will light up
digitalWrite(latchPin, HIGH);
}
void loop() {
matrixWriteBit(0,0);
matrixWriteBit(0,1);
matrixWriteBit(0,2);
matrixWriteBit(0,3);
matrixWriteBit(1,0);
matrixWriteBit(1,1);
matrixWriteBit(1,2);
matrixWriteBit(1,3);
matrixWriteBit(2,0);
matrixWriteBit(2,1);
matrixWriteBit(2,2);
matrixWriteBit(2,3);
matrixWriteBit(3,0);
matrixWriteBit(3,1);
matrixWriteBit(3,2);
matrixWriteBit(3,3);
}
This circuit should not work at all. No LEDs should light. The uln chip cannot source current.
What is "RP1"?
You must use series resistors for your leds.
PaulRB:
This circuit should not work at all. No LEDs should light. The uln chip cannot source current.What is "RP1"?
but PaulRB this is working on proteus and on real hardware but on real hardware has led's brightness issue. the uln source current was connected to 5v.
RP1 is 10k resistor pack.
Ah, I see. I have never used Proteus. I have only heard bad things about it. What you say confirms that
But I can see how your leds light dimly. The led anodes are getting a very small current from the 10K resistor. Your circuit design is simply wrong. As I said before, the uln chip's outputs cannot source current for your led anodes. Connect the anodes to the 595's outputs directly, bypassing the uln, but with series resistors, e.g. 330R. The uln outputs can remain connected to the cathodes. You can remove the 10K resistor pack, it has no purpose.
Thanks PaulRB for your response.
PaulRB:
I have never used Proteus. I have only heard bad things about it. What you say confirms that
I don't know deeply about proteus but want to say that sometimes things work fine on proteus but don't work on real hardware and sometimes things don't work on proteus but work on real hardware. its rare.
PaulRB:
The led anodes are getting a very small current from the 10K resistor.
Sorry i did not mention in previous reply it's 10k pull up resistors pack. I used it because I'm inverting output of 595 in the above code. like: shiftOut(dataPin, clockPin, MSBFIRST, ~Data);
so whenever 595 an output will be low then uln output pin will be high by pull up resistor.
I will try as you said, then reply you. thanks again.
uln output pin will be high by pull up resistor
But that is only a weak high. Only a very small current can be provided. It would be suitable to drive the input of another logic chip but not enough to drive a led satisfactorily. And if you did want to drive the inputs of logic chips, the uln would be uneccessary. This circuit would be suitable for driving high-side transistors for switching high voltages.
The ULN outputs cannot be driven high, only low. The 595 outputs can be driven both high and low but their current capability is much lower.
Thanks PaulRB.
PaulRB:
The ULN outputs cannot be driven high, only low. The 595 outputs can be driven both high and low but their current capability is much lower.
then how do I supply +5v to cathode side of leds to prevent lighting in multiplexing?
The ULN's outputs are either driven low (so they will sink current) or they are off/high impedance (will neither source or sink current). They can never output 5V or source current. To prevent leds lighting, turn the output off.
So the ULN's outputs have two states: low/sink and high impedance. The 595's outputs have 2 states: low/sink and high/source. The Arduino's outputs have 3 states: high, low and input/high impedance.
Actually, the 595's outputs can also be high impedance, by using the OE pin. But not individually by pin.
Thanks PaulRB
I attached redesigned sketch as you said...there is no difference on brightness. is that right sketch?
No. See reply #4 and reply #6
Also, in Arduino-speak, "sketch" means code, not a schematic.
You will need to change your code also. To light a single led, you need to write a 1 to both the row and column, and all other bits should be zero.
Also, in Arduino-speak, "sketch" means code, not a schematic.
sorry for that.
You'r right PaulRB. i had changed the code also as you can see below. but the problem is persist.
byte Data = B00000000;
bitWrite(Data, row, 1);
bitWrite(Data, column+4, 1);
digitalWrite(latchPin, LOW);
shiftOut(dataPin, clockPin, MSBFIRST, Data);
digitalWrite(latchPin, HIGH);
Try adding a delay(1000) at the end of matrixWriteBit(). But before you do that, you must add those series resistors, otherwise you could blow your leds. The delay will slow down the multiplexing, so that you can see the true brightness of the leds. They may be dim because of the multiplexing, which with your sketch above is using a 1-in-16 duty cycle. With code changes, this can be reduced to a 1-in-4 duty cycle.
Thanks PaulRB.
PaulRB:
Try adding a delay(1000) at the end of matrixWriteBit().
I used delay at the end of matrixWriteBit(). now led brightness is 100% but problem is all leds are not turning on at the same time but one by one after one sec. I don't know how do i reduce duty cycle could you help me?
I want to know that can i use udn2981 ic instead of uln?
Your current code lights one led at any instant. This means that if you want all 16 LEDs to appear lit at once, each led is lit for 6.25% of the time at most. Probably less than that in practice because of code overheads.
It is possible to light up to 4 LEDs at any instant. These can be 4 in the same row or 4 in the same column, depending how you wire the matrix to the driver chips. That way, to make all 16 LEDs appear to be out at once, each led can be lit up to 25% of the time. This will require significant changes to your code.
Yes, you could use the udn chip instead of the uln chip, but there would be no advantage. You could use both udn and uln together to achieve more brightness, but I do not think that will be needed, once your code is changed to achieve 1 in 4 duty cycle.
Thanks PaulRB for your help and time.
PaulRB:
It is possible to light up to 4 LEDs at any instant.
But i need to light up only an led when i give row and column. not 4 leds.
also i changed 330ohms to 120Ohms resistors (increased 25% brightness of leds) at columns side.
Thanks again.