That said there's a few tweaks if love to see if possible.
1) a watchdog timer.
It seems pretty bomb proof but every so often it does seem to fall over. Temp control remains and the LCD works but the Web displays says 'can't receive display' (or something to that effect) and restarting the Pi always seems to fix it. Is it possible to have it auto restart if it detects that state for an hour or something similar?
Well, first, what you are talking about is not Fementrack but the Raspberry Pi in general. As such it's outside of the scope of the project.
That said, I would also draw your attention to what it is you are trying to accomplish. "I want my Raspberry Pi to know if it is unresponsive for more than > amount of time." If the Pi is unresponsive, it's not gonna know.
While the Raspberry Pi does have an internal watchdog that can be used, it is notoriously unreliable. A working solution would need to be external electronics coupled with an internal heartbeat. Again, outside the scope of Fermentrack. I'm not the author however so John is free to take on whatever he wants.
An easy solution for you would be to create a schedule that reboots the Pi on a regular basis - preferably before it goes unresponsive because this is unlikely to fix that if it is hung. Create a file in the cron.d directory:
Code:
$ sudo nano /etc/cron.d/reboot
Paste in the following:
Code:
# m h dom mon dow user command
00 2 * * * root /sbin/shutdown -r now
Save and exit with Chrl-X and "Y" to save. This will create a job that reboots your Pi every morning at 2:00 AM. If you want to know how to customize that, Google "cron" and you will have more than you ever wanted in the way of information.
2) Support for a hardware reset button.
If the Pi does need restarting I hate just yanking the power but starting up a PC to SSH in is a right pain. Be great if grounding a pin restarted the Pi. I'm aware I can probably add this seperatly but would be nice to have it all integrated.
Again, this is a Pi thing and not a Fermentrack thing so see the note about scope above.
That said, I am warning you now if you continue to yank the power without shutting down you will corrupt your SD card and lose everything. It will happen. It's not a matter of "if." If you think starting up a PC so you can shut the Pi down is a pain, you'll really hate having to start over.
I will give you some ideas though, some, all or none may work for you:
- If you have a Pi 2 or B+ there is a "Run" header on the board. If you solder a couple of DuPont pins onto that, you can use a bit of wire and a momentary switch as a "reset button." I think there's still a danger of corrupting individual files, but the risk is far less than tanking the little beast. If you have an old PC case, the reset button from that would be perfect.
- Set up the Raspberry Pi watchdog. It's better than nothing. Instructions are here.
- Just in case someone with some extreme skills is reading and wants a "cool method" you can short the SoC end of R15 to ground momentarily to initiate a reset. This is not for the faint of heart. I have not looked to see if this was still available/working on the Pi 4. Maybe @day_trippr can have a look and bless this method?
- You can set up a hardware/software solution by creating a script to run in the background that will shut down the Pi based on GPIO input. You can run this script on boot and when you short GPIO 3 to ground (see #1) the Pi will shutdown cleanly (provided it is functional enough to be running the script.)
4) additional configurable logging channels.
I assume gravity logging is done tilt to pi rather than tilt to controller to Pi? If so would additional channels connected directly to the Pi be that complex? I'm aware displaying them graphically would be challenging but would displaying the current value be possible?
Pretty sure this is already done? Either that or I don't understand what you mean.
Finally. Something that I assume isn't possible but would be ace. Any chance of showing the current gravity on the LCD? I assume to do so the display would need to be driven from the Pi rather than the controller?
The display is connected to the controller so there's no straightforward way to display them on the controller. Using a permanent display on the Pi is a better idea. See
this little TFT screen which puts a display on the top of the case. You can then use a browser and a
customized web page to cobble it together. This is rather fiddly and I'm not sure John will want to do it.
A better solution I think would be to use Tiltbridge as a separate gravity display.