Arduino Self-Service Car Wash
This Arduino project uses a coin acceptor, a 7-segment display, a start button, a pause button, a water pump, and a relay module to create a self-service car wash. Users insert coins into the coin acceptor, and the display shows the time for a 5-minute wash. When the start button is pressed, the pump turns on and the countdown begins. If the pause button is pressed, the countdown and pump stop, and a 1-minute pause countdown begins. After the pause time has elapsed, the pump turns on again and the countdown continues. When the countdown is complete, everything turns off. This project is a fun

-
Gather the necessary components: You'll need an Arduino board, a coin acceptor, a 7-segment display, a start button, a pause button, a water pump, a relay module, some jumper wires, and a breadboard.
-
Set up the circuit: Connect the components on the breadboard as shown in the circuit diagram. Make sure to connect the coin acceptor to the correct pins on the Arduino board, and connect the relay module to control the water pump.
-
Write the code: Using the Arduino IDE, write the code for your project. The code will need to detect when a coin is inserted, start a 5-minute countdown when the start button is pressed, pause the countdown when the pause button is pressed, and resume the countdown when the pause time is up. When the countdown is complete, the code will turn off the water pump and reset the display.
-
Test and troubleshoot: Upload your code to the Arduino board and test your project. If it doesn't work as expected, try to identify and troubleshoot any errors in your code or wiring.
-
Refine and improve: Once your project is working, consider ways to improve it. You might add additional features such as a buzzer to signal the end of the countdown or a warning message if the pause button is not pressed before the end of the pause time.
Here's some sample code to get you started:
#include SevenSegmentTM1637.h
SevenSegmentTM1637 display(2, 3); // CLK pin, DIO pin
const int coinPin = 4;
const int startButtonPin = 5;
const int pauseButtonPin = 6;
const int pumpPin = 7;
const int relayPin = 8;
int pauseTime = 0;
int countdownTime = 300;
bool isCountingDown = false;
void setup() {
pinMode(coinPin, INPUT);
pinMode(startButtonPin, INPUT);
pinMode(pauseButtonPin, INPUT);
pinMode(pumpPin, OUTPUT);
pinMode(relayPin, OUTPUT);
digitalWrite(pumpPin, LOW);
digitalWrite(relayPin, LOW);
display.begin();
display.setBacklight(100);
}
void loop() {
if (digitalRead(coinPin) == HIGH) {
countdownTime = 300;
isCountingDown = false;
display.showNumberDec(countdownTime / 60, true);
while (digitalRead(coinPin) == HIGH) {
// Wait for coin to be removed
}
}
if (digitalRead(startButtonPin) == HIGH && !isCountingDown) {
isCountingDown = true;
digitalWrite(relayPin, HIGH);
}
if (digitalRead(pauseButtonPin) == HIGH && isCountingDown) {
delay(100); // Debounce the button
pauseTime = 60;
isCountingDown = false;
digitalWrite(relayPin, LOW);
}
if (pauseTime > 0) {
pauseTime--;
display.showNumberDec(pauseTime, true);
digitalWrite(pumpPin, LOW);
} else if (isCountingDown && countdownTime > 0) {
countdownTime--;
display.showNumberDec(countdownTime / 60, true);
digitalWrite(pumpPin, HIGH);
} else {
display.clear();
digitalWrite(pumpPin, LOW);
digitalWrite(relayPin, LOW);
}
delay(1000);
}
Remember to adjust the pin.