Uncategorized

Latching up comments

0

enter image description here

I am trying to read a signal coming from an external circuit thru the use of raspberry pi’s gpio. the signal I am trying to read is a 3.3V signal coming from a voltage divider circuit. this circuit also has an external power source (not coming from Rpi both VCC and GND.) I’m a bit lost to what I am missing. Thanks!

  • Have you connected the grounds of the Pi and the external device? – joan Apr 16 at 3:24
  • @joan yep I connected the ground of the pi and the externad device. I noticed that when I turned on the external device. the Rpi I’m using is somehow turned off. that is I am using a VNC viewer to view that behavior of my code. but as I mentioned when I turn on the device that Rpi is disconnected. – Rikku Apr 16 at 4:33
  • It’s worrying if the Pi switches off. That suggest a serious problem with the wiring. Clear photos showing the wiring may help. – joan Apr 16 at 8:23
  • @joan The Pi didn’t actually turned off. I only assumed that it was not functioning normally. during my testing earlier, I connected the signal from the device 3x and the VNC viewer got disconnected 3x also. so I assumed that that was the case. – Rikku Apr 16 at 11:31

-1

read signal from external circuit by Rpi GPIO

signal is 3.3V from voltage divider

circuit divider circuit has external power not Rpi

Well, if the divider Vcc is 5V or higher, there is risk that the Rpi will be fried, or life shortened. The cause is usually called the “latch up” effect, when Rpi GPIO is connected by a resistor to 5V or higher, as illustrated below.

A way to get around is to use a digital buffer between Rpi GPIO and the signal to read.

rpi latch up

Update2019apr22hkt1559

And if you wish to measure AC/DC current of motor/pump/batteries, you might like to read my answers of the following posts.

The Pumps to measure current flowing

The OP's Pump

tlfong01's ppumps

References

Measuring Battery DC Current using ADC

