TL;DR - I need help on making a relay with voltage comparator which accepts two reference voltages.
Aim
My project needs to run a Raspberry Pi on solar power. Solar panel will be connected to a power bank which will then be connected to Raspberry Pi.
Challenge
Running on solar means there won't be enough power left in the power bank for the Pi. In this case I will shut it down and turn it back on when there is enough power. This process needs to be automatic since the project will be installed at a remote place.
Since Raspberry Pi doesn't have ability to detect power from the power bank directly I'm planning to install a circuit between Pi and the power bank. I will use a MCP3008 - Analogue to Digital Converter to detect the voltage level of the power bank. The schematic diagram will look like this. I will run a script to shut down Pi if it detects only 5% of power is left.
Problem
After shutting down Pi, I want to close the circuit between Pi and the power bank completely so I'm planning to use a relay for this. I think Relay with LM393 like this will do the job.
The problem is I want to switch off the relay when the voltage equals to 5% power of the battery and switch it on automatically when the battery reaches 25% of its power. The module I consider can set only one value of voltage.
So is there any way I can set one value of voltage for the relay to switch off and another value for it to switch on?