Poll

Would you routinely place a resistor in series with a jelly bean LED on an RPi 3.3V GPIO?

Yes
No
What's a resistor?
What's a datasheet?

Author Topic: Software guys, please, no.  (Read 17976 times)

0 Members and 1 Guest are viewing this topic.

Offline fourfathom

  • Super Contributor
  • ***
  • Posts: 2004
  • Country: us
Re: Software guys, please, no.
« Reply #100 on: September 21, 2022, 07:37:22 pm »
Where do people get the idea there is current limiting. Are they confusing this with variable drive strenth?

Well, it is current limiting, of a sort.  This doesn't make it right, or safe for the IO pin.
We'll search out every place a sick, twisted, solitary misfit might run to! -- I'll start with Radio Shack.
 

Online coppice

  • Super Contributor
  • ***
  • Posts: 10034
  • Country: gb
Re: Software guys, please, no.
« Reply #101 on: September 21, 2022, 07:43:46 pm »
Where do people get the idea there is current limiting. Are they confusing this with variable drive strenth?

Well, it is current limiting, of a sort.  This doesn't make it right, or safe for the IO pin.
Any wire is a current limiter of a sort, unless its superconducting. Some people are making comments like there is true current control on these pins, rather than a selection between vague and temperature dependant impedances.
 

Offline fourfathom

  • Super Contributor
  • ***
  • Posts: 2004
  • Country: us
Re: Software guys, please, no.
« Reply #102 on: September 21, 2022, 07:51:07 pm »
Where do people get the idea there is current limiting. Are they confusing this with variable drive strenth?

Well, it is current limiting, of a sort.  This doesn't make it right, or safe for the IO pin.
Any wire is a current limiter of a sort, unless its superconducting. Some people are making comments like there is true current control on these pins, rather than a selection between vague and temperature dependant impedances.
Of course, and that was my point.  The current is limited by the Rds (etc) of the output driver.  Not a great current limiter, but not a piece of copper wire.  Not worth arguing about -- he should have used a resistor.
We'll search out every place a sick, twisted, solitary misfit might run to! -- I'll start with Radio Shack.
 

Offline SiliconWizard

  • Super Contributor
  • ***
  • Posts: 15797
  • Country: fr
Re: Software guys, please, no.
« Reply #103 on: September 21, 2022, 08:11:09 pm »
Uh yeah. You could discuss current limits and wire resistance to no end, just because, but it appears completely pointless here IMHO.
What's wrong with what this guy is conveying here is that 1/ it's just not how you should teach beginners, if that was at all the intended purpose - sane basics are better than ugly hacks especially since it would have not taken more than a few seconds to explain it and add a fricking resistor on a breadboard, and 2/ with this kind of "I dare you to convince me otherwise" attitude, it just sounds like someone full of themselves, laking minimum humility on a topic they don't fully grasp, and it also sounds like the typical "software guy" (the stereotype) whose mantra is "but it works on my own machine".

So for those 2 reasons, even if that was a detail in the video, it's just bullshit conveying the wrong ideas. And as someone else mentioned, it's not about the guy who I don't know, it's all about what he *says*.

Now for the last thought, as he is apparently a seasoned Youtuber with fancy equipment, let's not ignore the fact that he possibly said that *exactly* knowing that it would trigger a lot of reactions, just to get the buzz and maximum number of views. I would seriously consider this here. That may all have been right on purpose just to generate more traffic. And it appears to work. Yes, Youtube is a sad game but it's just a business.
 

Online tggzzz

  • Super Contributor
  • ***
  • Posts: 21226
  • Country: gb
  • Numbers, not adjectives
    • Having fun doing more, with less
Re: Software guys, please, no.
« Reply #104 on: September 21, 2022, 09:29:02 pm »
Uh yeah. You could discuss current limits and wire resistance to no end, just because, but it appears completely pointless here IMHO.
What's wrong with what this guy is conveying here is that 1/ it's just not how you should teach beginners, if that was at all the intended purpose - sane basics are better than ugly hacks especially since it would have not taken more than a few seconds to explain it and add a fricking resistor on a breadboard, and 2/ with this kind of "I dare you to convince me otherwise" attitude, it just sounds like someone full of themselves, laking minimum humility on a topic they don't fully grasp, and it also sounds like the typical "software guy" (the stereotype) whose mantra is "but it works on my own machine".

