Languages

Photomotion sensor

The photomotion is a general method for a very low-cost, easy-to-build motion detector. It uses a simple photoresistor as a sensor and is triggered by quick variations in the light value.

This detector has a range of about 3-4 meters. It is relatively robust and will work well in dimm light. However, it doesn't work at all in total darkness (could maybe be fixed using an infrared LED) and is too sensitive in broad daylight (could maybe be fixed by automatically adjusting the threshold).

We used a 50kOhm photoresistor and a 50kOhm resistor (to bring the resistor's output between 0 and 5V). The main part of the program detects variations between two readings of the photoresistor:

 
  1. define PHOTO_IN 0 // Photoresistor input.

// ... int motion(long time = 100) {
  int before = analogRead(PHOTO_IN);
  delay(time);
  return (analogRead(PHOTO_IN) - before);
}

The original idea was retroengineered from cheap motion detectors found in a Flea market (see this post).

Ingredients

  • 1 x 20-50kOhm photoresistor
  • 1 x 50kOhm resistor
  • 1 x opaque shrink, about 1.5-2 cm long

Note: You can use another value for the photoresistor, however it is important that the resistor's resistance approximately matches that of the photoresistor.

Instructions

  1. Put the shrink around the photoresistor to create a "gun sight" (see picture). It is better to heat the shrink near the photoresistor so that no light comes from the back.
  2. Connect the photoresistor and the resistor as shown in the schema (see attached files).
  3. Upload program to the board (or adapt it to suit your needs). Note: Attached to this post are an example for Arduino and another for ATtiny.
Fichier attachéTaille
photoresistor_schema.jpg8.94 Ko
photomotion_attiny.c3.48 Ko
photomotion.pde1.53 Ko

Commentaires

Question

What is that IC chip in the center?

Thanks Yuri

ATtiny

It's an ATtiny. However the above code will only work with Arduino (ATMega8/168/..) but the method is the same.