Shop OBEX P1 Docs P2 Docs Learn Events
Ok I would like to draw as little current as possible from the propeller i/o pin and - Page 2 — Parallax Forums

Ok I would like to draw as little current as possible from the propeller i/o pin and

2

Comments

  • rwgast_logicdesignrwgast_logicdesign Posts: 1,464
    edited 2012-09-01 23:57
    im so sorry ive been posting from my phone no access to a pc at the moment thats why i dont have a schematic data sheets or more details and am trying not to ask much till i can have specifics in on paper in my head and links posted.

    i will check out tht chip later peter i dont even know what it is. this is what im expermenting with atm.

    prop p0 toggled to output then connected to a 50ohm resistor. This resistor goes to the base of an NPN3904.

    the 3904s collector is straight to a quickstarts 3.3 power vdd pin. the emitter then runs directly to anode of the digit1 of display.

    im reading current draws of 5mA from prop pin0 and 60ma from the digit1 anode. 60mA is max for the display i plan on adding a limiting resistor to make 30mA which is the recommended forward current. i could limit from the base of the npn to make a 30mA draw but Im hoping to make a board that can generically power these displays of different colors and allow sockatable current resistors.

    my question is this method technically wrong why do u both suggest pnp set ups?
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2012-09-02 03:56
    im so sorry ive been posting from my phone no access to a pc at the moment thats why i dont have a schematic data sheets or more details and am trying not to ask much till i can have specifics in on paper in my head and links posted.

    i will check out tht chip later peter i dont even know what it is. this is what im expermenting with atm.

    prop p0 toggled to output then connected to a 50ohm resistor. This resistor goes to the base of an NPN3904.

    the 3904s collector is straight to a quickstarts 3.3 power vdd pin. the emitter then runs directly to anode of the digit1 of display.

    im reading current draws of 5mA from prop pin0 and 60ma from the digit1 anode. 60mA is max for the display i plan on adding a limiting resistor to make 30mA which is the recommended forward current. i could limit from the base of the npn to make a 30mA draw but Im hoping to make a board that can generically power these displays of different colors and allow sockatable current resistors.

    my question is this method technically wrong why do u both suggest pnp set ups?
    The ULN2803 is nothing more than an array of 8 NPN darlington transistors with base resistors so it's a convenient way of providing more current. If you try to use NPNs from 3.3V to the anodes of the display you will have a very inefficient circuit with lots of voltage drop, in fact the anodes will not ever get more then 3.3V-0.6V <= 2.7V and that makes the current harder to control with the resistors due to variations in voltage drops there and with the LEDs. The PNPs will be more efficient for this circuit but the emitter voltage cannot be much higher than 3.3 + 0.6 = 3.9V which is why there are two diodes in series if you elect to run this from a perhaps beefier 5V supply otherwise you can tie the emitters directly to 3.3V.

    I could elaborate but I would have to get a little bit technical.
  • rwgast_logicdesignrwgast_logicdesign Posts: 1,464
    edited 2012-09-02 14:11
    so i just took a 3906pnp wired base to 460ohm to prop pin held hi. the emmiter connects to 3.3 vss collector to a blue led. no current is flowing to led no voltage either. even fliped transistor on the breadboard to make sure e and c werent reversed. am i doing something wrong?
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2012-09-02 15:03
    am i doing something wrong?
    Yes, lots.

    The PNP won't turn off with 3V.
    3V isn't enough to turn a blue LED on.

    Go back to the NPN. Use my example (attached).

    CE npn.JPG
    264 x 267 - 9K
  • kwinnkwinn Posts: 8,697
    edited 2012-09-02 15:12
    so i just took a 3906pnp wired base to 460ohm to prop pin held hi. the emmiter connects to 3.3 vss collector to a blue led. no current is flowing to led no voltage either. even fliped transistor on the breadboard to make sure e and c werent reversed. am i doing something wrong?

    When you use a PNP transistor connected like you described the output from the prop pin needs to be low to make the transistor conduct.
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2012-09-02 16:47
    so i just took a 3906pnp wired base to 460ohm to prop pin held hi. the emmiter connects to 3.3 vss collector to a blue led. no current is flowing to led no voltage either. even fliped transistor on the breadboard to make sure e and c werent reversed. am i doing something wrong?

    Obviously some people are not reading the posts very well.....
    Are you aware of voltage drops that all diodes exhibit? LEDs are light emitting diodes, so they are diodes. A red LED will have a typical voltage drop at moderate current of 1.8V while a blue LED can have a voltage drop that exceeds 3.3V. What does this mean? It means you can't run many types of blue LEDs from 3.3V, even if you connect directly to the power without resistors or transistors.
    So NPN is for driving the cathodes and PNP for driving the anodes. BTW, I'm not guessing, I'm not talking off the top of my head without thinking, I'm not speaking from inexperience etc The point is, this is what works, just hook it up the SAME (no blue LEDs). Try the circuit first without the ULN2803 or the equivalent NPN transistors and you can make it work easily. Once you get a ULN2803 you can make it brighter but the segment resistors would need to be reduced and of course instead of a logic low on the segment pin to turn it on you would need a logic high to turn on the NPN.
    Voltage drops to take into account are:
    Red LEDs = 1.6..1.8V
    Darlington sink = 0.8V
    PNP source = 0.2..0.4V
    So all these voltage drops will have to be subtracted from your supply voltage but as you can see they already add up to 3V which means you could get it to operate at 3.3V supply but don't expect to have even control of the LED current due to variations etc. So the segment resistors could easily be R=V/I so 0.3V/80ma ~ 3.9 ohms. Once you multiplex over 4 digits the average current per segment will be less than 25% of the peak which is why I calculated on a current of 80ma, do you understand that? The problem is if your software stops or takes too long and gets stuck on a digit then the peak current of 80ma will now be continuous current and you could very well end up destroying the LED (not immediately).

    What would I do myself? I'd either just skip the ULN2803 and connect through resistors straight to the segments and use the PNPs for supplying the heavier current of the anodes (8 LED load) and end up with a simple display albeit not as bright or alternatively I have in the past used SAA1064 I2C bus 4 digit drivers which is about as simple as it could get.
  • rwgast_logicdesignrwgast_logicdesign Posts: 1,464
    edited 2012-09-02 17:41
    @peter

    ok i will have to re read your posts again and error check my work see what i missed. Im sticking with ypur advice becuase ive seen alot of work and know you what your talking about more than most. I was acually satisfied with the npn results for the yellow display im using but i know if i go replace it with a blue it wont work, now i know thats becuase of the hi voltage drop of npns and why my test worked stellar at 5v but only marginal at 3.3v. Im not sure what voltage drop my blue leds have when powered from 3.3 a meter reads 2.6v across the leads and they draw 11mA. So is the led eating 2.6v or .7v?

    i will probably not use the darlington array i have a feeling the npn did goog enough so the switch to pnp will probably give me plenty of power and more voltage to work with. idk how much these transistors drop the data sheets arent helping me much at all.... the one for the 3906 list all the max voltages in negatives and thats got me wondering is i need negative voltage or something idk here the pnp im using

    http://www.fairchildsemi.com/ds/2N/2N3906.pdf
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2012-09-02 18:13
    Sorry, I was kinda talking about some of the other "solutions" which ignored the fact that you are running a multiplexed display which needs anode drive as well. BTW, a negative voltage figure is really in relation to what it's referenced to which in some cases might use the + supply as the reference rather than the "ground" so if you put your meter common onto the supply and measure the voltage it would appear (and is in this regard) negative.

    You mentioned not using the darlington array instead of PNP but as you see from my schematic that you need anode drive which is best with PNP (and possibly NPN driving it in some circuits) PLUS the NPN transistor, be it an array or discrete, to drive the segments. LED displays are not used very often unless you want a bright power hungry indoor display. BTW, a red filter and masking improves the contrast immeasurably.

    The best way to measure the voltage drop of a diode is to have a high enough voltage with current limiting connected to the diode and measure the voltage drop across it, which is what you measured as 2.6V across the blue LED although this is probably at very low currents and you will find the real drop only when you run the diode at the current you will be using. In a multiplexed display bear in mind that the peak current will also cause a higher voltage drop so this needs to be taken into account too. Most transistors have enough current gain and current handling for your task so the pertinent 3906 figure is:
    [FONT=lucida console]VCE(sat) Collector-Emitter Saturation Voltage IC = -10mA, IB = -1.0mA -0.25 V
                                                  IC = -50mA, IB = -5.0mA -0.4 V             <-------------- 0.4V drop @50ma
    
    [/FONT]
    
    Obviously that is a maximum but only specified at 50ma whereas the peak current will be 320ma maximum even if you only ran each segment at an average current of 10ma/segment (10av*8segments*4digits = 320). Oh boy, the transistor is not up to it (200ma max) unless you downgrade further which is easy to do now if you have these devices available and just want to get running. Later on you can upgrade the parts if you feel it necessary.

    There is also an option to use higher peak currents and simply reduce the average current through software controlling the duty cycle but you don't want to worry about that for now as there are other issues involved.

    So don't be impatient and try just anything or use anything but take your time enough to devise a workable if not optimal plan, but don't over-plan either. Once you make a decision just run with it and take it from there. K.I.S.S.
  • rwgast_logicdesignrwgast_logicdesign Posts: 1,464
    edited 2012-09-02 18:39
    ok thank u so much uve been a huge help so far! i got the 3906 lighting my a digit in my display and the blue led. the problem was i needed to pull the base low and was driving hi like u would with a npn, as someone caught on to above.

    The pnp is providing much less current to the displays than the npn did though.. i played with the base resistor nothing brought it close to the npns power though... basically im using ur posted schematic without the darlington and providing 0v to the base and 3.3vdd to the emitter.
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2012-09-02 18:56
    ok thank u so much uve been a huge help so far! i got the 3906 lighting my a digit in my display and the blue led. the problem was i needed to pull the base low and was driving hi like u would with a npn, as someone caught on to above.

    The pnp is providing much less current to the displays than the npn did though.. i played with the base resistor nothing brought it close to the npns power though... basically im using ur posted schematic without the darlington and providing 0v to the base and 3.3vdd to the emitter.
    There are some things that are omitted because they are both taken for granted and also for brevity otherwise it could turn into a 3-day course. Check your voltage across the emitter-collector and if it is more than 0.5V or so it's quite possible that you need more base current to turn the transistor on "hard" enough to saturation (like a switch). Please don't try stuff with blue LEDs at present because you are only confusing the issue and readings. Use a red LED if you feel the need, at least it's comparable to the display LED. The current gain of the 3906 is rather poor at high currents as it could be as low as 30 rather than the typical 300 so reduce the base resistor down to 220R or so just for testing. The NPN for anode drive is not a good circuit but I have a very strong feeling that what you are doing, what you are saying, and what really is does not necessarily match.

    Can't you just go out and buy an SAA1064 or at least 4 individual digits and a shift register for each?

    EDIT: Here's a module I did many years ago using an SAA1064 which is mounted underneath the pcb. It only requires +5V and I2C bus lines which you can connect to P28,P29 which connects to the EEPROM. No I/O and very little code, brightness control etc, very easy.
    LED DISPLAY-v.jpg
    639 x 351 - 47K
  • rwgast_logicdesignrwgast_logicdesign Posts: 1,464
    edited 2012-09-02 19:13
    oops lol never flipped the transistor back around but this is great ive been able to get way more current out of the pnp, so much so my display is glowing red instead of yellow :) obviously this is excessive but ill smooth out the details! thank u so much now i can build an acuall module for the clock and move back on to the code!

    So ur telling me this pnp is better not becuase it can provide more current but is leaving more available voltage? ill have to check the 3904 sheet now that u showed me how to find the vdrop. when it says .4v drop at 50mA where do i test the current of the transistor is the 50mA base current?
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2012-09-02 19:26
    oops lol never flipped the transistor back around but this is great ive been able to get way more current out of the pnp, so much so my display is glowing red instead of yellow :) obviously this is excessive but ill smooth out the details! thank u so much now i can build an acuall module for the clock and move back on to the code!

    So ur telling me this pnp is better not becuase it can provide more current but is leaving more available voltage? ill have to check the 3904 sheet now that u showed me how to find the vdrop. when it says .4v drop at 50mA where do i test the current of the transistor is the 50mA base current?

    Isn't it a red LED display???
    PNP transistors are usually "inferior" to their NPN counterparts but are much better suited for sourcing current vs sinking current as they can be used in a "grounded emitter" configuration. By grounded we mean in relation to the transistor's emitter being it's common which is also refered to as "ground" or "positive ground" or point of reference. The saturation voltage will be, should be, and can be a couple of hundred millivolts whereas the NPN configuration as a "source" drive in "emitter follower" configuration can never have an output voltage greater than the base voltage less approx. 0.6V which means less than 2.7V at the anode for NPN sourcing.

    The NPN is ideal however for "sinking" the segment cathodes where it's emitter is tied to "negative ground" and exhibits very little voltage drop across the collector and emitter.
    PLEASE USE CURRENT LIMIT RESITORS IN THE SEGMENTS. You are only damaging the LEDs or other devices and LEDs if overheated (too much current) will lose their brightness through damage and eventually FAIL.
  • rwgast_logicdesignrwgast_logicdesign Posts: 1,464
    edited 2012-09-02 19:59
    no its yellow lol its an extra with a few burnt segments. i know to limit the current for the final board these are just tests. :) just trying to get the max available brightness by default then use a pwm to adjust with software. thank u so much for the help again.. i just wish i understood transistors better.. like a said alot of this is trying to be simple and learn from the lowest common denominator, i coulda done this easy with an opamp which i acually understand but then id still be in the dark about doing this the simplest way
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2012-09-02 20:08
    Opamps are not drivers or switches and are not normally capable or suitable for this application and if you understood opamps then transistors should be a cinch. Transistors are easier to understand in digital circuits as we are only worried about how to use them as switches. AGAIN, don't try to short cut or justify your testing, you admit don't know what you are doing in the first place so you will only be more confused with the results of tests that you don't understand either. Be methodical, step by step, go back cross check, start again if necessary, it's your only hope.

    Don't design your circuit in the hope that PWM will bring down the brightness, because it will, IF it is working properly all the time. In the meantime you are damaging your devices which from my experience you already have.
  • frank freedmanfrank freedman Posts: 1,983
    edited 2012-09-02 20:41
    lol u almost hit it on the head. im using a 4 digit 7 segment common anode so theres only 14 pins including dots and colons. i would not even attempt to direct connect 4 different 7 segments.

    i realized today ive been playing with the thing but idk how to make the 4 displays display different things.. the way ive been thinking about coding this can turn on and off digits 1 through 4 but only display the same digit on each display since im not sure i tell the thing pull only these cathodes to ground on digit 1 and these other different cathodes on digit 2.

    if it helps ne im using a display like this one in this avr project

    http://www.ikalogic.com/build-your-40-mhz-frequency-meter/

    Now you may have realized you can not escape some minimal amount of multiplexing, that is you must select each digit individually while outputing the corect segment levels one at a time to get 4 different values displayed in your device........ Has nothing to do with shift registers. You may still want to consider 74xx47/48 bcd to 7 segment decoder chip to reduce draw on the prop I/O
  • frank freedmanfrank freedman Posts: 1,983
    edited 2012-09-02 20:46
    Confusion is best cleared up with some hard information such as part numbers or links or photos or drawings. If we rely on your own terminology we are bound to be in a state of confusion. So come on.

    Anyway I would recommend that you just play with these using direct drive for the moment with 8 I/O driving 8 common segments through resistors (yes) and then use four PNP transistors with base resistors to power the anodes of each digit. The idea is to only power up one digit at a time and output the segments for it from a buffer (byte of a long), wait a few milliseconds, then blank the segments before switching over to the next digit then present it's segment information etc. You could use a ULN2803 to drive the segments (through resistors) if you want it really bright.

    EDIT: Here's a possible schematic without using shift registers and the ULN2803 is optional.
    Attachment not found.

    Or replace the ULN2803 with 74xx47 and drop to 8 lines......
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2012-09-02 20:51
    Or replace the ULN2803 with 74xx47 and drop to 8 lines......
    Only BCD digits available but mostly the biggy is 40ma MAX even from the 7447. Didn't know they still made those dinosaurs!
  • frank freedmanfrank freedman Posts: 1,983
    edited 2012-09-02 23:10
    Only BCD digits available but mostly the biggy is 40ma MAX even from the 7447. Didn't know they still made those dinosaurs!

    Yep, Digikey still has the LS version of this thing, but could always go with a 48 into the ULN; 'course the only gain there would be trading off the code and lookup ram space for a bit more hardware. If you really need drive, you could always go with the TI OPA567 5.5V supply and a 2A output.

    Fire in da hole!!!!!!!!


    FF
  • rwgast_logicdesignrwgast_logicdesign Posts: 1,464
    edited 2012-09-03 00:16
    Im just going to stick to 4 PNP3906 transistors, they can supply 110mA to the Anode and sync with the prop at 2.4mA. Thats pretty decent, maybe to much, the last thing i guess im failing to understand is the data sheet says 25mA per segment continuous current does that mean to get that much current to the segments i need to supply 7x20mA or 140mA to each anode to get that current correct? When I measure the current from the cathode to ground i only get a 4.5 mA reading.

    As far as the code go ya I understand I have to pull the anode of the digit hi and then all the cathodes to ground that i need to make a letter, so to make a 1, pull digit one anode 1 hi, and pull cathodes b and c low. What im saying is now when I light the second digit it will also display a 1 becuase the same cathodes are pulled to the ground. I understand this display is multiplexed and im suppose to somehow time when i pull the annodes but im not sure how that works or what the timing is, the only thing i see in the data sheet is something about .1ms pulse width.

    this is the data sheet proaly should have linked to it a long time ago
    http://optoelectronics.liteon.com/en-us/api/DwonloadFileHandler.ashx?txtSpecNo=DS30-2000-186&txtPartNo=LTC-4627JS

    If someone could maybe just give a quick few lines of psudeocode i can run with that, I dont have to many issues with code but like i have stated i just dont understand alot about how the hardware does what it does and that the point of alot of this, I have a full seven se3gment driver to look at but id rather not dig into that just yet im just really need to get the concept of how the timing works, something like

    toggle annode digit
    flip cathodes
    wait .1ms
    toggle next annode

    @Peter you correct i dont know jack :), Im learning. I just meant ive wired a few op amps understand them a bit especially how to connect them and set gain. What i didn't think about when i made that statement is ya they might boost my current but i cant rapidly flip them off and on like a transistor to update the display, is this what you meant? Also the display i use for testing is ruined and was well before this, everyone needs a bit of experimentation its fun to pump out .3amps to and led sometimes :) if it blows out no big deal the display was already messed up from wiring accident. Since i obviously cant figure out how the base resistor effects the transistors gain i had to experement to get the amount of current i was looking for. obviously 2.4mA to 110 mA is not quite a 100 amp gain just dont know the formula. I really need to read some better electronics books than this Make: Electronics its fairly practical but leaves alot of holes in theory and knowlege, i will look into some of the simulators listed before but im guessing any free spice sim should be sufficent. Once again thank you for being so patient and helpfull your a very good person to take time out of your day to tell me Smile most people on here probably knew long before picking up a uController.
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2012-09-03 01:55
    All this information...finally! LOL
    Just a few quick notes overall:
    1) Best to write 0.1ms rather than .1ms as decimal points can be missed etc (or just write 100us)
    2) You will probably notice now that your original subject line was very misleading both for the forum and for yourself. ("How can I interface a multiplexed LED display" perhaps)
    3) Best to give the forum a little bit of background about yourself, your project, and your desired objective as this helps us immensely to tailor a reply that's concise and in a language that you can understand better.

    Now, since it is a yellow LED then the voltage drop is higher than a red LED. The curves from the datasheet indicate that at a 25% duty cycle at 1kHz that the peak current cannot be higher than 45ma or so. Also looking at the forward voltage Vf (voltage drop) vs forward current the display will have a Vf of 2.3V. All this says don't expect a bright display especially from 3.3V although 5V won't be much better. Continuous current is not an issue here as it is a multiplexed display and the peak current is the figure of interest.

    Transistors are essentially current amplifiers but when we use them for digital switching of a heavier current (not signals) we are trying to make that transistor switch on as hard as it can so we overdrive the input to put it into "saturation". That is, if we want 60ma through it's emitter-collector and it may have a current gain as low as 60 (at that current) we would not just give it 60ma/60 = 1ma base current, no no no, we want at least twice that just to make sure. So it doesn't matter if we have base current of 2ma or 5ma as we are not shy of any current drive from the Prop but at least we know that the transistor is turned on fully despite variations in batches, ageing, temperature etc. So the resistor value should be around R=V/I where V = 3.3V - 0.6V base-emitter drop - approx 0.2V Prop I/O "loss" = 2.5V and divide this by the minimum current of 2ma we get 1,250 ohms so it's better to round down than up so we end up with 1K or less.

    As to software that is another issue but there are such things as inter-digit blanking to prevent ghosting and ensuring that the display is not stuck on any one digit because the peak current will then be continuous and the display will suffer. A simple Spin routine running in another cog will suffice and the segment buffer for all 4 digits can be a simple long variable or just 4 bytes. Your main application code would call the LED object with a number for instance in a form like SEGLED.NUM(mynum) where NUM in your LED object would pull apart the digits from mynum and lookup a simple segment table and place this in a byte of the segment buffer. The Spin code that is actually running in the LED cog (vs the interface software such as NUM) will simply go through a repeat loop from 0 to 3 indexing into the segment buffer to read the segments for the corresponding digit while your software also selects that current digit etc etc.

    One of the very first things I did with microprocessors was interface to a surplus LED display from a calculator but I wrote the whole thing in machine code and there were no forums or Googling in those days. Trust me, you have got it way too easy and I feel sorry for you because whenever you get help you also miss out on figuring it out yourself. As I said, you need to be methodical, understand, learn, and think about it otherwise you are not much different from the ancient alchemists who didn't understand a thing they were doing but just tried all kinds of combinations, to no avail. Embedded electronics is not a video game where you can roll and crash your race-car and try all kinds of stuff and it kinda works. So effort is required but it is far more rewarding and beneficial.

    EDIT: I just came across this post of yours. I think you should have mentioned it as it would have cleared up quite a few things.
  • kwinnkwinn Posts: 8,697
    edited 2012-09-03 02:07
    this is the data sheet proaly should have linked to it a long time ago
    http://optoelectronics.liteon.com/en...tNo=LTC-4627JS

    Yes, it's always a good idea to post links or part numbers for the parts you are using along with the questions. It avoids a lot of confusion.

    As for the pseudocode:

    1 > repeat I = 1 to 4
    2 > turn E1 to E4 off ' This removes power from the anodes of all the digits.
    3 > output data for segments and decimal point for digit(I) ' Always do this after all the anodes have been turned off.
    4 > make anode pin for digit(I) high ' this allows segment data to light the segments of that digit
    5 > wait for x number of milliseconds ' leave lit for a short time to refresh at 60Hz minimum

    Probably best to have the display routine run in a separate cog and display data written to an array of bytes.
  • rwgast_logicdesignrwgast_logicdesign Posts: 1,464
    edited 2012-09-07 01:30
    Ok so I sat down with a bread board and learned to use a simulator a little bit and came up with these I wanted to make sure there fine and Im not an gonna blow something up here. Im still somewhat confused about how to test the current of a seven segment.

    i.e the sheet Power disapation per segment 40mW. Ok well theres seven segements so I guess Im not sure where Im suppose to be probing the current readings so Ive been probing at the anode for voltage and current. Both circuits i have designed are under 40mW as far as power on the anode goes. I tried measuring the current from each cathode to ground and the first circuit is 13.3mA, and the second is 15mA. But those numbers dont divide into the anodes current 7 times. Everything seems fine here the transistor gets a little warm but thats no big deal right? Its under its 200mA max output.

    Anyways if you guys could look at this and proof it for me, and maybe explain how I would find the current draw and voltage of a single segment in a common anode 7 segment id appreciate it much.

    All voltages, watts, and currents listed on pics were found using a meter and math, not the simulator!

    So heres the first one using a pnp conected to prop to amplify the 7 segment (sorry bout plain LED symbol didnt have nething else)

    pnpBoost.gif


    And here is the second circuit, I havent acually tried it yet but the sim says its fine. I came up with this so I could #1 get the display brighter without the prop sourcing more current, and #2 using the pnp to amplify meant I had to change my code to pull the anodes to 0v, i didnt want to do this so i used an npn to accept the high signal and invert it to a low for the PNP

    invertedPNP.gif


    To make it easy here is the data sheets again,

    4 digit Seven Segment Display Data Sheet
    Fairchild PNP 2n3906
    Fairchild NPN 2n3904
    1024 x 851 - 37K
    1024 x 728 - 32K
  • kwinnkwinn Posts: 8,697
    edited 2012-09-07 19:11
    Circuit 1 does not have a current limiting resistor so you may damage the led. Otherwise it will work, but only IF you are running the led from the same (3.3V) as the propeller. I would make the base resistor 2K to 2.7K instead of 470 ohms.

    Circuit 2 is drawing all it's power from the propeller pin so you may as well replace it all with a current limiting resistor. Normally this type of circuit has the base of the PNP going to a higher voltage than what is powering the propeller, and the NPN drives the base of the PNP.

    Also you would need a current limiting resistor to avoid damaging the led.

    If you have been running the leds with these circuits and it has lit without burning out you have been very lucky.
  • SapiehaSapieha Posts: 2,964
    edited 2012-09-07 20:36
    Hi rwgast_logicdesign;

    If it was me so I will have it connected as my picture show !
    1024 x 754 - 59K
  • rwgast_logicdesignrwgast_logicdesign Posts: 1,464
    edited 2012-09-07 22:21
    Ok Ok, I just realized the last post I made was not at all what I meant to say here it is broken down, The first circuit works well and ran for hours the display was cool, before using a 470ohm on the base I was using 1k, I went with 470 because it was brighter and only uped the current from the prop to 5mA, also peters schematic used a 470. The second schematic i messed up I only simulated it before I posted, when I built it it did not work. I got it working and it looks alot like sephias design. but for now nevermind that drawing Im trying to do this in steps and I would like to know why you say the Display will burn out with the first schematic.

    #1 Why do i need a current limiting resistor on the anode? The transistor will never allow the display to draw any more current than its drawing right now correct? Assuming the board is always drawing it power from a 3.3v regulator, and the base is connected to a prop i/o pin.

    #2 How do I calculate the current each segment will draw, Do I measure the current at the anode with all segments lit and divide that by 7? If so I just did the mathe and the continous current to each segment would be 19mA and the data sheet says the segments can operate at 25mA continous, if this divide by 7thing im doing is right the wattage numbers are also under the continous wattage spec.

    As a matter of fact im deleting my last post becuase it just makes me look stupid, idk what i was thinking when I typed it
  • SapiehaSapieha Posts: 2,964
    edited 2012-09-07 22:29
    Hi.

    As You see --- I specified even 5V --- and in this place You can use any Voltage You will
    > It is why I placed optional Current limiting resistor

    #1 Why do i need a current limiting resistor on the anode? The transistor will never allow the display to draw any more current than its drawing right now correct? Assuming the board is always drawing it power from a 3.3v regulator, and the base is connected to a prop i/o pin.
  • rwgast_logicdesignrwgast_logicdesign Posts: 1,464
    edited 2012-09-07 23:52
    @saphiea ahhh missed that, ya im not going to be using 5vs, the board is being designed to work vdd and vss breakouts on prop based boards
  • kwinnkwinn Posts: 8,697
    edited 2012-09-08 02:37
    Here is a typical I-V diagram for an LED. As the voltage increases from zero there is virtually no increase in current until the forward voltage of the LED is reached. Once that point is reached the current increases very quickly for a very small change in voltage. This makes it very difficult to control the current and brightness of the LED. By adding a current limiting resistor the current becomes much easier to control.

    See http://en.wikipedia.org/wiki/Light-emitting_diode for a more detailed explanation.
    #1 Why do i need a current limiting resistor on the anode? The transistor will never allow the display to draw any more current than its drawing right now correct? Assuming the board is always drawing it power from a 3.3v regulator, and the base is connected to a prop i/o pin.*

    The gain of transistors varies enough that you cannot count on that. The data sheet usually gives a min, max, and typical gain.
    #2 How do I calculate the current each segment will draw, Do I measure the current at the anode with all segments lit and divide that by 7? If so I just did the mathe and the continous current to each segment would be 19mA and the data sheet says the segments can operate at 25mA continous, if this divide by 7thing im doing is right the wattage numbers are also under the continous wattage spec.

    You take your input voltage (3.3V), subtract the typical forward voltage of the LED (2.2 to 4V) and the transistor (0.2 to 0.4V), and use the remainder to calculate the resistance needed for the desired current.

    Lets say you are using LED's with a typical forward voltage of 2.2V. The remaining voltage across the resistor would be 3.3 – (2.2 + 0.3) = 0.8V. If you want 25mA through the segments the resistor would be 0.8 / 0.025 = 32 ohms. In this case you would use the nearest standard resistor value of 33 ohms.
    682 x 566 - 12K
  • kwinnkwinn Posts: 8,697
    edited 2012-09-08 02:41
    BTW, I did post a diagram for a segment and digit drive circuit in post 19 that works well.
  • rwgast_logicdesignrwgast_logicdesign Posts: 1,464
    edited 2012-09-08 04:11
    ok let me first start by saying i know your probably a little annoyed at me, and i thank u very much for helping me. ive seriously been reading all the stuff i can and understand at this point, to learn about transistors as far as amplification circuits go.

    ok i looked at your schematic again the one in post 19 and that combined with your explanation above is filling in some of the pieces a little better. im going to think about this a little more and run a simulation of your circuit. im also going to play with a sim of 8 leds wired in parallel becuase i think that will help me understand alot im not getting also. on that i have two sime questions.

    1 in your schematic u have npns connected to the cathodes. first of all what is its function? in my head im thinking the current has been applyed to the anode travled through the led and is now going to ground assuming the segment is lit so i dont understand what that npn is there for.

    2 in a physicall circuit if you wanted to measure current draw fron the anode to lets say cathode g, where would u stick your meter. i mean measuring current at the base of the anode is the total current consumed by the 8 leds, so dividing that by 8 should be how mamy mA each segment draws, but is there a way at all to use a metet to see current draw from the anode to any random cathode?
Sign In or Register to comment.