Go Down

Topic: Having trouble controlling 3 Row Seven Segment with 4 shift register 74hc595 (Read 1 time) previous topic - next topic

PaulRB

Put that delay(1000) back into updateShiftRegister(). Check that each column lights in turn, on all 3 rows. Then reduce to delay(500), then delay(250), delay(125), delay(63) and so on. At what point does the display to crazy like in your last video?

zifank

yes i change, length of digit is 6 digit/rows,
and i change to this value too:

Code: [Select]
byte displayBuffer[3][6] =    //digit to display in each position
{
  {1, 1, 1, 1, 1, 1},
  {2, 2, 2, 2, 2, 2},
  {3, 3, 3, 3, 3, 3},
};

PaulRB

I said, in a much easier post, that I think there are components missing from your board. I am beginning to think that might be part of the problem. Very close to each shift register chip, there are two holes. Can you solder 0.1uF ceramic capacitors there?

zifank

Put that delay(1000) back into updateShiftRegister(). Check that each column lights in turn, on all 3 rows. Then reduce to delay(500), then delay(250), delay(125), delay(63) and so on. At what point does the display to crazy like in your last video?
What this case is called the flicker/ghosting/dimming?

oke. i'll try your advise to add delay for each column

PaulRB

yes i change, length of digit is 6 digit/rows,
The length of the array is 6 but the indexes are 0 to 5. So 6 is not a valid index.

zifank


I said, in a much easier post, that I think there are components missing from your board. I am beginning to think that might be part of the problem. Very close to each shift register chip, there are two holes. Can you solder 0.1uF ceramic capacitors there?
oke, i'll do that

zifank

hi PaulRB, All Problem Solved. flicker solved by change a power+Gnd to 5V from Arduino power pin  :)

result pic:


and the working code is from you.

Code: [Select]

int latchPin = 4;
int clockPin = 3;
int dataPin = 2;

const byte digit[11] =      //seven segment digits in bits
{
  B10000001,  // 0  129 0x81
  B11110011,  // 1  243 0xF3
  B01001001,  // 2   73 0x49
  B01100001,  // 3  97 0x61
  B00110011,  // 4  51 0x33
  B00100101,  // 5  37 0x25
  B00000101,  // 6  5 0x5
  B11110001,  // 7  241 0xF1
  B00000001,  // 8  1 0x1
  B00100001,  // 9  33 0x21
  B11111111,  // BLANK
};

byte displayBuffer[3][6] =    //digit to display in each position
{
  {2, 2, 2, 2, 2, 2},
  {0, 0, 6, 7, 8, 9},
  {0, 1, 2, 3, 4, 5},
};

void setup()
{
  Serial.begin(9600);
  pinMode(latchPin, OUTPUT);
  pinMode(dataPin, OUTPUT);
  pinMode(clockPin, OUTPUT);
}

void loop()
{
  updateShiftRegister();
}
static unsigned long lastUpdateTime; // time from millis() when the dispaly was last updated
static byte column; // the column currently being lit

void updateShiftRegister()
{
  if (millis() - lastUpdateTime > 0)
  {

    digitalWrite(latchPin, LOW);
    shiftOut(dataPin, clockPin, MSBFIRST, 1 << (column));
    for (byte row = 0; row < 3; row++)
    {
      byte d = displayBuffer[row][column];
      shiftOut(dataPin, clockPin, MSBFIRST, digit[d]);
    }
    digitalWrite(latchPin, HIGH);
    column++;
    if (column > 5) column = 0;
    lastUpdateTime = millis();
  }
}


thanks for God and you PaulRB...

PaulRB


Great news.

So what power supply was it using when the flickering was happening?

zifank

i used this paul, the site tell the 9V 1A Power Adapter for Arduino (2-Flat-Pin Plug / 100CM Cable)




PaulRB

Was that powering the display directly when it was flickering? The display does not seem to have its own voltage regulator. 9V could have fried it. Or did you power the Arduino with that PSU and then power the display from the 5V pin on the Arduino? The Arduino's regulator may have been overloaded.

And you are powering the Arduino and display from USB power now?

zifank

Was that powering the display directly when it was flickering? The display does not seem to have its own voltage regulator. 9V could have fried it. Or did you power the Arduino with that PSU and then power the display from the 5V pin on the Arduino? The Arduino's regulator may have been overloaded.

And you are powering the Arduino and display from USB power now?
yes, the display flickering when connect to Adapter 9V. now, i don't use that adapter. Arduino only use USB cable power from my USB Laptop.

PaulRB

yes, the display flickering when connect to Adapter 9V.
Yes, you must use a regulated 5V supply with the display. I think you were very lucky that the display was not permanently damaged by connecting it to a 9V supply. 9V exceeds the safe limit for the chips and leds on the display.

zifank

Ok PaulRB. thanks for everything..

but I've one problem again, i've a one Water Flow sensor connect to Arduino with pin 11, the sensor result is work perfectly on arduino uno or mega.
but when i try to upload with USBasp to Atmega32 in pin PD3. the sensor can't show the flow sensor result.
how to solved this? this problem stuck from two month ago.  :smiley-confuse:

(maybe, i must change/move this post to sensor category post)

Go Up