Screen touchable nodes?

Hi All,

My pi is gonna be locked away inside a plastic enclosure by the driveway, so I'm thinking about methods to reboot if needed. Can be done by command-line (normal) or GPIO pins if the pi is locked up. Either way, or both, would be good to have.

Is there a node that I can put on my dashboard that is touch-sensitive but not visible? That way I could intentionally do a reboot (from my phone) but others couldn't accidentally do it.

Russ

You could use a simple "reboot" button that asks for a password. If correct, it will reboot.

You can use ui_notification or adapt this

I've got the soft boot going!.Two large invisible buttons w/o focus in the lower LH and RH corners -> JOIN node -> (2) SWITCH nodes. JOIN combines button presses from both buttons, either ones or zeros for a total of four, then sends that string to each SWITCH node, which are set for different number sequences. With the correct number combo, that SWITCH triggers it's NOTIFICATION node, which then pops up with either "Soft Reboot" or "Hard Reboot". Pressing "Reboot" or "Cancel" -> SWITCH node -> EXEC node with "sudo shutdown" & "-r now". or otherwise for "Cancel". I need to make that shutdown instead of hard boot though.

Still contemplating the shutdown, as it would take some effort to remove/restore physical power to the pi. I guess for the shutdown command, one must remove and restore power? No other way?

If you try this, the buttonLeft & buttonRight backgrounds needs to be #000, I left them red for show.

Russ