Measuring AC Motor Current using ADC

  • 2
    This is totally incorrect! Learn some circuit theory. – Milliways Apr 16 at 4:08
  • hello I noticed that when I connected the output of my voltage divider to the gpio of rpi the rpi is somehow turned off.. – Rikku Apr 16 at 4:13
  • @Rick Joseph Amodia What do you mean by “turn off”? Do you need to use reset button at the Rpi board, or power off and on to turn on the Rpi? Can you show us a schematic diagram of what is behind the voltage divider? If the top of the voltage divider is much above 3V3, you might be in big trouble. The Rpi GPIO is not 5V tolerant, that means if 5V or higher is directly connected to Rpi GPIO, the Rpi will drop dead immediately. If you connect 5V or higher through a resistor, there might be latching up and you Rpi’s life might be shortened, if not immediately go crazy. – tlfong01 Apr 16 at 4:58    
  • @tlfong01 I am using VNC viewer to view the behavior of my code when I connect the ouput of the external circuit to the rasppi somehow when I turn the device on the VNC view is disconnected so I assume that the rasppi is somewhat offline. – Rikku Apr 16 at 5:09
  • @tlfong01 I added the picture above.. Am I missing something here? during the simulation of this circuit I only Used Rpi’s 5V source and connected it to a switch and a voltage divider circuit. when the switch is closed a signal is sent to a GPIO pin of the rpi.. the circuit worked fine then.. I did not encounter this type of problem before. So I hope you can enlighten me. – Rikku Apr 16 at 5:25
  • @Rick Joseph Amodia Are you using CircuitLab to simulate your circuit? But what works in virtual CircuitLab does not mean it will work in the real world. I still find your 18V source dangerous. I would suggest to use 3V3 source, divide by 10K + 10K to get the about 1V8 you want. Rpi will be more than happy to read it. Let me know if my suggestion does not work. – tlfong01 Apr 16 at 5:45   
  • @tlfong01 nope.. Actually I have an actual circuit righ now.. the values you see in circuit diagram are the actual values I am using with my circuit. I have also measured the voltages both input and ouput. I modified the circuit from outputting 3.3V to 1.8V as I have suspected that I am overloading the Pi’s GPIO but the problem still persist. – Rikku Apr 16 at 5:59
  • @tlfong01 I connected that 18V to a voltage divider circuit that ouputs a 1.8V. I got the 18V supply from a liquid filling machine I am working with. and I did some code that will detect if a signal is sent to rpis gpio which in turn that will output a message that the machine is online or powered on. – Rikku Apr 16 at 6:02
  • @Rick Joseph Amodia Well let us make things as simple as possible, but not simpler. I would suggest the following: (1) Forget the 18V voltage divider and the liquid filling thing. (2) Instead, just add up two 1.5V batteries to make 3V, and let Rpi read it. If Rpi can read it, then let us look again. If Rpi python cannot read a 3V battery, then of course it it the python program’s fault! One more thing – don’t flip any power switch after you connect and run your program. Power on, connect the signal to Rpi, then run your python program. – tlfong01 Apr 16 at 6:11    
  • @tlfong01 okay will do that.. I will isolate the problem one by one. – Rikku Apr 16 at 6:22
  • @tlfong01 have you experienced tis kind of problem before?. I also noticed earlier when I touched the Rpi’s Heat sink (the Big one) it was much hotter thatn normal operation time. Also I would like to ask, Do I still need to connect the raspberry pi’s ground to the external circuits’ ground?. – Rikku Apr 16 at 7:37
  • @Rikku Ah, last year I fried one Rpi3B+ because of casually applying over voltage to Rpi. That is why now I am so concerned about any possible latching up problem. I did not understand you heat sink question. Yes, you MUST connect Rpi ground to you signal ground. – tlfong01 Apr 16 at 7:49   
  • @tlfon The heatsink part was not a question.. I only stated that there was an irregular heating of heatsink during the period i applied the signal to the rpi’s gpio. does this mean that the rpi was overloading? or too much current is passing through gpio even thought the voltage was low? – Rikku Apr 16 at 11:29
  • @Rikku Ah let me see. I usually make a very rough calculation. There is current going down through the 20k to Rpi. Suppose Rpi is Low or near 0V, then the current is 18V or roughly 20V/20k ~= 1mA. Rpi can sink 2 to 16 mA. So should not heat up anythings. My calculation is always dodgy, so you better verify it. – tlfong01Apr 16 at 12:21   
  • @tlfong01 I took your advice, I created a circuit using push button and a LED, I also wrote a program that would detect if the button is pressed then the Rpi turns on the LED. The circuit and program worked fine.. so I tried running my nodeJS code that detects if the button is press and return a message “Button is On”. and pooof the problem occurred again. this time I notice that the yellow LED on the rpi’s board stopped blinking. I think that the Rpi froze? or Am I wrong?. Please enlighten me. – Rikku Apr 17 at 1:29
  • I am a little bit confused. Did you mean you first wrote a test program in python to read a button and switch on a led, and the python program worked? And then you tried your nodeJS program and it doesn’t work? Then of course the nodeJS program is to blame. Perhaps you can show us the nodeJS program listing so everybody can join in to find the bug. – tlfong01 Apr 17 at 1:44   
  • @tlfong01 We already solved it thanks to you.. I also thought that the node JS is causing the problem. it was due to the polling. the polling was too short. we adjusted the polling and voila it now works perfectly. Thanks!– Rikku Apr 18 at 1:04
  • How nice to hear the good news. Happy programming. 🙂 – tlfong01 Apr 18 at 1:36   
  • @tlfong01 have you ever tried working with pumps like this one (zonesun-technology-limited.myshopify.com/products/…)?.. I am having a hard time on reading correctly the signal coming from its terminal. through RPi gpio.. – Rikku Apr 22 at 7:35
  • What I did was.. I made a parallel connection to the terminal of this pump. hoping to get a signal everytime the pump switches on. the signal I got from the parallel connection was arround 13-14V so I connected it to a Voltage divider circuit. then the ouputof the voltage divider is connected to RPi GPIO. but the RPi reads the signal as high even though the pump is not yet turned on. – Rikku Apr 22 at 7:39
  • Yes, I am also playing with pumps. You might also like to read the update at the bottom of of my old answer.– tlfong01 Apr 22 at 8:01   
  • @tlfong01 is is possible to have an NPN transistor as input of RaspberryPi GPIO – Rikku Apr 23 at 4:09

Categories: Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: