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

WiFi-Controlled Basket-Carrying Robot with GPS and GSM Notification

View and Edit Project In Cirkit DesignerImage of WiFi-Controlled Basket-Carrying Robot with GPS and GSM Notification

Circuit Documentation

Summary

This circuit is designed to control a 4-wheeled WiFi car with a basket. It features an IR sensor for detecting when the basket is full, which then triggers the system to send the car's location and a message to the user via GPS and GSM modules. The core of the control system is an ESP8266 NodeMCU microcontroller, which interfaces with a GPS module (NEO 6M), a GSM module (Sim800l), and an L298N DC motor driver to control the gearmotors attached to the wheels.

Component List

Gearmotor DC / Motorreductor

Sim800l

GPS NEO 6M

IR Sensor

Li-ion 5000mAh Battery

ESP8266 NodeMCU

L298N DC Motor Driver

7805 Voltage Regulator

Wiring Details

Gearmotor DC / Motorreductor

Sim800l

GPS NEO 6M

IR Sensor

Li-ion 5000mAh Battery

ESP8266 NodeMCU

L298N DC Motor Driver

7805 Voltage Regulator

Documented Code

/*
 * This Arduino Sketch controls a 4-wheeled WiFi car with a basket. An IR sensor
 * detects when the basket is full, triggering the system to send the car's
 * location and a message to the user via GPS and GSM modules.
 */

#include <SoftwareSerial.h>

// Pin definitions
#define IN1 D6
#define IN2 D7
#define IN3 D5
#define IN4 D8
#define ENA D2
#define ENB D1
#define IR_SENSOR D0

// GPS and GSM serial connections
SoftwareSerial gpsSerial(RX, TX); // GPS NEO 6M
SoftwareSerial gsmSerial(D3, D4); // Sim800l

void setup() {
  // Initialize serial communications
  Serial.begin(115200);
  gpsSerial.begin(9600);
  gsmSerial.begin(9600);

  // Initialize motor control pins
  pinMode(IN1, OUTPUT);
  pinMode(IN2, OUTPUT);
  pinMode(IN3, OUTPUT);
  pinMode(IN4, OUTPUT);
  pinMode(ENA, OUTPUT);
  pinMode(ENB, OUTPUT);

  // Initialize IR sensor pin
  pinMode(IR_SENSOR, INPUT);

  // Initialize motors to off
  digitalWrite(ENA, LOW);
  digitalWrite(ENB, LOW);
}

void loop() {
  // Check IR sensor
  if (digitalRead(IR_SENSOR) == HIGH) {
    // Basket is full, send location and message
    sendLocationAndMessage();
  }

  // Add motor control logic here
}

void sendLocationAndMessage() {
  // Get GPS location
  String location = getGPSLocation();

  // Send message via GSM
  gsmSerial.println("AT+CMGF=1"); // Set SMS mode to text
  delay(1000);
  gsmSerial.println("AT+CMGS=\"+1234567890\""); // Replace with user number
  delay(1000);
  gsmSerial.print("Basket is full. Location: ");
  gsmSerial.print(location);
  delay(1000);
  gsmSerial.write(26); // ASCII code for Ctrl+Z to send SMS
  delay(1000);
}

String getGPSLocation() {
  String location = "";
  while (gpsSerial.available()) {
    char c = gpsSerial.read();
    location += c;
  }
  return location;
}

This code is responsible for the operation of the WiFi car. It initializes the serial communication with the GPS and GSM modules, sets up the motor control pins, and reads the IR sensor to detect when the basket is full. Upon detection, it retrieves the GPS location and sends an SMS message with the location to a predefined user number.