# Positive Peak Detector using Comparator circuit.

#### Kimi555

Joined Oct 30, 2020
28
Hi everyone,
I need some help with my circuit that takes an AC output from a drone motor and turns it into a digital pulse train to be read by a picaxe. I would like to build this as a positive peak detector as per the picture from below datasheet.
My first question is do i need to have the negative volts on VCC- (as in do i need to actually create a lower potential than ground for this circuit to work? Also is the purpose of the LM110 just to keep the signal at a constant V+ (digital). Sorry if this is obvious.

Thanks

#### Audioguru again

Joined Oct 21, 2019
6,608
Both the LM110 and the LM111 need a negative supply for their outputs to reach 0V.
If the input voltage goes negative then the output voltage will also go negative which might damage a digital load.

#### Kimi555

Joined Oct 30, 2020
28
Both the LM110 and the LM111 need a negative supply for their outputs to reach 0V.
If the input voltage goes negative then the output voltage will also go negative which might damage a digital load.
Thanks for the reply audio guru. Ok so if I was powering this with say a multicell lipo how would I best create the negative volts?

#### dl324

Joined Mar 30, 2015
16,675
My first question is do i need to have the negative volts on VCC- (as in do i need to actually create a lower potential than ground for this circuit to work?
What is the input voltage range?

Why are you using a military grade voltage comparator when you should be using an opamp?

EDIT: That circuit won't work anyway. Where did you get it?

Also is the purpose of the LM110 just to keep the signal at a constant V+ (digital). Sorry if this is obvious.
The voltage follower prevents the hold capacitor from being discharged.

#### Kimi555

Joined Oct 30, 2020
28
What is the input voltage range?

Why are you using a military grade voltage comparator when you should be using an opamp?

EDIT: That circuit won't work anyway. Where did you get it?

The voltage follower prevents the hold capacitor from being discharged.
Ahh right that makes sense. The circuit is straight from the data sheet (ti). The input is 0-12v ac. This was the chip the local supplier had...

#### crutschow

Joined Mar 14, 2008
34,038
I would think you would want a detector that trips at about 1/2 the AC voltage peaks, not the peaks.

#### MrChips

Joined Oct 2, 2009
30,467
TS is not really using military grade ICs. The circuit is copied straight out of the NS Linear Databook (NS is now owned by TI).
To the TS, don't use LM111 and LM110. Use single supply opamps and comparators.

The LM110 as shown in the circuit is a high impedance unity gain buffer to reduce leakage off the peak detect capacitor.
A simple peak detect circuit is a diode and storage capacitor followed by a comparator.
Again, you would not need a negative supply depending on your circumstances.

#### dl324

Joined Mar 30, 2015
16,675
Ahh right that makes sense. The circuit is straight from the data sheet (ti). The input is 0-12v ac. This was the chip the local supplier had...
From Microchip:

With a 12VAC input, you should put a voltage divider on the input and amplify in the second opamp so you can use smaller supplies. You need a negative supply for this circuit.

Or you could use this rectifier that will work with a single 20V supply:
EDIT: the opamp in this circuit won't work with 20V...

You need to use an opamp that doesn't invert when you exceed it's common mode input range (the opamp is operating with a single supply).

Last edited:

#### Kimi555

Joined Oct 30, 2020
28
Ok thanks for all the help so far. Im a bit lost here as i already have all the parts to build the circuit as per the national semi and TI data sheets so i would like to do that. I have a 741 which i could use in place of the LM110? As far as i can tell the LM311 is designed to work with a single 5v power supply and my bench test confirms that it outputs .05V in the low state and around 5 in the high state (so that should be fine with the PICAXE). A question regarding the TI data sheet circuit, does the OPAMP need power (as its not shown in the diagram)... This is probably a stupid question but why would they not show it if it needs it??

#### dl324

Joined Mar 30, 2015
16,675
A question regarding the TI data sheet circuit, does the OPAMP need power (as its not shown in the diagram)... This is probably a stupid question but why would they not show it if it needs it??
All opamps and comparators need power. Power supply connections are often not shown to not distract from circuit function.

#### crutschow

Joined Mar 14, 2008
34,038
Sorry but I don't understand how a peak detector will give you the pulse train you want as a peak detector just gives a DC voltage out equal to the peak of the input voltage.
Can you explain that to me?

#### Kimi555

Joined Oct 30, 2020
28
All opamps and comparators need power. Power supply connections are often not shown to not distract from circuit function.
Great thanks Dennis.

#### Kimi555

Joined Oct 30, 2020
28
Sorry but I don't understand how a peak detector will give you the pulse train you want as a peak detector just gives a DC voltage out equal to the peak of the input voltage.
Can you explain that to me?
Well if i understand it correctly the Lm311 comparitor will out put high every time the top of the sin curve is reached and from this i can calculate the RPM of the motor using the PICAXE and motor topology. I currently have it as a zero crossing comparitor but this yields two pulses every period so to help clean things up the peak detect would be better?

#### MrChips

Joined Oct 2, 2009
30,467
Well if i understand it correctly the Lm311 comparitor will out put high every time the top of the sin curve is reached and from this i can calculate the RPM of the motor using the PICAXE and motor topology. I currently have it as a zero crossing comparitor but this yields two pulses every period so to help clean things up the peak detect would be better?
You are looking for a circuit that will take a low voltage sine wave and generate a digital square wave.
You don't use a peak detect circuit for this.
Show us the circuit that generates the sine wave and/or the shape and voltages of the sine wave.

#### Kimi555

Joined Oct 30, 2020
28
You are looking for a circuit that will take a low voltage sine wave and generate a digital square wave.
You don't use a peak detect circuit for this.
Show us the circuit that generates the sine wave and/or the shape and voltages of the sine wave.
Its just a 3 phase bldc motor. The voltage output is determined by the motor RPM and will vary from 0 to around 12V. As long as i can use the output to determine the RPM im happy.

#### MrChips

Joined Oct 2, 2009
30,467
You can start off with something as simple as this:

Modify the value of resistor R1 to suit your application.
Do you have access to an oscilloscope so that you can view the waveforms?

#### sghioto

Joined Dec 31, 2017
5,369
I currently have it as a zero crossing comparitor but this yields two pulses every period
I would keep the circuit as a zero crossing detector. You can easily divide the pulse count by two in the micro.

#### djsfantasi

Joined Apr 11, 2010
9,151
I would keep the circuit as a zero crossing detector. You can easily divide the pulse count by two in the micro.
And you don’t even have to divide. You can get the true count quickly (faster than dividing) by shifting the raw count by one bit to the right.

#### sghioto

Joined Dec 31, 2017
5,369
Thinking about this further how is the micro going to differentiate a pulse from a peak or zero crossing detector when the RPM varies the output voltage from 0 to 12 volts? Won't the pulse from either detector be the same whether the voltage is 1 volt or 12 volts?
Seems like you should convert the AC output to a DC value between 0 and 5 volts that would be connected directly to a ADC input on the micro.