Post your best Lua script examples here

User avatar
By Cosmic Mac
#17642 Hmmm... more or less. :)
My intention was to photograph birds and I encountered 3 problems: false triggers, latency and "inertia".

I partly solved false triggers by putting a tube around the PIR sensor, to make it more directive, by placing it closer to the target (a small bag of seeds hooked to a support), and by managing to have no other moving subject in the field, even when the slightest breath of wind makes everything moving.

For the moment I have found no solution concerning latency, which is probably due to ESP rather than the PIR sensor. So, don't expect to get very fast moving subjects trapped immediately as they appear. Fortunately, when birds come to eat seeds, they stay for a while and chances are great to get them on the picture anyway.

This leads us to the last point: inertia.
When the PIR detects movement, its output pin goes high, and stay high as long as movement is detected, and at least for 4 seconds (this is the minimum duration I could get).
So, in my case I have one trigger at the beginning of the movement, but even if a bird stays for half the day eating seeds, continuously moving in front of the sensor, I won't get any other picture.
I didn't think about this point at the time I made my script, and this is an obvious misconception.
Fortunately, this is quite easy to handle: I will change the code to continuously trigger the camera, with a short delay between shots, as long as the PIR is high (and then, avoiding false triggers will become mandatory ;) ).

Cheers