We have a bird nest box close to our terrace which has been used by a Great Tit (Parus major) couple during the recent years and we hope to have them back breeding this year. However, the box is in a bad condition and hast to be replaced sooner or later. As a scientist I couldn't resist having a box with a counter measuring the activity of the birds at their nest. Although it is located close to our house, I would not like to have a cable connected to the counter and thus decided on a battery powered device. As I do not want to disturb breeding, the device has to run on a single pack of batteries throughout the season and thus has to be limited in power drain. So it's an ATTiny85 processor instead or a full grown ARDUINO.

I thought of a method to switch the display on and off without going too close to the box - that is where the laser comes into play...

The video shows the box in action. The rightmost LED shows when the lightbarrier was triggerd. The LEDs have different colors with different colors and position representing different digits. When the laser hits the sensor all LEDs blink three times indicating that the actual number of visits will be shown shortly. Each of the first five LEDs represents a digit, so 99999 visits can be counted. In the video you see LED 3 blinking once, LED 4 blinking twice and LED 5 blinking four times - that is 124 visits.

For parts list see Appendix (Step 7)

Step 1: Building an IR light barrier

IR light barriers are cheap and fairly easy to build. You'll find great tutorials here:


Here are my two cents on what to keep in mind building a IR-light barrier: First of all, you can not see IR light but your camera can. The image above was shot with my mobile phone, I use the non-filtered camera to check if my IR-diode is working. Second, IR is all around you. So while building and breadbording the light barrier, your sensor will most likely be hit by other sources of IR light than your IR-LED! Some time ago, I spent hours debugging a circuit over and over again until I finally realized that the sun was shining on my IR sensor...

I here used a matched pair of emitter and detector (Temic K153P), a 220 Ohm resistor for the emitter, and a 10k resistor for the detector. Other brands will work, too.But you have to figure out the right resistors for your setup, depending on the diode and sensor you have. Of course, you can read the manual of the sensor (well, who reads manuals?) or you might just play with different resistors for finding a good threshold for the sensor. Keep in mind to shield the detector from other IR light sources - this will save you so much time!

The second picture above shows a simple circuit connected to an ARDUINO. Here is a simple test sketch for reading the IR sensor:

//connect an IR LED via a matching resistor (usually ~220 Ohm will work) to 5v and GND

//check with an unfiltered camera (e.g., mobile phone) if it shines

//connect the IR sensor to 5v and via a resistor (e.g. 10k) to GND

//connect the second leg of the sensor also to A0 of the ARDUINO

int IRVal;

void setup()


Serial.begin(9600); // open serial


void loop()


IRVal = analogRead(A0);

Serial.println(IRVal, DEC);



Load this sketch to your ARDUINO and open the serial monitor as shown in the third picture above.

When everything works, the lightbarrier should be protected from other light sources, e.g., by mounting them into such aluminum tubes as shown in the last two pictures.

<p>This is really great stuff! It&acute;s amazing to count the incoming birds! Just waiting for the App!</p>
<p>How cool! Can't wait to see more about this project.</p>

About This Instructable


29 favorites


More by ljohann: Robot Tablet Player Arduino handy knowlege Laser operated nest box visit counter
Add instructable to: