External Status LED's for Raspberry Pi (without GPIO) en

By SuperKris on Sunday 19 February 2017 17:23 - Comments (6)
Categories: Elektronica algemeen, Raspberry Pi Algemeen, Views: 3.545

Introduction
The Raspberry Pi is a great device for all kinds of applications. For some of these applications you want to build the Rpi in a housing where the status LEDs are no longer visible. I like to be able to see the LED's for some basic diagnostics.

My solution:
  • Low cost. Componects can be bought for less than § 1,-
  • No connection to GPIO needed.
  • No code needed. Works without any software.
werkend

Here i will explain a simple solution to extend the status LED's to the outside of any enclosure. This solution requires soldering on the PCB of the Rpi, but only in a very simple way. If you have soldered on a PCB before, you can easily do this with risking damaging your Pri.

The Rpi have many test pad's that can be used for all kinds of diagnostics. There are also pad's connected to the status LED's of the Rpi PCB, and we can tap into these. The problem is they will not directly give a suitable voltage (or current) to directly attach a LED. I would much rather have seen these test pads connected differently but we need to work with what we have.

The test pad's give about 3.3V when the LED's is of, and down to 2V when the LED is on. We need to translate this to 0V and 5V so we can sent it to a LED. In basic electronics there is a very simple solution for this. Its called a comparator. Have a look at the schematic below:

Schema LEDs
Schematics

How does a comparator work?
A comparator can be build with a simple OpAmp. A OpAmp has a positive input and negative input. Putting a voltage on the positive input will raise the output voltage. Putting a voltage on the negative input wil lower it. A OpAmp (operational amplifier) wil also amplify the input. You can set is to 0, to 10x, to 1000x, etc. By default the gain is extremely high. For example 100.000 times or even much higher.

In a comparator we can use both characteristics to our advantage. If we compare the voltage of the negative input to our positive input we can calculate the output.

For example: -5V + 6V = 1V. Simple right? Now if we multiply this by 100.000 we get a output voltage of 100.000V. Off course this if far from possible, so what happens in the real world? The opamp "clips" to the available power supply (minus a small voltage needed by the OpAmp to work) As a opamp has a positive power supply (Vcc+) and a negative power supply (Vcc-) the opamp will clip to Vcc+ in this example.

So a comparator can compare a reference voltage to a measured voltage an tell you which one is higher. If you use a positive power supply only(Vcc+) of 5V (Vcc- connected to GND) and you have a 0,001V (1mV) difference between your voltage reference and the measured voltage, the output of the comparator will be either 0V or 5V. This is great for controlling a LED. The average power output of a opamp is enough to supply enough power to a few LED's

LED PCB
The PCB with comparator and LED's.

Back to the test pad's. We know ther voltages are approx 3,3V with the LED's off, and 2V with the LED on. If we compare this to 2,65V (the number between 2 and 3,3) the comparator can easily tell if the LED is on or off.

So we need a reference voltage (Vref) for the comparator to work with. Actually anything below 3,3V and above 2V will do, but these voltages may vary a little bit. A voltage divider with resistors is the most simple way to do this.

2 resistors of the same value connected between 5V (Vcc) and GND will give 2,5V, This is close enough so this will work fine in most cases. If 5V however is actually 4,5V the output of the divider will be 2,25. If you use the populair E12 resistor series you can have a 10% error in the resistor value. This can make your Vref drop below 2V. Therefore i prefer setting the Vref manually with a precision trim potentiometer. I most cases however 2 resistors will work just as good.

Rpi PCB testpoints
Connecting the test pad's

Connecting the test pad's to the Rpi PCB
I prefer a detachable connection to the Rpi, so here is how i connected this. I soldered some small AWG26 wires (out of a old network cable) to the test pads. Don't use to much solder and strip the wires for only 1 or 2mm.

I used a standard cheapass female 2.54 pitch header as connector. Simply cut it into the right size. Glue it to the PCB at a spot you like, and solder the other ends of the wires to it. Another option is to use the populair aliexpress/ebay jumper cables (also called dupont connector). Glue the female side to the PCB, and cut of the other side and solder.

I recommend getting a hot glue gun at you favorite hardware store. These are great for gluing electronics components together.

Comments



By Tweakers user SuperKris, Monday 20 February 2017 11:49

Ok, er zijn absoluut veel makkelijkere methodes om een status LED aan te sluiten. Ik had echter 2 eisen waar een oplossing zoals die uit jouw link niet aan voldoet.

- Geen gebruik maken van de GPIO (deze is bij mij al geheel in gebruik)
- Geen code of gebruik van software. Deze oplossing functioneerd zelfs zonder OS

By Tweakers user himlims_, Monday 20 February 2017 13:36

SuperKris wrote on Monday 20 February 2017 @ 11:49:
[...]


Ok, er zijn absoluut veel makkelijkere methodes om een status LED aan te sluiten. Ik had echter 2 eisen waar een oplossing zoals die uit jouw link niet aan voldoet.

- Geen gebruik maken van de GPIO (deze is bij mij al geheel in gebruik)
- Geen code of gebruik van software. Deze oplossing functioneerd zelfs zonder OS
systeem lijkt me wel interresant - is dat echt Ri3 voor nodig/ of kan dat op de orginele 1 ook nog?

By Tweakers user SuperKris, Monday 20 February 2017 14:12

himlims_ wrote on Monday 20 February 2017 @ 13:36:
[...]
systeem lijkt me wel interresant - is dat echt Ri3 voor nodig/ of kan dat op de orginele 1 ook nog?
Ik durf het je niet met zekerheid te zeggen. Als de aansturing van de LED's hetzelfde is in principe wel. Er zijn echter verschillende revisies van de raspberry Pi 1, en dan heb je ook nog eens de A, de B, en de B+.

Op deze link kan je de schema's van de raspberry's terugvinden. Ik heb net even snel gekeken, maar ik zie de test pads er iig niet in terug. Dat betekend niet persee dat deze er niet zijn natuurlijk.

Bij de Pi 2 zijn de betreffende test pad's volgens mij wel hetzelfde.

By Tweakers user fastedje, Tuesday 21 February 2017 20:57

Als je gebrek hebt aan GPIO pennen dan is zijn i2c/spi io extenders ook heel handig zoals de MCP23017. Je kan er meerdere gebruiken door verschillende ICs een ander adres te geven.

By Tweakers user SuperKris, Wednesday 22 February 2017 09:17

fastedje wrote on Tuesday 21 February 2017 @ 20:57:
Als je gebrek hebt aan GPIO pennen dan is zijn i2c/spi io extenders ook heel handig zoals de MCP23017. Je kan er meerdere gebruiken door verschillende ICs een ander adres te geven.
Die zijn zeker handig ja! Ik heb ook al een MCP23017 ingebouwd in een aparte I/o module die via een soort van bus connector (I2C) is verbonden. Status LED's via een dergelijke IC kan heel goed, maar hier heb je natuurlijk wel het 1 en andere aan code bij nodig.

Comment form
(required)
(required, but will not be displayed)
(optional)

Please enter the code from the image below: