Closed structure7 closed 8 years ago
Opto sensors works great:
with:
#define OPTO1 16 // WeMos pin D0
void fridgeDoorStatus()
{
if (digitalRead(OPTO1) == HIGH)
{
Blynk.virtualWrite(25, "OPEN");
}
else if (digitalRead(OPTO1) == LOW)
{
Blynk.virtualWrite(25, "CLSD");
}
}
1 = OPEN 0 = CLOSED
I might want to learn about and add a TI LM393 comparator. This is the same gizmo on my analog to digital moisture sensors (I think a pot dialing Vcc in is how this works) and might help with a surefire digital signal (although it seems to be working okay now).
http://www.dx.com/p/lm393-beam-photoelectric-sensor-black-217202#.V05d7vkrLCM
Ah! So it "compares" the value I set with the pot to the value from the analog sensor and that's the "threshold" for my digital signal. Cool: https://arduino-info.wikispaces.com/Brick-LightSensor-Analog-Digital
Side note: the TI LM358 is that I've seen on some of the opto boards: http://www.elecfreaks.com/store/octopus-photo-interrupter-sensor-p-640.html
Maybe tweak resistors and see if my readings are any "cleaner:"
To use this sensor simply connect the LED Anode to 5VDC and the Cathode to ground through a ~180 Ohm resistor. On the receiver side connect the Collector to 5VDC and the Emitter to a ~1K Ohm resistor (going to ground) as well as your Arduino or other microcontroller digital input.
Or:
Bah... temp sensing only. However, maybe a local alarm/buzzer for high temp isn't a bad idea.
Idea for open door alarm buzzer: https://www.sparkfun.com/products/7950?_ga=1.43265765.1383511344.1455541994
Optical sensor (one is in the mail).
Reed switch might work, but I won't be able to control the distance-to-trigger as well as with an opto.