So for those 2 reasons, even if that was a detail in the video, it's just bullshit conveying the wrong ideas. And as someone else mentioned, it's not about the guy who I don't know, it's all about what he *says*.

Now for the last thought, as he is apparently a seasoned Youtuber with fancy equipment, let's not ignore the fact that he possibly said that *exactly* knowing that it would trigger a lot of reactions, just to get the buzz and maximum number of views. I would seriously consider this here. That may all have been right on purpose just to generate more traffic. And it appears to work. Yes, Youtube is a sad game but it's just a business.

Precisely, on all points :(

Clickbait. It is why it is not worth my time to watch yootoob vids unless I know in advance the video gives me visual information that I can't get by other means.

The "convince me otherwise" is a classic charlatan ploy.

No, if You make extraordinary claims, it is not up to Me to disprove them. Rather, it is up to You to prove the claims. That's the way science and engineering works. (Political, religious and disreputable shills are the opposite).
« Last Edit: September 21, 2022, 09:30:47 pm by tggzzz »
There are lies, damned lies, statistics - and ADC/DAC specs.
Glider pilot's aphorism: "there is no substitute for span". Retort: "There is a substitute: skill+imagination. But you can buy span".
Having fun doing more, with less
 

Offline james_s

  • Super Contributor
  • ***
  • Posts: 21611
  • Country: us
Re: Software guys, please, no.
« Reply #105 on: September 21, 2022, 10:36:27 pm »
Where do people get the idea there is current limiting. Are they confusing this with variable drive strenth?

Probably. Really though I don't think it's fair to rip on people for not knowing these things, especially people who are not professional engineers with backgrounds in hardware. You know about it, I know about it, a large percentage of the people on this forum probably know about it, but I would bet that most software developers are clueless. That doesn't make them idiots, that just isn't their area of expertise. There are lots of things that are not really proper or advisable but which will typically work, this is IMO one of those things.
 

Offline tooki

  • Super Contributor
  • ***
  • Posts: 13157
  • Country: ch
Re: Software guys, please, no.
« Reply #106 on: September 22, 2022, 06:36:59 am »
FYI, I grabbed a standard 5mm, 520nm emerald green LED out of my LED bin last night and hooked it up to my bench supply. It drops 3.1V at 20mA, right in the middle of the “3.0-3.2V” rated Vf. At 3.3V, it was at 30mA. So while that’s certainly over what the GPIO is rated for, at least it’s not grotesquely more. Of course, I wouldn’t recommend running it that way, between it stressing the MCU and LED and being retina-searingly bright. But running one LED that way is not going to instantly fry anything. But several at once is really asking for trouble.
 

Online wraper

  • Supporter
  • ****
  • Posts: 17952
  • Country: lv
Re: Software guys, please, no.
« Reply #107 on: September 22, 2022, 11:01:39 am »
FYI, I grabbed a standard 5mm, 520nm emerald green LED out of my LED bin last night and hooked it up to my bench supply. It drops 3.1V at 20mA, right in the middle of the “3.0-3.2V” rated Vf. At 3.3V, it was at 30mA. So while that’s certainly over what the GPIO is rated for, at least it’s not grotesquely more. Of course, I wouldn’t recommend running it that way, between it stressing the MCU and LED and being retina-searingly bright. But running one LED that way is not going to instantly fry anything. But several at once is really asking for trouble.
But GPIO is not some ideal voltage source. Generally should consider it as a few tens of ohms resistor in series with that LED. Also it seems Raspberry Pi output drive strength can be programmed, and by default it's not the maximum strength. http://www.mosaic-industries.com/embedded-systems/microcontroller-projects/raspberry-pi/gpio-pin-electrical-specifications
Quote
The Raspberry Pi's GPIO pins are quite versatile, and you can modify many of their characteristics from software. You can turn on/off input pin hysteresis, limit output slew rate, and control source and sink current drive capability from 2 mA to 16 mA in 2 mA increments. These properties are set for the GPIO block as a whole, not on a pin-by-pin basis.

Source/sink current capability does not limit the current into or out of the pin, but only specifies the maximum current for which the output signal high/low voltage specifications will be met. If misused, output pins can be damaged by excessive current irrespective of the source/sink current programmed. After a reset, the RPi comes up with the GPIO outputs set to 8 mA drive capability.
 

Offline Psi

  • Super Contributor
  • ***
  • Posts: 10385
  • Country: nz
Re: Software guys, please, no.
« Reply #108 on: September 22, 2022, 11:03:42 am »
I don't care,  use a resistor or don't use a resistor.

But if your LED burns out or your GPIO fails don't come crying to me unless you used the correct resistor.
Greek letter 'Psi' (not Pounds per Square Inch)
 

Offline pcprogrammer

  • Super Contributor
  • ***
  • Posts: 4670
  • Country: nl
Re: Software guys, please, no.
« Reply #109 on: September 22, 2022, 11:15:00 am »
Quote
The Raspberry Pi's GPIO pins are quite versatile, and you can modify many of their characteristics from software. You can turn on/off input pin hysteresis, limit output slew rate, and control source and sink current drive capability from 2 mA to 16 mA in 2 mA increments. These properties are set for the GPIO block as a whole, not on a pin-by-pin basis.

Source/sink current capability does not limit the current into or out of the pin, but only specifies the maximum current for which the output signal high/low voltage specifications will be met. If misused, output pins can be damaged by excessive current irrespective of the source/sink current programmed. After a reset, the RPi comes up with the GPIO outputs set to 8 mA drive capability.

It is right there in the quote you gave. I read that article and near the end it states:
Quote
  • To prevent excessive power dissipation in the chip, you should not source/sink more current from the pin than its programmed limit. So, if you have set the current capability to 2 mA, do not draw more than 2 mA from the pin.
  • Never demand that any output pin source or sink more than 16 mA.

Online xrunner

  • Super Contributor
  • ***
  • Posts: 7836
  • Country: us
  • hp>Agilent>Keysight>???
Re: Software guys, please, no.
« Reply #110 on: September 22, 2022, 11:26:38 am »
The guy is probably laughing his ass off now if he sees this thread. He even infected an electronics forum with his joke!  :-DD
I told my friends I could teach them to be funny, but they all just laughed at me.
 
The following users thanked this post: wraper, tooki, pcprogrammer

Online wraper

  • Supporter
  • ****
  • Posts: 17952
  • Country: lv
Re: Software guys, please, no.
« Reply #111 on: September 22, 2022, 11:31:38 am »
Quote
The Raspberry Pi's GPIO pins are quite versatile, and you can modify many of their characteristics from software. You can turn on/off input pin hysteresis, limit output slew rate, and control source and sink current drive capability from 2 mA to 16 mA in 2 mA increments. These properties are set for the GPIO block as a whole, not on a pin-by-pin basis.

Source/sink current capability does not limit the current into or out of the pin, but only specifies the maximum current for which the output signal high/low voltage specifications will be met. If misused, output pins can be damaged by excessive current irrespective of the source/sink current programmed. After a reset, the RPi comes up with the GPIO outputs set to 8 mA drive capability.

It is right there in the quote you gave. I read that article and near the end it states:
Quote
  • To prevent excessive power dissipation in the chip, you should not source/sink more current from the pin than its programmed limit. So, if you have set the current capability to 2 mA, do not draw more than 2 mA from the pin.
  • Never demand that any output pin source or sink more than 16 mA.
As if I did not read that sentence. But it changes the drive strength. Which means higher impedance which very likely is perfectly enough to limit current through the LED to acceptable level. You can even calculate the pin impedance and actual current through the LED with known Vf and drive strength set, as Drive strength is set for current at the border of acceptable logic level which are VIL=0.8V and VIH=1.3V AFAIK. So with default drive strength with LED connected between 3.3V and GPIO the typical current should be below 8mA if Vf is >2.5V.
EDIT: figures taken out of this paper https://matt.ucc.asn.au/mirror/electron/GPIO-Pads-Control2.pdf but I suspect VIL=0.8V and VIH=1.3V are not usable for this since naming and figures suggest input levels. And I did not find definite answer in official documentation.
« Last Edit: September 22, 2022, 12:14:42 pm by wraper »
 

Offline thinkfat

  • Supporter
  • ****
  • Posts: 2161
  • Country: de
  • This is just a hobby I spend too much time on.
    • Matthias' Hackerstübchen
Re: Software guys, please, no.
« Reply #112 on: September 22, 2022, 01:30:57 pm »
Well, I'm sure Dave has an IR camera around somewhere. Just suggest to him using it for visualizing the extra power dissipation of the main SoC. It should be quite noticeable. Even if not, I believe the Raspi SoC has a bandgap somewhere on the silicon die that you can used to measure the die temperature. If I'm not mistaken, there's even a Linux driver included. I expect a noticeable increase once the LED is switched on. If that isn't convincing...
Everybody likes gadgets. Until they try to make them.
 

Offline PlainName

  • Super Contributor
  • ***
  • Posts: 7508
  • Country: va
Re: Software guys, please, no.
« Reply #113 on: September 22, 2022, 03:27:08 pm »
Quote from: RPi datasheet
To prevent excessive power dissipation in the chip, you should not source/sink more current from the pin than its programmed limit. So, if you have set the current capability to 2 mA, do not draw more than 2 mA from the pin.

I am struggling to understand the basis of this. Let's suppose you have the output programmed to the example 2mA, and to ensure more tha 2mA is not drawn from the pin (as they state) you put a resistor or other current-limiting device in the circuit. What's the point of programming it for 2mA in the first place?
 
The following users thanked this post: tooki

Offline pcprogrammer

  • Super Contributor
  • ***
  • Posts: 4670
  • Country: nl
Re: Software guys, please, no.
« Reply #114 on: September 22, 2022, 03:31:21 pm »
What I understand from it is that it has to do with the slew rate. 2mA setting will be slow and 16mA fast. It has nothing to do with actual current limiting, and more with the output impedance.

Offline PlainName

  • Super Contributor
  • ***
  • Posts: 7508
  • Country: va
Re: Software guys, please, no.
« Reply #115 on: September 22, 2022, 03:41:54 pm »
Sure, but wouldn't the slew rate be managed by current limiting externally? I guess it would with a resistor but not with something more steppy. Like, for instance, an LED :)
 

Online wraper

  • Supporter
  • ****
  • Posts: 17952
  • Country: lv
Re: Software guys, please, no.
« Reply #116 on: September 22, 2022, 03:56:40 pm »
What I understand from it is that it has to do with the slew rate. 2mA setting will be slow and 16mA fast. It has nothing to do with actual current limiting, and more with the output impedance.
By adding impedance current is reduced. But it's not a sort of current limiting with feedback loop so it measures actual current to limit it to certain value.
 

Offline pcprogrammer

  • Super Contributor
  • ***
  • Posts: 4670
  • Country: nl
Re: Software guys, please, no.
« Reply #117 on: September 22, 2022, 04:10:55 pm »
In this pdf https://matt.ucc.asn.au/mirror/electron/GPIO-Pads-Control2.pdf wraper referred to it shows it is using different drivers in parallel to modify the drive strength. With all drivers enabled it will charge the capacitance it sees on the pin faster due to lower resistance in the driver and thus the signal will rise faster.

I believe this kind of setup is used in other MCU's and FPGA's too.

Offline PlainName

  • Super Contributor
  • ***
  • Posts: 7508
  • Country: va
Re: Software guys, please, no.
« Reply #118 on: September 22, 2022, 05:08:24 pm »
I'm not sure it makes things clearer!

"Why don't I set all my pads to the maximum current!"

It's basically saying that if you did and you put 16mA on each pin you'd fry the IO system. Well, yes, but if you set it to 2mA and do the same you'd still fry it. As a designer you'd know not to exceed the spec, and being able to set a current which doesn't actually achieve the aim of protecting from accidental overloads seems kind of pointless.

AFAICS, it would be useful if you have a (small) capacitive load where you want or need to limit inrush, but surely an external resistor would be safer (in the sense that it would protect against 'software guys' programming the stuff incorrectly).
 

Offline HowardlongTopic starter

  • Super Contributor
  • ***
  • Posts: 5424
  • Country: gb
Re: Software guys, please, no.
« Reply #119 on: September 22, 2022, 05:14:54 pm »
Quote from: RPi datasheet
To prevent excessive power dissipation in the chip, you should not source/sink more current from the pin than its programmed limit. So, if you have set the current capability to 2 mA, do not draw more than 2 mA from the pin.

I am struggling to understand the basis of this. Let's suppose you have the output programmed to the example 2mA, and to ensure more tha 2mA is not drawn from the pin (as they state) you put a resistor or other current-limiting device in the circuit. What's the point of programming it for 2mA in the first place?

To reduce high current transients and transient noise. It can be a quite effective solution if you have an application that's failing EMC tests for example on a higher speed bus: it might save you a board re-spin if the hardware and software guys talk to each other ;-)

In some situations, it's important to have specific rise and/or fall time ranges to other devices, and this can provide a possible solution in these cases but it's a bit of a hack IMO.

I've also heard of a potential urban myth using it to provide a somewhat adjustable impedance match, although as it's not really characterised I'm sceptical of its use in this situation other than as a hack.
 
The following users thanked this post: PlainName, pcprogrammer

Offline pcprogrammer

  • Super Contributor
  • ***
  • Posts: 4670
  • Country: nl
Re: Software guys, please, no.
« Reply #120 on: September 22, 2022, 05:31:47 pm »
AFAICS, it would be useful if you have a (small) capacitive load where you want or need to limit inrush, but surely an external resistor would be safer (in the sense that it would protect against 'software guys' programming the stuff incorrectly).

Like Howardlong wrote it reduces noise when frequent switching is done. The capacitive load you can think of is the gate capacitance of a MOSFET, and yes even then a small series resistor can have its use. I'm no expert in this field though.

And yes in some way it is good practice to protect the hardware from abuse by a programmer. That is why I encourage at the minimum embedded programmers to learn some basics of hardware. I started with hardware at a young age before getting schooled in it and learned about assembly programming in school. Did several years in embedded hardware and software, but with more and more software jobs coming my way I went into al sorts of programming from printer drivers to web based information systems.

Now retired I'm back on embedded and tinkering with FPGA's

Online tggzzz

  • Super Contributor
  • ***
  • Posts: 21226
  • Country: gb
  • Numbers, not adjectives
    • Having fun doing more, with less
Re: Software guys, please, no.
« Reply #121 on: September 22, 2022, 06:48:06 pm »
The guy is probably laughing his ass off now if he sees this thread. He even infected an electronics forum with his joke!  :-DD

If that was his objective, there is an old word to describe it: trolling.
There are lies, damned lies, statistics - and ADC/DAC specs.
Glider pilot's aphorism: "there is no substitute for span". Retort: "There is a substitute: skill+imagination. But you can buy span".
Having fun doing more, with less
 

Offline pcprogrammer

  • Super Contributor
  • ***
  • Posts: 4670
  • Country: nl
Re: Software guys, please, no.
« Reply #122 on: September 22, 2022, 06:53:40 pm »
And as usual we were happy to oblige :)

