Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

Arduino UNO Fingerprint-Activated Solenoid with LDR-Controlled LED System

View and Edit Project In Cirkit DesignerImage of Arduino UNO Fingerprint-Activated Solenoid with LDR-Controlled LED System

Circuit Documentation

Summary

This circuit is designed to control a push-pull solenoid and multiple LEDs using an Arduino UNO. The circuit includes a fingerprint scanner for authentication, a photoresistor (LDR) sensor for light detection, and relays to control the solenoid and LEDs. The Arduino UNO is programmed to read inputs from the fingerprint scanner and LDR sensor and control the outputs accordingly.

Component List

  1. 1-Channel Relay (5V 10A)

    • Pins: NC, signal, C, power, NO, ground
    • Description: Used to control high-power devices like the solenoid and LEDs.
  2. Push Pull Solenoid

    • Pins: +ve, -ve
    • Description: An electromechanical device used to push or pull when activated.
  3. Resistor (200 Ohms)

    • Pins: pin1, pin2
    • Description: Used to limit current to the LEDs.
  4. 4 x AAA Battery Mount

    • Pins: -, +
    • Description: Provides power to the solenoid.
  5. LED: Two Pin (blue)

    • Pins: cathode, anode
    • Description: Blue LEDs used for visual indication.
  6. Fingerprint Scanner

    • Pins: VCC, TX, RX, GND
    • Description: Used for fingerprint authentication.
  7. LED: Two Pin (red)

    • Pins: cathode, anode
    • Description: Red LED used for visual indication.
  8. LED: Two Pin (green)

    • Pins: cathode, anode
    • Description: Green LED used for visual indication.
  9. 2x 18650 Battery

    • Pins: vcc, gnd
    • Description: Provides power to the blue LEDs.
  10. Photoresistor (LDR) Sensor (Wokwi Compatible)

    • Pins: VCC, GND, DO, AO
    • Description: Used to detect ambient light levels.
  11. Arduino UNO

    • Pins: UNUSED, IOREF, Reset, 3.3V, 5V, GND, Vin, A0, A1, A2, A3, A4, A5, SCL, SDA, AREF, D13, D12, D11, D10, D9, D8, D7, D6, D5, D4, D3, D2, D1, D0
    • Description: Microcontroller used to control the circuit.

Wiring Details

1-Channel Relay (5V 10A)

Push Pull Solenoid

Resistor (200 Ohms)

4 x AAA Battery Mount

LED: Two Pin (blue)

Fingerprint Scanner

LED: Two Pin (red)

LED: Two Pin (green)

2x 18650 Battery

Photoresistor (LDR) Sensor (Wokwi Compatible)

Arduino UNO

Code Documentation

#include <Adafruit_Fingerprint.h>

#if (defined(__AVR__) || defined(ESP8266)) && !defined(__AVR_ATmega2560__)
// Voor UNO en anderen zonder hardware serial, gebruik software serial...
// pin #2 is IN van sensor (GROENE draad)
// pin #3 is OUT van arduino  (WITTE draad)
SoftwareSerial mySerial(2, 3);

int GreenLed = 11;
int RedLed = 12;
int RelayPin = 9;  // Pin verbonden met relay voor solenoid
int RelayPin2 = 7; // Tweede relais voor witte LED's (via externe voeding)

#else
// Voor Leonardo/M0/etc, gebruik hardware serial!
#define mySerial Serial1

#endif

Adafruit_Fingerprint finger = Adafruit_Fingerprint(&mySerial);

// Pinnen toewijzen voor LDR en LED
int ldrPin = A0;  // LDR is verbonden met analoge pin A0
int threshold = 800; // Drempelwaarde voor de LDR

void setup()
{
  pinMode(GreenLed, OUTPUT);    
  digitalWrite(GreenLed, HIGH);  // Zet groene LED aan bij start
  pinMode(RedLed, OUTPUT);    
  digitalWrite(RedLed, LOW);     // Zet rode LED uit bij start
  
  pinMode(RelayPin, OUTPUT);     // Stel relay voor solenoid in als output
  digitalWrite(RelayPin, LOW);   // Zorg dat relay voor solenoid inactief begint
  
  pinMode(RelayPin2, OUTPUT);    // Stel tweede relay in als output voor witte LED's
  digitalWrite(RelayPin2, LOW);  // Zorg dat tweede relay inactief begint
  
  Serial.begin(9600);
  while (!Serial);  // Voor Yun/Leo/Micro/Zero/...
  delay(100);
  Serial.println("\n\nAdafruit finger detect test");

  // Stel de data rate voor de sensor in
  finger.begin(57600);
  delay(5);
  if (finger.verifyPassword()) {
    Serial.println("Found fingerprint sensor!");
  } else {
    Serial.println("Did not find fingerprint sensor :(");
    while (1) { delay(1); }
  }

  Serial.println(F("Reading sensor parameters"));
  finger.getParameters();
  Serial.print(F("Status: 0x")); Serial.println(finger.status_reg, HEX);
  Serial.print(F("Sys ID: 0x")); Serial.println(finger.system_id, HEX);
  Serial.print(F("Capacity: ")); Serial.println(finger.capacity);
  Serial.print(F("Security level: ")); Serial.println(finger.security_level);
  Serial.print(F("Device address: ")); Serial.println(finger.device_addr, HEX);
  Serial.print(F("Packet len: ")); Serial.println(finger.packet_len);
  Serial.print(F("Baud rate: ")); Serial.println(finger.baud_rate);

  finger.getTemplateCount();

  if (finger.templateCount == 0) {
    Serial.print("Sensor doesn't contain any fingerprint data. Please run the 'enroll' example.");
  }
  else {
    Serial.println("Waiting for valid finger...");
    Serial.print("Sensor contains "); Serial.print(finger.templateCount); Serial.println(" templates");
  }
}


void loop()                
{
  // LDR lezen en tweede relais voor witte LED's aansturen
  int ldrValue = analogRead(ldrPin);
  Serial.println(ldrValue);  // Optioneel: print LDR waarde naar seriƫle monitor
  
  if (ldrValue < threshold) {
    // Als het donkerder wordt dan de drempelwaarde, schakel het tweede relais in
    digitalWrite(RelayPin2, HIGH);