Circuit Documentation
Summary
The circuit in question appears to be designed for a drone or a similar remote-controlled vehicle. It includes brushless motors controlled by electronic speed controllers (ESCs), a power distribution board (PDB) with an XT60 connector, a Lipo battery, and a buck converter for voltage regulation. The circuit also features an MPU-6050 sensor for motion tracking, an HC-SR04 ultrasonic sensor for distance measurement, a GPS module for positioning, and two ESP32 microcontrollers for overall control and communication. Additionally, there is an ESP32-CAM module for capturing images and a flight controller for managing the vehicle's stability. The circuit is completed with a remote receiver for user input.
Component List
Brushless Motor
- Description: A type of electric motor that uses electronic commutation instead of mechanical means to change the direction of current flow in the motor.
- Purpose: Provides propulsion for the drone.
Electronic Speed Controller (ESC)
- Description: An electronic circuit that controls and regulates the speed of an electric motor.
- Purpose: Controls the speed of the brushless motors.
MPU-6050
- Description: A motion tracking device that combines a 3-axis gyroscope and a 3-axis accelerometer.
- Purpose: Used for motion sensing and orientation tracking.
HC-SR04 Ultrasonic Sensor
- Description: An ultrasonic ranging module that provides 2cm to 400cm non-contact measurement functionality.
- Purpose: Measures distances by emitting ultrasonic waves and detecting their reflections.
PDB XT60
- Description: A power distribution board designed for drones, with an XT60 connector for power input.
- Purpose: Distributes power from the battery to various components in the circuit.
Lipo Battery
- Description: A rechargeable battery of lithium-ion technology used for high energy storage.
- Purpose: Provides power to the entire circuit.
LM2956 Buck Converter DC-DC
- Description: A DC-DC converter that steps down voltage from a higher level to a lower level.
- Purpose: Regulates voltage to provide a stable power supply to components requiring lower voltages.
GPS NEO 6M
- Description: A GPS module that provides location and timing information.
- Purpose: Used for positioning and navigation.
ESP32 38 PINS
- Description: A microcontroller with Wi-Fi and Bluetooth capabilities and a wide range of GPIO pins.
- Purpose: Acts as the main controller for the drone, handling sensor data, motor control, and communication.
ESP32 - CAM
- Description: An ESP32-based module with an onboard camera.
- Purpose: Captures images and possibly video for surveillance or monitoring purposes.
Resistor
- Description: A passive two-terminal electrical component that implements electrical resistance as a circuit element.
- Purpose: Typically used for current limiting or voltage dropping within circuits.
KK 2.1.5 FLIGHT CONTROLLER
- Description: A flight control board for multi-rotor aircraft.
- Purpose: Manages the stability and control of the drone during flight.
FLYSKY FS- IA6
- Description: A 6-channel 2.4GHz receiver designed for RC aircraft.
- Purpose: Receives control signals from a remote transmitter.
Wiring Details
Brushless Motor
- Connected to the corresponding M1, M2, and M3 pins of the ESCs.
Electronic Speed Controller (ESC)
- Battery VCC and Battery GND pins are connected to the PDB XT60 and the Lipo Battery for power.
- Signal pins are connected to the ESP32 38 PINS microcontroller for motor control signals.
- 5v out and GND out pins are not detailed in the net list.
MPU-6050
- VCC and GND pins are connected to the LM2956 Buck Converter for power.
- SCL and SDA pins are connected to the ESP32 38 PINS microcontroller for I2C communication.
HC-SR04 Ultrasonic Sensor
- VCC and GND pins are connected to the LM2956 Buck Converter for power.
- TRIG and ECHO pins are connected to the ESP32 38 PINS microcontroller for ultrasonic signal control and reading.
PDB XT60
- "+" and "-" pins are connected to the Lipo Battery for power input.
- VCC and GND pins are connected to the ESCs for power distribution.
LM2956 Buck Converter DC-DC
- IN+ and IN- pins are connected to the PDB XT60 for input power.
- OUT+ and OUT- pins are connected to the MPU-6050, HC-SR04 Ultrasonic Sensor, and the FLYSKY FS- IA6 for regulated power output.
GPS NEO 6M
- VCC and GND pins are connected to the LM2956 Buck Converter for power.
- RX and TX pins are connected to the ESP32 38 PINS microcontroller for serial communication.
ESP32 38 PINS
- GND pin is connected to the GND of various components for a common ground.
- 3V3 and 5V pins are connected to the LM2956 Buck Converter for power.
- GPIO pins are connected to the ESCs, MPU-6050, HC-SR04 Ultrasonic Sensor, and GPS NEO 6M for control and data communication.
ESP32 - CAM
- 5V and GND pins are connected to the LM2956 Buck Converter for power.
- IO12, IO13, IO14, and IO15 pins are connected to the ESP32 38 PINS microcontroller for camera control and data.
Resistor
- Not detailed in the net list, but typically connected in series or parallel with other components to form voltage dividers or current paths.
KK 2.1.5 FLIGHT CONTROLLER
- 5V and GND pins are connected to the LM2956 Buck Converter for power.
- S pin is connected to the FLYSKY FS- IA6 for receiving control signals.
FLYSKY FS- IA6
- 5V and GND pins are connected to the LM2956 Buck Converter for power.
- CH1 to CH6 pins are connected to the KK 2.1.5 FLIGHT CONTROLLER for control signal input.
Documented Code
ESP32 38 PINS Microcontroller (Main Controller)
#include <Wire.h>
#include <Adafruit_MPU6050.h>
#include <Adafruit_Sensor.h>
#include <WiFi.h>
#include <ESP32Servo.h>
#define MPU6050_SDA 21
#define MPU6050_SCL 22
#define ULTRASONIC_TRIG 12
#define ULTRASONIC_ECHO 13
#define ESC1_SIGNAL 23
#define ESC2_SIGNAL 19
#define ESC3_SIGNAL 18
#define ESC4_SIGNAL 17
Adafruit_MPU6050 mpu;
long duration;
int distance;
Servo esc1;
Servo esc2;
Servo esc3;
Servo esc4;
void setup() {
Serial.begin(115200);
Wire.begin(MPU6050_SDA, MPU6050_SCL);
if (!mpu.begin()) {
Serial.println("Failed to find MPU6050 chip");
while (1) {
delay(10);
}
}
mpu.setAccelerometerRange(MPU6050_RANGE_8_G);
mpu.setGyroRange(MPU6050_RANGE_500_DEG);
mpu.setFilterBandwidth(MPU6050_BAND_21_HZ);
pinMode(ULTRASONIC_TRIG, OUTPUT);
pinMode(ULTRASONIC_ECHO, INPUT);
esc1.attach(ESC1_SIGNAL);
esc2.attach(ESC2_SIGNAL);
esc3.attach(ESC3_SIGNAL);
esc4.attach(ESC4_SIGNAL);
WiFi.begin("yourSSID", "yourPASSWORD");
while (WiFi.status() != WL_CONNECTED) {
delay(1000);
Serial.println("Connecting to WiFi...");
}
Serial.println("Connected to WiFi");
}
void loop() {
sensors_event_t a, g, temp;
mpu.getEvent(&a, &g, &temp);
Serial.print("AccelX: "); Serial.print(a.acceleration.x);
Serial.print(", AccelY: "); Serial.print(a.acceleration.y);
Serial.print(", AccelZ: "); Serial.println(a.acceleration.z);
digitalWrite(ULTRASONIC_TRIG, LOW);
delayMicroseconds(2);
digitalWrite(ULTRASONIC_TRIG, HIGH);
delayMicroseconds(10);
digitalWrite(ULTRASONIC_TRIG, LOW);
duration = pulseIn(ULTR