Advanced On/Off boa...
 
Notifications
Clear all

Advanced On/Off board question

19 Posts
4 Users
0 Likes
1,682 Views
(@ndr4684)
New Member
Joined: 7 years ago
Posts: 3
Topic starter  

Hi,  I recently received my advanced on/off and FPC breakout boards. I noticed to get the power board working I had to connect ground from -In to -Out. My question is if I hooked it up wrong or this is intended. from my perspective it might be nice to have this built into the board but I'm kind of a novice and might be hooking things up differently than intended. Aside from that it's working very nicely! I love the trick with the TX pin to automatically power off on shutdown 🙂


   
Quote
(@othermod)
Reputable Member Admin
Joined: 7 years ago
Posts: 356
 

The -in and -out should be connected together already. All that is required for it to function is for the -in to be connected to the GND of the power source. It's only the +5v that switches on and off. I'm thinking it might help if I make a guide for each board so there isn't any confusion.

I very much appreciate the feedback.


   
ReplyQuote
(@woozer)
Active Member
Joined: 7 years ago
Posts: 6
 

Hi,

How should I connect your board if I would use another pin in stead of the TX pin, I could use another IO pin when the pi is booted up, using software? But i guess the cap will drain, cutting the power before i can run such a script?

Thanks

W

 


   
ReplyQuote
(@othermod)
Reputable Member Admin
Joined: 7 years ago
Posts: 356
 

Yeah some software can be used to pull any pin high. If I remember correctly, there is a single line that can be added to config.txt where you specify which pin to pull high and it will operate similarly to the TX pin.

In the meantime, temporarily connect the TX pin and 5V out pin on the board together. That will keep it on and bypass the Pi altogether.


   
ReplyQuote
(@woozer)
Active Member
Joined: 7 years ago
Posts: 6
 

I think you are talking about the gpio-poweroff-overlay settings in config.txt? i'll look into that.


   
ReplyQuote
(@othermod)
Reputable Member Admin
Joined: 7 years ago
Posts: 356
 

Something along those lines.  

dtoverlay=gpio-poweroff,gpiopin=xx,active_low might be what you need (just some quick googling). I don't remember whether there are separate commands to pull high at bootup and to pull low or switch to floating at shutdown.


   
ReplyQuote
 vrpc
(@vrpc)
Active Member
Joined: 7 years ago
Posts: 8
 

I am planning to use this to control a battery supply to the RPi. I added a dedicated charging USB port but in the event that a USB port on the Rpi is plugged in that supplies power I need reverse current protection. Which on your schematic would mean disabling the MOSFET "M1". What would happen if there is a higher voltage on the 5V out?

I was originally planning to use a MCU for on/off control and a load switch (Texas Instruments - TPS22929) but found your solution that wouldn't require flashing MCU's.

In the event that it can't be changed I can still use the load switch. Since I won't be passing much current at all through the MOSFET's could I replace them with cheaper general purpose transistors? It would also make a good cheaper solution for using with a 5v booster with an enable pin.


   
ReplyQuote
(@othermod)
Reputable Member Admin
Joined: 7 years ago
Posts: 356
 

I think a really simple solution is to add a good diode (1A rating or so) on the USB port. That way, your device can use power from the Pi, but it won't go the other way.


   
ReplyQuote
 vrpc
(@vrpc)
Active Member
Joined: 7 years ago
Posts: 8
 

The issue is that I am running the RPi directly from the battery. The voltage drop over a diode will be too much and cause the RPi to go unstable before the battery is depleted far enough to trigger a shutdown, or change the low voltage shutdown value and get much less battery life.

The TPS22929D contains a P-Channel MOSFET. Could I not just use the IRF7319 as M2 and M3 and use the TPS22929D as M1? Hmm.. well I read more into it and it seems like it shorts VOUT to GND when the switch is off or during a reverse current scenario.


   
ReplyQuote
(@othermod)
Reputable Member Admin
Joined: 7 years ago
Posts: 356
 

I'm having a little trouble visualizing your setup. At first it seemed like you were asking for a way to prevent power from flowing into the Pi from the Pi's USB port entirely. So you want the option of powering the Pi from the USB port and from the battery, but you want to prevent it from feeding back to the battery when powered from the USB port?


   
ReplyQuote
 vrpc
(@vrpc)
Active Member
Joined: 7 years ago
Posts: 8
 

