Smart Wooden Box

Ok, yeah soldering the wires to the underside of the Pi will work. Just make sure you don’t accidentally short two pins together with too much solder. I’d make the bare wire as short as possible, and pre tin it with a little solder. It will make tacking it in place easier.

Hello again
I’m nearly there, thanks to you alphanumeric! The pi-switch is working just as it should and does a soft shut down at the press of a button. The box is complete and houses the raspberry pi with a unicornhathd installed, the pi-switch and 3A power bank for power. The final hurdle is to set it all up to boot straight into the demo unicordnhathd python script in headless mode. With a keyboard and monitor attached I navigate to the folder where the demo script is and click on it I get a message which says the script is executable. Do I want to run it, run from command or open. If I run from the command line I can stop it with ctrl-C, if I just run it I can only stop it with a soft shutdown. I presume this is okay.
Could you please help me out setting up the auto boot routine? I have googled it, of course, but am getting more and more confused. Sorry to be such a pain!

I do the following to run my python file on boot up.
From terminal run
crontab -e
select option 1 for nano
and add
@reboot python3 /home/pi/your_file.py &
ctrl x and y enter
Change the your_file to the actual file name of the file you want to run.
When the Pi boots up and starts Raspbian it will also auto run your python file.
I also go into raspi-config and set it to boot to command line instead of the desktop GUI.
It will boot up quicker and use less resources which should help with battery use.

Well, tried it but it wasn’t successful. I checked my version of python and it’s version 2.7.16 Might this be the problem?
When I reboot it goes straight to the desktop.
Frustrating! Any thoughts?

Try
@reboot python /home/pi/your_file.py &
“python” should run it in python 2 instead of python3

Latest version of Pi OS, fully updated?

Yes, updated when I got the unicorn hat/

If I type the following into the terminal it executes just fine:
python /home/pi/Pimoroni/unicornhathd/examples/demo.py

Using the same entry in crontab -e just boots to the desktop.

OK, not sure what’s up? I’m not having any issues with using “python3” in crontab.
You added the @reboot ? And don’t put a # at the beginning of that line.
This is what is working for me, my file is in the home folder.
@reboot python3 /home/pi/HD_Port_WC.py &

This is what I added at the end:

@reboot python / home/pi/Pimoroni/unicornhathd/examples/demo.py

That’s right isn’t it?

That’s looks right, other than no & at the end, which I don’t think is actually needed. I used to know what that did, but I would have to go look it up at the moment.

Is it maybe, unicorn-hat-hd, double check the folder names, and it is case sensitive.

I know the location is right because it works from the terminal. Weird, eh.
I’m almost certainly doing something wrong but I’m blowed if I know what!

You could try sudo crontab -e?

Did that, set up a new crontab and…it works!!!

Thank you so much. I’ll video it all working in the box of ‘Box of Delights’ and share it with you.

Thank you, thank you.

Woot, nice to hear its working. Enjoy. =)

I’m hoping this link will show you the box. Microsoft OneDrive - Access files anywhere. Create docs with free Office Online.

1 Like

Link worked, thanks. Nicely done. Very nicely done. =)