Need help powering a 7.5V 7 Segment LED with Arduino Mega

Hello, Arduino Forum!

I'm a bit new to Arduino, so hang in there with me, please.

Backstory (not required reading): I am working on a project for a FIRST Robotics club I mentor. The club has a sign, "This team has gone xx days without an accident!" But they only drew enough numbers to go up to 7. So every 7 days the count is reset.

What I'm Trying To Do: I'm trying to make two 7-Segment LEDs display numbers counting up with each press of a button.

My Problem: The LEDs require 7.5v and (clearly) the Arduino Mega only puts out 5V max. I did some research, and would like some advice regarding what I should do. Should I use an inductor to boost the power, or should I use transistors and an externam power source so power the LEDs? :~ Thank you in advance.

Reassurances: Yes, I did some searching and couldn't find a definitive solution to my problem.

Additional Information: If someone can give an explanation of the best answer in Layman's Terms, that'd be great. As I said, I'm new to Arduino and am not so familiar with the roles of everything and whatnot. Thanks!!!

-xian

First question is: Is the 7-segment display Common Anode or Common Cathode. Are the common terminals Positive (Anodes) or Negative (Cathodes).

From what I can tell, they are common anode. They're from some obscure Chinese vendor, bought off eBay (not by me). From what I can tell, they are these http://www.yxztdz.com/EnProductShow.asp?ID=206.
And based on this (http://www.engineersgarage.com/contribution/anjali/seven-segment-testing) I think it's common anode. From what I've seen I have the SM4123-1.

UPDATE

After doing a continuity test I found that pins 1 and 5 are common. Therefore I have the SM4123-1 7-Segment LED listed here (http://www.yxztdz.com/EnProductShow.asp?ID=206). So I'm pretty sure it's common anode.

Need a 7.5V wallwart and TPIC6B595 to sink current from the cathodes.
http://www.dipmicro.com/store/DCA-07510

Okay, what exactly does the TPIC6B595N do? Again, sorry I'm new to all this.

officialxian:
Backstory (not required reading): I am working on a project for a FIRST Robotics club I mentor. The club has a sign, "This team has gone xx days without an accident!" But they only drew enough numbers to go up to 7. So every 7 days the count is reset.

Why "reset" it?

You could get a pen and draw a '+' after the number 7 on the last one.

officialxian:
Okay, what exactly does the TPIC6B595N do? Again, sorry I'm new to all this.

Mentor of a robotics club who doesn't know how to use google...?

officialxian:
After doing a continuity test I found that pins 1 and 5 are common. so I'm pretty sure it's common anode.

Nope. There's four variants there, 1+5 common could also be common anode.

You need to get +5V and GND from your Arduino and find out which way the voltage goes between pin 1 and 7.

5V should be enough to light it up dimly.

CrossRoads:
Need a 7.5V wallwart and TPIC6B595 to sink current from the cathodes.

He'll need more than 7.5 volts - each segment will need a current limiting resistor as well.

fungus:
Why "reset" it?

You could get a pen and draw a '+' after the number 7 on the last one.

Yes, we could do that, but that would take the fun out of making a digital counter ourselves. Same idea as one of the other mentors wants to add a digital lock to the door, so we can scan RFID cards to get into the room, he ordered a scanner/keypad from eBay, but turns out the thing is all self-contained. Not what we wanted because we want to be able to interface with an Arduino and make this our own thing.

fungus:
Mentor of a robotics club who doesn't know how to use google...?

Okay, touche, you got me there. Gimme some slack though, I had literally just woken up. I'll do some Google-ing now. BTW, I'm only a 'mentor' because I'm not in school. LOL I'm there to learn as much as the kids are (it's a high school club).

fungus:
Nope. There's four variants there, 1+5 common could also be common anode.

You need to get +5V and GND from your Arduino and find out which way the voltage goes between pin 1 and 7.

5V should be enough to light it up dimly.

I did some testing with the Radioshack Electronics Learning lab I have, and confirmed that is is common anode. Therefore it's the SM4123-1, right? I know it's either SM4123-1 or SM4123-2, because it says "SM4123" on it. So now to set it up with my arduino to see how bright they are when using the Arduino power source. My first problem was that I didn't know it was common anode, and so I had it set up wrong.

TPIC6B595 is an open-drain output shift register.
So it's basically a 74HC595 with outputs that can handle 50V and 150mA.
74HC595 (and Arduino) can only handle 5V outputs.
Your display has a lot of LEDs in series to make each segment, so a 9V source and 75 ohm current limit resistor might be a good match to achieve 20mA current flow:
(9V - 7.5)/75ohm = 20mA
Another option would be adding ULN2803 as output buffer to 74HC595.

CrossRoads:
Another option would be adding ULN2803 as output buffer to 74HC595.

Since they are using an Arduino Mega and only need to drive 14 segments they can probably just use one output pin per segment rather than using a shift register. That could be done with two ULN2803's or a bunch of small NPN transistors.

johnwasser:

CrossRoads:
Another option would be adding ULN2803 as output buffer to 74HC595.

Since they are using an Arduino Mega and only need to drive 14 segments they can probably just use one output pin per segment rather than using a shift register. That could be done with two ULN2803's or a bunch of small NPN transistors.

Okay, so I don't need the shift register?

Another question, that I'm seriously stumped on, is about buttons. I want to use two momentary switch buttons to trigger the adding of a day, or to reset the count to 0. Every example I see is using a special type of button that has an extra "digital I/O" pin, I think it was called. Is there a way to do this with just a regular 2-pin button (just a basic switch)? If so, please help or point me in the right direction. Thanks!!

Why only two displays, why not at least 3 or maybe 4? Are you expecting to have any accident once per 99 days?

This is a tutorial giving the basics of driving 7 segment displays and using a shift register. You will need to use components appropriate for your expected voltage and current and not assume the ones in the tutorial will work.

Shows how to setup momentary switch. Not sure which buttons you were looking it...? Some momentary switches have 2 pins and they simple connect when you press the button. Others have 4 pins. And when you press the button either the diagonal pins connect or the pins next to each other connect when you press the button. This can easily be tested with a multimeter in continuity mode.

wes000000:
Why only two displays, why not at least 3 or maybe 4? Are you expecting to have any accident once per 99 days?

Not necessarily once every 99 days, but right now we don't have the resources for 3 or 4, or more. Everyone agreed when we took a pole that 2 should probably be enough. Thanks for the links, I'll take a look in a minute.

wes000000:
Not sure which buttons you were looking it...?

I was looking here. Maybe I just misunderstood the example?

Thanks for the help, I'm going to check this stuff now and see if I can't figure it out without bothering you guys too much more.

-xian

The schematic shown here: http://arduino.cc/en/Tutorial/Button is probably overly complicated for your needs. That is to say you can remove the external resistor which simplifies things and it easier if your're just starting out and don't have spare resistors laying around.

The Arduino has built in pull-up resistors. What that means is when you set the digital pin mode to input (http://arduino.cc/en/Tutorial/DigitalPins) you can also enable pull up resistors so that the pin idles at a HIGH state. When using button inputs you always have to define a pin idle state so that when you press the button the state can invert and in your code that inversion of state is how you know the button has been pressed.

What you want as your idle state can depend, but the Arduino doesn't have internal pull down resistors it has internal pull up resistors so that is what you need to use unless you want to add an external resistor.

I would recommend before doing anything with 7 segment displays or shift registers to simply setup a button and write some basic Arduino code to print to the serial monitor when you press that button. There a billion tutorials on YouTube and on the internet on how to setup a basic button input to the Arduino.

Once you have the button down you can start adding complexity and other components, but start small and work you're way up.

I say all of this because you asked about the button having a "digital i/o pin" but no button has a digital i/o pin. A button in it's basic form is a broken wire and when you press the button you are closing that wire and making a it a complete connection. That is useful because you can enable pull ups, then connect one side of the button to the pin on which you enabled pullups and then the other side to ground . This way in code you can read the pin you set pullups on and connected your button too and if it is HIGH (5V) you know the button is not pressed. If it is LOW (GND) you know the button is pressed.

Great! Thank you so much. I used that tut, and got the digitalRead(); to change with the button press. Everything is slowly coming together! Thanks to everyone who helped!! :smiley:

Okay, now what am I doing wrong?! I followed this tutorial to set up my common anode 7-segment display, and it's still not working. I modified the code and pins a little bit but other than that I followed it to the T. Here's my code...

/* 7 Segment LED Controller
 * Board: Arduino Mega 2560
 * LED: SM4123-1 ( http://www.yxztdz.com/EnProductShow.asp?ID=206 )
 * By Official.xian
 * 2014.05.31
*/

int anode1 = 22;  // Anode
int anode2 = 23;  // Anode
int led1 = 23;  // E - Bottom Left
int led2 = 24;  // D - Bottom Middle
int led3 = 25;  // C - Bottom Right
int led4 = 27;  // B - Top Right
int led5 = 28;  // A - Top Middle
int led6 = 29;  // DP - Dot Point
int led7 = 30;  // F - Top Left
int led8 = 31;  // G - Middle Middle

void setup(){
  pinMode(led1, OUTPUT);
  pinMode(led2, OUTPUT);
  pinMode(led3, OUTPUT);
  pinMode(led4, OUTPUT);
  pinMode(led5, OUTPUT);
  pinMode(led6, OUTPUT);
  pinMode(led7, OUTPUT);
  pinMode(led8, OUTPUT);
  
  digitalWrite(anode1, HIGH);
  digitalWrite(anode2, HIGH);

  digitalWrite(led1, HIGH);
  digitalWrite(led2, HIGH);
  digitalWrite(led3, HIGH);
  digitalWrite(led4, HIGH);

  digitalWrite(led5, HIGH);
  digitalWrite(led6, LOW);  // This is the DP, I have this as the only LED turned on because I know that Arduino will power it (found out by accident a couple days ago)
  digitalWrite(led7, HIGH);
  digitalWrite(led8, HIGH);
}

void loop(){}

And here's how I have everything set up...
Here's a link to the pix...

Can someone help, please! I don't get this. I'd be fine if I had a common cathode LED, I've already made that work (smaller scale, from the Radioshack Electronics Learning Lab).

-xian

you didn't call pinMode on anode1 and anode2. You have to set them as outputs.

In addition I believe when you set the ledx pins LOW they will turn on. So try setting pinMode for anodes and setting led1-8 to LOW.

Your picture link was broken, can you put up another? And why two anodes?

What's the common anode connected to? I don't see a 7.5V connection there.
Nor a buffer chip like ULN2803.

I was assuming he is just using 5V as an anode for now in an effort to get at least one segment displaying something .I would expect it to still work just not be as bright.

And I think similarly in an effort to get something working he has just directly connected the micro controller pins to the 7 segment display.