Arduino Coin-Operated Car Wash 🚗🫧
Drop a coin, press a button, and watch Wash, Soap, Blow and Water switch on one by one! Build a real vending-style controller with an LCD screen and learn how robots control big machines safely.
🌟 What Will You Build?
This project is a multi-stage coin-operated car wash controller. A coin acceptor adds money (credit). You choose a stage with big arcade buttons: WASH, SOAP, BLOW or WATER. The Arduino switches the right SSR-40A relay, counts the credit down on the LCD, and switches everything off when the money runs out.
🧰 Parts You Need
🔌 Circuit Diagram
📋 Wiring Table
| Part | Part Pin | Arduino Pin |
|---|---|---|
| LCD (I2C) | VCC / GND / SDA / SCL | 5V / GND / A4 / A5 |
| Coin acceptor | +12V / GND / Signal | 12V supply / GND / D2 |
| Wash button | One leg / other leg | D4 / GND |
| Soap button | One leg / other leg | D5 / GND |
| Blow button | One leg / other leg | D6 / GND |
| Water button | One leg / other leg | D7 / GND |
| SSR1 to SSR4 | Input + (3) / Input − (4) | D8, D9, D10, D11 / GND |
🪜 Step-by-Step Instructions
💻 Arduino Code
Change the prices in pricePerMin to set how much each stage costs per minute.
// MakeMindz - Coin-Operated Car Wash #include <Wire.h> #include <LiquidCrystal_I2C.h> LiquidCrystal_I2C lcd(0x27, 16, 2); // try 0x3F if blank const byte COIN_PIN = 2; const byte btnPins[4] = {4, 5, 6, 7}; const byte ssrPins[4] = {8, 9, 10, 11}; const char* names[4] = {"WASH ", "SOAP ", "BLOW ", "WATER"}; float pricePerMin[4] = {30, 20, 25, 15}; // Rs per minute const float COIN_VALUE = 10; // Rs per coin pulse volatile unsigned int pulses = 0; volatile unsigned long lastPulse = 0; float balance = 0; int active = -1; // -1 = nothing running unsigned long lastTick = 0, lastPress = 0, lastShow = 0; void coinISR() { unsigned long now = millis(); if (now - lastPulse > 30) { pulses++; lastPulse = now; } } void setRelays() { for (byte i = 0; i < 4; i++) digitalWrite(ssrPins[i], i == active ? HIGH : LOW); } void setup() { lcd.init(); lcd.backlight(); for (byte i = 0; i < 4; i++) { pinMode(btnPins[i], INPUT_PULLUP); pinMode(ssrPins[i], OUTPUT); digitalWrite(ssrPins[i], LOW); } pinMode(COIN_PIN, INPUT_PULLUP); attachInterrupt(digitalPinToInterrupt(COIN_PIN), coinISR, FALLING); lcd.setCursor(0, 0); lcd.print("MakeMindz CarWash"); lcd.setCursor(0, 1); lcd.print("Insert coin..."); delay(1500); lcd.clear(); } void loop() { // 1. Add coins noInterrupts(); unsigned int p = pulses; pulses = 0; interrupts(); if (p > 0) balance += p * COIN_VALUE; // 2. Read buttons for (byte i = 0; i < 4; i++) { if (digitalRead(btnPins[i]) == LOW && millis() - lastPress > 300) { lastPress = millis(); if (balance > 0) { active = (active == i) ? -1 : i; // press again = pause lastTick = millis(); setRelays(); } } } // 3. Count down credit while a stage runs if (active >= 0 && millis() - lastTick >= 1000) { lastTick += 1000; balance -= pricePerMin[active] / 60.0; if (balance <= 0) { balance = 0; active = -1; setRelays(); } } // 4. Update LCD if (millis() - lastShow > 250) { lastShow = millis(); lcd.setCursor(0, 0); lcd.print("Credit: Rs "); lcd.print((int)balance); lcd.print(" "); lcd.setCursor(0, 1); if (active >= 0) { int secs = balance * 60.0 / pricePerMin[active]; lcd.print(names[active]); lcd.print(" ON "); lcd.print(secs); lcd.print("s "); } else { lcd.print("Pick a stage "); } } }
🧩 How the code works
The coin acceptor sends a tiny pulse for each coin. An interrupt catches it instantly, so no coin is missed. Every second, the Arduino subtracts the stage price from your credit. When credit hits zero, all relays turn off.
🛠️ Troubleshooting
coinISR to 50.🚀 Upgrade Ideas
Add a buzzer when time is almost over, save your earnings in EEPROM, add a Stop button, or use a bigger 20x4 LCD to show all four prices at once.
❓ FAQ
Can I use mechanical relays instead of SSR-40A?
Yes. Use relay modules with a flyback diode, but SSRs are quieter and last longer.Why use INPUT_PULLUP for buttons?
It uses the Arduino's built-in resistor, so you need no extra parts.Can kids build this alone?
Kids can build the low-voltage part. Mains wiring needs an adult, always.Can I run two stages together?
Yes. Change thesetRelays logic to allow more than one active stage.
Comments
Post a Comment