# Best way to create LED logic using differential op amp and comparator?

I got this project a month ago and I've been working on it but I just can't seem to figure this out and my professor won't help us. The project is to build a device to correct the patient's walk -in a crude way. Instead of actually "fixing it" I need to turn on 1 or 2 LEDs to show which out of 8 sensors are most pressured. I can only use comparators and op-amps to turn on the LEDs. It's given that only 1 LED can be turned on(the sensor with most force) or if 2 sensors are close in voltages (+/- 10% V) then both of those sensors LEDs would turn on.

Basically I would have 8 sensors on the foot that would measure the pressure and convert it to voltage (linear) which I would use to determine which one is the most pressured one. Now this doesn't have to be a real example so I don't need to worry about which specific component I'm going to use, I need more of a general idea.

So far I've been able to convert force to voltage using two PNP transistor and getting a constant current source on each of the sensors and I've created a circuit to ,"find" the highest voltage from all eight sensors and only output it, using op-amp and some diodes.

Only problem I have is how to figure out which LED to turn on using comparators and a bit of op-amps and how to add that +/- 10% comparison between all the voltages. When I asked my professor only thing he said, "It is not an interesting situation when the voltages are equal, but when they are sufficiently different, which can be interpreted as improper reliance."

Project : "Based on pressure differences turn on one LED of eight, which shows the approximate position of the foot, that is, which is the most loaded sensor. If the load on the two sensors is equal (in limits +/- 10%), two LEDs should be switched on. Make a signal to turn on the LEDs using differential amplifiers and comparators that compare the difference of two voltages with zero, and if the difference is less than zero, turns on one, and if it is greater than zero, turns on the other LED."

Constant current source Finding the highest voltage Some idea I had about the LED logic using diff op-amp and a comparator

• Can you post your circuit and explain how you think it should work? Commented Sep 5, 2021 at 21:49
• Your professor is providing you with a huge hint! "It is not an interesting situation when the voltages are equal, but when they are sufficiently different, which can be interpreted as improper reliance." Do you not see where that is directing you??? It's big-time. He's practically telling you what to do!! If you understood the clue, you'd be slapping yourself in the face! The problem already says similar things, anyway. I'll add another clue. Think about quadrature (if that is familiar to you) or else think geometrically away from square thinking and towards diamond thinking?
– jonk
Commented Sep 5, 2021 at 22:36
• Also, were you given a physical arrangement of the sensors to work with? If so, you should disclose it.
– jonk
Commented Sep 5, 2021 at 22:43
• @Transistor Ah yes, here it is imgur.com/a/kkxPhjN. I created a constant current going through the sensor and giving me linear voltage compared to force. Then I would find the highest voltage out of 8 and forward it to diff op-amp as Vref and connect voltage from the sensors, get a Vsens - Vref and then output of that would go to a comparator and compare that voltage diff to 0 and based on the sign I would turn on LED.Problem I have is that doing that I have always 4 LEDs turned ON. Here is my idea for that imgur.com/a/hsB1W5V Commented Sep 5, 2021 at 23:25
• @jonk Well sort of "The sensors are resistant, linear and identical, resistance 18 kΩ when unloaded and with a positive slope of 2 kΩ / kg load.". That's all we have but I just ran a constant current through the sensor and got linear voltage compared to force applied. Commented Sep 5, 2021 at 23:28

This could be a dot matrix display to show the pressures by intensity of each foot like a 7 segment display but intensity modulated. Using a comparator with 10% hysteresis is what the Prof asked for. Interesting but how useful as the gain of each sensor needs to be normalized or the area needs to be normalized for equal weight distribution on the pressure sensors. Each sensor will have different peaks and durations. Seems primitive to me.

This is no different than a "color organ" to detect the amplitude of different frequencies in music.

You know that F=mg and the foot reacts with an equal and opposite force, F, but thin film sensors measure pressure, P by force over area, P=F/A. The area will be distributed by the substrate but can made small enough in critical zones only capture a fraction of the total forced since it does not capture the total area equally unless you design awkward rigid plates to move independently bonded to each pressure sensor. Motion artifact from twisting would create additional noise that must be integrated for each micro-motion of foot steps. Calibration might reduce the total imbalance error to 10%. Alternatively 8 independent high pressure spots can sample the weight in those zones if the person has a normal gate. YET THIS MIGHT ONLY BE USEFUL IF THE PERSON HAS AN UNHEALTHY GATE. Pronated ankles and pigeon toes not-withstanding there may be many sources of error from footwear, size, weight, sole materials that are physio measurement issues. Or perhaps due to poor ergonomics and road surface, that increases the error by missing the optimal high pressure points supported by the foots bones and muscle structure.

Given the above is a mechanical issue, it still is important for the electrical designer to identify the optimum method of sensors. and get help where needed.

Now the pressure and duration is also a key issue and the acuity of being able to decode sequencing LEDs for 8 Zones in real-time may be interesting but not clinically useful to an Orthopoedic Doctor as measuring the deviation to expected sequences of pressure to a normal walking cadence.

That being researched or experimentally determined, the circuit must include both Proportional, integral and Derivative and possible jerk measurements (Rate of change of a) to determine the averaged or mean weighted sum of all the conditioned signals in real-time to make a signal that differentiates between the stored left foot and stored right foot values to be compared afterwards as a multiplexed sequence of Analog values in S&H or ADC stored values. The duty cycle of pressure on and null depends on the shoe, and walking speed. But the sequence of pressures needs to be compared analytically. Unequally duty cycles indicates a limp perhaps caused by unequally leg lengths or injury and pronation or lateral movement of angles shown by skewed tread wear.

Thus the PRof's concept seems primitive to me but doable as you suggested but difficult to analyze by flashing LEDs. It would be more useful to scope an 8 sensor extremity in analog mode as a 8 stage sequence machine with lots of statistics used by Orthopedic Doctors for peaks, covariance and RMS averages forward or rear-heel and lateral bias, cadence and acceleration or jerks due to pain avoidance.

• You are absolutely right about everything but this is an 2nd year undergraduate project from subject called Electronic Measurements, where we spent this semester learning about digital electronics and digital logic. So I guess this whole thing is highly theoretical. I can only use these sensors which are primitive I guess. There are a lot of things what realistically don't make sense and I spent over a month overthinking about that. In the end they are just using this project to teach us how to use op-amps and create something of our own. It's not a real project. I won't have to build it. Commented Sep 5, 2021 at 23:59
• You can simulate it on Falstad's site easily with a ring counter with different resistors to control the LED intensity with smoothing caps, but always learn to define the input and output specs and functions in a list of expectations and assumptions or specs. Before design. Commented Sep 6, 2021 at 0:33
• For something completely different tinyurl.com/yh4x92f3 Commented Sep 6, 2021 at 0:37
• Then using the bipolar signals to drive LEDs tinyurl.com/yhw27u7j Commented Sep 6, 2021 at 0:46
• I will have to look into this since it doesn't make any sense to me right since because I have no experience dealing with this or understanding somewhat complex circuits at first look but still thanks. Commented Sep 6, 2021 at 0:56

Only problem I have is how to figure out which LED to turn on using comparators and a bit of op-amps and how to add that +/- 10% comparison between all the voltages.

This is highest and "within 10%" finding circuitry.

simulate this circuit – Schematic created using CircuitLab