This is my first foray into Raspberry Pi (and these kinds of electronics in general) as well as asking questions about it here.

My goal: Attaching a power indicator LED along with a fan (Pimoroni Fan SHIM). For some reason I can't get them working at the same time.

Details: I'm trying to add a simple external power indicator LED that turns on and off with the system. I used the guide found here to wire my LED to the TXD pin (pin 8) and GND (pin 20 because both 6 and 14 are already occupied by other wires). My circuit is as in the guide: TXD -> LED anode -> cathode -> 220ohm resistor -> GND. I'd include the specs of my LED, but I'm not sure what they are... It came with the resistor as a set though, so I imagine they must be appropriate for each other.

Other devices I have installed are a Pimoroni Fan SHIM (here is its pin layout) and a NO momentary switch to turn on/off the system by shorting pins 5 and 6. For the fan, I have a pull-down resistor installed between GPIO18 and GND (pin 14) so that it stays off when the system is off. Both components work as they should.

The whole setup works nearly as intended and the LED lights up fully when the system is on, but it remains half-on when the system is off. I have to unplug the power to turn it off completely. I included pictures at the end for comparison.

According to the guide and as noted by other sources/forum posts/comments I've read, using the TXD pin should be straightforward and work with no real programming. In the end, I was able to get the LED to work perfectly by removing the Fan SHIM entirely. Now I'm suspecting that the fact it uses the very same TXD pin is interfering somehow.

The answer to this post makes it sound like this kind of shared GPIO shouldn't be an issue, but if removing the fan fixes the problem, I'm not sure what else to think. Though the fan is provided with scripts to run fan curves and operate the built-in LED and tactile switch, I haven't installed any of these and I simply turn the fan on at boot with dtoverlay=gpio-fan,gpiopin=18,temp=20000 in config.txt and let its pull-down resistor do the rest.

My question: Is there a way to get this all working while keeping the fan installed, or can I really only use either the LED or the fan, but not both?

Apologies if there's a lot of information in this post. It feels like it's probably a simple problem, but I'm at my wits' end now. Thanks for reading.

Some final stuff if it helps at all:

  • Raspberry Pi 4B, 4GB
  • Official power and HDMI cables
  • RetroPie 4.6

EDIT: Just out of curiosity, I tried wiring up an LED straight to the Pi's first 3.3V pin, and it's lighting up the exact same way it does in my second picture below; a faint point in the middle that persists as long as the Pi is plugged in, on or off. Does that mean anything useful?

Here are those pictures of the LED and the whole circuit:

System on: LED on state

System off with half-lit LED: LED off state

  • I would avoid any GPIO pin that has a secondary use (e.g. BCM 16 or 26) and set this high as part of config.txt This way you do not limit yourself if you need to plug in and sensors that expect pin access. You May still get stuffed though if all 40 are used (Hyperpixel being one) :) – Andyroo Jun 18 at 22:02
  • The fundamental problem is we have no idea what you are trying to achieve – Milliways Jun 18 at 22:48
  • I'm trying to have both my power indicator LED and fan installed and working correctly at the same time, but it seems like they can't coexist this way. Fan works alone or with the LED; LED works alone but not with fan. – user121183 Jun 18 at 23:15
  • Have you got a voltmeter? – Seamus Jun 19 at 0:12
  • I do have a multimeter here. – user121183 Jun 19 at 0:33

I'm not sure if this is really an "answer" since the initial question remains unsolved, but I did get the setup working how I want it to:

I ended up using the GPIO Zero library to control the problematic LED. I made a script the turns the LED on at boot, then turns it off with a press of the power button which then shuts down the system. This allowed me to keep my fan installed and move the LED to a different pin altogether which has eliminated any half-lit weirdness.

Some remarks: first, the LED of course is no longer directly linked to the actual Pi's on/off state, instead relying on and assuming the proper functioning of a button that does directly control it. Second, though I say the LED turns on at boot, the way I have it set up (editing rc.local to run the script at boot) turns it on a bit later in the boot segment than the TXD pin did (it only lights up after all the logos have appeared on the screen), which I don't prefer but is acceptable.

Despite those particularities, the system now behaves as it was meant to, so I'll be going with this for this project. Thanks for the comments I've received in the meantime.

| improve this answer | |
  • Congratulations - you're making progress. I'd encourage you to keep asking yourself these "why" questions, and read, read, read. The connections between the dots will eventually reveal themselves. I commented here because you've said you're using rc.local to run a script at boot... that's generally not a good idea, and you should avoid making a habit of this. Why? I guess a short answer would be that it's a bit like moving into a condemned house - it may not be there much longer. A better, more reliable method to start a script/program at boot use either cron or systemd. – Seamus Jun 20 at 19:22
  • One other comment & I will leave you in peace: Using photographs to communicate component connections is generally not helpful to getting good answers. Instead, try the schematic tool. – Seamus Jun 20 at 19:28

Your Answer

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