RaspTech wrote: ↑
Sun Mar 31, 2019 10:07 pm
Hello guys, I'm medium experience raspberry enthusiast. I really enjoy what pi3B+ offers(hardware, software, documentation), but there's one thing I cant figure out. I want make proper power on/power off module for raspberry pi 3B+. However gpio shutdown or pin RUN, functions more like desktop power button, which bothers me...
Deal is I have constant 5V and GND for supply, but problem is 1 input from environment, its 5V ignition wire(ill convert it to 3v for rasp gpio, no problem here). I want that this 1 wire could control raspberry powering up and powering off. EG if 5V ignition is present at gpio it will poweron but if its 0volt, it will poweroff. I think I might need use 2 gpio pins with a relay for that and custom /boot/config.txt? Ive cant find solution for that, please help.
The best one I came up is to install relay that switches ground between gpio3 and RUN pins, but the problem is that sometimes 5v ignition changes between 5v and 0v in very fast timing. In that case device have chance to fail to poweroff or power on properly.
So do you mean actual power off/on or send the RPI to sleep/low power mode and wakeup.
Actual power on/off requires the RPI to boot its O/S every time it power up, a delay of say 30 seconds.
Powering down should only be done after you have shutdown the O/S cleanly, otherwise you run a high risk of SD card corruption, and an inability to boot.
Most consumer electronic devices these days do not actually power off they sleep. In the sleep mode they can look for an Interrupt on a given I/O pin then wake up and resume. This is the easiest method,, code only as you dont actually control the power supply.
But if you want true power on off, then its more complicated. You will need external logic to control the power supply via a relay or suitable mosfet. An external voltage latches the power on for the RPI, but only the RPI can clear the latch via a signal it sends when the O/S is clear to shutdown.
Clarify your actual requirements for power or sleep and we can advise on a circuit or code further.