Go Down

Topic: 4 Digit 7 Segment Serial LED Module - TM74HC595 (Read 39426 times) previous topic - next topic

nickgammon

Quote
Red lead was plugged into middle socket and connected to Uno 3.3V.
Black lead was plugged into COM and connected to the LED Module VCC.
Setting used was 2000 uA and reading was "- 001".
You may have blown the meter's fuse. It says it is fused for 200 mA. It is possible that trying to measure a whole lot of LEDs, without current limiting, would exceed 200 mA.

Try setting up a test case. For example, get a 1k resistor, and put it in series with the meter, between 5V and ground.

ie.

Code: [Select]

5V pin ---> 1k resistor ---> meter mA + -----> meter Common ---> Ground


Now you should get 5 mA.

Code: [Select]

I = V / R
I = 5 / 1000
I = 0.005 A


If it doesn't read 5 mA then there is something wrong with the meter. Open it and see if you can check the fuse. (You might need a meter to check it - the other ranges should be OK, so you could pull the fuse out, and try measuring the fuse with the Ohms part of the meter).

A fairly standard approach, if you don't know the current, is to measure on the 10A range first (use the other socket) and see if that reads more than 200 mA or not.
Please post technical questions on the forum, not by personal message. Thanks!

More info: http://www.gammon.com.au/electronics

aisc

#31
Apr 20, 2015, 07:59 am Last Edit: Apr 20, 2015, 08:17 am by aisc
@Nick Gammon : On the suggested test, I do get 5 mA.
Since I was using a breadboard power supply, I switched from 5V to 3.3V (changed jumper) and I get 3.2/3.3 mA.

So I went back to measuring the LED Module ("- - - -") on the 200mA setting.
At 5V I get 27.2 mA.
At 3.3V (only swapping wire from 5V to 3.3V on Uno) I get 0.00 with a flashing minus sign.

Using a second "Voltcraft" DMM on 200mA setting, I get exactly the same readings i.e. 27.2 mA at 5V and 0.00 with flashing minus at 3.3V.

Hmmm... I am scratching my head here.

Curiosity got the better of the cat....
Using a 10k resistor I tested at 5V and 3.3V on 2000uA, 20mA and 200ma.
At 5V I get 500uA/0.50mA/00.5mA
At 3.3V I get 325uA/0.33mA/00.3mA

So seems the meter is fine, must be something about running the module at 3.3V....

nickgammon

Quote
So it seems my meter has issues at 3.3V.
This doesn't really make sense because you don't measure current "at 3.3V". You just measure current.

I can't quite picture your setup here.

Quote
Since I was using a breadboard power supply, I switched from 5V to 3.3V (changed jumper) and I get 3.2/3.3 mA.
Are you powering your LEDs with 3.3V, but putting the Uno output pins onto the 595 shift register? Can you sketch what you are doing?
Please post technical questions on the forum, not by personal message. Thanks!

More info: http://www.gammon.com.au/electronics

aisc

#33
Apr 20, 2015, 09:05 am Last Edit: Apr 20, 2015, 09:07 am by aisc
@Nick Gammon

I think u are confusing the 2 test setups.

1. LED Module current measuring :
For the LED current measuring setup see my earlier post with pictures of the setup and a detailed description of the connections. Posts #25 and 27.

2. Meter check:
For the meter check test (per your suggested setup), instead of using the Uno as a source of supply, I used a breadboard power supply. See my previous post (including updates) - the meter checks out fine. Pic attached for your convenience. Ignore other stuff on breadboard. Not on same power rail.

Issue is not with my meter.
From what I can determine, there is an issue measuring the current draw of the LED module when the module is powered with 3.3V. When powered at 5V, I am able to measure the current.

Quote from: Nick

Gammon link=msg=2195164 date=1429511896
This doesn't really make sense because you don't measure current "at 3.3V". You just measure current.

I can't quite picture your setup here.

Are you powering your LEDs with 3.3V, but putting the Uno output pins onto the 595 shift register? Can you sketch what you are doing?
Sorry if my shorthand is confusing you - I initially measured the current draw with the LED module powered only at 3.3V. I have since measured the current draw with the LED module powered at 5V.

At 5V I get current reading of 27.2mA at 3.3V I cannot get a reading.
N.B. Voltage refers to the level at which the LED module is powered.

nickgammon

Can you draw a schematic? This module has a couple of 595s, right? They won't draw much power until commanded to do so. I don't know what it proves to measure the current into them, if the Arduino hasn't shifted stuff into them, for there to be something to display.
Please post technical questions on the forum, not by personal message. Thanks!

More info: http://www.gammon.com.au/electronics

aisc

Can you draw a schematic?
Will a verbal schematic do?
The module is plugged into a breadboard.
The module is powered at 3.3V from an Uno.
Uno pins 5, 6, 7 are connected to SCLK, RCLK and DIO on the module.
See pic in post #27.

Quote
This module has a couple of 595s, right?
Yes, see data sheet in Post #1.

Quote
They won't draw much power until commanded to do so. I don't know what it proves to measure the current into them, if the Arduino hasn't shifted stuff into them, for there to be something to display.
They are displaying something - the Uno is coded to display "- - - -" i.e. only light up one segment of each of the 4 digits.

nickgammon

Quote
Will a verbal schematic do?
No.

Do I post verbal schematics on my web site? I think not.
Please post technical questions on the forum, not by personal message. Thanks!

More info: http://www.gammon.com.au/electronics

nickgammon

Quote
The module is powered at 3.3V from an Uno.
Uno pins 5, 6, 7 are connected to SCLK, RCLK and DIO on the module.
So you are powering the module with 3.3V but sending it 5V logic signals, did I get that bit right?
Please post technical questions on the forum, not by personal message. Thanks!

More info: http://www.gammon.com.au/electronics

aisc

So you are powering the module with 3.3V but sending it 5V logic signals, did I get that bit right?
Aha! - yes you are right... and the unit does still light up.

Thinking about it..., I assume the LEDs must be powered from VCC given that I measured 27.2 mA drawn through VCC, when powered at 5V.

So when powered with 3.3V the LEDs should be running at 3.3V  - would that be right?

aarg

#39
Apr 20, 2015, 03:05 pm Last Edit: Apr 20, 2015, 03:06 pm by aarg
My guess is that the display module is powering itself through the input protection diodes in the 74HC595 since they are connected to the logic lines to the Arduino.  It's a higher voltage so it doesn't draw anything from the 3.3V. It sounds weird but I have seen this happen before on the job. Someone thought the power supply was bad on a unit, so they removed it to replace it. The unit continued to run, but badly! It turned out to be drawing power from the logic lines of another device. Try removing the 3.3V power and check the display while the power pin on the module is disconnected. It might be lit! :)

If it is the case, that in itself would be a good reason to power it on 5V, but also there are also logic level matching issues between the two voltages. So I advise you to leave the 3.3V supply out of it.
  ... with a transistor and a large sum of money to spend ...
Please don't PM me with technical questions. Post them in the forum.

aisc

Try removing the 3.3V power and check the display while the power pin on the module is disconnected. It might be lit! :)
Correct - it stayed lit.
Quote
If it is the case, that in itself would be a good reason to power it on 5V, but also there are also logic level matching issues between the two voltages. So I advise you to leave the 3.3V supply out of it.
Noted. I will run it on 5V.

Thanks for the help.
Could u please provide a link to the "sweet" units you described in your earlier post.


nickgammon

Exactly what I was getting at. You can't push 5V logic into a 3V system unless it is designed for it. If you must use 3.3V (although why, I wonder?) you need logic level shifters for the logic lines.
Please post technical questions on the forum, not by personal message. Thanks!

More info: http://www.gammon.com.au/electronics

aarg

Could u please provide a link to the "sweet" units you described in your earlier post.
There's more than one. So search for "TM1638 display" on Ebay and you get mostly the board I'm using, and some other interesting ones.
  ... with a transistor and a large sum of money to spend ...
Please don't PM me with technical questions. Post them in the forum.

aarg

@aisc, I have written an improved driver. Can you test it for me?
Code: [Select]

// controls 4 digit 7 segment display
// test version 1
// 2015-04-22 by aarg

const byte numDigits = 4;
byte testDigit[numDigits];

// control pin definitions:
int shiftClock = 5;
int latchClock = 6;
int DIO = 7;

void setup ()
{
  // configure outputs:
  pinMode(shiftClock, OUTPUT);
  pinMode(latchClock, OUTPUT);
  pinMode(DIO, OUTPUT);

  for (int i = 0; i < numDigits; i++)
    testDigit[i] = i;
}

void loop()
{
  displayUpdate(testDigit);
  //
  // any code in here that is non-blocking for more than the display
  // refresh interval should not
  // interfere with the display.
}

// non-blocking display update
//
// every time this routine is called, 16 bits are shifted into the display
// and latched.
// The first 8 bits is the segment data, and first 4 bits of the second byte are
// the segment select.

void displayUpdate(byte displayDigit[])
{
  unsigned long lastDisplayUpdate;
  const int scanRateHz = 60;
  const int displayScanPeriod = 1000000L / numDigits / 8 / scanRateHz;

  byte segmentList[] =
  { // 0123456789AbCdEF-
    0xC0, 0xF9, 0xA4, 0xB0, 0x99, 0x92, 0x82, 0xF8, 0x80, 0x90, 0x8C, 0xBF, 0xC6, 0xA1, 0x86, 0xFF, 0xbf
  };

  static byte digit = 0;
  static byte segment = 0x80;

  if (micros() - lastDisplayUpdate > displayScanPeriod)
  {

    // send segment data
    for (byte i = 8; i >= 1; i--)
    {
      if ( i & (~segment | segmentList[displayDigit[digit]]) != 0)
        digitalWrite(DIO, HIGH);
      else
        digitalWrite(DIO, LOW);
      bitClock();
    }

    // send digit select data
    for (byte i = 0; i < 8; i++)
    {
      if (i == digit)
        digitalWrite(DIO, HIGH);
      else
        digitalWrite(DIO, LOW);
      bitClock();
    }

    // data is now in the display shift register, so latch to LEDs
    //
    latchData();

    // increment variables to select the next segment and possibly the next digit:
    //
    segment = segment >> 1;
    if (segment == 0)
    {
      segment = 0x80;
      digit++;

      if (digit >= numDigits)
        digit = 0;
    }

    // reset timer for next update:
    lastDisplayUpdate = micros();
  }
  // else just return without doing anything
}

void bitClock()
{
  digitalWrite(shiftClock, LOW);
  digitalWrite(shiftClock, HIGH);
}

void latchData()
{
  digitalWrite(latchClock, LOW);
  digitalWrite(latchClock, HIGH);
}
  ... with a transistor and a large sum of money to spend ...
Please don't PM me with technical questions. Post them in the forum.

Blerk

Hi aarg, I have also this kind of display. I have uploaded you sketch, but the display stays empty (nothing on it).


@aisc, I have written an improved driver. Can you test it for me?
Code: [Select]

// controls 4 digit 7 segment display
// test version 1
// 2015-04-22 by aarg

const byte numDigits = 4;
byte testDigit[numDigits];

// control pin definitions:
int shiftClock = 5;
int latchClock = 6;
int DIO = 7;

void setup ()
{
  // configure outputs:
  pinMode(shiftClock, OUTPUT);
  pinMode(latchClock, OUTPUT);
  pinMode(DIO, OUTPUT);

  for (int i = 0; i < numDigits; i++)
    testDigit[i] = i;
}

void loop()
{
  displayUpdate(testDigit);
  //
  // any code in here that is non-blocking for more than the display
  // refresh interval should not
  // interfere with the display.
}

// non-blocking display update
//
// every time this routine is called, 16 bits are shifted into the display
// and latched.
// The first 8 bits is the segment data, and first 4 bits of the second byte are
// the segment select.

void displayUpdate(byte displayDigit[])
{
  unsigned long lastDisplayUpdate;
  const int scanRateHz = 60;
  const int displayScanPeriod = 1000000L / numDigits / 8 / scanRateHz;

  byte segmentList[] =
  { // 0123456789AbCdEF-
    0xC0, 0xF9, 0xA4, 0xB0, 0x99, 0x92, 0x82, 0xF8, 0x80, 0x90, 0x8C, 0xBF, 0xC6, 0xA1, 0x86, 0xFF, 0xbf
  };

  static byte digit = 0;
  static byte segment = 0x80;

  if (micros() - lastDisplayUpdate > displayScanPeriod)
  {

    // send segment data
    for (byte i = 8; i >= 1; i--)
    {
      if ( i & (~segment | segmentList[displayDigit[digit]]) != 0)
        digitalWrite(DIO, HIGH);
      else
        digitalWrite(DIO, LOW);
      bitClock();
    }

    // send digit select data
    for (byte i = 0; i < 8; i++)
    {
      if (i == digit)
        digitalWrite(DIO, HIGH);
      else
        digitalWrite(DIO, LOW);
      bitClock();
    }

    // data is now in the display shift register, so latch to LEDs
    //
    latchData();

    // increment variables to select the next segment and possibly the next digit:
    //
    segment = segment >> 1;
    if (segment == 0)
    {
      segment = 0x80;
      digit++;

      if (digit >= numDigits)
        digit = 0;
    }

    // reset timer for next update:
    lastDisplayUpdate = micros();
  }
  // else just return without doing anything
}

void bitClock()
{
  digitalWrite(shiftClock, LOW);
  digitalWrite(shiftClock, HIGH);
}

void latchData()
{
  digitalWrite(latchClock, LOW);
  digitalWrite(latchClock, HIGH);
}



Go Up