# Switching on and off at different voltage while maintaining states

I am designing my own circuit to switch on / off a 9V motor via solar panel. I am connecting 2 sets of 3.7V 18650 batteries in series, that means the circuit runs on 7.4V. I am also using a generic battery charger, so the battery protection part is solved.

My question is, how do I design a circuit (without a microcontroller) so that

1. It switches ON from OFF state only if the voltage is above 7V
2. It switches OFF from ON state only if the voltage is below 6V
3. When it's switched ON due to (1) above, it'll hold it's ON state until (2) happens
4. When it's switched OFF due to (2) above, it'll hold it's OFF state until (1) happens

When you combine (1) - (4), it means I want a kind of "latching" behavior where, when it's charging, it'll charge until at least 7V before switching on the motor, and when it's discharging (motor running,) it'll discharge until 6V at which point we'll stop the motor so that it can go back to charging mode again.

As mentioned earlier, I am not planning to use a microcontroller here. I have BJTs, MOSFETs and comparators (LM393) on hand, so I thought I would go try to go fully analog.

• You're looking for a low-voltage cutoff with a 1 V hysteresis, right? Commented Sep 16, 2021 at 18:11
• This is referred to as "hysteresis." You will need a reasonably precise voltage reference in addition to the comparator. Plus various caps and resistors, including a divider for VBAT. It can be done without the microcontroller. Commented Sep 16, 2021 at 18:21
• You are looking for a comparator with hysteresis. The LM393 datasheet has example circuits for that. Commented Sep 16, 2021 at 23:21
• Thanks for all the suggestion guys. I actually did not know the terms "hysteresis" until now. You all have been very helpful! :) Commented Sep 17, 2021 at 4:27

You can use two comparators and one SR flop to achieve this function. Make a 5v power supply from battery using some 5v LDO to supply comparators and for 2.5v reference also(2x 10k devider). R3 and R6 make from 22k pots for precise setting of upper and lower limits.

SR flop holds the motor state until battery voltage mets some boundary (upper or lower).

Red is battery voltage, green is low level comparator output, blue is high level comparator output.

Edit:

If you dont have an oportunity to buy a latching IC you can build one from BJTs and connect it according circuit below:

Blue is battery voltage, green is motor current.

• Thanks for the answer! Do you have any idea of the exact SR Latch model to be used here? I have never used SR Latch, so I do not know what are the common models available on the market, nor do I know which model to select. Commented Sep 17, 2021 at 4:43
• You can use 74LS279 circuit, build it from two NAND gates (7400 ic) or build it from two transistors (monostable circuit). Even old 555 can do the job.
– user208862
Commented Sep 17, 2021 at 5:00
• Also 4043 ic is ready solution.
– user208862
Commented Sep 17, 2021 at 5:09
• I recommend 4043 due to active high control.
– user208862
Commented Sep 17, 2021 at 5:19
• Wow, thanks for the input and the alternative implementation! It's definitely very helpful! :) Commented Sep 17, 2021 at 18:05

Here's a lttle circuit to do that, using the components you have:

simulate this circuit – Schematic created using CircuitLab

A simulation shows this output (orange), given a rising and falling input voltage (blue):

R3 provides positive feedback, for about 1V hysteresis. R1, R2 and VR1 set a potential at some point between the thresholds, to be modulated by R3. Since the values necessary to obtain the required switching thresholds depend on D1's breakdown voltage, and other component tolerances, VR1 is there to be able to fine tune the center point.

In this CircuitLab simulation, there's no LM393, and I've actually used an LM358 instead. Using a real LM393 comparator will result in slightly different thresholds, due to its open collector output, but VR1 will allow for center correction, and changing R3 will permit you modify the voltage interval between switching thresholds.

Q1 is switched on or off by the comparator output, to connect or disconnect the output load from the input voltage source, V1, which represents your battery of course.

The load RL is just there to provide a current sink for Q1 in the simulation, representing whatever you intend to connect to the output. Don't put it in the final design.

• Thanks for the answer. What if I do not have a Zener diode on hand? Any idea how can we replace D1 and still have the same result? I am open to buying Zener diodes, but I thought I would like to use this opportunity to learn. Commented Sep 17, 2021 at 4:39
• @wooncherk You need some sort of voltage reference, to compare with. In a pinch, you can use a few regular silicon diodes in series (and forward biased, not reversed like the zener). Each one will give you a bit less than 0.7V, so a few in series can yield a relatively constant voltage drop. Let me think on it. Maybe others have an idea of how to derive a stable voltage drop without a zener. Commented Sep 17, 2021 at 4:46
• @wooncherk the base-emitter junction of a BJT is a zener diode (a bit noisy, but the hysteresis will take care of that). If you can find one that breaks down at 5V, you have a usable zener diode without even knowing it. Commented Sep 17, 2021 at 4:48
• Okay, it seems the most sensible idea is to stick to the original design, buying a Zener is not particularly hard, so I don't find why should I not buy it. :) Commented Sep 17, 2021 at 18:10

Check out this 555 timer low-voltage disconnect.

The relevant notes you need to see are:

When the voltage on the trigger input is less than 1/3 of Vcc, the NE555 output pin 3 goes and stays HIGH.
When the voltage on the threshold input is greater than 2/3 of Vcc, the NE555 output pin 3 goes and stays LOW.

To repeat:
threshold pin HI, output LO
trigger pin LO, output HI

So the function is inverted, but inverting the output pin is not so hard. (use the inverting output of a relay, for example).
By replacing R1/R2 and R3/R4 with pots, you can fine-tune the trigger voltages, and the circuit will stay in its previous state while the voltage remains in between.

One thing you may have to be careful of is that the voltage of the circuit should not vary wildly, or it may cause the timer circuit to oscillate. But I suspect it should work fine. You WILL need a solid voltage reference, however, like a 3.3v or 5v regulator or similar. Do not try to run it from the battery directly as its trigger and threshold voltages will swing as the battery voltage changes.

• I don't have 555 on hand, but thank you for the info (and the resource link). I did learn a lot from your info, especially about the versatility of 555. I reckon I should start stocking some of these 555 chips! :) Commented Sep 17, 2021 at 18:06
• @wooncherk The 555 is an incredibly simple but powerful IC considering it's been virtually unchanged for like 50 years. Example: paleotechnologist.net/?p=548. I daresay it's the cheapest way to build your battery cut-off circuit. Plenty of 555-timer projects to be found online! Commented Sep 24, 2021 at 4:06

I did a search for "low voltage cutoff with hysteresis" and found this circuit:

It has two adjustments, one for turn on voltage, and one for turn off voltage. It uses a standard IC, the 555.

• Unfortunately this circuit has no reference voltage, the trigger points for the 555 being 1/3 and 2/3 VCC. You'd have to run it from a regulated supply to get any precision. Commented Sep 16, 2021 at 19:22
• Thanks for the answer, I don't have 555 on hand, but I'll keep this design in mind! One thing I did learn though, that 555 can be a very versatile chip, so i should stock up on it! :) Commented Sep 17, 2021 at 4:40
• @jack creasey there is a 7.5V zener regulating Vcc Commented Sep 17, 2021 at 13:30