The comparator circuit presented in the course detected flex in the sensor for only one direction, as this is a single rail circuit. This presents a challenge, as my robot platform uses a single long whisker straight out the front to detect collision. An obstacle could strike the end of the sensor and bend it in either direction. Thus it is crucial that the micro controller be able to read a flex in the sensor in either direction.
Having measured the voltage differential across the Wheatstone bridge flex sensor circuit, I noticed that a negative voltage when the sensor was flexed in the direction opposite from what the datasheet advises. It stood to reason that this change in voltage might be detectable.
After posting my circuit and question on the discussion board, Thomas_91 was kind enough to supply the following voltage window circuit. It is a dual comparator circuit that detects an upper and lower reference, and gives a HIGH when within the window of the reference and LOW when outside the reference, or the inverse. In my case, I want to measure when the sensor is at rest, and provide a HIGH signal when outside the window. This solves my design problem of wanting to detect a flex in either direction.
Having installed LTSpice but never really used it in solving a problem, I recreated Thomas_91’s circuit, and adapted it for my purposes. Verifying the window and threshold behaviours in simulation, I breadboarded the circuit and included trimpots to adjust the upper ceiling of the voltage reference. The flex sensor is measured with a trimpot for adjustment to its balance.
I created a small program in Arduino to read the output of the dual comparator on a digital pin. After fine tuning the trimpots, I was able to get a very satisfactory sensitivity range.
The Sensor Rig
After reading the many comments about how this particular flex sensor can break easily, I followed the instructor’s example and mounted my sensor on a tie wrap. Smooth sided tape was used to fashion a sheath that allows the sensor and tie wrap to bend together without bunching up.