[{"id":"e3729e2.ffb6d6","type":"ui_template","z":"c199b9b6.017a2","g":"7e4507b4.d3a11","group":"4ed5c42b.ce13dc","name":"ButtonLeft - 0","order":1,"width":3,"height":3,"format":"<button class=\"buttonLeft\" type=\"button\" ng-click=\"send({payload: 0})\">LEFT</button>","storeOutMessages":false,"fwdInMessages":false,"resendOnRefresh":false,"templateScope":"local","x":240,"y":660,"wires":[["2960ccbf.be310c"]]},{"id":"6fcc0177.b5dc68","type":"ui_template","z":"c199b9b6.017a2","g":"7e4507b4.d3a11","group":"40f30843.03128","name":"misc css","order":1,"width":0,"height":0,"format":"<style>\n\n/* sets font size for ALL text nodes label property */\n.nr-dashboard-theme .nr-dashboard-text .label {\n        font-size: 24px;\n}\n\n/* sets font size for ALL text nodes .value property */\n.nr-dashboard-theme .nr-dashboard-text .value {\n        font-size: 30px;\n }\n \n/* sets OPERATE button properties */ \n.button {\n  display: inline-block;      /* needed to set size/padding */\n  padding: 15px 25px;         /* spacing around button text */\n  font-size: 36px;\n  cursor: pointer;\n  text-align: center;\n  text-decoration: none;\n  outline: none;\n  color: #fff;                /* button text color - white */\n  background-color: #4CAF50;  /* button body color - green */\n  border: none;\n  border-radius: 12px;\n  box-shadow: 0 9px #3c6026;  /* button up shadow color */\n}\n.button:active {\n  background-color: #4CAF50;\n  box-shadow: 0 5px #000;  /* button down shadow color */\n  transform: translateY(4px);\n}\n\n/* sets buttonLeft properties */ \n.buttonLeft {\n  display: inline-block;      /* needed to set size/padding */\n  padding: 48px 24px;         /* spacing around button text */\n  font-size: 48px;\n  cursor: pointer;\n  text-align: center;\n  border: none;\n  color: #000;                /* button text color - white */\n  background-color: #c00;  /* button body color - black */\n}\n\n.buttonLeft:focus {\n  outline: none;\n  box-shadow: none;\n}\n\n/* sets ButtonRight properties */ \n.buttonRight {\n  display: inline-block;      /* needed to set size/padding */\n  padding: 48px 24px;         /* spacing around button text */\n  font-size: 48px;\n  cursor: pointer;\n  text-align: center;\n  border: none;\n  color: #000;                /* button text color - white */\n  background-color: #c00;  /* button body color - black */\n}\n\n.buttonRight:focus {\n  outline: none;\n  box-shadow: none;\n}\n\n</style>\n","storeOutMessages":true,"fwdInMessages":true,"resendOnRefresh":false,"templateScope":"global","x":500,"y":640,"wires":[[]],"info":"NOTE: Do not add comments - everything breaks!"},{"id":"2960ccbf.be310c","type":"join","z":"c199b9b6.017a2","g":"7e4507b4.d3a11","name":"Add #s","mode":"custom","build":"string","property":"payload","propertyType":"msg","key":"topic","joiner":"","joinerType":"str","accumulate":false,"timeout":"3","count":"4","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"num","reduceFixup":"","x":270,"y":720,"wires":[["d0dc4bf9.2fc","aeb00edb.b6a528"]]},{"id":"edac3f02.2edb38","type":"ui_template","z":"c199b9b6.017a2","g":"7e4507b4.d3a11","group":"4ed5c42b.ce13dc","name":"ButtonRight - 1","order":2,"width":3,"height":3,"format":"<button class=\"buttonRight\" type=\"button\" ng-click=\"send({payload: 1})\">RIGHT</button>","storeOutMessages":false,"fwdInMessages":false,"resendOnRefresh":false,"templateScope":"local","x":240,"y":780,"wires":[["2960ccbf.be310c"]]},{"id":"e96dd6d7.e57a28","type":"switch","z":"c199b9b6.017a2","g":"7e4507b4.d3a11","name":"Runs Command","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"Reboot","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":490,"y":780,"wires":[["5d364351.5b309c"],[]]},{"id":"aeb00edb.b6a528","type":"switch","z":"c199b9b6.017a2","g":"7e4507b4.d3a11","name":"0001","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"0001","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":420,"y":720,"wires":[["f1fe023d.1d5e4"]]},{"id":"d0dc4bf9.2fc","type":"switch","z":"c199b9b6.017a2","g":"7e4507b4.d3a11","name":"1001","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"1001","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":420,"y":680,"wires":[["8ff5de7b.6299c"]]},{"id":"8ff5de7b.6299c","type":"change","z":"c199b9b6.017a2","g":"7e4507b4.d3a11","name":"blanker","rules":[{"t":"change","p":"payload","pt":"msg","from":"1001","fromt":"num","to":"     ---- HARD Reboot ----","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":550,"y":680,"wires":[["3b6a731.500c30c"]]},{"id":"f1fe023d.1d5e4","type":"change","z":"c199b9b6.017a2","g":"7e4507b4.d3a11","name":"blanker","rules":[{"t":"change","p":"payload","pt":"msg","from":"0001","fromt":"num","to":"     ---- SOFT Reboot ----","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":550,"y":720,"wires":[["425d72b.58de40c"]]},{"id":"3b6a731.500c30c","type":"ui_toast","z":"c199b9b6.017a2","g":"7e4507b4.d3a11","position":"dialog","displayTime":"10","highlight":"red","sendall":true,"outputs":1,"ok":"Reboot","cancel":"Cancel","raw":false,"topic":"","name":"hReboot","x":690,"y":680,"wires":[[]]},{"id":"425d72b.58de40c","type":"ui_toast","z":"c199b9b6.017a2","g":"7e4507b4.d3a11","position":"dialog","displayTime":"3","highlight":"","sendall":true,"outputs":1,"ok":"Reboot","cancel":"Cancel","raw":false,"topic":"","name":"sReboot","x":690,"y":720,"wires":[["e96dd6d7.e57a28"]]},{"id":"5d364351.5b309c","type":"exec","z":"c199b9b6.017a2","g":"7e4507b4.d3a11","command":"sudo shutdown","addpay":false,"append":" -r now","useSpawn":"true","timer":"","oldrc":false,"name":"Soft Reboot","x":690,"y":780,"wires":[[],[],[]]},{"id":"4ed5c42b.ce13dc","type":"ui_group","z":"","name":"Hidden Reboot Buttons","tab":"81831aab.f2f568","order":7,"disp":false,"width":"6","collapse":false},{"id":"40f30843.03128","type":"ui_group","z":"","name":"Button","tab":"81831aab.f2f568","order":5,"disp":false,"width":6,"collapse":false},{"id":"81831aab.f2f568","type":"ui_tab","z":"","name":"GTO-500 Gate Opener","icon":"dashboard","disabled":false,"hidden":false}]

Errr, forgot my screengrabs, one with colored buttons and one with black bg's:

Actually, with the pi shut down but connected to power, it is possible to restart it using a physical pushbutton. This involves connection to either the RUN or GLOBAL_EN pins on the pc board. I have forgotten the exact recipe, and the pi 4 may be different from earlier models. (Do a Google search and try to filter out the obvious misinformation.) If you attach the button to the outside of the enclosure, you will have pay it a visit but you won't have to open it up.

If I'm reading this article right, using a button click across pin 5 to grd will not only shut down pi, but a second click will restart it. This could be coded in as a software shutdown, but since the pi is "offline" code won't bring it back. As far as an external button goes, this solution seems more elegant than toggling pi's power source. Although in my case, I have a 12v -> micro-USB adaptor than could have a switch spliced right off the 12v battery. I have a new pi case coming that has a fan, and I think pins 1- 6 are blocked away for fan use from the 40p ribbon cable, which would force my hand...

Russ

I have not tried the method in that article or any of the others I have seen that involve the GPIO pins and additional software. What has worked for me on a pi 3 is to shut the pi down using sudo shutdown (either from the command line or an exec node) and then restarting it by shorting briefly between the RUN contact and the adjacent ground contact. These are located next to the 40-pin connector as indicated in red in this photo. Something very similar is possible with the pi 4, but I have not tried it.

This works however be careful how you attach to the contacts.

Some HATs like the UPS Pico HAT use gold plated spring loaded pins (like those used in manufacturing ATE equip) that extend the contacts so the UPS can do a power up. This is possible because this HAT has a micro that is kept alive on a few micro amps and does the shorting of the pins for you.

Would SLCK (pin 23) do the same thing? It appears to be the clock pin for a different protocol. Not sure I'm up for a "test-run" without having someone with more knowledge step in...

Russ

Is this a good idea or a bad idea? I just solder a male header to those two pads and use jumper wires to connect to a push-button switch or logic circuit.

If the header is soldered from the underside then no problems as any spring loaded pin can still make contact with the soldered pads by pressing against the short end of the header. There are 90 degree headers that have a low profile and will easily fit on the underside of the pcb.

It is only a problem if you later wish to go with an intelligent HAT that acts as a watchdog and can do a power up of the pi.

Sorry for not chipping in before you soldered the wires.

If you would like to re-solder the wires I recommend un-soldering with either a solder sucker or some copper solder wick to clean the pad ready for re-soldering. If you are an experienced HW engineer then obviously you know all this.

P.S. If you are not an experienced HW engineer or not, always pre tin both sites before making the joint.

I don't know what gives you that idea. As you say, SCLK is the clock signal for the Serial Peripheral Interface (SPI). Unless you are implementing an SPI peripheral I wouldn't mess with it.

That's ok. You would have needed to speak up several years ago. I have never had much interest in third-party HAT's. They generally cost too much for functionality that I can build for myself without having to worry about the manufacturer going out of business.

When the Pi powers down it will only start up with a power disconnect and reconnect or by shorting these two pins.

Sound principle.

I think that's exactly what I said.

Sorry the reply was meant for @RASelkirk. And sorry but forums are a bit strange to me.

No worries. I was confused too.

I'm just gonna interrupt the main power feed with a local switch. I may be able to do it with some spare contacts on my gate's MoBo, I'll have to check the manual and see if there's anything triggerable there.

Russ

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.