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

Arduino UNO-Based Automated Testing System with Relays and Sensors

View and Edit Project In Cirkit DesignerImage of Arduino UNO-Based Automated Testing System with Relays and Sensors

Circuit Documentation

Summary

This circuit is designed to perform a series of tests using various sensors and actuators controlled by an Arduino UNO. The tests include light detection, vibration detection, loopback audio test, and melody detection. The results of these tests are indicated using LEDs and solenoids, and the circuit also includes a sound playback module.

Component List

  1. 12V SINGLE CHANNEL RELAY

    • Pins: NC, COM, NO, IN, GND, VCC
    • Description: A relay module used to control high voltage devices with a low voltage signal.
  2. Push Pull Solenoid

    • Pins: +ve, -ve
    • Description: An actuator that provides linear motion when powered.
  3. Battery 12V

    • Pins: +, -
    • Description: A 12V power source for the circuit.
  4. 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: A microcontroller board used to control the circuit.
  5. 1N4007 Rectifier Diode

    • Pins: Cathode, Anode
    • Description: A diode used to allow current to flow in one direction only.
  6. LED: Two Pin (red)

    • Pins: cathode, anode
    • Description: A red LED used for visual indication.
  7. Resistor

    • Pins: pin1, pin2
    • Description: A resistor with a resistance of 200 Ohms.
  8. ISD1820

    • Pins: VCC, GND, P-E, Sp1, SP2
    • Description: A sound playback module.
  9. Loudspeaker

    • Pins: pin1, pin2
    • Description: A speaker used to output sound.
  10. Sound Sensor

    • Pins: 5V +, OUT, GND
    • Description: A sensor used to detect sound levels.
  11. SW-420 Vibration Sensor

    • Pins: vcc, Ground, Digital output
    • Description: A sensor used to detect vibrations.
  12. Pushbutton

    • Pins: Pin 3 (out), Pin 4 (out), Pin 1 (in), Pin 2 (in)
    • Description: A button used to trigger the tests.

Wiring Details

12V SINGLE CHANNEL RELAY

Push Pull Solenoid

Battery 12V

Arduino UNO

1N4007 Rectifier Diode

LED: Two Pin (red)

Resistor

ISD1820

Loudspeaker

Sound Sensor

SW-420 Vibration Sensor

Pushbutton

Code Documentation

// Pin definitions
const int vibrationSensorPin = A2;
const int soundAnalogPin = A1;  // Analog output from sound sensor
const int lightAnalogPin = A0;  // Analog input from photoresistor
const int Light_ledPin = 8;     // LED connected to digital pin 9
const int Vibration_ledPin = 9; 
const int Loopback_ledPin = 11; 
const int Melody_ledPin = 12;           
const int isdPlayPin = 10;      // ISD1820 playback pin connected to digital pin 10
const int buttonPin = 4;        // Button to trigger the loop

// Relay pins for solenoids (pass and fail)
const int relayPassPin = 2;   // Relay for solenoid (test passed)
const int relayFailPin = 3;   // Relay for solenoid (test failed)

bool buttonPressed = false;    // Flag to check if button is pressed
bool buttonState = HIGH;       // Current state of the button (not pressed)
bool lastButtonState = HIGH;   // Previous state of the button
bool runTest = false;          // Flag to run the loop

void setup() {
  // Initialize serial communication
  Serial.begin(9600);

  // Set the LED, ISD1820 playback, and button pins as output/input
  pinMode(Light_ledPin , OUTPUT);
  pinMode(Vibration_ledPin , OUTPUT);
  pinMode(Loopback_ledPin , OUTPUT);
  pinMode(Melody_ledPin , OUTPUT);
  pinMode(isdPlayPin, OUTPUT);    // ISD1820 playback pin
  pinMode(vibrationSensorPin, INPUT);
  pinMode(buttonPin, INPUT_PULLUP); // Use internal pull-up resistor for the button

  // Set relay pins as output
  pinMode(relayPassPin, OUTPUT);
  pinMode(relayFailPin, OUTPUT);

  // Turn off the LEDs and ISD1820 playback initially
  digitalWrite(Light_ledPin, LOW);
  digitalWrite(Vibration_ledPin, LOW);
  digitalWrite(Loopback_ledPin, LOW);
  digitalWrite(Melody_ledPin, LOW);