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

Arduino UNO Controlled Robotic Vehicle with MPU-6050 and Bluetooth Connectivity

View and Edit Project In Cirkit DesignerImage of Arduino UNO Controlled Robotic Vehicle with MPU-6050 and Bluetooth Connectivity

Circuit Documentation

Summary

This circuit is designed to control a robotic vehicle with an Arduino UNO as the central processing unit. It includes motor drivers for wheel movement, servos for articulated mechanisms, an MPU-6050 for motion tracking, flex sensors for input, and Bluetooth modules for wireless communication. The circuit is powered by 12V batteries and uses various resistors for voltage division and signal conditioning.

Component List

Wiring Details

Arduino UNO

Motor and Wheels

Servo

MPU-6050

Basic Flex Resistor

Resistor

L298N DC Motor Driver

HC-05 Bluetooth Module

Battery 12V

Documented Code

Arduino UNO Code (Main Controller)

#include <Wire.h>
#include <MPU6050.h>

// Create an object for MPU6050
MPU6050 mpu;

// Flex sensors connected to analog pins
int flexPins[] = {A0, A1, A2, A3};  // Four flex sensors on analog pins
int flexValues[4];  // Store flex sensor values

// The 5th flex sensor is connected to digital pin 7
const int flexDigitalPin = 7;

void setup() {
  Serial.begin(9600);  // Bluetooth communication
  
  // Initialize MPU6050 (I2C)
  Wire.begin();
  mpu.initialize();

  // Check if the MPU6050 is connected
  if (!mpu.testConnection()) {
    Serial.println("MPU6050 not connected");
    while (1);
  }
  
  // Initialize flex sensor pins as inputs
  for (int i = 0; i < 4; i++) {
    pinMode(flexPins[i], INPUT);
  }

  // Set the 5th flex sensor (digital pin 7) as input
  pinMode(flexDigitalPin, INPUT);
}

void loop() {
  // Read MPU6050 data (acceleration in the X and Y axes)
  int16_t ax, ay, az;
  mpu.getAcceleration(&ax, &ay, &az);

  // Read flex sensor values from analog pins
  for (int i = 0; i < 4; i++) {
    flexValues[i] = analogRead(flexPins[i]);
  }

  // Read the digital state of the 5th flex sensor
  int flex5State = digitalRead(flexDigitalPin);

  // Send car movement commands based on hand tilt (MPU6050 data)
  if (ax > 5000) {
    Serial.println("MOVE_FORWARD");
  } else if (ax < -5000) {
    Serial.println("MOVE_BACKWARD");
  } else if (ay > 5000) {
    Serial.println("TURN_LEFT");
  } else if (ay < -5000) {
    Serial.println("TURN_RIGHT");
  } else {
    Serial.println("STOP");
  }

  // Send robotic arm movement commands based on flex sensor values
  if (flexValues[0] < 500) {
    Serial.println("BASE_MOVE");
  }
  if (flexValues[1] < 500) {
    Serial.println("SHOULDER_MOVE");
  }
  if (flexValues[2] < 500) {
    Serial.println("ELBOW_MOVE");
  }
  if (flexValues[3] < 500) {
    Serial.println("GRIPPER_CLOSE");
  }
  
  // Handle the digital flex sensor
  if (flex5State == LOW) {
    Serial.println("GRIPPER_OPEN");  // Example action when the digital flex sensor is triggered
  }

  delay(100);  // Small delay for stability
}

Servo Controller Code (Placeholder)

void setup() {
  // put your setup code here, to run once:

}

void loop() {
  // put your main code here, to run repeatedly:

}

Additional Microcontroller Code (Placeholder)

void setup() {
  // put your setup code here, to run once:

}

void loop() {
  // put your main code here, to run repeatedly:

}

(Note: The placeholder code for the servo controllers and the additional microcontroller indicates that the specific functionality for these components has not been implemented in the provided code snippets.)