Having Trouble With 7 Segment Display

Thread Starter

vsvinit0

Joined Dec 7, 2016
14
Hello everyone ,
Few days back i bought some 7 segment display and i was trying to interface it with my Raspberry Pi 3. Initially i was not able to lit a single LED on that 7 segment display. Later i found that i bought a 7 segment display which is having a common anode mode (CA) and now i don't now how to interface it with Pi to display all the digits from 0 to 9. I have searched the internet and i was not getting any proper solution, all i was getting results on common cathode mode (CA). I am quite lost while searching all these things and now i am totally blank.

Please provide me some resources on how to interface a common anode 7 segment display with Pi to display digits.
 

dannyf

Joined Sep 13, 2015
2,197
which is having a common anode mode (CA) and now i don't now how to interface it with Pi to display all the digits from 0 to 9.
for ca, tie the anode to power and output '0' to light up a segment.
for cc, tie the cathode to ground and output '1' to light up a segment.
 

hp1729

Joined Nov 23, 2015
2,304
Hello everyone ,
Few days back i bought some 7 segment display and i was trying to interface it with my Raspberry Pi 3. Initially i was not able to lit a single LED on that 7 segment display. Later i found that i bought a 7 segment display which is having a common anode mode (CA) and now i don't now how to interface it with Pi to display all the digits from 0 to 9. I have searched the internet and i was not getting any proper solution, all i was getting results on common cathode mode (CA). I am quite lost while searching all these things and now i am totally blank.

Please provide me some resources on how to interface a common anode 7 segment display with Pi to display digits.
Do you have a part number or data sheet for the display you have?
 

ScottWang

Joined Aug 23, 2012
7,409
Common Cathode mode is using npn to drive the 7-segs led display.
Common Anode mode is using pnp to drive the 7-segs led display.

Please check the page 7(CD4553 datsheet) to see the Common Anode mode 7-segs led display pnp driver.

Common Anode mode 7-segs led display pnp driver for pic16F628A.
 

Thread Starter

vsvinit0

Joined Dec 7, 2016
14
If you have a circuit that works for CC displays, you just invert the logic to use CA.
Thank you for your reply #dl324 ... I have tried the circuit of CC display but its not glowing in CA i don't know what i am doing wrong. If you don't mind will you elaborate a bit more so that i can grasp some knowledge regarding these 7 segment display.

This is the python script for CC display in which i am glowing all the LED but i am confused to implement it on CA display.

Code:
import RPi.GPIO as GPIO

GPIO.setmode(GPIO.BOARD)

GPIO.setup(33, GPIO.OUT)    # PIN-a
GPIO.setup(31, GPIO.OUT)    # PIN-b
GPIO.setup(36, GPIO.OUT)    # PIN-c
GPIO.setup(38, GPIO.OUT)    # PIN-d
GPIO.setup(40, GPIO.OUT)    # PIN-e
GPIO.setup(35, GPIO.OUT)    # PIN-f
GPIO.setup(37, GPIO.OUT)    # PIN-g
GPIO.setup(32, GPIO.OUT)    # PIN-h

GPIO_Output(33, GPIO.HIGH)
GPIO_Output(31, GPIO.HIGH)
GPIO_Output(36, GPIO.HIGH)
GPIO_Output(38, GPIO.HIGH)
GPIO_Output(40, GPIO.HIGH)
GPIO_Output(35, GPIO.HIGH)
GPIO_Output(37, GPIO.HIGH)
GPIO_Output(32, GPIO.HIGH)
Till now i just know that in CA display all the anode a connected together and all the cathode are left out. With these knowledge i can just glow a single LED in CA display but don't know how to glow and control the LED to display digits from 0 to 9. As a beginner i don't know much about electronics so i guess i don't know how to invert the CC display circuit to CA display.


Moderators Note:
Please using code and /code to quote the program as:


"["+"code"+"]"
program ...
...
"["+"/code"+"]"

 
Last edited:

Thread Starter

vsvinit0

Joined Dec 7, 2016
14
for ca, tie the anode to power and output '0' to light up a segment.
for cc, tie the cathode to ground and output '1' to light up a segment.
Thank you for your reply #dannyf .... I have tried this method to glow a single LED on 7 segment display having CA mode but i am not able to design a circuit through which i can glow a series of digits from 0 to 9. I would like to get some detail description on this so that i can design a circuit as well as write a python script to generate a series of digits.
 

Thread Starter

vsvinit0

Joined Dec 7, 2016
14
Do you have a part number or data sheet for the display you have?

