petermeigs
Posts: 80
Joined: Thu Mar 23, 2017 1:34 pm
Location: Los Altos, California

Re: GPIO.input voltage levels vs edge detection

Tue Jan 01, 2019 6:53 pm

Brandon92 wrote:
Mon Dec 31, 2018 9:48 pm
A okay, a separate power supply is also a very good idea. You could also use something like this power supply. This will give you also a isolation between the two power rails.
Thanks for the tip. It turns out I am using a power supply with two usb sockets https://www.ebay.com/itm/232126014258 anyway so the extra 5v power is easy to come by. I haven't cracked one of these open but one hopes that a circuit failure of some sort on one USB side won't be able to cause any damage (other than perhaps loss of power) on the other.

I started using these power supplies after reading that 5v for the Raspberry Pi power supply might be a little low. I have observed the lightening bolt (and dmesg messages) for undervoltage at boot time on the raspberry pi.

Brandon92
Posts: 617
Joined: Wed Jul 25, 2018 9:29 pm
Location: Netherlands

Re: GPIO.input voltage levels vs edge detection

Tue Jan 01, 2019 8:21 pm

For the Rpi you also need a usb cable that can carry the current that is required for the Rpi. If the wires are to thin in that cable it will cause a to large voltage drop across that wire. And this will trigger that warning on your screen. Assuming that the power supply has a stable output voltage arcross the full output range.

Anyway, those power supply's share often on main power supply and the usb outputs are probably parallel to each other. So, if there is one short on the output. The other one is also "disabled" by that.

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

Re: GPIO.input voltage levels vs edge detection

Mon Jan 14, 2019 12:14 pm

Brandon92 wrote:
Tue Jan 01, 2019 8:21 pm
1. Anyway, those power supply's share often on main power supply and the usb outputs are probably parallel to each other.
2. So, if there is one short on the output. The other one is also "disabled" by that.

PSU and Back EMF etc

1. If you already have a transformer based 24VAC power available, one way is to rectify and filter it to DC24V, then use a DC to DC short circuit protected regulated power supply module to step it down to 5V, then this PSU is floating and its ground is not connected to any other PSU's ground. I think this way your Rpi has the lowest risk.

2. And if you don't use wall warts, but 110VAC to 5V PSU modules with short circuit protection, then one short circuit would not shut down everything.

3. I am playing with 5~12V, 0.5~2A solenoids. I am worrying the high current back EMF is strong. So I am checking it out. You might take a look if interested.

Back EMF picture - Solenoid Lock - tlfong01 2019jan10
viewtopic.php?f=91&t=230325&start=25#p1414587

220VAC in 12VDC 1A out PSU Wiring Notes
viewtopic.php?f=91&t=230325#p1412068

...
Attachments
psu_scheme_2019jan1401.jpg
psu_scheme_2019jan1401.jpg (191.19 KiB) Viewed 294 times
I am an electronics and smart home hobbyist.

Brandon92
Posts: 617
Joined: Wed Jul 25, 2018 9:29 pm
Location: Netherlands

Re: GPIO.input voltage levels vs edge detection

Tue Jan 15, 2019 2:21 pm

tlfong01 wrote:
Mon Jan 14, 2019 12:14 pm
Brandon92 wrote:
Tue Jan 01, 2019 8:21 pm
1. Anyway, those power supply's share often on main power supply and the usb outputs are probably parallel to each other.
2. So, if there is one short on the output. The other one is also "disabled" by that.

PSU and Back EMF etc

1. If you already have a transformer based 24VAC power available, one way is to rectify and filter it to DC24V, then use a DC to DC short circuit protected regulated power supply module to step it down to 5V, then this PSU is floating and its ground is not connected to any other PSU's ground. I think this way your Rpi has the lowest risk.

2. And if you don't use wall warts, but 110VAC to 5V PSU modules with short circuit protection, then one short circuit would not shut down everything.
Well not really in this case. We are talking about a power supply like this:
Image

And depending on the type that he is using. The power for both ports is coming from one internal power supply. So they are not separated. And depending on the implementation of the over-current protection. It could shut down one USB port, but it is also possible that the main power supply has the protection. And the other port is also powered down.

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

Re: GPIO.input voltage levels vs edge detection

Tue Jan 15, 2019 3:18 pm

Brandon92 wrote:
Tue Jan 15, 2019 2:21 pm
And depending on the type that he is using. The power for both ports is coming from one internal power supply. So they are not separated. And depending on the implementation of the over-current protection. It could shut down one USB port, but it is also possible that the main power supply has the protection. And the other port is also powered down.

