On/Of Shim

I have MusicBox image on my pi Zero W with the pHAT DAC, and I can only ssh into it by root, which is the login for Musicbox.
So when I try to sudo apt update etc, I get a message saying I am already root, try logging in as a user. If I knew how I would.

My question is, how do I login to Musicbox as a user and if not, how do I install the required software for the ON/Off Shim?

My plan is to use the pi Zero W headless, but would need to power off at times, so it could be moved to another location.

Try it without the sudo, just type apt-get update. I’m no expert on this stuff but it would be what I would try. Then post back with an “anybody else” if it doesn’t work. ;)

Thanks, that worked fine.

So what would be the answer to my actual question about using the On/Off shim

if you install the clean-shutdownd script then when you press the button on the onoff shim it will initiate a clean shutdown rather than just cut the power so that should be all you need to restart without any peripherals connected.

there are also two holes on the shim marked BTN which allow you to wire up a momentary switch which mimics the button on the shim itself so you could place it in a more accessible place and press when you want to shut down. the one thing I couldn’t find any guidance on was if there is a specific way to hook up the pins to the button (i.e. does it matter which hole is connected to which pin on the switch) my guess is that is doesnt but don’t hold me to that.

edit: just in case it wasn’t clear in alphanumeric’s response to install the onoff shim as root you just drop sudo off the install command as well (sudo essentially means ‘run this command as root’)

The button type you want to use is a normally open, momentary contact. Like a door bell button. When pressed it shorts the two contacts together, and becomes an open circuit when you take your finger off. It doesn’t latch. Something like this will work, https://shop.pimoroni.com/products/mini-arcade-buttons I used those on my Pirate Radio build. The pHat Beat uses those same mini push buttons. My Pirate Radio is in my own custom case so I added my own easy to use buttons for volume, change channel etc. My case is black so I went with all black buttons. It doesn’t matter which terminal is wired to which solder pad. Just solder one terminal to each pad with a wire.

Thanks, but as I am using the pi 3 as a headless music player, would you know which pin holes those mini arcade buttons go in to make the system work, ie switch off when pressed and switch on when pressed.

I am using runeaudio and that has a shutdown or reboot functions when the appropriate button is clicked on. That would be same sort of thing as any on/off buttons wouldn’t it, and I probabley wouldn’t need a specific button.

Its not that simple, you don’t just wire them to GPIO PIN’s. The software has to be in place and coded to use the specific PINs. On my Pirate Radio it was already done for me. The buttons on the pHat Beat are already mapped to specific GPIO PINs. By the Pirate Radio installer.

I just wired my switches to the same GPIO pins the pHat Beat uses. I didn’t have to write any code.

I have done a shut down with a button, in Raspbian, using python code.

How you do it in something like Runeaudio I have no idea.

You started out with a PI Zero and on/off shim, now its a Pi 3 and you want to add buttons?

I started out with the Pi 3b, then got the pi ZeroW free with a magazine sub, and wanted to put both to some use.
I have runeaudio on the pi 3b, which I thought I would need button for , but realised I wouldn’t need them as per my last sentence of my post above.
The zero has musicbox on for the time being, and maybe well used for something else soon.

So no, I don’t need any on/off buttons, and thanks for the link.

No problem have fun. I run OpenElec / KODI on a 3B. And stream internet radio (Pirate Radio) on a Zero W. Last time I took a head count I had 9 Raspberry Pi’s kicking around. Anytime I’m ordering Pi stuff I add a Zero W to the order. For 10 bucks why not. All but 3 are actually in use or dedicated to a project in the works. I’m always looking for ideas to put my spares to some use.

I tried kodi with OpenElec on my pi 3b and it was dog slow, and as I have a tv box to run kodi, I took it off the 3b and put runeaudio on instead.