zerodeviation.net - musings of an engineer, developer, and picky theologian

Posts Tagged ‘electronics’

Engineering

February 5, 2009

Proximity sensor

Tags: , , ,

First of all the video. Music by lostprophets. That’s what I was listening to at the time and thought I’d leave it to make it more interesting.

Schematics and explanation below.

Schematics (click to enlarge):

proximity sensor schematics

The IR LED acts just like any other LED. It’s rated for 100mA continuous current, but to play it safe I only provide about 80mA at approximately 6V. The IR photo transistor acts like a simple transistor with the base current being determined by the IR receiver part. This way, when no IR light is detected, the transistor is in shutoff mode, i.e. it acts like an open, so no current flows and the voltage at node A = Vcc. As more IR light is detected, the transistor changes to active and then saturation mode, eventually acting like a short, which makes the voltage at node A = 0V. So the voltage range, depending on the amount of IR detected, is 6V – 0V. The voltage change is just about linear.

The output voltage is then fed into four op amps that act as comparators. That means the voltage on the positive and negative pins is compared. When the voltage on the + side is larger than on the – side, the output bounces to the positive rail, Vcc. Otherwise it bounces to the negative rail, in this case 0V or ground. The + voltage is regulated using one potentiometer per comparator.They act like a simple voltage divider, so I can adjust the threshold to a value between 6V and 0V, the same range I get from the photo transistor. The outputs of the op amps are connected to one LED each.

Using the pots, I adjusted the threshold such that no LEDs are on when no IR is detected, and all are on when IR is maxed out. That means LED 1 will come on when the voltage is lower than about 4.5 V, LED 2 when the voltage is lower than 3V – the midpoint -, LED3 at anything lower than 1.5 V, and LED 4 at just little over 0 V.

Overall a fun project that wasn’t too difficult to do, but fun to get my hands wet with.