Just a short reply.

Ah yes, I misunderstood your configuration. In your case, I guess it is just like a usb hub, where all wires inside are connected in parallel. But I am not sure. Actually I always wondered how the neutral line is connected inside the plug. Perhaps I should tear down one, ... :)

Update 2019jan16hkt1005

And it is like the official Rpi PSU

https://shop.pimoroni.com/products/rasp ... wer-supply

...
Attachments
rpi_psu_official_2019jan1601.jpg
rpi_psu_official_2019jan1601.jpg (181.96 KiB) Viewed 243 times
I am an electronics and smart home hobbyist.

petermeigs
Posts: 80
Joined: Thu Mar 23, 2017 1:34 pm
Location: Los Altos, California

Re: GPIO.input voltage levels vs edge detection

Wed Jan 16, 2019 10:38 pm

My two port power supply looks similar to the Sweex Brandon92 is showing except mine had US plugs (although it is rated 100-240VAC 50-60Hz) so with a plug adapter it will work anywhere. It has not Ground pin.

I guess I am missing the concern here. If either socket goes down, it does not matter to me that the other is also down. This is because without power to my water meter reed switch, there is nothing I can measure and without power to the Raspberry Pi, the ticking of the reed switch will go unrecorded. Both are necessary for the system to work.

As a result of everyone's help, (thank you for your insights) I see the point of separating the power used for the raspberry pi and the 24vac detection circuit from the power used for the reed switch at the end of a 30m cable. This will help protect the raspberry pi (a 35USD item).

I'm not too worried about protecting the A3700 as they are not too expensive and I can easily replace one in the socket it it goes bad. The A3700 is an opto-coupler so it should protect the low voltage dc side from the higher voltage AC side if there are spikes.

We have discussed a lot of concerns about connection to ground but the two port USB power supply has no ground pin anyway and I'm not sure how having one would affect (either for good or harm) the 5vdc circuit.

Even the Sweex Brandon92 shows us has no ground. BTW, looking at the picture of the "Official" RPI powersupply, the US plugs have no grounds either and for the UK/Hong Kong plug, the pin that goes into the socket hole for ground looks like it is a non-conductor there for the purpose of unlocking the powered holes in the socket.

I think I am missing something here.

PS. Went skiing in Park City, Utah for a week (Near Salt Lake City). We had great weather except for a worrisome storm while driving the 13 hours to get there. I've been away from my project. I'm back now and when the winter rains here calm down a little, I'll go out and start digging to install the first water meter.

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

Re: GPIO.input voltage levels vs edge detection

Thu Jan 17, 2019 7:24 am

petermeigs wrote:
Wed Jan 16, 2019 10:38 pm
1. My two port power supply, ... It has not Ground pin.
2. If either socket goes down, ... without power to my water meter reed switch, there is nothing I can measure and without power to the Raspberry Pi, the ticking of the reed switch will go unrecorded.
3. Separating the power used for the raspberry pi and the 24vac detection circuit from the power used for the reed switch at the end of a 30m cable. This will help protect the raspberry pi (a 35USD item).
4. I'm not too worried about protecting the A3700 as they are not too expensive and I can easily replace one in the socket it it goes bad. The A3700 is an opto-coupler so it should protect the low voltage dc side from the higher voltage AC side if there are spikes.
5. We have discussed a lot of concerns about connection to ground but the two port USB power supply has no ground pin anyway and I'm not sure how having one would affect (either for good or harm) the 5vdc circuit.

System Power Monitoring and System Ground Discussion

1, 2, 3. I agree you need both PSU working to do the job. So as you mentioned long time ago, perhaps we need a UPS (based on Li ion cell 18650 or National lead battery).

As I concluded long time ago, after playing with A3700, that it is very good for detect main power 110/220VAC. For for low voltage 12/24V AC/DC, I would prefer other devices, such the one below.


Microcontroller [Power] Supervisort Circuit
http://ww1.microchip.com/downloads/en/d ... 11187f.pdf

* Precision monitoring of 3V, 3V3, and 5V0 power
* 7 Voltage trip apoints available.


4. I agree.

5. I have never understood the grounding problem. I have Googled and Wikied many times and still found things confusing. I need to google harder again. One of my problems is that I have a 220VAC fish tank pump, submerged in water. This pump has no ground pin at the mains. So should I submerge a ground line into the fish tank? Need to do some research later. :mrgreen:
I am an electronics and smart home hobbyist.

Return to “Python”