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

Bluetooth-Controlled Line Maker with Dual Motor and Pump Operation

View and Edit Project In Cirkit DesignerImage of Bluetooth-Controlled Line Maker with Dual Motor and Pump Operation

Circuit Documentation

Summary

The circuit in question is designed to control a line maker with two modes of operation: manual and semi-automatic. In manual mode, the pump can be directly controlled via push buttons. In semi-automatic mode, the system is controlled via a smartphone connected through Bluetooth, allowing for the control of both the motors and the pump. The circuit utilizes an Arduino UNO as the main microcontroller, interfaced with a Bluetooth module for wireless communication, a 4-channel relay module for controlling the motors and pump, a 2-channel relay for additional control, and a 12V battery for power supply.

Component List

250W 12V Electric Motor Brush Motor DC

Pump

Arduino UNO

2-Channel Relay

Bluetooth HC-06

12V 7Ah Battery

Relay 4 Channel 5V

Wiring Details

Arduino UNO

250W 12V Electric Motor Brush Motor DC

Pump

2-Channel Relay

Bluetooth HC-06

12V 7Ah Battery

Relay 4 Channel 5V

Documented Code

Arduino UNO Code

/*
 * Project: Line Maker
 * Description: This Arduino sketch controls a line maker with two modes: manual and
 * semi-automatic. In manual mode, the pump can be controlled directly via push
 * buttons. In semi-automatic mode, the system is controlled via a smartphone
 * connected through Bluetooth, allowing control of both the motors and the pump.
 */

#include <SoftwareSerial.h>

SoftwareSerial mySerial(2, 3);  // RX, TX

// Declare the Arduino pins for motor control
int lm1 = 4;
int lm2 = 5;
int rm1 = 6;
int rm2 = 7;
int pump1 = 8;  // Pump control pin 1
int pump2 = 9;  // Pump control pin 2
int manualButton = 10;  // Manual mode button
int pumpButton = 11;  // Pump control button
int state;

void setup() {
  // Initialize motor control pins
  pinMode(lm1, OUTPUT);
  pinMode(lm2, OUTPUT);
  pinMode(rm1, OUTPUT);
  pinMode(rm2, OUTPUT);
  // Initialize pump control pins
  pinMode(pump1, OUTPUT);
  pinMode(pump2, OUTPUT);
  // Initialize manual control buttons
  pinMode(manualButton, INPUT_PULLUP);
  pinMode(pumpButton, INPUT_PULLUP);
  
  // Set initial state for motors and pump (motors and pump off)
  digitalWrite(lm1, HIGH);
  digitalWrite(lm2, HIGH);
  digitalWrite(rm1, HIGH);
  digitalWrite(rm2, HIGH);
  digitalWrite(pump1, LOW);  // Pump off initially
  digitalWrite(pump2, LOW);  // Pump off initially

  // Set the serial communication rate
  Serial.begin(9600);
  mySerial.begin(9600);
}

void loop() {
  // Check if manual mode button is pressed
  if (digitalRead(manualButton) == LOW) {
    // Manual mode
    if (digitalRead(pumpButton) == LOW) {
      // Turn pump on
      digitalWrite(pump1, HIGH);
      digitalWrite(pump2, LOW);
    } else {
      // Turn pump off
      digitalWrite(pump1, LOW);
      digitalWrite(pump2, LOW);
    }
  } else {
    // Semi-automatic mode
    // Save incoming data to variable 'state'
    if (mySerial.available() > 0) {
      state = mySerial.read();
    }

    /*********************** Left ****************************/
    // If state is 'L', car will go left
    if (state == 'L') {
      Serial.println("LEFT");
      digitalWrite(lm1, LOW);
      digitalWrite(lm2, HIGH);
      digitalWrite(rm1, HIGH);
      digitalWrite(rm2, LOW);
    }
    /********************** Forward ************************/
    // If state is 'F', car will go forward
    else if (state == 'F') {
      Serial.println("FORWARD");
      digitalWrite(lm1, LOW);
      digitalWrite(lm2, HIGH);
      digitalWrite(rm1, LOW);
      digitalWrite(rm2, HIGH);
    }
    /********************** Backward ************************/
    // If state is 'B', car will go backward
    else if (state == 'B') {
      Serial.println("BACKWARD");
      digitalWrite(lm1, HIGH);
      digitalWrite(lm2, LOW);
      digitalWrite(rm1, HIGH);
      digitalWrite(rm2, LOW);
    }
    /*********************** Right ****************************/
    // If state is 'R', car will go right
    else if (state == 'R') {
      Serial.println("RIGHT");
      digitalWrite(lm1, HIGH);
      digitalWrite(lm2, LOW);
      digitalWrite(rm1, LOW);
      digitalWrite(rm2, HIGH);
    }
    /*********************** Pump On ****************************/
    // If state is 'P', turn the pump on
    else if (state == 'P') {
      Serial.println("PUMP ON");
      digitalWrite(pump1, HIGH);
      digitalWrite(pump2, LOW);
    }
    /*********************** Pump Off ****************************/
    // If state is 'O', turn the pump off
    else if (state == 'A') {
      Serial.println("PUMP OFF");
      digitalWrite(pump1, LOW);
      digitalWrite(pump2, LOW);
    }
    /********* STOP or Invalid Command *********/
    else {
      Serial.println("Invalid!!!");
      digitalWrite(lm1, HIGH);
      digitalWrite(rm1, HIGH);
      digitalWrite(lm2, HIGH);
      digitalWrite(rm2, HIGH);
    }
  }
}

Note: The code provided for the other microcontroller instances is either empty or a default template without specific functionality. Therefore, it is not included in this documentation.