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

Arduino-Based Bluetooth-Controlled Servo System with Flex Sensors and MPU-6050

View and Edit Project In Cirkit DesignerImage of Arduino-Based Bluetooth-Controlled Servo System with Flex Sensors and MPU-6050

Circuit Documentation

Summary

This circuit involves an Arduino UNO and an Arduino Nano, both of which are used to control various components including servos, a Bluetooth module, and sensors. The Arduino UNO is connected to a PCA9685 PWM Servo Breakout to control multiple servos, while the Arduino Nano reads data from flex sensors and an MPU-6050 accelerometer and communicates this data via a Bluetooth module.

Component List

  1. Micro servo 9G

    • Description: Small servo motor used for precise control of angular position.
    • Pins: GND, +5V, PWM
  2. Arduino UNO

    • Description: Microcontroller board based on the ATmega328P.
    • Pins: UNUSED, IOREF, Reset, 3.3V, 5V, GND, Vin, A0, A1, A2, A3, A4, A5, SCL, SDA, AREF, D13, D12, D11, D10, D9, D8, D7, D6, D5, D4, D3, D2, D1, D0
  3. Adafruit PCA9685 PWM Servo Breakout

    • Description: 16-channel, 12-bit PWM driver.
    • Pins: 5.0V, GND, PWRIN, PWM7, PWM6, PWM5, PWM4, PWM3, PWM2, PWM1, PWM0, VCC, SDA, SCL, OE, PWM15, PWM14, PWM13, PWM12, PWM11, PWM10, PWM9, PWM8
  4. Arduino Nano

    • Description: Small, complete, and breadboard-friendly board based on the ATmega328P.
    • Pins: D1/TX, D0/RX, RESET, GND, D2, D3, D4, D5, D6, D7, D8, D9, D10, D11/MOSI, D12/MISO, VIN, 5V, A7, A6, A5, A4, A3, A2, A1, A0, AREF, 3V3, D13/SCK
  5. HC-05 Bluetooth Module

    • Description: Bluetooth module for wireless communication.
    • Pins: Key, VCC, TXD, RXD, State, GND
  6. 2.2 inch Basic Flex Resistor

    • Description: Flex sensor used to measure bending or flexing.
    • Pins: Pin 2, pin 1
  7. Resistor

    • Description: Electrical component that limits or regulates the flow of electrical current.
    • Pins: pin1, pin2
    • Properties: Resistance: 10 Ohms
  8. MPU-6050

    • Description: 6-axis motion tracking device that combines a 3-axis gyroscope and a 3-axis accelerometer.
    • Pins: VCC, GND, SCL, SDA, XDA, XCL, AD0, INT

Wiring Details

Micro servo 9G


Micro servo 9G


Micro servo 9G


Arduino UNO


Adafruit PCA9685 PWM Servo Breakout


Arduino Nano


HC-05 Bluetooth Module


2.2 inch Basic Flex Resistor


2.2 inch Basic Flex Resistor


Resistor


Resistor


MPU-6050


Code Documentation

Arduino UNO Sketch

/*
 * Arduino UNO Sketch
 * This code controls three servos connected via a PCA9685 PWM driver.
 * The servos are connected to PWM channels 0, 4, and 8 of the PCA9685.
 * The servos will move slowly back and forth.
 */

#include <Wire.h>
#include <Adafruit_PWMServoDriver.h>

Adafruit_PWMServoDriver pwm = Adafruit_PWMServoDriver();

const int servoMin = 150; // Minimum pulse length count (out of 4096)
const int servoMax = 600; // Maximum pulse length count (out of 4096)

void setup() {
  pwm.begin();
  pwm.setPWMFreq(60); // Analog servos run at ~60 Hz updates
}

void loop() {
  for (uint16_t pulselen = servoMin; pulselen < servoMax; pulselen++) {
    pwm.setPWM(0, 0, pulselen);
    pwm.setPWM(4, 0, pulselen);
    pwm.setPWM(8, 0, pulselen);
    delay(10);
  }
  for (uint16_t pulselen = servoMax; pulselen > servoMin; pulselen--) {
    pwm.setPWM(0, 0, pulselen);
    pwm.setPWM(4, 0, pulselen);
    pwm.setPWM(8, 0, pulselen);
    delay(10);
  }
}
``