blue pill pins - Page 1
Forum section: electronics / beginners

author: ME
author_rank: Frequent Contributor
timestamp: March 25, 2025, 04:21:39 am
content: can a bluepill PA0 pin sink enough current to drive an led ?

author: Andy Chee
author_rank: Super Contributor
timestamp: March 25, 2025, 04:28:49 am
content: Chat GPT says:The PA0 pin can sink a maximum of about 8 mA reliably without risking damage.

author: golden_labels
author_rank: Super Contributor
timestamp: March 25, 2025, 06:21:36 am
content: ME:Get the datasheet for the controller used. Probably STM32F103, but only you know what you received on your board.In the datasheet check electrical characteristics. In particular absolute maximum ratings for I/O pins sinking, maximum current from VSS, and the sum of all I/O pins.Compare that with the current your LED needs. Mind that this current is for the given voltage.Pray that the chip actually follows the datasheet, instead of being a discard from a factory or a fake.Andy Chee: Seriously?

author: pcprogrammer
author_rank: Super Contributor
timestamp: March 25, 2025, 07:53:39 am
content: For a STM32F103 the absolute maximum sink current rating for a single IO pin is 25mA. Total drawn from the power supply through the VDD pins is 150mA.Mind you that the IO voltage level drops or rises depending on the current.Modern LED's can produce a lot of light with low current (<1mA) depending on the type and color. To make sure the current does not become to high a series resistor needs to be added. To calculate the resistor you need the supply voltage, the LED forward voltage, the voltage drop or rise on the output for the expected current, the intended current to flow through the LED, and of course Ohms law to do the calculations.

author: Simon
author_rank: Unknown
timestamp: March 25, 2025, 08:21:47 am
content: Quote from: Andy Chee on March 25, 2025, 04:28:49 amAnd you believe that?

author: golden_labels
author_rank: Super Contributor
timestamp: March 25, 2025, 10:44:21 am
content: Quote from: pcprogrammer on March 25, 2025, 07:53:39 amThere is also a separate limit for I/O pins total.And VSS pin, not VDD, since the question is about sinking.

author: ahsrabrifat
author_rank: Regular Contributor
timestamp: March 25, 2025, 12:04:28 pm
content: If it's a generic 5mm LED that has a 5-10 mA forward current requirement, you can connect it to PA0 pin with a 330 ohm current limiting resistor in series.

author: pcprogrammer
author_rank: Super Contributor
timestamp: March 25, 2025, 12:18:14 pm
content: Quote from: golden_labels on March 25, 2025, 10:44:21 amFor the absolute max current out of the VSS pins is also 150mA.QuoteThis is where ChatGPT probably got it's 8mA from.

author: radiolistener
author_rank: Super Contributor
timestamp: March 25, 2025, 01:02:51 pm
content: when it comes to the specification of some chip, I don't trust chat-gpt or any kind of other AI at all, instead I advise you to look at the datasheet.Here is Absolute Maximum Rating for STM32F103x8 which is used in blue-pill:From my experience its GPIO can drive usual LED with no issue. But it depends on the LED model, the modern range of LEDs includes a fairly wide range of supply voltages and currents, some LED can require 1 Amp current or 70 V for example. So, it is obvious that high-current and high-voltage LED's will not work.

author: langwadt
author_rank: Super Contributor
timestamp: March 25, 2025, 01:37:44 pm
content: Quote from: Simon on March 25, 2025, 08:21:47 amthat the great thing about AI, you can ask it anything and as long as you already know the answer you can tell if it is correct ....

author: Gyro
author_rank: Super Contributor
timestamp: March 25, 2025, 01:38:44 pm
content: Quote from: radiolistener on March 25, 2025, 01:02:51 pmOf course, those are the Absolute Maximum ratings 'beyond which the device will suffer permanent damage and at which long term reliability cannot be guaranteed', so not useful for actual use. You need to de-rate to the typical figures in the parameters section (where the output voltage will be specified at certain output currents). The absolute maximum ratings also don't take account of maximum ratings for the supply and ground pins, which are also stressed by the current consumption of CPU itself and current being drawn on other outputs.

author: PeteH
author_rank: Unknown
timestamp: March 25, 2025, 01:51:47 pm
content: Grok 3 answer:https://grok.com/share/bGVnYWN5_d4acc9e3-739c-4014-ae2f-5c7c8a2049c0These things are getting better every day. It matters which version and what capability level the "AI tools" are set to.

author: langwadt
author_rank: Super Contributor
timestamp: March 25, 2025, 02:03:32 pm
content: Quote from: PeteH on March 25, 2025, 01:51:47 pm"A typical LED (e.g., a standard 5mm red, green, or blue LED) requires: 10–20 mA of forward current to light up adequately"unless you just found some 20 year old LEDs that is just nonsense

author: radiolistener
author_rank: Super Contributor
timestamp: March 25, 2025, 02:30:22 pm
content: Quote from: langwadt on March 25, 2025, 02:03:32 pmThe LED in my flashlight draws a current of approximately 1.5 Amperes, it consumes about 5-6 Watt from the battery.Another example is an LED from a filament bulb, which starts to emit light at a voltage of approximately 70 Volts.Such LEDs cannot be connected to a GPIO - they simply won't work.But usual standard low-power LEDs that consume 5 - 20 mA should work fine. Just add a resistor in series to limit the current.

author: Simon
author_rank: Unknown
timestamp: March 25, 2025, 06:12:32 pm
content: 3mA will light an LED if you just need to see it light. If you need it as an obvious indicator then you will need to evaluate that. I don't tend to let a microcontroller power anything, it just heats the chip more and things like ADC's will drift further, but then programmers don't understand electronics.