Shop OBEX P1 Docs P2 Docs Learn Events
Controlling a 4 digit 7-segment Display — Parallax Forums

Controlling a 4 digit 7-segment Display

I working with a 4 digit 7-segment display and a BASIC Stamp HomeWork Board... Using only the Vss and Vdd and a larger breadboard, I've figured out the basic pin configuration.

In my case, pins 12, 9, 8 and 6 of the display need to be connected to each digit of the display to Vdd. Then the other pins connect each segment to Vss. For the breadboard operation, I only need (1) 1K resistor.


My question now, is how to control it with the BASIC Stamp?

Do I need to connect each pin of the display to an I/O of the BASIC Stamp right? (the 4 individual "select" pins, along with each segment)

What about resistors? One for each of the segments right?

What about the pins connecting Vdd to the display? Is a resistor needed here too?



I don't want to blow up my BASIC Stamp, so I'm asking these questions before I connect it.


Thanks,

Randy
«13

Comments

  • First off, is this a Common Anode or Common Cathode Display?
  • Common Cathode
  • Hal AlbachHal Albach Posts: 747
    edited 2015-09-07 22:52
    On your 4 digit 7 segment module, is there a separate pin for each of the 28 segments or are all like segments tied together? In other words, 4 pins for the digits and 7 or 28 pins for the segments? How much current does each segment draw? The BS2 on the Homework board can only source/sink 20mA/25mA per io pin and is further limited to 40mA/50mA per 8 pins.
  • Mike GreenMike Green Posts: 23,101
    edited 2015-09-08 03:07
    There are all sorts of examples for hooking up this sort of display. I believe there are some in the Nuts and Volts Stamp archive. Go to the main Parallax webpage and search for "Nuts and Volts". Essentially you'll need 4 digit drivers (PNP switching transistors like the 2N3906) connected with collectors to pins 12, 9, 8, 6, emitters to Vdd, and bases to 4 Stamp I/O pins through 1K resistors which provide about 5mA of drive. When you set these I/O pins to output low, that'll turn on the corresponding digit, usually one at a time. You can use a ULN2003A Darlington array for segment drivers with the ULN2003A inputs connected to another 7 I/O pins and the outputs connected through 330 Ohm resistors to the LED segment pins.

    As Hal mentioned, the Stamp's I/O pins have maximum current draws. If you limit the segment current to maybe 5mA, you could connect the 7 segments (maybe plus a decimal point) directly to one group of 8 I/O pins. You'd need 1K resistors for each segment. You'll probably still need the digit drivers since 7 x 5mA = 35mA, well in excess of what a single I/O pin can handle.

    Some LEDs are quite small and bright even at low currents. You're multiplexing these though and the brightness has to be greater since each digit is only on at most 1/4 of the time.

    You're using a HomeWork Board which already has 220 Ohm (?) series resistors on all I/O pins. You have to figure that into the total resistance you want.
  • RTrotter15 said in two separate posts:
    "In my case, pins 12, 9, 8 and 6 of the display need to be connected to each digit of the display to Vdd. Then the other pins connect each segment to Vss. "
    "Common Cathode "

    These two statements by the OP seem to be at odds. Common cathodes should be connected, through a switching transistor, to Vss, or ground, and the segments to Vdd, or positive voltage. The OP should positively determine if his display is common cathode or common anode, then we can provide more specific ideas on how to use the BS2 to control the display. Personally, I tend to shy away from using Vxx when describing voltage levels, I prefer the simplistic terms "positive voltage" and "ground", they are less confusing.
  • First, Thanks for the great replies...this is going to be a great learning experience!!!
    Hal Albach wrote: »
    In other words, 4 pins for the digits and 7 or 28 pins for the segments?

    Hal, my display has 12 pins, 4 for the digits and 8 for the segments (and DP)
    Mike Green wrote: »
    There are all sorts of examples for hooking up this sort of display. I believe there are some in the Nuts and Volts Stamp archive. Go to the main Parallax webpage and search for "Nuts and Volts".

    Mike, I'll do some searching. Thanks giving me the basics. It's a good starting point.
    Hal Albach wrote: »
    These two statements by the OP seem to be at odds. Common cathodes should be connected, through a switching transistor, to Vss, or ground, and the segments to Vdd, or positive voltage. The OP should positively determine if his display is common cathode or common anode, then we can provide more specific ideas on how to use the BS2 to control the display. Personally, I tend to shy away from using Vxx when describing voltage levels, I prefer the simplistic terms "positive voltage" and "ground", they are less confusing.

    Hal. LOL, this is why I'm posting this question here... to straighten out these issues.... In my "testing" I was able to get all of the segments to come on. For example, I connected all of the "digit" pins (12, 9, 8 and 6) to a 1K resistor and then to the Vdd output of the BASIC Stamp, then I connected pin 7 (the "A") to the Vss output of the BASIC Stamp. All four "A" segments came on. Right or wrong, it worked. (No I/O pins were connected.

    Since I got this display from a non-big named website, I don't have much technical specifications.

    Randy

  • What you have is a common anode display. The LED anodes (that connect to the positive voltage to turn on) for each digit are connected in common to make the digit line.
  • Mike Green wrote: »
    What you have is a common anode display. The LED anodes (that connect to the positive voltage to turn on) for each digit are connected in common to make the digit line.


    LOL, not that I specially ordered a Common Cathode display... but that is what the package was labeled.

    With the lack of tech specs and a Common Anode display, should I order another one?

    Randy
  • Common anode displays are easy to use. Just refer back to Mike Green's first post on how to hook it up. You will definitely need the PNP transistors to drive the common anodes, that is just too much current for the Stamp io pins to handle. The Stamp should be able to handle the segments since only one led will be driven by each segment pin at a time, just have the stamp output a logic 0 for the segments.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    I prefer common-anode displays for the larger ones since the high-current drivers typically sink the outputs. An examples is the ULN2803.
  • Try using a MC14489 . A good example can be viewed on prototyping a digital tachometer using
    Parallax micro controller on floridaame.org by Kamran Nili. I added code to use 5 digits




  • I finally found a small note on the website I ordered this display... It says "Easy to use with MAX7219CNG display driver".

    I plan to make a few purchases on my next paycheck. It appears that I can get (1) of all of the suggested componets from "Digi-Key". I think I'll get each... to build up of "supply".


    Randy
  • The MAX7219CNG display driver is for COMMON CATHODE displays. To use this driver on a Common Anode display will require all outputs to be inverted and current control to be managed by you.
  • Hal Albach wrote: »
    The MAX7219CNG display driver is for COMMON CATHODE displays. To use this driver on a Common Anode display will require all outputs to be inverted and current control to be managed by you.

    LOL, wow... so much for the "support" from this website (I'll be nice and not "bad mouth this company").

    I think I'm going to be purchasing another 4 digit 7-segment display... maybe a "dual" 4 digit 7-segment display.

    Thanks for all the great replies

    Randy

  • Just a suggestion...
    Go to Amazon.com, search on 7 segment display, and stand back! Find the stuff you want that offers Prime, order it, sign up for Prime 30-day trial, and get the stuff shipped for free in 2 days. Just remember to cancel your Prime before 30 days or they will charge you $99. Besides the obvious upside, if what they send you isn't correct they will take it back with no hassle.
  • Hal Albach wrote: »
    Just a suggestion...
    Go to Amazon.com, search on 7 segment display, and stand back! Find the stuff you want that offers Prime, order it, sign up for Prime 30-day trial, and get the stuff shipped for free in 2 days. Just remember to cancel your Prime before 30 days or they will charge you $99. Besides the obvious upside, if what they send you isn't correct they will take it back with no hassle.


    I have Amazon Prime.. I didnt think about it... LOL, the disadvantage is that my finacee see's what I spend on Amazon. Well decide if its "worth".... shhhhhh guys. Secret!!!! LMAO

    Randy
  • And Ebay isnt a secret too
  • If you go with the eBay device I can vouch for it working.
    1281 x 720 - 150K
  • JonnyMac wrote: »
    If you go with the eBay device I can vouch for it working.

    Jonny, is this a kit?

  • So Gentlemen... I've made an order Digi-Key...

    I got
    (2) 4 digit 7-segment displays (Common Anode)
    a few 2N3906
    a few ULN2003A
    a few ULN2803

    And some additional breadboarding items.

    Randy
  • PublisonPublison Posts: 12,366
    edited 2015-09-10 16:45
    I would have used the MAX7219 driver chip that Hal pointed out. Drives 7-segment displays with 3-pins using SHIFTOUT.

    And the ebay item Tom pointed out and Jon blessed, uses the same chip.

    http://www.ebay.com/itm/5V-MAX7219-8-Digit-Red-LED-Display-Module-7-Segment-Digital-Tube-For-Arduino-MCU-/281251260576?hash=item417be1a8a0

    Not a kit, and is probably cheaper than what you spent for parts.

  • RTrotter15RTrotter15 Posts: 35
    edited 2015-09-10 17:44
    Publison wrote: »
    I would have used the MAX7219 driver chip that Hal pointed out. Drives 7-segment displays with 3-pins using SHIFTOUT.

    And the ebay item Tom pointed out and Jon blessed, uses the same chip.

    http://www.ebay.com/itm/5V-MAX7219-8-Digit-Red-LED-Display-Module-7-Segment-Digital-Tube-For-Arduino-MCU-/281251260576?hash=item417be1a8a0

    Well, it's not the cheapest option... But I've now purchased both the MAX7219 driver chip and the 8 digit display previously recommended. The display is coming from hong kong so I don't except it for a while.

    LOL, I've not blown my "play money" for the next 2 weeks,


    Randy
  • To learn how to use the MAX7219, be sure and study:

    1. The data sheet
    2. this thread: http://forums.parallax.com/discussion/160443/basic-stamp-bs2p-and-the-max7219-display-driver

    and remember, kids, "dig" is your friend. (page 117 of the Basic manual)
  • Well guys... I just received a package with (2) MAX7219's. Now I need to really study the specs. After reading a little bit of the above forum discussion (By G McMurry) I think I'm planning to build a separate power supply.

    Question. Is this the best forum, or is there another (better) forum to ask questions about designing a circuit for the MAX7219/7-segment combo? General electronic questions? Like I see that the 7219 has both digit and segment pins. Do I leave the digit pins un-hooked? Or do I need to tie them to a high or a low?

    Randy
  • tomcrawfordtomcrawford Posts: 1,126
    edited 2015-09-15 21:17
    1. Unless you have a whole lot of large LEDs, a 5V, 1/2 amp wall wart will work just fine. Don't get distracted trying to design a power supply just yet. Focus on the MAX7219.
    2. The best place to learn about designing with the MAX7219 is the MAX7219 data sheet. Download it and print it out. Double-sided it is only eight pieces of paper. Start at the beginning and go on until you come to the end. Pay particular attention to the tables. They will speak to you about how to program it.
    3. Study Typical Application Circuit on page one and the Pin Description Table on Page 5.
    4. Segment Pins connected to the segment pins. See Table 6 on page 8.
    5. Digit Pins connected to the digit pins. Eight is on the left, one is on the right.
    6. Become as one with shiftout.
    7. Draw a schematic of how you intend to connect everything and post and post it here. Someone is sure to comment.
    8. And remember, kids: DIG is your friend.
  • Data Sheet and a couple of forum discussions have been printed.... and studying has begun.

    Tom, when you say "Basic Manual", is this what you're referring to?

    https://www.parallax.com/product/27218

  • tomcrawfordtomcrawford Posts: 1,126
    edited 2015-09-16 20:36
    RTrotter15 wrote: »
    Tom, when you say "Basic Manual", is this what you're referring to?

    https://www.parallax.com/product/27218

    Yes. That is an absolute necessity for programming Basic Stamp.

    BTW, I'm assuming that you have one or another of the Board of Education boards. The 5V regulator on any of those should provide plenty of +5, especially if you're using a 7.5V wall wart. No need for any separate power supply for small leds and MAX7219.

    Above all, have fun.
  • Just finished printing the Basic Manual (lol, my printer was giving me a hard time printing double sided pages, But I wasn't going to have 500 separate pages!!!)

    I have the "HomeWork Board". I'm using longer jumper wires to connect other bigger breadboards. Right now I only have power coming from the Homework board, (powered by only 9V battery) so I've ordered a 5V breadboard power supply (it attaches directly into the end of a breadboard, feeding all of the bus strips)

    After I do some of my "honey do" list (I'm medically retired) I'll start working on drawing a schematic.

    What file formats does this forum allow for attachments? Jpeg?

  • PublisonPublison Posts: 12,366
    edited 2015-09-17 16:36
    Out of the box the following file types are accepted: txt, jpg, jpeg, gif, png, bmp, tiff, ico, zip, gz, tar.gz, tgz, psd, ai, fla, swf, pdf, doc, xls, ppt, docx, xlsx, log, rar, 7z.
    The maximum file size users will be able to upload is 50 mb.
Sign In or Register to comment.