Medidor de parpadeo de luz
Este es un instrumento para medir el parpadeo de las fuentes de luz. Algunas bombitas son mucho más estables que otras. Esos datos no son disponibles. Podemos medir y publicar datos sobre las bombitas que son comunes acá.
Fotos
Sensor
Codigo
#include "I2C_LCD.h"
const int COLLECTION_MS = 200;
const int SENSOR_LIMIT = 850;
const int SENSOR_BAJO = 200;
I2C_LCD lcd(39);
void setup() {
Wire.begin();
Wire.setClock(100000);
lcd.begin(16, 2);
}
void loop() {
int x_max = 0, x_min = 10000;
unsigned long stop_ms = millis() + COLLECTION_MS;
int sample_count = 0;
while (millis() < stop_ms) {
int x = analogRead(A0);
if (x > x_max) x_max = x;
if (x < x_min) x_min = x;
sample_count++;
}
lcd.clear();
if (x_max > SENSOR_LIMIT) {
lcd.center(1, "demasiada luz");
} else if (x_max < SENSOR_BAJO) {
lcd.center(1, "falta de luz");
} else {
float ratio = (float)x_min / x_max;
lcd.center(0, ("ratio = " + String(ratio)).c_str());
lcd.center(1, ("samples = " + String(sample_count)).c_str());
}
}