I want to know the purpose of connecting a resistor in parallel to an LED. the schematic below is a part of microchip's Explorer 16/32 Development Board. Full schematic can be found here


The LED's partnumber is QBLP631-IG. the nets P91_LED9 and P92_s5_LED10 are connected directly to the microcontroller's input/output pin and is driven at 3.3V. The jumper is used to isolate the LEDs circuit if needed and use the input/output pins for other purposes (the nets mentioned before are connected to an expansion header).

My thoughts are: maybe the parallel resistor is connected so that if the microcontroller's pin is not configured, the default state is to be used as an input, and hence the resistor is to prevent this pin from floating and connect this pin to ground (by the 36k+2K resistors). floating inputs are unhealthy for a microcontroller.But again, who knows...

  • \$\begingroup\$ If all Pxx_LEDx GPIOs from the MCU are configured as input, and JP2 is removed, the GPIOs will be floating anyway, with or without those resistors. So I don't think it is to apply a default logic level. Honestly, I don't see any reason either. \$\endgroup\$ – dim Jan 3 '18 at 11:18
  • \$\begingroup\$ Have you read the datasheet about the allowed states off the pin? If floating is not allowed and it has no internal protection then this might be a way to keep it from floating \$\endgroup\$ – PlasmaHH Jan 3 '18 at 11:20
  • \$\begingroup\$ When driving that 8 bit bus from the header with the jumper out, some current will flow through those LEDs if some of the lines are pulled low. Maybe a cheap and nasty bus monitor? R values are huge in general though esp for 3.3V \$\endgroup\$ – Trevor_G Jan 3 '18 at 11:53

The resistors are there to make sure that the pin is pulled all the way to ground when the LED is off.

This is important, for example, when you are using RMW (read-modify-write) operations to toggle individual LEDs. When you read all 8 pins, the LEDs that are supposed to be off could still read as "1" because of the forward voltage of the LED. When you write the byte out again, those LEDs will now turn on, even though that isn't what was intended.

There are other ways to avoid this problem, but including the resistors follows the principle of "least surprise" — especially for the newbies who are likely to be using such a board.

A parallel resistor is more commonly seen when you want to use an LED as both a pull-up and an indicator, but it makes sense in this configuration, too.

| improve this answer | |
  • \$\begingroup\$ Since the only thing that can drive an LED is a uC output pin, and the only thing that determines the state of the output pin is the firmware, I don't see a need to "read" the LEDs to determine their status. \$\endgroup\$ – AnalogKid Jan 3 '18 at 13:41
  • \$\begingroup\$ @AnalogKid: Look again. Some of those pins are shared with other functions. And keep in mind that this board is not designed for a single specific microcontroller; it is intended to support a wide range of chips plugged into the daughtercard socket. \$\endgroup\$ – Dave Tweed Jan 3 '18 at 13:50
  • \$\begingroup\$ Wouldn't it be wiser to do read-modify-write operations by reading the port output latch register of the MCU (I believe called "LAT" in PIC MCUs) rather than by reading the actual port state ("PORT" register in PICs)? This completely eliminates the risk you're mentioning, and seems much safer. \$\endgroup\$ – dim Jan 3 '18 at 13:51
  • \$\begingroup\$ @dim: That's exactly what I was alluding to in the third paragraph. \$\endgroup\$ – Dave Tweed Jan 3 '18 at 13:54
  • \$\begingroup\$ Dave - Tried to edit my comment; it took too long to wade through such a poorly drawn schematic. \$\endgroup\$ – AnalogKid Jan 3 '18 at 13:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.