Here are the step-by-step
connections for the relay
module in your Fire Fighting
Robot project:
Relay Module Connections:
1. VCC: Connect to Arduino 5V
2. GND: Connect to Arduino GND
3. IN: Connect to Arduino Digital Pin 8 (D8)
4. NO (Normally Open): Connect to Water Pump (+)
5. NC (Normally Closed): Not used
6. COM (Common): Connect to Water Pump (-)
Water Pump Connections:
1. (+): Connect to Relay Module NO
2. (-): Connect to Relay Module COM
Arduino Connections:
- Digital Pin 8 (D8): Relay Module IN
- 5V: Relay Module VCC
- GND: Relay Module GND
Motor relay:
Based on our previous conversation, here are the connections for your Fire
Fighting Robot using the single-channel EE2008 relay module:
Connections:
1. IN (I/P) → Arduino Digital Pin 6
2. VCC → 5V Power Supply
3. GND → Power Supply GND
4. NO (Normally Open) → Motor 1 (+) (Rear Left Wheel)
5. COM (Common) → Motor 1 (-) (Rear Left Wheel)
6. NC (Normally Closed) → Motor 2 (+) (Rear Right Wheel)
7. Dummy Motor 1 (Front Left): No connections
8. Dummy Motor 2 (Front Right): No connections
Here's a detailed connection
guide for the L298N motor
driver:
L298N Motor Driver Connections:
Motor 1 (Rear Left Wheel)
1. Motor 1 (+) → L298N Output 1 (OUT1)
2. Motor 1 (-) → L298N Output 2 (OUT2)
Motor 2 (Rear Right Wheel)
1. Motor 2 (+) → L298N Output 3 (OUT3)
2. Motor 2 (-) → L298N Output 4 (OUT4)
Arduino Connections:
1. L298N Input 1 (IN1) → Arduino Digital Pin 2
2. L298N Input 2 (IN2) → Arduino Digital Pin 3
3. L298N Input 3 (IN3) → Arduino Digital Pin 4
4. L298N Input 4 (IN4) → Arduino Digital Pin 5
5. L298N Enable A (ENA) → Arduino Digital Pin 6
6. L298N Enable B (ENB) → Arduino Digital Pin 7
Power Supply:
1. L298N VCC → 5V/12V Power Supply
2. L298N GND → Power Supply GND
3. L298N 5V → Arduino 5V (if using Arduino's 5V supply)
Dummy Motors:
No connections needed (non-functional)
Arduino Code Example:
const int motor1Forward = 2; // IN1
const int motor1Backward = 3; // IN2
const int motor2Forward = 4; // IN3
const int motor2Backward = 5; // IN4
const int enableA = 6;    // ENA
const int enableB = 7;   // ENB
void setup() {
    pinMode(motor1Forward, OUTPUT);
    pinMode(motor1Backward, OUTPUT);
    pinMode(motor2Forward, OUTPUT);
    pinMode(motor2Backward, OUTPUT);
    pinMode(enableA, OUTPUT);
    pinMode(enableB, OUTPUT);
}
void loop() {
    // Forward movement
    digitalWrite(motor1Forward, HIGH);
    digitalWrite(motor2Forward, HIGH);
    digitalWrite(enableA, HIGH);
    digitalWrite(enableB, HIGH);
    delay(1000);
    // Stop movement
    digitalWrite(motor1Forward, LOW);
    digitalWrite(motor2Forward, LOW);
    digitalWrite(enableA, LOW);
    digitalWrite(enableB, LOW);
    delay(1000);
}