💬 Light Level Sensor - LM393
-
This thread contains comments for the article "Light Level Sensor - LM393" posted on MySensors.org.
-
-
This thread contains comments for the article "Light Level Sensor - LM393" posted on MySensors.org.
@hek hi, I've been searching to see if I can find anything on th LM393 Sound sensor, I know I saw one but can't find it, looking to build a simple soundsensor with the LM393 unit.
-
@hek I found this sketch, but how do I incorporate it to my sensors library and serial gateway?
-
@hek
int soundDetectedPin = 10; // Use Pin 10 as our Input
int soundDetectedVal = HIGH; // This is where we record our Sound Measurement
boolean bAlarm = false;unsigned long lastSoundDetectTime; // Record the time that we measured a sound
int soundAlarmTime = 500; // Number of milli seconds to keep the sound alarm high
void setup ()
{
Serial.begin(9600);
pinMode (soundDetectedPin, INPUT) ; // input from the Sound Detection Module
}
void loop ()
{
soundDetectedVal = digitalRead (soundDetectedPin) ; // read the sound alarm timeif (soundDetectedVal == LOW) // If we hear a sound
{lastSoundDetectTime = millis(); // record the time of the sound alarm // The following is so you don't scroll on the output screen if (!bAlarm){ Serial.println("LOUD, LOUD"); bAlarm = true; }}
else
{
if( (millis()-lastSoundDetectTime) > soundAlarmTime && bAlarm){
Serial.println("quiet");
bAlarm = false;
}
} -
Not sure I understand what you mean by "incorporate".
Suggerst sending a TRIPPED value 1 when sound is detected for the a SOUND child sensor.
@hek what extra code do I need to add to the sketch so tha it sends the tripped value to my gateway?
-
@hek will do thanks
-
Hello. I need a sensor that can sense the green status led on an audio amplifier and report state via MQTT. The goal is an accurate source of Power State (ON/OFF) for the audio amp. The light is a fairly dim led. The sensor could mount directly on it. Is the LM393 appropriate for this type of requirement?
Here is the problem... Home theater setup. TV and sound app both start at the same time. However, the audio amp has a "feature" where it cuts it's power off if it doesn't sense audio for more than two minutes. As soon as you mute the TV for an advertisement, the audio amp shuts down (while the remote control thinks the audio amps state is ON). Then, everything is out of sync and my wife and kids start calling me names. Bad ones.
-
Oh, what a crappy thing. 2 minutes is nothing. You can't fix this by bypassing the circuitry that shuts the thing down?
The only way of knowing is to mount a photo resistor over the led and see if you get any reading when it is on. Use the trimpot to adjust the binary output.
