Pi install

From: Peter (BOUGHTONP)26 Aug 2018 22:19
To: graphitone 48 of 92
> There must also be some kind of inbuilt shutdown script

Heh, so yeah, that's a really simple solution - that loser Xen would have pointed it out ages ago if he were here.

You can use systemd to hook into system events (like shutdown), so you can create simple service like this one with Before=shutdown.target:

[Unit]
Description=/etc/rc.local.shutdown Compatibility
Before=shutdown.target

[Service]
ExecStart=/bin/true
ExecStop=/etc/rc.local.shutdown
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target

Where /etc/rc.local.shutdown is a script containing the original echo 0 > /sys/class/backlight/rpi_backlight/bl_power (prepended with #!/bin/bash line) and once you've enabled that service, any time the system is shutdown - whether via Kodi or command line or the button - it triggers the script and turns off the backlight.

From: graphitone26 Aug 2018 22:19
To: All Peter (BOUGHTONP) 49 of 92
Okaaaaay... I've created a shutdown file here:
 
Code: 
/storage/.config/shutdown.sh

And created this script, putting in the backlight command under the poweroff option.
 
Code: 
case "$1" in
  halt)
    # your commands here
    ;;
  poweroff)
    # your commands here
    ;;
  reboot)
    # your commands here
    ;;
  *)
    # your commands here
    ;;
esac

This works with the software power off, but will mean I need to flick the power switch (which'll be mounted in an under counter cupboard) to get it to turn back on. So, not ideal, but it'll work for now. :)
EDITED: 26 Aug 2018 22:20 by GRAPHITONE
From: ANT_THOMAS26 Aug 2018 22:21
To: graphitone 50 of 92
If I'm understanding what you want to do there is a pin available on the RPi to reset the board/power. Connect a button, press it, and it'll act a soft on type button by resetting the RPi from its shutdown state.
From: graphitone26 Aug 2018 22:23
To: ANT_THOMAS 51 of 92
Ah, that'd be damned useful, providing it's somewhere between 1 & 10 and isn't 5!
From: ANT_THOMAS26 Aug 2018 22:24
To: graphitone 52 of 92
It's totally separate. It's called "run". Different location on different versions of raspberry pis but the newer ones have it.
From: graphitone26 Aug 2018 22:27
To: ANT_THOMAS 53 of 92
Found this which seems useful, I'll have a read before bed:

https://www.raspberrypi.org/forums/viewtopic.php?t=218600
 
From: ANT_THOMAS26 Aug 2018 22:31
To: graphitone 54 of 92
That's the one. When you momentarily connect Run to Ground it resets.
On previous models the pin next to Run was also ground, so you could just use those two pins. But on the latest 3B+ (?) the pin next to Run isn't ground, so you need to use a ground on the GPIO header. Which can be any, even if it's used by something else. Ground is ground.
From: graphitone26 Aug 2018 22:33
To: ANT_THOMAS 55 of 92
Brilliant. Yeah, the GPIO ground advice is on that site too.

Now I just need a 2 pin header and some soldering skills. :/
EDITED: 26 Aug 2018 22:33 by GRAPHITONE
From: ANT_THOMAS26 Aug 2018 22:37
To: graphitone 56 of 92
It's a doddle. But understandably daunting if you don't solder much. You can probably buy a big bag of headers on ebay for 99p.

Watch a few video tutorials on soldering headers. Bluetack is useful.
From: graphitone27 Aug 2018 16:36
To: ANT_THOMAS 57 of 92
Ok, I dug out an old circuit board from a long unused modem and found a set of headers on there that I could remove. I watched a lot of youtube videos on soldering and unsoldering and have discovered that many americans can't pronounce solder. Preferring to leave the 'l' out and making it 'sodder'. :|


Anywho, after a bit of practicing, I unsoldered them, took two out and soldered them onto the Pi. It's not the neatest or straightest, but they're in.

The circuit does work, I've just got to test it now with the whole thing assembled. :)

Edit - Yay, the software switch powers it off and the push switch powers it back on. It's working, but there's room for improvement, but that can all be done later, for now it's something I can give to the builders and say stick this in the wall for me.

I wonder if you can script anything on that Run pin... If that can be used to shutdown/sleep the Pi, that'd be ideal.
EDITED: 27 Aug 2018 16:43 by GRAPHITONE
From: graphitone27 Aug 2018 22:08
To: ALL58 of 92
Thanks for your help with getting this far PB and Ant. Tonight's job is getting the momentary switch hooked up. It's got 4 poles and didn't come with a wiring diagram, so a little more experimentation is taking place. :)
From: graphitone 8 Sep 2018 22:47
To: ALL59 of 92
The kitchen project is continuing, albeit slowly, which is why I've not updated this for a while. If anyone's interested in seeing what it's like let me know and I'll post a link to a google drive file with pictures of how the whole thing's going, but although the Pi is working it won't be installed for a good few days as yet.
From: CHYRON (DSMITHHFX) 9 Sep 2018 13:11
To: graphitone 60 of 92
I want to see.
From: graphitone 9 Sep 2018 15:48
To: CHYRON (DSMITHHFX) 61 of 92
Alrighty then. Concept art at the top of the folder, which is what it all should look like by the end of this week. :)

linky
 
EDITED: 9 Sep 2018 15:50 by GRAPHITONE
From: CHYRON (DSMITHHFX)10 Sep 2018 00:24
To: graphitone 62 of 92
Where's the pi thingy?
From: graphitone10 Sep 2018 16:12
To: CHYRON (DSMITHHFX) 63 of 92
It's in a box at the moment. The electricians are doing their 2nd fit this week, so it'll go in then. It's going to sit above the work top where they've put a clock on the 3d drawings. There's 3 double power sockets going along there and it'll sit above the middle one. The power leads are going to go to a double socket hidden in the cupboard underneath, so we won't have any cable clutter. The screen and case I've got don't have an easy way of mounting it all into a recess, so I've got a tablet mounting bracket kit; all it contains is 2 small U shaped bits of plastic that screw into the wall and you drop your kit into them.

The screen needs the protection of the case I've got it mounted in, but it's only ~5mm thick, so isn't going to stand out too much. I would have preferred to have it flush in the wall or something like this, but that's hideously expensive for what it is.
EDITED: 10 Sep 2018 16:25 by GRAPHITONE
From: william (WILLIAMA)11 Sep 2018 11:16
To: graphitone 64 of 92
O.M.G. that is expensive. A flat screen with a case to fit a back box and not much change from £500 with tax. Couldn't you put something together with a screen like this and an ordinary back box from Screwfix or somewhere? 

And having reread your post, that's pretty well what you're doing, almost.
EDITED: 11 Sep 2018 11:21 by WILLIAMA
From: william (WILLIAMA)11 Sep 2018 11:18
To: william (WILLIAMA) 65 of 92
Just had another look at that Amazon ad. If that's a 7 inch touch screen then that's a teeny weeny hand.
From: graphitone11 Sep 2018 11:38
To: william (WILLIAMA) 66 of 92
Of Trumpian proportions.

The only issue I think we'll have is that the gubbins on the back of the Pi sticks out a fair way at the back and I'm going to have to (for want of a better expression) "roll" it into the brackets, then slide it down into them, so the hole in the wall is going to have to be bigger than it needs to be.
EDITED: 11 Sep 2018 12:48 by GRAPHITONE
From: CHYRON (DSMITHHFX)11 Sep 2018 17:56
To: william (WILLIAMA) 67 of 92