I am connecting the battery directly to the 5v pin of the RPi Zero. The 5V line of the RPi is tied to the USB ports that are on the RPi. So in the event that a power source is plugged into the RPi's USB port I need reverse current protection as to not feed 5v to the battery.

So in my circuit I would be connecting VBAT+ to +5V-IN on your circuit.

Side note, the RPi Zero runs perfectly fine directly from the battery in my use case. The RPi uses a PAM2306 DC/DC for the 3.3v and 1.8v lines and the CPU has it's own DC/DC on board. Only the 3.3v line suffers from low battery voltage as it start to drop below 3.3v when the battery is at 3.5-3.45v. In my tests the RPi was still running an emulator even with a battery voltage of 3v but at that point the battery is depleted and should be cut off to prolong life. I only ran a single test but I got 25%+ longer battery run time omitting the 5v booster. Also the USB WiFi adapter I use can run directly from the battery as well.


   
ReplyQuote
(@othermod)
Reputable Member Admin
Joined: 7 years ago
Posts: 356
 

I know it seems like I'm backtracking a little, but I'm trying to figure out whether you actually want to power the Pi from the 5V USB port. 

I'm asking this because originally when I said a diode on the USB was the easiest option, I was saying put the diode on the USB, not the battery . This would require you to break out the USB port. That way, the battery voltage is not reduced. It would slightly reduce the voltage on the USB port though.


   
ReplyQuote
 vrpc
(@vrpc)
Active Member
Joined: 7 years ago
Posts: 8
 

I added a dedicated usb for charging the battery and powering the system. But the Rpi's USB ports will be exposed in the case and is used for a wifi adapter or other. I don't want the rpi's usb ports used to power the system. The other way around it would be to use the added USB port but the 5v line will be connected to the battery charger and it won't be powered.


   
ReplyQuote
(@othermod)
Reputable Member Admin
Joined: 7 years ago
Posts: 356
 

Ok the open RPi USBs complicate it. If you had it broken out then putting the diode on it would probably work. I'm going to ponder on it.


   
ReplyQuote
 vrpc
(@vrpc)
Active Member
Joined: 7 years ago
Posts: 8
 

I think I found a compromise. To give you a visual here is v0.2 of the board.

The Rpi Zero will be moved up and the case will cover up the Rpi's ports and the added USB will be the only port exposed. I am thinking of routing the USB pins to the added USB port and will either remove the ability to add peripheral devices by just having the 5v line go to the charger and have no current out on it (The Zero can still work in USB gadget mode to get the internet this way), or I will use the ETA9740 which is a booster/charger that uses the VIN pin as the VOUT (It was made for battery packs with USB type-C in/out ports). Also could add a footprint for a wifi module on the back and not have any USB support.

What about using a zener diode as over voltage protection that will control a load switch/MOSFET on the low side (BAT- terminal)? The switch would isolate the Rpi's GND from the battery GND.


   
ReplyQuote
(@othermod)
Reputable Member Admin
Joined: 7 years ago
Posts: 356
 

That's exactly the direction I'm pondering on. Using a mosfet that switches off when anything above a certain voltage (4.2v i guess) is supplied to the output side of the fet.

If you prefer to keep the Pi at the bottom and keep the ports available, then there isn't any reason why it can't be done. It's just going to take a little more work. I'm testing a few ideas on everycircuit.com


   
ReplyQuote
(@othermod)
Reputable Member Admin
Joined: 7 years ago
Posts: 356
 

The fet would have to be in addition to the ones already in the on/off circuit (if you're planning to incorporate it)

Also, something just occurred to me. The DW01 dual mosfet protection circuit that's used in most charge boards that use the TP4056 (which it appears you're using) might be able to handle the work here. It will disable the battery as soon as the voltage entering the battery exceeds 4.2v. I use this on my boards. 

The battery would remain disabled until the charger is connected back to the TP4056.


   
ReplyQuote
(@othermod)
Reputable Member Admin
Joined: 7 years ago
Posts: 356
 

http://everycircuit.com/circuit/5768320024576000

Check that out. It's an operational amplifier in the emulator. I would use an LM393.

The other alternative is the zener and a p-fet, but I couldn't get it to emulate properly.


   
ReplyQuote
 vrpc
(@vrpc)
Active Member
Joined: 7 years ago
Posts: 8
 

Don't know why I didn't think of using a battery overvoltage IC. 

The other part of the problem would be that it would bypass the shutdown circuit too. The Rpi would then lose power as soon as the usb port was disconnected. Guess it is best to cover them and avoid the problem.


   
ReplyQuote