### Author Topic: Comparing two voltages in digital circuit  (Read 2133 times)

#### April151

##### Comparing two voltages in digital circuit
« on: July 19, 2016, 03:56:57 AM »
I have a task that I have two sensors,which bought from TI ,http://www.kynix.com/Detail/1169820/LM77CIMM-3NOPB.htmleach reading a voltage value. I need a circuit to output 1 if the difference between the two readings is smaller than 10% and 0 otherwise.

I can solve it both analogic or digitally. Since I have more experience dealing with digital circuits than analogic ones, I thought about doing the following: Convert the readings to binary and build a circuit which basically uses the formula | (V1 - V2) | / ((V1 + V2)/2) ) and compares it with 0.1. I think there is an easier way of solving this and wanted some help to find it.

Any help will be greatly appreciated.
Great regards,
April151

#### Digital Larry

##### Re: Comparing two voltages in digital circuit
« Reply #1 on: July 19, 2016, 12:24:40 PM »
I'd say an analog solution is going to be vastly simpler at the expense of some accuracy.

Digital Larry
Want to quickly design your own effects patches for the Spin FV-1 DSP chip?

#### cloudscapes

##### Re: Comparing two voltages in digital circuit
« Reply #2 on: July 19, 2016, 04:38:33 PM »
Isn't that what comparators are for? An 8 pin IC and a couple passives should do the trick.
~~~~~~~~~~~~~~~~~~~~~~
{DIY blog}
{www.dronecloud.org}

#### ElectricDruid

##### Re: Comparing two voltages in digital circuit
« Reply #3 on: July 20, 2016, 05:22:18 PM »
I'd say an analog solution is going to be vastly simpler at the expense of some accuracy.

Unless the inputs are digital, I don't think you'd even lose accuracy. Probably the reverse. Think about the trouble you'd have to take to *maintain* accuracy if you were going via an ADC.

Tom