I am doing a project with Arduino, making a synthesizer, in which an LDR is used.
Before connecting the Arduino to a power source and use the project, do I need to calibrate the LDR like it is explained in Arduino website ?
-
1Either pick some values and hopes if works in most cases. Or have the software keep track of the minimum and maximum values, and use that to 'scale' the light input to a normalize range. You could have the user do a "calibration" routine before using it, by putting their hand over the sensor, and removing their hand completely, and thus getting the max and min values.Gerben– Gerben2020年02月19日 16:22:47 +00:00Commented Feb 19, 2020 at 16:22
2 Answers 2
An LDR is a pretty inaccurate device. It just gives you a number which relates to darkness or brightness. How do those numbers relate to darkness and brightness? Well, only in a very vague way. All you can really say with any confidence is that bigger numbers mean brighter light, and smaller numbers mean darker darkness.
Even after "calibration" the numbers are pretty meaningless in any real-world sense.
All the "calibration" does is give a rough guide to the range of the numbers produced in any given lighting situation. It's then up to you to program your sketch in such a way that it works within the ranges of those numbers.
And yes, those numbers will change depending on the current lighting situation.
You could incorporate some form of "calibration" routine in your sketch to adjust any relevant values and calculations, or you could just provide some interface for tweaking values. Or your system may just really not care. It's impossible to know until you actually start creating your system.
-
2A good example of this is if you want a program that detects when an object is placed over the sensor and blocks the light. In that case you wouldn't normally want to write the code such that it looks for some particular value that means darkness, because the number you get from a particular level of darkness changes. So instead of writing code to look for some particular darkness threshold, you would write the code such that you look for large negative changes in the reading. Maybe anytime it changes by more than a certain amount in some short time consider it covered.Delta_G– Delta_G2020年07月18日 19:59:21 +00:00Commented Jul 18, 2020 at 19:59
My application was a little different. My illumination/light source was fixed (and exact). I compensated the sensor for temperature. The results I obtained were very exact and repeatable.
Here are my temperature compensation results.