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

Solar-Powered Arduino-Based Coin-Operated Mask Dispenser

View and Edit Project In Cirkit DesignerImage of Solar-Powered Arduino-Based Coin-Operated Mask Dispenser

Circuit Documentation

Summary

This circuit is designed to manage a solar-powered system with an automatic transfer switch, a coin acceptor, an IR sensor, and a servo motor controlled by an Arduino UNO. The system includes a solar panel, a solar charge controller, a 12V battery, and an AC power supply. The Arduino UNO is programmed to control the servo motor based on inputs from the coin acceptor and the IR sensor.

Component List

  1. Solar Panel

    • Pins: +, -
    • Description: Converts sunlight into electrical energy.
    • Purpose: Provides power to the solar charge controller.
  2. 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 board.
    • Purpose: Controls the servo motor and processes inputs from the coin acceptor and IR sensor.
  3. Multi Coin Acceptor

    • Pins: COIN, DC12V, GND, COUNTER
    • Description: Accepts multiple types of coins.
    • Purpose: Detects coin insertion and sends a signal to the Arduino.
  4. Solar Charge Controller

    • Pins: Solar +, Solar -, Battery +, Battery -, Load +, Load -
    • Description: Manages the charging of the battery from the solar panel.
    • Purpose: Ensures the battery is charged properly and provides power to the load.
  5. 12V 5Ah Battery

    • Pins: 12v +, 12v -
    • Description: Stores electrical energy.
    • Purpose: Provides backup power to the system.
  6. IR Sensor

    • Pins: out, gnd, vcc
    • Description: Detects objects using infrared light.
    • Purpose: Detects the presence of an object to trigger the servo motor.
  7. Servo

    • Pins: GND, VCC, PWM
    • Description: Rotational actuator.
    • Purpose: Dispenses items based on signals from the Arduino.
  8. AC Supply

    • Pins: +ve, -ve
    • Description: Provides AC power.
    • Purpose: Supplies power to the automatic transfer switch.
  9. AC Power Plug

    • Pins: positive terminal, negative terminal
    • Description: Connects to an AC power source.
    • Purpose: Provides AC power to the system.
  10. Dual Power Automatic Transfer Switch

    • Pins: +, -
    • Description: Switches between two power sources.
    • Purpose: Automatically switches between solar and AC power.
  11. Momentary Push Button Switch

    • Pins: 1, 3, 2, 4
    • Description: Momentary switch.
    • Purpose: Provides a manual input to the system.
  12. Resistor

    • Pins: pin1, pin2
    • Description: 10k Ohm resistor.
    • Purpose: Limits current in the circuit.
  13. Pushbutton

    • Pins: Pin 3 (out), Pin 4 (out), Pin 1 (in), Pin 2 (in)
    • Description: Pushbutton switch.
    • Purpose: Provides a manual input to the system.

Wiring Details

Solar Panel

Arduino UNO

Multi Coin Acceptor

Solar Charge Controller

12V 5Ah Battery

IR Sensor

Servo

AC Supply

AC Power Plug

Dual Power Automatic Transfer Switch

Momentary Push Button Switch

Resistor

Pushbutton

Documented Code

Arduino UNO Code

#include <Servo.h>

Servo myservo;
const int buttonPin = 2;
const int irPin = 3;
const int servoPin = 9;
int buttonState = 0;
int coinInserted = 0;

void setup() {
  pinMode(buttonPin, INPUT);
  pinMode(irPin, INPUT);
  myservo.attach(servoPin);
  myservo.write(0); // Initial position
  Serial.begin(9600);
}

void loop() {
  buttonState = digitalRead(buttonPin);
  
  if (buttonState == HIGH) {
    coinInserted = 1;
    Serial.println("Button Pressed (Coin Inserted)");
    delay(200); // Debounce delay to avoid multiple detections
  }

  if (coinInserted && digitalRead(irPin) == LOW) {
    Serial.println("Dispensing Mask");
    myservo.write(90); // Move servo to dispense mask
    delay(1000); // Wait for 1 second
    myservo.write(0); // Return servo to initial position
    coinInserted = 0; // Reset coin inserted flag
  }
}

12V 5Ah Battery Code

void setup() {
  // put your setup code here, to run once:
}

void loop() {
  // put your main code here, to run repeatedly:
}

This documentation provides a comprehensive overview of the circuit, including a summary, component list, wiring details, and documented code.