Easiest way to build a voltage sensor?

Thread Starter

rudyauction8

Joined Jan 27, 2012
250
Need something that can switch a relay on or trigger a microcontroller at around 22-27v (adjustable if possible) and switch it off around 30v, and it needs to be accurate to +-1v on the high range or adjustable to get that accuracy. What's the easiest way to do this? It will be used to switch a small generator on a scooter to automatically charge the battery while riding. I'd prefer to avoid expensive solar/windmill charge controllers and will switch the generator manually if possible, just looking to see if there's a somewhat simple circuit capable of doing the job.

EDIT: Just thought of something, if I string enough diodes together (5 volt zener to 25v and normal rectifiers the rest of the way) would that be enough to trigger a power transistor with a pull down, or will the current slowly increase over a large voltage range or something? I could add and remove diodes as needed to adjust the voltage needed to turn on the generator. I've never tried using diodes this way so I have no idea how they'd behave.
 
Last edited:

MrChips

Joined Oct 2, 2009
30,620
You can use a voltage divider to reduce the voltage by a factor of 10 so now you are monitoring voltages from 0-3V.

Then use two analog comparators that are set with reference at 2.5V and 3.0V respectively.
 

ericgibbs

Joined Jan 29, 2010
18,734
You can use a voltage divider to reduce the voltage by a factor of 10 so now you are monitoring voltages from 0-3V.
Morning MrC,
A 10:1 resistive divider will not give an output of 0-3V.

Eric

EDIT:
The OP is monitoring 27V thru 30V

EDIT2:
My apologies, I misread the OP's question.
I will now go outside and beat myself with a stick!;)
 
Last edited:

Dodgydave

Joined Jun 22, 2012
11,277
Use an op amp Window Comparator, scale the voltage down using a resistive divider as suggested earlier, set your trigger point altering the values of R1,R2,R3, choose an op amp to suit your needs.
 

Thread Starter

rudyauction8

Joined Jan 27, 2012
250
Thanks guys, I'll look into those. I have a few microcontrollers with analog to digital converters, could I use a voltage divider with one of them so I can program the exact switching points?
 

Alec_t

Joined Sep 17, 2013
14,263
What is the battery voltage?
Will you be using the battery to power the relay (or whatever) circuit?

Edit:
Assuming a 12V battery powering the circuit you could make a window comparator from a '555 IC, like this
 

Attachments

Last edited:

Thread Starter

rudyauction8

Joined Jan 27, 2012
250
What is the battery voltage?
Will you be using the battery to power the relay (or whatever) circuit?

Edit:
Assuming a 12V battery powering the circuit you could make a window comparator from a '555 IC, like this
The circuit will preferably run off the 36v source and a 5v regulator. I'm having trouble with the generator now so I may not be building the circuit, I'll know soon.
 

#12

Joined Nov 30, 2010
18,224
The LM555 has a supply limit of 18 volts, so using a regulator to supply it would be a good thing, but you will have to change some resistor values if you are going to use Alec's circuit with a 5 volt supply. While you're at it, be sure to consider that a generator can throw some nasty voltage spikes. Protect your regulator from these.

As for zeners to the base of a transistor, a transistor (base to emitter) is affected by temperature change and might make this design change where it switches too much to be reliable in this position. Besides, one transistor would only make one switching point. The 555 chip seems the excellent choice for this job. And thanks to Alec. I usually forget that a 555 can be used for a window comparator.
 

Attachments

Last edited:

Thread Starter

rudyauction8

Joined Jan 27, 2012
250
Just realized the window comparator won't quite work. The low range where the output is low should actually switch on, the middle range where it's high shouldn't switch (stay where it is), and the high range where it's low again should switch off. It's close but not perfect. With the window comparator when the battery is really low, the generator will switch off, and when the batteries are near full, the generator will cut off and the voltage will drop quickly, causing it to start again in just seconds.
 

Thread Starter

rudyauction8

Joined Jan 27, 2012
250
Here's a graph I made in paint to show what I need done. I think I fixed the generator today, or at least have it close, so the project is back on.
 

Attachments

Alec_t

Joined Sep 17, 2013
14,263
and when the batteries are near full, the generator will cut off and the voltage will drop quickly, causing it to start again in just seconds.
I don't think so. The voltage won't drop more than a couple of volts (?), and the window comparator has a larger hysteresis so shouldn't respond to that drop.
 
Last edited:

Thread Starter

rudyauction8

Joined Jan 27, 2012
250
I don't think so. The voltage won't drop more than a couple of volts (?), and the window comparator has a larger hysteresis so shouldn't respond to that drop.

Under the load of the scooter motors (15 amps on 3x old 12ah sla batteries in series), the voltage could likely drop 2/3 of the way to the low trigger voltage in under a minute. I'll have to test this to find out exactly how much it drops.
 

burger2227

Joined Feb 3, 2014
194
What is the battery voltage?
Will you be using the battery to power the relay (or whatever) circuit?

Edit:
Assuming a 12V battery powering the circuit you could make a window comparator from a '555 IC, like this
How do you calculate the high and low voltage value components needed on the 555?
Is there a reference somewhere?
 

Thread Starter

rudyauction8

Joined Jan 27, 2012
250
3 x 12V sla batteries in series are going to need >41V to charge them. Can your genny provide that?
Currently it's maxing at ~50v at redline, and charging fine. I'm just using a switch and would like to automate it in the near future. I'm going to build a new generator soon that will provide the same ~50v but 5x the current (current one only gives 5a at 36v) so it'll easily keep up with the 350w motor on the scooter, and only need to run 1/4 of the time. I have the motor and parts, just need to wait for a free day to put it all together.
 

MrChips

Joined Oct 2, 2009
30,620
I would not charge three 12V batteries in series. You will get unbalanced charging and risk over charging one or more batteries.

Edit: Oops, sorry, I just reread your posts. I now see that the generator is on a scooter.
I think you need to do some energy calculations first to determine how much energy will be required to recharge your batteries.
 
Last edited:

Thread Starter

rudyauction8

Joined Jan 27, 2012
250
I would not charge three 12V batteries in series. You will get unbalanced charging and risk over charging one or more batteries.
The way the scooter comes from the factory charges all 3 in series, however I use my computerized chargers to individually charge each battery every night so balancing shouldn't be a problem.
 
Top