[Guide] Graceful shutdown switch without Pololu [RETIRED]

Various user-contributed guides for hardware-related things
User avatar
Camble
Posts: 881
Joined: Thu May 05, 2016 2:31 am
Location: Scotland
Has thanked: 269 times
Been thanked: 487 times

Re: [Guide] Graceful shutdown switch without Pololu

Post by Camble » Thu Nov 10, 2016 8:12 am

@tescorg Looks like it might work in theory. Reminds me of this solution out https://github.com/NeonHorizon/lipopi

In my experience, the PowerBoost doesn't seem stable when the EN pin is pulled high externally like this. The LEDs oscillate and I personally wouldn't use it in this state.

The only way to know is to build and test it.

tescorg
Posts: 6
Joined: Wed Aug 31, 2016 6:28 pm
Has thanked: 3 times
Been thanked: 3 times

Re: [Guide] Graceful shutdown switch without Pololu

Post by tescorg » Thu Nov 10, 2016 10:35 am

cool @ that link. That does look very similar to my idea, even down to the resistor values. But they did not use a transistor at all, which means they're feeding VBAT directly into a GPIO pin while the button is depressed. Is that ok? vbat can potentially reach 5volts (with usb connected and battery disconnected).

Can you elaborate on what you mean about the powerboost not being stable when en is pulled high? And what LEDs oscillate?

User avatar
Camble
Posts: 881
Joined: Thu May 05, 2016 2:31 am
Location: Scotland
Has thanked: 269 times
Been thanked: 487 times

Re: [Guide] Graceful shutdown switch without Pololu

Post by Camble » Thu Nov 10, 2016 11:25 am

@tescorg It's not a good idea to have any GPIO pins sitting at 5v. I investigated most, if not all of these solutions when I was struggling with this problem. I can't remember the specifics of them all, but I rejected them for various reasons.

I think the charging and low batt LEDs were the ones flickering away. Using the circuit in that link I posted, if you held down the momentary switch you'd get the same effect. It's not an issue with a momentary switch, but the DMG-01 doesn't have a momentary switch.

tescorg
Posts: 6
Joined: Wed Aug 31, 2016 6:28 pm
Has thanked: 3 times
Been thanked: 3 times

Re: [Guide] Graceful shutdown switch without Pololu

Post by tescorg » Sun Nov 13, 2016 3:22 pm

So with the confidence that I wasn't going to fry anything with my circuit :lol: I went ahead and built a mockup on a breadboard and tested my circuit. It seemed to work perfectly fine. I did not notice any LEDs blinking, the charge LED stayed on steady while charging, and stayed off steady when not charging.

I will go ahead with this circuit in my project and hopefully I don't have any issues in the future.

Thanks Camble.

User avatar
Camble
Posts: 881
Joined: Thu May 05, 2016 2:31 am
Location: Scotland
Has thanked: 269 times
Been thanked: 487 times

Re: [Guide] Graceful shutdown switch without Pololu

Post by Camble » Mon Nov 14, 2016 5:43 am

@tescorg That's great! I had tried a few enhancement mode MOSFETs when I was building the circuit, but at the time my knowledge of semiconductors was limited.

With all the problems sourcing working JFETs, using a BJT may be a more reliable alternative.

One more thing. You may notice that the EN pin sits between VBAT and GND. This is so you can use a 3 pin switch to pull EN up/down. So using a BJT on VBAT is perfectly viable.

User avatar
bigrich424
Posts: 16
Joined: Thu Oct 27, 2016 10:06 pm
Has thanked: 7 times
Been thanked: 6 times

Re: [Guide] Graceful shutdown switch without Pololu

Post by bigrich424 » Mon Nov 14, 2016 7:11 am

Following.
"Unix gives you just enough rope to hang yourself -- and then a couple
of more feet, just to be sure."

User avatar
Ganreizu
Posts: 552
Joined: Thu May 05, 2016 8:20 am
Has thanked: 168 times
Been thanked: 97 times

Re: [Guide] Graceful shutdown switch without Pololu

Post by Ganreizu » Mon Nov 14, 2016 8:36 pm

@camble: Can I get a command to remove the shutdown script from startup? I need to do things to the SD card through a separate raspberry pi 2 and the script is shutting it down since the hardware isn't there.

User avatar
HoolyHoo
Posts: 731
Joined: Sat Jul 09, 2016 9:34 pm
Has thanked: 201 times
Been thanked: 725 times

Re: [Guide] Graceful shutdown switch without Pololu

Post by HoolyHoo » Mon Nov 14, 2016 9:35 pm

Ganreizu wrote:@camble: Can I get a command to remove the shutdown script from startup? I need to do things to the SD card through a separate raspberry pi 2 and the script is shutting it down since the hardware isn't there.
At the command prompt type, crontab -e, then comment out the line that starts the script by typing a # in front of it. Save with control X and then reboot. Reverse this to start script again.
Last edited by HoolyHoo on Wed Nov 16, 2016 6:30 am, edited 1 time in total.

User avatar
Ganreizu
Posts: 552
Joined: Thu May 05, 2016 8:20 am
Has thanked: 168 times
Been thanked: 97 times

Re: [Guide] Graceful shutdown switch without Pololu

Post by Ganreizu » Tue Nov 15, 2016 8:25 pm

HoolyHoo wrote:At the command prompt type, sudo crontab -e, then comment out the line that starts the script by typing a # in front of it. Save with control X and then reboot. Reverse this to start script again.
Hmm so i go into the file and there's nothing that isn't uncommented. No reference to the shutdown script at all. It just has a bunch of instructions that I assume was always in the file, all lines with # already.
IMG_2010.PNG
IMG_2010.PNG (998.09 KiB) Viewed 2892 times

User avatar
HoolyHoo
Posts: 731
Joined: Sat Jul 09, 2016 9:34 pm
Has thanked: 201 times
Been thanked: 725 times

Re: [Guide] Graceful shutdown switch without Pololu

Post by HoolyHoo » Wed Nov 16, 2016 5:21 am

Ganreizu wrote:
HoolyHoo wrote:At the command prompt type, sudo crontab -e, then comment out the line that starts the script by typing a # in front of it. Save with control X and then reboot. Reverse this to start script again.
Hmm so i go into the file and there's nothing that isn't uncommented. No reference to the shutdown script at all. It just has a bunch of instructions that I assume was always in the file, all lines with # already.

IMG_2010.PNG
Well that's strange. I assume you added the start up script with cambles install command correct?

echo "@reboot /usr/bin/nice -n 19 /usr/bin/python ~/GBZ-Power-Monitor_PB/gbz_power_monitor.py" >> mycron; crontab mycron;rm mycron

If you did then that's where it would be unless you decided to start it in rc.local for some reason.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest