1. Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
    Dismiss Notice

Query/Feedback to Colin @ TalkingElectronics

Discussion in 'Microcontrollers' started by Mike - K8LH, Aug 27, 2011.

  1. JimB

    JimB Super Moderator Most Helpful Member

    Joined:
    Sep 11, 2004
    Messages:
    6,390
    Likes:
    592
    Location:
    Peterhead, Scotland
    I have to agree with phalanx, without limiting resistors the LED current during the conduction part of the cycle is potentially unlimited.

    We do not know what this peak current will be, it will depend on:
    The ON resistance of the PIC current sourcing port.
    The ON resistance of the PIC current sinking port.
    The PIC supply voltage.
    The LED segment voltage.
    The wiring resistance.

    Whether this peak current exceeds the maximum ratings of any of the components, PIC or LED display, I do not know without trawling through datasheets.
    It could be that this instantaneous current is within ratings of the components.

    Adjusting the duty cycle of the current through the LED segments will certainly vary the average current and hence the brightness perceived by the human eye, but it will not vary the amplitude of the individual current pulses.

    JimB
     
    • Like Like x 1
  2. be80be

    be80be Well-Known Member

    Joined:
    Aug 23, 2008
    Messages:
    4,869
    Likes:
    144
    Location:
    morristown,tn
    ONLINE
    Read the part in red

    Power delivery

    PWM can be used to adjust the total amount of power delivered to a load without losses normally incurred when a power transfer is limited by resistive means. The drawback are the pulsations defined by the duty cycle, switching frequency and properties of the load. With a sufficiently high switching frequency and, when necessary, using additional passive electronic filters the pulse train can be smoothed and average analog waveform recovered.

    High frequency PWM power control systems are easily realisable with semiconductor switches. As has been already stated above almost no power is dissipated by the switch in either on or off state. However, during the transitions between on and off states both voltage and current are non-zero and thus considerable power is dissipated in the switches. Luckily, the change of state between fully on and fully off is quite rapid (typically less than 100 nanoseconds) relative to typical on or off times, and so the average power dissipation is quite low compared to the power being delivered even when high switching frequencies are used.

    Modern semiconductor switches such as MOSFETs or Insulated-gate bipolar transistors (IGBTs) are quite ideal components. Thus high efficiency controllers can be built. Typically frequency converters used to control AC motors have efficiency that is better than 98 %. Switching power supplies have lower efficiency due to low output voltage levels (often even less than 2 V for microprocessors are needed) but still more than 70-80 % efficiency can be achieved.

    Variable-speed fan controllers for computers usually use PWM, as it is far more efficient when compared to a potentiometer or rheostat. (Neither of the latter is practical to operate electronically; they would require a small drive motor.)

    Light dimmers for home use employ a specific type of PWM control. Home-use light dimmers typically include electronic circuitry which suppresses current flow during defined portions of each cycle of the AC line voltage. Adjusting the brightness of light emitted by a light source is then merely a matter of setting at what voltage (or phase) in the AC halfcycle the dimmer begins to provide electrical current to the light source (e.g. by using an electronic switch such as a triac). In this case the PWM duty cycle is the ratio of the conduction time to the duration of the half AC cycle defined by the frequency of the AC line voltage (50 Hz or 60 Hz depending on the country).

    These rather simple types of dimmers can be effectively used with inert (or relatively slow reacting) light sources such as incandescent lamps, for example, for which the additional modulation in supplied electrical energy which is caused by the dimmer causes only negligible additional fluctuations in the emitted light. Some other types of light sources such as light-emitting diodes (LEDs), however, turn on and off extremely rapidly and would perceivably flicker if supplied with low frequency drive voltages. Perceivable flicker effects from such rapid response light sources can be reduced by increasing the PWM frequency. If the light fluctuations are sufficiently rapid, the human visual system can no longer resolve them and the eye perceives the time average intensity without flicker (see flicker fusion threshold).

    In electric cookers, continuously-variable power is applied to the heating elements such as the hob or the grill using a device known as a Simmerstat. This consists of a thermal oscillator running at approximately two cycles per minute and the mechanism varies the duty cycle according to the knob setting. The thermal time constant of the heating elements is several minutes, so that the temperature fluctuations are too small to matter in practice.
     
  3. be80be

    be80be Well-Known Member

    Joined:
    Aug 23, 2008
    Messages:
    4,869
    Likes:
    144
    Location:
    morristown,tn
    ONLINE
    This is the kind of thing that get's me we set down and figure with out any real data

    A pic18f2550 with a cheap red led from PORTB.0 draws 28.6 mA with the pin set high where is it going to get this dreamed up instantaneous current of 100mA

    O and no resistor.
     
    Last edited: Sep 1, 2011
  4. dave

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    -
    Likes:
    0


     
  5. ghostman11

    ghostman11 Well-Known Member

    Joined:
    Nov 22, 2009
    Messages:
    1,192
    Likes:
    99
    Location:
    Scotland

    is there really any need for comments such as this? it helps no one and certainly isnt conducive to a rational debate. rather than trying to deflect the situation i personaly still think you should stick to answering the questions that were put to you from mike.
    as for the pwm and not using resistors blah blah blah, while it my not be seen as best pratice, clearly its is possiable to run LEDS in this manner as it has been done! inexperianced members like myself gain more knowledge when the debate is rational and dosnt descend into the childish.
    regards jason
     
  6. phalanx

    phalanx Member

    Joined:
    Oct 22, 2003
    Messages:
    405
    Likes:
    7
    Location:
    New Hampshire, USA
    Anyone can copy and paste other people's work. Understanding what you are reading is a whole other matter. No one here is trying to say that PWM can't be used to control current. We are trying to say that PWM alone cannot adequately control current through an LED since it has no means of limiting the instantaneous current through it. Do you understand the electrical properties of a diode and why this is important?
     
    Last edited: Sep 1, 2011
  7. phalanx

    phalanx Member

    Joined:
    Oct 22, 2003
    Messages:
    405
    Likes:
    7
    Location:
    New Hampshire, USA
    Congratulations. You just figured out that the specific LED you have combined with the specific PIC you have exceeds the maximum current rating of the PIC's I/O pin by nearly 15%. Microchip even has a big disclaimer in their datasheets warning of the risk of damage if the absolute maxes are exceeded. Try every combination of a batch of 1000 LEDs and 1000 PICs and you will find the occasional combination that is in spec but the vast majority will be out of spec just like the one you tested. If you look at all the development boards that Microchip makes, you will not find a single one that has a LED connected to an I/O pin without a current limiting resistor.

    No current limiting devices on an LED is an immediate sign that you are looking at a hack design.
     
  8. be80be

    be80be Well-Known Member

    Joined:
    Aug 23, 2008
    Messages:
    4,869
    Likes:
    144
    Location:
    morristown,tn
    ONLINE
    Some people can write and make it look good . Do you understand the facts

    1. If you place a red led on PORTB.0 of a 18f2550 and set that pin high it will only output 28mA.
    2. That's with no resistor.
    3. If you use PWM as Jose Pino's Amost No Parts Clock, You can control the current as he did.
    4. The led can easily handle 28mA peaks.

    And sure any one can Google and paste it at lest I did you have not posted any backup for your reasoning.
    Looks more like a attack on me then facts.

    Here one more and I'm sure you can Google it Leds can't be figured for instantaneous current.

    There datasheets leave a lot out.
    Maximum output current sourced by any I/O pin ....................................................................................................25 mA
    The limiting factor which determines maximum current at any duty cycle is average power dissipation. 10mA
    I think she can handle it. LOL
     
    Last edited: Sep 1, 2011
  9. phalanx

    phalanx Member

    Joined:
    Oct 22, 2003
    Messages:
    405
    Likes:
    7
    Location:
    New Hampshire, USA
    I can't stress this enough: JUST BECAUSE IT WORKS DOESN'T MEAN IT'S RIGHT!

    Moderated off Topic
     
    Last edited by a moderator: Sep 2, 2011
  10. be80be

    be80be Well-Known Member

    Joined:
    Aug 23, 2008
    Messages:
    4,869
    Likes:
    144
    Location:
    morristown,tn
    ONLINE
    If it was a pacemaker and it needed a led I would put a resistor on it. But that's not the point here "Jose Pino's Amost No Parts Clock" the point is it can be done with out a lot of parts and he is limiting current with PWM Jose Pino never said not to use limiting resistors he said he was going to show how it could be done in software as far as current limiting gos.
     
  11. phalanx

    phalanx Member

    Joined:
    Oct 22, 2003
    Messages:
    405
    Likes:
    7
    Location:
    New Hampshire, USA
    Probably so considering 30mA is a common number for bulk LEDs. The PIC I/O pin is not intended to handle current above 25mA.


    There is plenty of backup even from other posters. You either seem to be ignoring it or you have no idea what we are talking about.

    Yes they can. What gives you the impression that they can't be?

    Where?

    Which you are exceeding putting the PIC at risk in the long term.

    Now you are quoting a listed assumption in a person's question as fact. http://electronics.stackexchange.co...her-current-yield-greater-apparent-brightness. This was a boundary constraint for their scenario and isn't correct in your real world application. For example, a cheap LED available through digikey has a max forward voltage of 2.5V and a max current of 30mA for a maximum power of 75mW. The same LED can tolerate a 160mA pulse at 1/10 duty cycle. (2.5V * 160mA)/10 = 40mW. This is nearly half of the rated LED power therefore average power dissipation is not the limiting factor otherwise the pulse duty cycle would be roughly 1/5.
     
    Last edited: Sep 1, 2011
    • Like Like x 1
  12. be80be

    be80be Well-Known Member

    Joined:
    Aug 23, 2008
    Messages:
    4,869
    Likes:
    144
    Location:
    morristown,tn
    ONLINE
    You no it don't really matter to me I could care less what you think. I don't see you posting any thing useful here.
    You think it's this way I say it can be done in software. I myself like current limiting resistors, But it can be done in software
    You think your right so be it. But that don't make me wrong fact is it works find in software maybe you should try it kind of like beer if you don't like change to something
    else.
     
  13. Mr RB

    Mr RB Well-Known Member

    Joined:
    Jul 22, 2008
    Messages:
    4,716
    Likes:
    194
    Location:
    Out there
    Some of these posts are a bit dismaying!

    It's quite acceptable in design terms to use a FET in PWM mode with much higher peak current than the FET's specified "maximum average current".

    I just grabbed a random p-channel FET datasheet from my hard drive, it lists maximum average current 130mA and max peak current 520mA. Another lists 600mA drain current and 1.9A peak drain current.

    The PIC output drivers are FETs, nothing more and nothing less. They also have characteristics defined in the PIC datasheet if people bother to look, and a typical PIC high side PFET is shown in the datasheet as "max source current 25mA" and an output voltage of Vdd-0.7v at 3mA and 4.5v Vdd which indicates the PFET Rds on at 0.7/3mA = 233 ohms.
    That is a worst case spec, I have tested PIC pin FETs in the past and they are usually much better than that, typically half the worst case Rds on. Which is a PFET of about 100 ohms Rds on, and many are better. It's trivial to test, just load the PIC pin and measure the voltage drop, that is the PFET Rds on.

    Anyone experienced in designing DC power control electronics knows you have quite a bit of leeway in FET max drain current, provided you don't exceed average drain current and average dissipation. So like any other FET, the PIC pin FET can be driven at much higher peak current than 25mA, and by looking at most small PFET datasheets you will see the peak drain current is usually 4 to 5 times the value for max average drain current. Which indicates a PIC pin PFET of about 100 ohms Rds and capable of 100-120mA or more peak and 25mA average.

    Also, LEDs are commonly driven with peak currents far exceeding their average current. Look in a remote control designed by Sony's best engineers and you find 30mA IR LEDs running 1.2A peak current pulses.

    So provided the hardware is properly understood (which apparently excludes some of the rude people here) it's quite possible and reliable to run a LED directly from a PIC output pin provided the PWM duty keeps the peak and average currents in spec.

    Burt, I'm dismayed at the way people have spoken to you! :( You are perfectly right the LED can be direct driven and controlled in software, although a beginner with bad software might damage something through doing it wrong. Also the insulting comments to Mike and Jose seem a bit low too. Must be the change of weather or something making people irritable...
     
    • Like Like x 1
  14. be80be

    be80be Well-Known Member

    Joined:
    Aug 23, 2008
    Messages:
    4,869
    Likes:
    144
    Location:
    morristown,tn
    ONLINE
    I really don't get it when it come to pic micro people start thinking they redesign how FET work it's crazy. I test my ideas and yes I have the right tools for the job LOL

    And I'm with you RB Mike and Jose do great work and it is a bit low what has been said.
     
  15. phalanx

    phalanx Member

    Joined:
    Oct 22, 2003
    Messages:
    405
    Likes:
    7
    Location:
    New Hampshire, USA
    Discrete FETs both large and small usually have their pulse ratings listed in their datasheet along with acceptable on times and duty cycles. PICs are not characterized in this manner and you can't assume that they directly scale with discrete FETs. There are differences in process type, encapsulant, wire bonds, packaging, proximity to other circuitry, etc., that no one except for the design engineers at Microchip fully understand. These are the same engineers contributing to the multitude of application notes published by Microchip and none of them detail a scenario where it is safe to dirct drive an LED without a resistor. Their tips-and-tricks on varying the intensity of an LED using PWM has a resistor. They even go so far as to show you how to directly connect your PIC to mains power yet they still show current limiting resistors on LEDs. I would also imagine that Microchip would advertise a no resistor capability as a cost saving measure in their inexpensive 10F line especially with ARM making inroads to the cost constrained markets.

    You aren't doing any favors to the entry level people by proclaiming that it is perfectly safe to run LEDs without resistors. They should be learning about proper design considerations and limiting current to an LED is definitely one of them.
     
  16. be80be

    be80be Well-Known Member

    Joined:
    Aug 23, 2008
    Messages:
    4,869
    Likes:
    144
    Location:
    morristown,tn
    ONLINE
    phalanx The clock wasn't designed by a beginner and no one said not to use resistors to limit current to an LED Jose said he controlled the current in software.

    That's doable and he was not over sourcing the port also doable.


    Beginner 101 is down the hall you may want to go there and help out we had are milk as babies where on to the the meat as men.
     
    Last edited: Sep 2, 2011
  17. colin55

    colin55 Well-Known Member

    Joined:
    Feb 14, 2009
    Messages:
    3,534
    Likes:
    82
    Location:
    Melbourne Australia
    I am not even going to reply.

    Some people have not learnt and will never learn.

    That's why I concentrate on teaching students 14 to 18 years old.

    As I said before, listen to phalanx everyone else is mixing facts from one source and trying to apply them to a completely different situation.
    Putting a LED on the output of a micro increases the losses in the FET over 10 times.
    Of course it might work but it is not a good design. You are just relying on the wonderful over-design of the components.
    It is a bit disappointing to see engineers that I thought knew their subject, falling down so badly in this section.
     
  18. be80be

    be80be Well-Known Member

    Joined:
    Aug 23, 2008
    Messages:
    4,869
    Likes:
    144
    Location:
    morristown,tn
    ONLINE
    Collins i can take a pic and call it Burt's pic and rate it's output as 30mA which has been done the name is a pun, But there is room here for under rating a chip because there market is not total a cut and dry industry. That doesn't mean that a well trained EE couldn't get the most out of a pic you two are still babies when you become men come back and add something good. Like I was wrong and I didn't understand what Jose was doing
     
  19. colin55

    colin55 Well-Known Member

    Joined:
    Feb 14, 2009
    Messages:
    3,534
    Likes:
    82
    Location:
    Melbourne Australia
    I don’t want to criticise, but I don’t understand what you are saying.
    I don’t have the time to take this discussion any further.

    I only took Pino to task because the project is not a good design and just because it saves $1.00 in parts does not prevent it being criticized.
    He does not provide the .asm code for the project, so why put it on the web as an educational project?
    Secondly, the chip has sufficient output pins to provide multiplexing (and improving the brightness of the display), so why not use them?
    I did not start this posting.
    Mike Mclauren you will notice he has not entered the discussion, after my statement that the micro pins should NOT be stressed by connecting a LED directly to them.
    I still stand by the statements I made on my website and I am here to educated people in Electronics – not to run around in circles.

    Moderated Off Topic

    Any further comment can be made by phalanx as he seems to be willing to discuss the matter further with someone who is quite devoid of understanding.
     
    Last edited by a moderator: Sep 3, 2011
    • Like Like x 1
  20. phalanx

    phalanx Member

    Joined:
    Oct 22, 2003
    Messages:
    405
    Likes:
    7
    Location:
    New Hampshire, USA
    I'm about at my threshold. It's time for me to enjoy my long weekend out in the woods with no internet access and phone service!

    No you can't. Only the manufacturer can determine what the rated specs of a device are. All the max ratings of a device are only valid if you are within the range on all of them. Can you guarantee operation at 125°C when an I/O port is out of spec? That is just one thing you have to consider. If you end up with failures down the road, Microchip (or any manufacturer) will see you are out of spec and not help you.

    Running outside of the rated specs to save $1 in parts is lazy and sets a very bad example for others that don't know any better.
     
  21. Mike - K8LH

    Mike - K8LH Well-Known Member

    Joined:
    Jan 22, 2005
    Messages:
    3,642
    Likes:
    109
    Location:
    Michigan, USA
    I apologize for letting this thread get away from me. As I stated in my first couple posts, I simply wanted to address Colin's second complaint about the lack of digit driver transistors. Here's the premise for Colin's complaint;

    Clearly, that situation could only happen when you attempt to light more than one segment on a single display at the same time. Since Jose is only lighting one segment at a time, Colin's premise and conclusion are incorrect.

    I was hoping that Colin might consider editing his critique of Jose's ANP clock once he realized he made a mistake. Instead, he commented that lighting one segment at a time was "an absurd way to scan a display" (note: the SuperProbe uses a similar method). Unfortunately, this comment doesn't really support his original complaint.

    May I ask if anyone has read the Spot The Mistake column and what you think of it? I believe the site needs an Editor to help eliminate some of the comments that tend to shed a negative light on the character of the author. Here are just a few of many comments that might be edited out;

    I hope I'm not the only one that finds comments like these to be very disturbing.

    What about the credibility of the Author? For example, can anyone spot the mistake in this statement;

    The schematic for the EDN article being criticized shows a 10F222 with the 8 pin PDIP or DFN package pinout. What kind of "expert" can't find the 8 pin pinouts in the 10F200 series datasheets (they're located on the same page as the 6 pin pinouts)? Unfortunately, I believe statements and comments like these, scattered throughout the column (and web site), tend to diminish the credibility of the author.

    I'd like to thank members of the Forum for being so tolerant and I apologize if I'm the only one who thinks Colin's behavior and comments fall outside the norms of common decency.

    Regards, Mike


     
    Last edited: Sep 10, 2011

Share This Page