User avatar
Posts: 1312
Joined: Sat Jun 02, 2018 1:43 pm
Location: Hong Kong

Re: Raspberry Pi + relay GPIO dont work

Sat Feb 02, 2019 7:04 am

rpdom wrote:
Tue Jan 29, 2019 2:29 pm
tlfong01 wrote:
Tue Jan 29, 2019 1:32 pm
There is 50% chance that only the Pin 40 circuit is damaged, all the rest is still working OK.
There is a very good chance that the rest of the chip will be damaged as the damage will slowly spread across the chip even after the bad voltage has been removed.

Latched Up Rpi Post Mortem

Ah, I always thought that Rpi was like the human body - if one of the 10 fingers is burnt, all the rest 9 fingers will still work happily. There is a automatically set up hard border between the bad finger and the good fingers, in other words, damage would be confined and controlled.

It was only last year when one of my Rpi's passed away prematurely, then I realized that Rpi is so stupid, compared to the intelligent humans.

Let me tell you the sad story of the miserable, probably latched up Rpi. I was experimenting with different things, including over voltage and current, inverted power polarity, over current drive (source and sink), over cpu frequency drive etc. Those were the days until one morning I woke up and found my Rpi seemed not behaving as usual - one weird thing I still vividly remember is the following:

I used sudo or gui command to hardware shut down the Rpi, it always did not hardware shut down, but only software reboot. I changed SD cards but the symptom did not go away.

At that time, I thought perhaps the boot ROM was corrupted, so did not load the OS correctly. But after perhaps a couple of weeks, my Rpi passed away suddenly, without any warning (I did not make any hardware or software changes in the previous couple of days).

Looking back, I guess the Rpi already fell ill long before resting in peace, though its risk seeking master did not notice anything.

My verdict is that the cause is latching up, and the damage spread over a couple of weeks, ...

So I now think all the risk seeking Rpi newbies should seriously study the latch up thing before just wanting to have fun. :mrgreen:

Those Were The Days - Mary Hopkin 24,602,200 views

Girls Just Want To Have Fun - Cyndi Lauper 702,496,996 views

Update 2019feb03hkt2157 - Latch Up References

Latch-up - Wikipedia

A latch-up is a type of short circuit which can occur in an integrated circuit . More specifically it is the inadvertent creation of a low-impedance path between the power supply rails of a MOSFET circuit, triggering a parasitic structure which disrupts proper functioning of the part, possibly even leading to its destruction due to overcurrent.

The parasitic structure is usually a PNPN structure which acts as a PNP and an NPN transistor stacked next to each other. During a latch-up when one of the transistors is conducting, the other one begins conducting too. They both keep each other in saturation for as long as the structure is forward-biased and some current flows through it.

The latch-up does not have to happen between the power rails - it can happen at any place where the required parasitic structure exists.

A common cause of latch-up is a positive or negative voltage spike on an input

or output pin of a digital chip that exceeds the rail voltage by more than a diode drop

Another cause is the supply voltage exceeding the absolute maximum rating, often from a transient spike in the power supply.

It leads to a breakdown of an internal junction.

Parasitic structure - Wikipedia

In a semiconductor device, a parasitic structure is a portion of the device that resembles in structure some other, simpler semiconductor device, and causes the device to enter an unintended mode of operation when subjected to conditions outside of its normal range.

For example, the internal structure of an NPN bipolar transistor resembles two PN junction diodes connected together by a common anode. If a sufficient forward bias is placed on this junction it will form a parasitic diode structure, and current will flow from base to collector.

A common parasitic structure is that of an SCR. Once triggered, an SCR conducts for as long as there is a current, necessitating a complete power-down to reset the behavior of the device. This condition is known as latchup.
I am an electronics and smart home hobbyist.

User avatar
Posts: 1312
Joined: Sat Jun 02, 2018 1:43 pm
Location: Hong Kong

Re: Raspberry Pi + relay GPIO dont work

Thu Feb 07, 2019 2:38 pm

tlfong01 wrote:
Tue Jan 29, 2019 1:32 pm
Dam_Fr wrote:
Tue Jan 29, 2019 8:24 am
I have some 3.3K and 10K resistances, I must connect a 10k resistance between GPIO PIN 40 and 5V ?
Connecting GPIO pin through 10k to 5V
Rpi's GPIO pins are not 5V tolerant, which means 5V is fatal...

Rpi GPIO Latch Up Discussion

The article in the appendix below has an explanation on why you should not connect a GPIO pin to 5V through a resistor.

I think either of the two situations below has the risk of latching up the GPIO pin and may cause severe damage to Rpi.

(1) Setting input mode to a GPIO pin which is connected to the input pin of a low trigger relay, because essentially you are connecting the GPIO pin to the 5V through the relay coil (X), and the transistor Collector Base junction (Y), and resistor + LED (Z) (see schematic below).

(2) Connecting GPIO pin to 5V through a resistor.

Appendix - Warning on dangerous pulling up GPIO pin to 5V

GPIO Electrical Specifications Raspberry Pi input and output pin voltage and current capability - Mosiac Documentation Web ... ifications

GPIO pin circuitry

The internal diodes shown in the figure are not really substrate diodes, but they are actually parasitic FETs.

Electrically, their I-V characteristic looks like a diode's, but with a greater forward drop and a more gradual knee.

They may protect against low current transient events caused by transient out-of-range voltages applied to the pins, but they are not intended to protect against the application of voltages greater than the supply voltage or less than ground, even with an external series resistor.

In brief, you should never deliberately forward bias those "diodes". Consequently, you can not safely place an external pull-up resistor to 5V on the I/O pin. That would forward bias a parasitic FET and owing to its poor internal impedance to the chip's internal power rail it may overheat, or worse, it may bias up parts of the chip to voltages greater than they can handle.

So, don't do it!

latching_up_risk_2019feb0701.jpg (172.2 KiB) Viewed 1690 times
I am an electronics and smart home hobbyist.

Posts: 5
Joined: Wed Dec 21, 2016 6:18 am
Contact: Skype

Re: Raspberry Pi + relay GPIO dont work

Fri Nov 13, 2020 12:36 pm

I did it my way:
This is working on a Raspberry 2, switching the battery charger for inverter-system off when we are off-grid (rural area in Thailand with frequent power-breaks)
For the quick picture below I connected the base of the transistor (via 1kΩ resistor) with 5V, but I tested further with a battery 1.2V and as mentioned before this is operational with a Raspberry 2B on a GPIO output.
This assembly is very responsive, there is already action, when I touch the base of the transistor. The green LED turns on and the relay begins buzzing.
solution.png (75.93 KiB) Viewed 345 times
IMG_20201113_143302.jpg (183.57 KiB) Viewed 445 times
IMG_20201113_143429.jpg (243.34 KiB) Viewed 445 times

Return to “Other”