Automatic light management

Hello Arduino Community,

my name is Sascha, I am 25 years old and I love to create whole new things from my own effort. I am working as a software engineer in Germany and started programming seven years ago. I like programming so much that I am doing it in my spare time. Programming new and complex algorithm only, wasn't enough for me so I startet with Arduino one month ago. I bought an Arduino Uno board with basic electric components and learnd a lot of new things. I am absolutely interested in combining my programming skills with objects in the real life. Until now, everything I've developed was only a result on my computer screen. But now, I want to see results in my real enviroment, like my home.

Because I only know a few basics, I need the help of the community. In my opinion I've found a small basic project that I can approach. I want to create an automatic light management for each room in my flat. I want to recognise how much people are entering and leaving a room. The problem I see is, how I approach that because a light barrier is unable to recognise two people are entering a room directly behind each other because the light barrier will only be interrupt once. The Arduino board would think there is one person inside the room. My light management would turn on the lights and when one people would left the room, the lights would turn off again, although there is still a person inside the room. As another component of the light management, there should be a way to recognise the amount of light inside the room, to determine if it is necessary to turn them on.

You may ask why I do not buy a sensor light. There are a couple of reasons. The first fact is that I am an owner of two cats. The second one is that I want to learn, how to create such things by myself. And last but not least, that project will not stay only as an automatic light management. My intention is to improve the system with other projects in the future.

As I mentioned, I am a beginner in the Arduino world and ready to learn whole new things. Do you think that this project is to much for the start? What components do I have to use, to apporach this project goal? Do you have any advises for me, what I should learn or where I should take a deeper look into?


I’d suggest buying an Arduino starter kit. You get all the basic components so you can prototype a solution before implementing it. Special for your application would be a relay module and some kind of special sensor for counting people entering or leaving the room (may be beam break sensor) and light level sensor (ldr). Also consider a passive infrared sensor mounted in such a way that the cats would not trigger it.

In all the places I have seen automatic lighting controls I have not come across any that have not been a total pain in the butt.

Quite literally in a toilet we had at a University I worked at, that would plunge you into total darkness if you spent too long in a “stall” hidden from the PIR sensors. Most inconvenient when it happened at night.

Other places would turn off the lights if you were alone and sitting still, then you would have to wave your arm or get up. Great if you are in the middle of soldering something small.

I am not saying don’t try and do this, what I am saying is I don’t thing anyone has yet got it right.

Quite literally in a toilet we had at a University I worked at, that would plunge you into total darkness if you spent too long in a “stall” hidden from the PIR sensors. Most inconvenient when it happened at night.

Familiar problem, experienced this before.

The problem is that these rely on movement, not keeping track of actual presence.

There are lots of discussions on this board on how to count people entering/leaving a room, and the general consensus seems to be that it's nigh impossible to do reliably without going visual (and that's out of scope of Arduinos).
Accurately counting passages through the door is hard. How about people coming in very close together, then leaving separately? People turning around in the doorway? You can't put your sensor too low as you start counting double (two legs rather than a single torso) but then you may miss small people (such as children).