Monthly Archives: March 2015

Prepping additional IR sensors and control board


As the 3 Sharp IR analog sensors in my robot design consume plenty of power, I’ve created an interconnect module that switches the load on and off by way of a TI nMOS FET. The microcontroller will periodically switch on the load, take a reading of the three sensors via ADC, and then switch the load off again. This process is controlled by  timer-based interrupt, storing the distance reading in a global variable.

Leave a comment

Filed under analog, edX, micro-controllers, Robots, Soldering

Prepping the IR proximity sensor


Preparing the Sharp 0A41SK for testing. Soldered a 10uF bypass cap, as per the data sheet and others. Don’t have any JST PH connectors, so the leads have also been soldered. Covered the exposed bits with polyamide tape prior to soldering the cap. Hot glue will be used for strain relieve in protecting the solder joints.

Leave a comment

Filed under DIY, edX, Robots, Soldering

Voltage window comparator front end

The Problem

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.

My original flex sensor bridge circuit with comparator front end.

The Question

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.

Thomas_91’s circuit posted on the EE40LX discussion board. He used a sine generator to demonstrate the window effect.

Thomas_91 produced a graph to demonstrate the window effect using a sine voltage generator.


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.

My window comparator circuit. R6 = flex sensor, R9 & R2 = trimpots.

My voltage window circuit with flex sensor (out of frame) and trimpots.

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

A nut captive in some hot glue allows mounting on the front end of the robot.

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.

The flex sensor bends together with the tie wrap without bunching up thanks to the green sheath. The sheath is affixed to the tie wrap with hot glue.


Filed under analog, DIY, edX, ICs, Robots