Hello Everyone,
I'm driving 3 digit multiplexed 7 segment with rotary encoder. code is working fine...but some off LEDs have dim light. I don't know why? how do i solve that issue?
you can see the problem in attachment.
Hello Everyone,
I'm driving 3 digit multiplexed 7 segment with rotary encoder. code is working fine...but some off LEDs have dim light. I don't know why? how do i solve that issue?
you can see the problem in attachment.
Wiring diagram?
Code?
I downloaded fff.png and it is hard to make out the schematic.
At the very least I don't see resistors for the LEDs.
.
You may be sinking more current into your segment pins (4,5,6) than is healthy for them.
You could put BJTs or mosfets on those and use a running one instead of a running zero.
Maybe a slight delay after latching the shift register might help.
E.g. doing
digitalWrite(Latch,HIGH);
twice.
Thanks Jobi for your response.
Jobi-Wan:
You may be sinking more current into your segment pins (4,5,6) than is healthy for them.
You could put BJTs or mosfets on those and use a running one instead of a running zero.
I used bc548 transistor, but the transistor did not solve the problem. any idea?
ieee488:
At the very least I don't see resistors for the LEDs.
I see them. Has the schematic been updated by the OP since then?
I cannot view the .ino attachment on my phone.
The dimly lit segments are because of a code error which causes "ghosting" or "bleeding". It is caused by not blanking the digits while the next segment pattern is being loaded.
szacpp:
I used bc548 transistor, but the transistor did not solve the problem. any idea?
Sorry, I thought your problem was that some segments were brighter than others. But I now think it is that some segments that should be off are still a little bit on. (It is still a good idea to not have i/o pins sink 7 LEDs.)
You may be looking at ghosting. This is what Rintin is hinting at too.
Did you try a small delay between setting the old digit low and shifting out the segments,
or between latching out the segments and setting the new digit high, or both?
Does it still happen if you display only one digit? By removing any 2 of the 3 cases in your Scanner() function? If it still happens, it is not ghosting.
I cannot open the sketch on my PC either, the file seems to be corrupt.
PaulRB:
I cannot open the sketch on my PC either, the file seems to be corrupt.
Yes, the file has 3617 leading 0x00's.
This is it:
#include <TimerOne.h>
//Define 74HC595 Connections with arduino
/*const int Data=A2;
const int Clock=A0;
const int Latch=A1;*/
#define Data A2
#define Clock A0
#define Latch A1
const int SEG0 = 4;
const int SEG1 = 5;
const int SEG2 = 6;
int cc = 0;
char Value[3];
//Refer Table 4.1 7-Segment Decoding
const char SegData[] = {0x3F, 0x06, 0x5B, 0x4F, 0x66, 0x6D, 0x7D, 0x07, 0x7F, 0x6F};
//=============================================================
// Setup
//=============================================================
void setup() {
// initialize the digital pin as an output.
//Serial.begin(9600);
pinMode(Data, OUTPUT);
pinMode(Clock, OUTPUT);
pinMode(Latch, OUTPUT);
pinMode(SEG0, OUTPUT);
pinMode(SEG1, OUTPUT);
pinMode(SEG2, OUTPUT);
//Initialize Display Scanner
cc = 0;
Timer1.initialize(4000); // set a timer of length 100000 microseconds (or 0.1 sec - or 10Hz => the led will blink 5 times, 5 cycles of on-and-off, per second)
Timer1.attachInterrupt( timerIsr ); // attach the service routine here
}
//=============================================================
// Loop
//=============================================================
int Voltage = 123;
void loop() {
char Volt[5];
//Display Voltage on Segments
sprintf(Volt, "%03d", Voltage); //We get ASCII array in Volt
//Serial.println(Volt);
Value[0] = Volt[0] & 0x0F; //Anding with 0x0F to remove upper nibble
Value[1] = Volt[1] & 0x0F; //Ex. number 2 in ASCII is 0x32 we want only 2
Value[2] = Volt[2] & 0x0F;
}
//=============================================================
// Generates Bargraph
//=============================================================
void DisplayDigit(char d)
{
int i;
for (i = 0; i < 8; i++) //Shift bit by bit data in shift register
{
if ((d & 0x80) == 0x80)
{
digitalWrite(Data, HIGH);
}
else
{
digitalWrite(Data, LOW);
}
d = d << 1;
//Give Clock pulse
digitalWrite(Clock, LOW);
digitalWrite(Clock, HIGH);
}
//Latch the data
digitalWrite(Latch, LOW);
digitalWrite(Latch, HIGH);
}
//===================================================================
// TIMER 1 OVERFLOW INTTERRUPT FOR DISPALY
//===================================================================
void timerIsr()
{
cc++;
if (cc == 4) //We have only 4 digits
{
cc = 1;
}
Scanner();
TCNT0 = 0xCC;
}
//===================================================================
// SCAN DISPLAY FUNCTION
//===================================================================
void Scanner()
{
switch (cc) //Depending on which digit is selcted give output
{
case 1:
digitalWrite(SEG2, HIGH);
DisplayDigit(SegData[Value[0]]);
digitalWrite(SEG0, LOW);
break;
case 2:
digitalWrite(SEG0, HIGH);
DisplayDigit(SegData[Value[1]]); //0x80 to turn on decimal point
digitalWrite(SEG1, LOW);
break;
case 3:
digitalWrite(SEG1, HIGH);
DisplayDigit(SegData[Value[2]]);
digitalWrite(SEG2, LOW);
break;
}
}
//===================================================================
Jobi-Wan:
Yes, the file has 3617 leading 0x00's.This is it:
Yuk! But thanks for posting it. And I can't see code errors that would cause ghosting. The digits seem to be getting blanked before the data is shifted out. So I'm thinking it could be due to overloaded Arduino pins connected to the digit commons.
under of thanks everyone.
Problem solved
i dont know how. i replugged all wires into bread board.