Offline SiliconWizard

  • Super Contributor
  • ***
  • Posts: 15797
  • Country: fr
Re: Software guys, please, no.
« Reply #123 on: September 22, 2022, 08:09:26 pm »
The guy is probably laughing his ass off now if he sees this thread. He even infected an electronics forum with his joke!  :-DD

If that was his objective, there is an old word to describe it: trolling.

Given the means he devotes to his channel, I'm still convinced it's more for the traffic it's generated rather than just pure trolling for the sake of having a laugh. Come on. Are people this deluded about what runing a successful YT channel means?
 
The following users thanked this post: rsjsouza, eti

Offline Infraviolet

  • Super Contributor
  • ***
  • Posts: 1185
  • Country: gb
Re: Software guys, please, no.
« Reply #124 on: September 22, 2022, 09:49:07 pm »
Routinely put a series resistor with a Pi's GPIO?

Actually I'd routinely put a resistor from the gpio to the base of a BJT, then the emitter to gnd and the collector through the LED and another resistor to Vcc. Atleast for anything more long term than a breadboard concept test (I don't think breadboards are the devils work, they are good for trying something out before you solder up a proper one, they are not right for anything you consider finished or permanent) or anything where you want the choice of being able to run the LED with more current than the GPIO could handle.

How do I vote for this in the poll?
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf