grptx
Posts: 15
Joined: Sat Jun 17, 2017 10:37 am

4 digits 7 segments

Sun Jul 16, 2017 11:39 am

Hi all,
i'm a total beginner so please be patient with me.

i'm trying to display 4 digits on a 4*7 segments display using a ranspberry pi 3 using as example this tutorial
https://www.hackster.io/davek17/rpi-7-s ... 1ic-8972f5

but I have a strange behavior when a i switch between the digits. i made this video to explain my issue:
https://www.youtube.com/watch?v=cYtT2Qamb54

here my code:

Code: Select all

void *displayDigits (void *dummy)
{
  uint8_t digit ,i;
  uint8_t index, d ;
  int delay = 150000;
  for (;;)
  {
    for (digit = 0 ; digit < 4 ; ++digit)
    {
      d = toupper (digits [digit]) ;
      index = d - '0' ;
      for(i=0;i<4;i++){
        digitalWrite (segments_ar[i], bcdD [index * 4+(3-i)]) ;
      }

      digitalWrite (digits_arr[digit], 1);
      delayMicroseconds (delay);

      digitalWrite (digits_arr[digit], 0);
      if(delay>10000) {
        delay-=500;
        printf("delay :%d\n",delay);
      }

    }
  }
}
In practice reducing the delay time until all 4 digits are displayed some of unexpected happens

here the components i using

C library: http://wiringpi.com/reference/
BCD : http://www.datasheetcatalog.com/datashe ... 11BC.shtml
transistors: https://www.onsemi.com/pub/Collateral/BC337-D.PDF
7 segments display: http://www.peterparts.com/CatalogPages/57/1023.pdf

p.s. sorry my bad English

rzusman
Posts: 301
Joined: Fri Jan 01, 2016 10:27 pm

Re: 4 digits 7 segments

Mon Jul 17, 2017 4:22 am

You need to scope the outputs to determine exactly what is happening, but I’d bet that the rise or fall times of your outputs are too slow, and so multiple transistors are being turned on.

Posting your schematic would help.

grptx
Posts: 15
Joined: Sat Jun 17, 2017 10:37 am

Re: 4 digits 7 segments

Mon Jul 17, 2017 6:36 pm

here my schematic: http://www.enslavedcoder.org/sketch.jpg

about the timing I gradually decreased the delay in my code to find the optimal value

Code: Select all

digitalWrite (digits_arr[digit], 1);
      delayMicroseconds (delay);

      digitalWrite (digits_arr[digit], 0);
      if(delay>10000) {
        delay-=500;
        printf("delay :%d\n",delay);
      }
I thought the correct value was about 16000 µs (60hz) but with this delay the digits are still overlapping and flickering

the problem can be the values of resistors on the base of transistors? (i using 1k now)

drgeoff
Posts: 7404
Joined: Wed Jan 25, 2012 6:39 pm

Re: 4 digits 7 segments

Mon Jul 17, 2017 6:52 pm

Try 220 ohm base resistors as in the tutorial.

grptx
Posts: 15
Joined: Sat Jun 17, 2017 10:37 am

Re: 4 digits 7 segments

Mon Jul 17, 2017 7:15 pm

I use 220 ohm between the bcd 4511 and the display and 1k ohm between the raspberry and the transistor .. as in the tutorial :cry:

User avatar
DougieLawson
Posts: 30171
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website

Re: 4 digits 7 segments

Mon Jul 17, 2017 11:15 pm

Microprocessor, Raspberry Pi & Arduino Hacker
Mainframe database troubleshooter
MQTT Evangelist
Twitter: @DougieLawson

Since 2012: 1B*5, 2B*2, B+, A+, Zero*2, 3B*3

Please post ALL technical questions on the forum. Do not send private messages.

grptx
Posts: 15
Joined: Sat Jun 17, 2017 10:37 am

Re: 4 digits 7 segments

Tue Jul 18, 2017 9:10 am

i have already did this project, but now i wish to use the bcd to reduce the GPIO lines

grptx
Posts: 15
Joined: Sat Jun 17, 2017 10:37 am

Re: 4 digits 7 segments

Sun Jul 23, 2017 2:07 pm

I solved by connecting the 4511 IC LE pin to ground :?

Return to “Beginners”

Who is online

Users browsing this forum: HawaiianPi and 22 guests