I'm building a small device that will be mounted on the ceiling (along with many other identical ones), facing downwards. I'd like to detect when someone walks underneath it. Due to the constraints of my system, the sensor needs to be:

  • Cheap - the whole device needs to cost about $5, so I'd rather not spend more than about $1 on the sensor.
  • Compact - the whole device is about 3cm diameter, so the sensor needs to be significantly smaller than that.
  • Reasonable range - when someone is standing under the device, their head may be 50cm - 1 meter away.

The sensor doesn't need to be fast - a few checks a second ought to be sufficient.

Cheap pretty much rules out 'passive IR' pyrometers, and compact and cheap rule out ultrasonic transponders. I tried an eletrostatic detector, but while it does a great job of detecting charged plastic objects, it doesn't respond to a person standing on a wooden floor at all.

Thus far, the best option seems to be an IR LED as a photodiode (I tried an actual phototransistor, but weirdly got a poorer signal than the LED). Using a setup with one LED emitting IR, and another reverse biased LED connected to an Arduino's analog in, I'm able to discern a useful return reflecting off my hand at anything up to half a meter. While this is usable, it's right at the edge of the range, and I'm concerned it may not work in the finished system. It does have the major advantage that I can put just one LED on each board, and use one board in sensing mode while another provides the illumination.

Can anyone suggest a better option for proximity detection, or a refinement to the active IR option to extend its range?

  • \$\begingroup\$ See futurlec.com/PIR_Sensors.shtml for some well priced PIR components. \$\endgroup\$
    – Russell McMahon
    Sep 6, 2011 at 17:20
  • \$\begingroup\$ @Russell Thanks, but they're still at least twice my budget per sensor. \$\endgroup\$ Sep 6, 2011 at 23:25
  • \$\begingroup\$ You say total budget of $5 - what is covered by that? Sensor control electronics and PCB can be under $1. What else is in each unit and what do they do? \$\endgroup\$
    – Russell McMahon
    Sep 7, 2011 at 0:15
  • \$\begingroup\$ @Russell The PCB (about $1), the microcontroller (about $2 for an ATTiny45), the LED ($0.3 - $1 depending on parts), the cable to connect it to neighbouring devices (~$1, probably less in quantities), and misc passive components ($0.1-ish). \$\endgroup\$ Sep 7, 2011 at 3:44
  • \$\begingroup\$ ATTiny45 - in stock Digikey. $2.20/1. $1.38/25. $1.23/100. Knowing the whole spec and what was required a cheaper processor would probably be possible. Whole project as decribed is almost certainly doable for $5 for materials with up to say $2 for sensor(s). ATTiny25 probably OK $1.89 / $1.19 / 1.05 volumes as above. There are cheaper parts that would probably work for you. What's the total spec? What volume? \$\endgroup\$
    – Russell McMahon
    Sep 7, 2011 at 5:03

3 Answers 3


From your explanation and other question, it seems you are connecting your IR LED directly to the ADC input. I don't think this will work too well at a distance, the ADC input will probably have quite a low impedance that will attenuate your signal. Photodiodes have a very large impedance so you need a transimpedance amplifier to convert the current to voltage.
I would use something that is designed for sensing rather than emitting, like a photodiode or your IR phototransistor (if it didin't work then you are probably not using it correctly), and feed this into an opamp, then into the ADC.
In the app note you link to, there are plenty of example circuits, all of which involve a transistor or opamp to amplify/buffer the signal. Try one of these and see how it performs.

  • \$\begingroup\$ I'm really trying to cut down on the component count and cost, and using the same device alternately for sensing and emitting seemed like a good way to do that. Not all of the sample circuits involve an opamp, and the voltages I'm seeing on the AVR are in a range that's usable without one - I'm just trying to figure out what works best. \$\endgroup\$ Sep 5, 2011 at 0:36
  • \$\begingroup\$ Which sample circuit are you looking at? All the ones I can see involve either a transistor or opamp. I think it may be pretty flaky without one at any reasonable distance, as the irradiance will be proportional to distance squared and the 20 Meg used may cause issues. If you are trying to keep component count down then I would use the phototransistor, it should be far more sensitive. I understand the desire to keep cost down, but $0.02 for a jellybean transistor would seem worth it to ensure things work as they should. \$\endgroup\$
    – Oli Glaser
    Sep 5, 2011 at 2:13
  • \$\begingroup\$ 2A, which is actually a 'fundamental circuit', but as I've observed, the voltage range is reasonable. The irradiance will be proportional to distance squared even with an op-amp, and I think the difference between it and background levels may be impossible to measure over about 50cm anyway, but I will try an op-amp. An IR phototransistor is more like $0.5 than $0.02, unfortunately. \$\endgroup\$ Sep 5, 2011 at 2:33
  • \$\begingroup\$ Looking at the datasheet of my chosen microcontroller (the ATTiny45), it actually already supports 20x gain on differential ADC, so hopefully I can skip the external opamp, if I just know the right parameters for the resistor part of the voltage divider - about which I'm still in the dark, and it still sounds like experimentation is the only real solution. \$\endgroup\$ Sep 5, 2011 at 3:10
  • \$\begingroup\$ So, I tried an opamp with circuit 6A from the appnote - with a 10M resistor it was actually less sensitive than the simple 10M voltage divider. \$\endgroup\$ Sep 5, 2011 at 8:00


(1) LEDs used to wash area from above with modulated IR with cheapest IR detectors that work for you. (LED,photodiode,...)

(2) IF you are able to provide emitters at floor level facing up you can use beam interruption with sensors above. IR emitters can easily be very inobvious (IR filter can be black and opaque to visible light.) Emitters should be able to be made "walk on" damage resistant.

(3) Emitters above with floor level reflectors - need not be visibly reflective. More liable to be subject to damage than low level emitters.

(4) Alibaba India has active IR sensor boards at Rs157 =~~~ $US3. This is whole PCB and volume unknown. Gives an idea of bottom order of cost for completed units.

(5) Capacitive may be able to be made to work at your range.

Philips PCF8883 sounds promising, priced at Digikey at $1.08/2500 or $2.80/1.

If you can install the sensor plates at floor level rather than above the targets then capacitive sensing should be very suitable.

Many capacitive sensor circuits of variable merit here via Google images

Some well priced PIR sensor components

Ultrasonic sensor pairs From $US2.90/pair 1's, $US2.30/100's.

  • \$\begingroup\$ Thanks for the suggestions. Idea 1 is more or less what I'm thinking of as my leading option, only I can use an IR LED as both sensor and detector; one module emits while the other detects. I'd rather not require placing and powering anything at floor level, though. I've seen pyroelectric sensors as cheap as $1 on Aliexpress, but they tend to be too wide angle, as well as requiring interface circuitry. \$\endgroup\$ Sep 4, 2011 at 11:05

you can use light and photoresistor.which will be cheapest.But photoresistors are sensitive to all lights.The idea is that the light will be reflected by the ground and measured by the ldr.If the is obstacle the value read will not be the same:so detection.But ldr as I said is sensitive so where it is beeing used is important


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.