I've build a circuit with a 7-segment powered by a external 9V Battery and theorically controled with the arduino trough transistor..
The problem is the following :
When everything is plugged with standard LED instead of 7-segment everything works fine ! The Led blink while arduino tell them to !!
When I plug the 4'' 7segments device, nothing blink.. I used a 220k-Ohm to protect the Led (or 7 segment) and 10K-Ohm to protect the base of transistor..
One more time, no power trough the 7 segments When it's working fine with the LED.
I guess that's the transistor work when the LED ask 1,9V (20mA), but when I plug the 7segment requiring 7,4V (same 20mA).. Then the transitor give up ?
I used the transistor of the starter kit, it was writtent maximum 6V on the base and 80V on the collector/emiter with 100mA, so I thought it was ok..
Thanks for your help to the newcomer I am :)
By the way, I also tried with small 7 segments.. And it work fine ! The problem comes from the fact, that this bigger 7 segment require more power?
Hi and welcome.
The larger 7 segment displays use multiple LEDs per segment, where the smaller ones use a single LED.
You should look for the specifications of the display before you can use it.
I see you found out something that tells you 7.4 volts and 20 mA.
So you need to make sure that you have at least this 7.4 volts.
Also, a standard transistor "eats up" about 0.7 volts.
So if you want to power the large 7 segment display, you need at least 8 volts.
9 volts would be even better.
Then you can calculate what resistor you need to reduce current to 20 mA:
9 - 0.7 - 7.4 = 0.9 volts.
You want a 0.9 volt drop over the resistor, and you already know you want to allow a max of 20 mA.
I=U*R; R=I/U, so 0.9/0.02 = 45 Ohms.
45 Ohms is not a standard value, so we'll look for the next higher standard value, which is 47.
You could also decide for 56 Ohms.
The display will light less bright, but it might live a bit longer.
Also use a resistor in the base of the transistor, something like 1K should do.
A typical NPN transistor setup will invert the signal, so keep that in mind while building your sketch.
Common anode display? Use TPIC6C595 or TPIC6B595 to sink current from the segments.
Still need 9V. The shift register has some Rds associated with it, so you will need a smaller current limit resistor.
Carefull with that.
Segments use multiple LEDs in series, but the decimal point might use one or two.
That can be solved with a zener diode with the value of the "missing" LEDs.
Thanks for your answer. However, it doesn't help me yet :)
MAS3, you tell me that my resistor are not the best, too big, so it won't allow the LED to bright or less, but this is not the case. It works with those resistor.
Let me explain with pictures as I think the circuit is simple enough to do that.
The circuit just plug into a LED, it work correctly the LED is ON. So the transistor work correctly, the arduino deliver it power trough pin 2... All good
When plug into one segment of the 7 segments.. Everything OFF... I thought the 7segments could be dead, or the resistor to big..
But when I shortcut the transistor, the segment is ON.... So the 7 segment is alive, and the resistor is not too big.. it could probably bright more, but this is not the problem.. Is the transistor the problem? The arduino ?
Please help me :smiley-confuse:
Thank you :)
You haven't told us what transistor you are using, nor how it's wired up.
I told about the voltage drop of a transistor of about 0.7 volts.
The wire has a voltage drop of about 0.00 volts, which can be all the difference.
Your conclusions are incorrect, you can't take out a single component by shorting it, and then if it works assume that the rest is correct.
But first tell us about what transistor you used and exactly how you connected it.
That includes resistor values.
It is not visible from those photo's.
Transistor : https://www.arduino.cc/documents/datasheets/BC547.pdf
Resistor : 220 Ohms for the LED (I don't have any smaller yet) - 4,7 KOhms for the base.
+ of the 9V to the collector
Pin 2 of the arduino trough the resistor to Base
Emitter trough the resistor to the segment of the 7-segments
You say that the 0,7V that take the transistor can be the problem, because that doesn't leave enough voltage to the LED right ? I can try with a 12V battery ? :)
That's not the best way to do this.
You are using a NPN transistor.
The problem is that you seem to be using a common cathode display, is that correct ?
You should use a NPN transistor in the cathode line of a LED.
You can't do that if you have a common cathode display.
Yes it is a common cathod display.
Thing is I will need transistor at both anode pin and common cathode, because there will be 3 displays like that connected to the same arduino.
So all "same" segment connected to the same pin of the arduino. And each cathode to a pin. 7 anode + 3 cathode = 10pins.
Then I "light" let say number 1 with cathode 1, delay few millisecond, "light" 2 with cathode 2. And it "print" 12.
All this worked very fine with those small common cathode 7-segments : http://www.tme.eu/fr/Document/8096a7da4d6b8f0b5b1ecc419ba019ae/CC56-11EWA.pdf
But with the bigger one, not even able to light one segment >:(
By the way : here is the datasheet of the "big" 7 segments
You can use the BC547 for the cathodes, so to select the display.
You'd have to connect the cathode to the collector, and GND to the emitter.
For the anodes, you still need a transistor because you can't send 9 volts directly from an Arduino pin.
But because you are controlling the VCC here, you'd need a BC557 (which is complementary to your BC547), a PNP transistor.
This transistor gets the resistor connected, it doesn't matter whether it is connected to VCC and emitter or to collector and segment.
This means each segment needs its own resistor.
You told in your first post you were using a 220K Ohm resistor, because those are the only ones available to you right now.
I assume you made a mistake and meant 220 Ohm.
If you put 4 of those in parallel, you will create a new resistor of 55 Ohm.
That will be close enough to the right value.
So for your tests, you can still create the right circumstances this way to light up a single segment.
Your final setup needs to be like this. PNPs to drive the segments, NPN to turn on the digits one by one.
The resistor for the decimal point will be a different value than for the segments.
For the segments:
(12V - 0.7V - 0.7V - 7.8 )/.02 = 140 ohm, can use a standard 150 ohm
For the decimal point:
(12V - 0.7V - 0.7V - 3.9 )/.02 = 335, can use a standard 330 ohm
Than you for your reply.
I connected my transistor to the cathode (to control the complete display), and it works well.
Can you explain to me what the difference between NPN and PNP that make the PNP working when connecting to the anode and NPN doesn't ? But NPN work with cathode (will PNP work with cathode?).
Also why those same NPN transistor worked with both anode and cathode on the smaller system ?
NPN is used to sink current, meaning to pull it down to GND.
PNP is used to source current, to pull it up to VCC.
The transistor is built up in a different way.
Transistors are diodes with an extra layer, creating 2 diodes in one.
You need to open the diode to have the complete part conduct.
The two types are a pair of diodes pointing towards each other, or a pair of diodes pointing away from each other.
This of course is a simplified explanation, but it shows these transistors are polarity sensitive.
CrossRoads made a nice drawing in the post above your last, showing the control of each segment.
Thank you MAS53 and CrossRoads for your explanation.
Evertything is clear !
I ordered the PNP transistor, will get them tomorrow for testing.
Did you order a set of resistors to go with it ?
Saves some shipping costs.
I have recieved my PNP transistor.
I plugged it at the exact same as yesterday. And now have the exact opposit problem. The segment is ON whatever I say to Arduino, LOW or HIGH it's always ON.
I tried to mannually plug the base of the transistor to the GND then the segment switch OFF. It look like HIGH or LOW, the Arduino always deliver something.
What look very strange... Is when I unplug the USB cable of the Arduino, it is still a bit powered, the "ON" Led of the arduino light a bit (And the segment remain ON).. That probably mean power from the 9V battery goes a bit to the arduino trough the base of the transistor into Pin 2 ???
That may explain it doesn't work ?
Edit : Sorry.. Base to the GND, Segment is ON. Base disconnected, segment is OFF
What transistor did you use, and how did you wire it ?
Did you have a look at the datasheet for that transistor ?
Did you compare what you built, with CrossRoads' drawing ?
BC557 as you told me.
Yes I took a lot to be sure which pin was emmiter/collector/base.
Power to the collector
Pin 2 to base trough resistor
Emmiter to + of the segment trough resistor
Cathode of the segment to ground.
The base of a NPN transistor opens when you "push" it up.
The base of a PNP transistor opens when you "pull" it down.
Remember the two diodes i told of ?
Actually it's more like one and a half diode.
The N stands for Negative layer , the P for Positive layer.
The diode part means that current is stopped when it reaches the center layer.
But as soon as you start manipulating that center layer by applying a current there, the diode function is altered, and the outer layers will bridged by the now conducting center layer.
That's how a transistor functions in a nutshell, there's much more about it.
So, the good question is how to pull it down thanks to the arduino ?????
Pulling it down will make it go LOW ?
I managed to do the thing by connecting one PNP from power to the anode with the base connected to a NPN which link the PNP to the ground controlled by the arduino.
Is there any better solution ??? Or I have to use two transistor ???
So you have created an inverter so the signal you are sending out gets inverted to control the PNP.
How about writing an inverted signal to the PNP in order to enable it ?
What happens if you make pin 2 LOW ?