Thanks #hp1729 for your reply. I don't have any datasheet for my 7 segment display. I just got some digits written on it (* 5501 GLOW). I searched this number on internet but i am not getting any proper results.
 

Attachments

Thread Starter

vsvinit0

Joined Dec 7, 2016
14
Common Cathode mode is using npn to drive the 7-segs led display.
Common Anode mode is using pnp to drive the 7-segs led display.

Please check the page 7(CD4553 datsheet) to see the Common Anode mode 7-segs led display pnp driver.

Common Anode mode 7-segs led display pnp driver for pic16F628A.

Thanks #ScottWang for your reply will go through the datasheet and i have a single 7 segment display. I am quite a beginner but will try to grasp as much as i can from the links which u share.
 

dl324

Joined Mar 30, 2015
16,943
This is the python script for CC display in which i am glowing all the LED but i am confused to implement it on CA display.
How do you have the display connected? Are you trying to drive the segments directly? If so, how much current will the GPIO's sink or source?

In your code you show all of the GPIO's HIGH. How do you have the anode connected?
 

Thread Starter

vsvinit0

Joined Dec 7, 2016
14
How do you have the display connected? Are you trying to drive the segments directly? If so, how much current will the GPIO's sink or source?

In your code you show all of the GPIO's HIGH. How do you have the anode connected?
This is the reference code i used to drive a CC mode display. I am just trying to lit all the LED. But i am having some trouble with CA mode display.

Yes i am directly connecting CA display to GPIO, and may be its around 3.3 volt current supply.

Listen let me give you a idea on what exactly i am doing as i am quite beginner and this may sound stupid. First i took a breadboard and connected a CA display than i connected its ground(GND) pin with GPIO 33 which is i guess supplying 3.3 volts and than i took a 330 ohm resistor and connected it with the pin 'a' of 7 segment display having CA mode and than i connected this pin with GPIO 39 which is ground.

Than i executed my python script in which i am blinking the LED 'a' on 7 segment for 10 times but it's only blinking for one time.

Here's my code

Code:
import time
import RPi.GPIO as GPIO

GPIO.setmode(GPIO.BORAD)

GPIO.setup(33, GPIO.OUT)

for i in range(10):
    GPIO_output(33, GPIO.HIGH)
    time.sleep(0.15)
    GPIO_output(33, GPIO.LOW)
 

Attachments

Last edited:

dannyf

Joined Sep 13, 2015
2,197
First i took a breadboard and
impossible for me to follow that - you have a great talent in saying a lot without saying anything, :)

connect the anode to 3.3v, and cathods to your pins through resistors.

change your code to:

Code:
for i in range(10):
GPIo_Output(33, GPIO.HIGH)
time.sleep(0.15)
GPIo_Output(33, GPIO.LOW)
time.sleep(0.15)
 

MrChips

Joined Oct 2, 2009
30,821
What the moderator meant by code tags

"["+"code"+"]"

and

"["+"/code"+"]"

is

[code] and [/code]

How did I do this without the browser switching to code display?
Ah-ha, use "plain" tags to surround the "code" tags.
 

Thread Starter

vsvinit0

Joined Dec 7, 2016
14
impossible for me to follow that - you have a great talent in saying a lot without saying anything, :)

connect the anode to 3.3v, and cathods to your pins through resistors.

change your code to:

Code:
for i in range(10):
GPIo_Output(33, GPIO.HIGH)
time.sleep(0.15)
GPIo_Output(33, GPIO.LOW)
time.sleep(0.15)
#dannyf - Ya you are right i am bit passive in English, So u can guess my condition :) .... Ok i got this code but how i can generate a series of digits from 0 to 9 on CA display can u provide me the circuit diagram with sample code so that i can experiment with it.
 

dannyf

Joined Sep 13, 2015
2,197
simple:

1) do you know how to turn on and off a segment?
2) do you know what segments to turn on / off to show '0'?
3) do you know what segments to turn on / off to show '1'?
...

write subroutines to do each of them all and then go from there.

can u provide me the circuit diagram with sample code
definitely not from me. anyone providing you with such code pieces isn't helping you at all.
 

hp1729

Joined Nov 23, 2015
2,304
Thanks #hp1729 for your reply. I don't have any datasheet for my 7 segment display. I just got some digits written on it (* 5501 GLOW). I searched this number on internet but i am not getting any proper results.
HDSP5501 maybe
The middle pin on the top and bottom are the common anode. Connect the anodes to VCC and a resistor to ground on the other pins. 200 ohms or so. Figure "A" on the data sheet.
 

Attachments

Last edited:
Top