EverythingSmartHome / fingerprint-mqtt

Fingerprint sensor with MQTT support based on Adafruit Fingerprint Sensor Library
GNU General Public License v3.0
24 stars 14 forks source link

Connecting a relay to work with solenoid #15

Closed VarunKumaran closed 1 year ago

VarunKumaran commented 2 years ago

Is there a way to trigger a small 5V relay when the fingerprint is matched with the stored prints ??

unseemlycoder commented 1 year ago

Yes, it's possible. Ideally you could set up an automation on Home Assistant to trigger on match but if you want to execute it within the microcontroller. Assuming relay signal is connected on pin 7 of an esp32:


void setup()
{
// ... //  

  pinMode(7,OUTPUT);
  digitalWrite(7,HIGH);

// ... //
}

uint8_t getFingerprintID() {

// ... //
if (p == FINGERPRINT_OK) {
    Serial.println("Match!");
    lastID = finger.fingerID;
    lastConfidenceScore = finger.confidence;

    digitalWrite(7,LOW);
    delay(500);
    digitalWrite(7,HIGH);

    return p;
    }
// ... //
}
unseemlycoder commented 1 year ago

Referenced in #20 Addition of a GPIO pin for relay modulation.

VarunKumaran commented 1 year ago

Hiii @unseemlycoder I worked around the problem and got a solution a year back itself and I was a noob back then 😅.. anyway thanks for reminding me to close the issue