Cov txheej txheem:

ESP32 LoRa Tswj Drone Cav: 10 Kauj Ruam
ESP32 LoRa Tswj Drone Cav: 10 Kauj Ruam

Video: ESP32 LoRa Tswj Drone Cav: 10 Kauj Ruam

Video: ESP32 LoRa Tswj Drone Cav: 10 Kauj Ruam
Video: ESP32 with LoRa using Arduino IDE – Getting Started 2024, Kaum ib hlis
Anonim
Image
Image
Qhia tawm
Qhia tawm

Niaj hnub no peb tab tom tham txog lub tshuab drone, nquag hu ua "brushless" lub cev muaj zog. Lawv tau siv dav hauv aeromodelling, feem ntau hauv drones, vim lawv lub zog thiab kev sib hloov siab. Peb yuav kawm txog kev tswj lub cav tsis siv txhuam siv ESC thiab ESP32, ua qhov kev ua piv txwv ntawm ESC siv sab hauv LED_PWM maub los, thiab siv lub zog ntsuas kom hloov lub cev muaj zog nrawm.

Kauj Ruam 1: Qhia tawm

Kauj Ruam 2: Cov Khoom Siv

Cov peev txheej siv
Cov peev txheej siv
  • Jumpers rau kev txuas
  • Wifi LoRa 32
  • ESC-30A
  • Txhuam A2212 / 13t Cav
  • USB cable
  • Potentiometer rau kev tswj hwm
  • Protoboard
  • Fais fab mov

Kauj Ruam 3: Wifi LoRa 32- Pinout

Wifi LoRa 32- Pinout
Wifi LoRa 32- Pinout

Kauj Ruam 4: ESC (Kev Tswj Hluav Taws Xob)

ESC (Kev Tswj Hluav Taws Xob)
ESC (Kev Tswj Hluav Taws Xob)
ESC (Kev Tswj Hluav Taws Xob)
ESC (Kev Tswj Hluav Taws Xob)
  • Hluav Taws Xob Hluav Taws Xob
  • Hluav taws xob hluav taws xob los tswj qhov nrawm ntawm lub tshuab hluav taws xob.
  • Tswj los ntawm tus qauv 50Hz PWM servo tswj.
  • Nws txawv qhov kev hloov pauv ntawm lub network ntawm cov txiaj ntsig kev ua haujlwm transistors (FETs). Los ntawm kev kho qhov hloov pauv zaus ntawm transistors, lub cev muaj zog tau hloov pauv. Lub cev muaj zog nrawm sib txawv los ntawm kev kho lub sijhawm ntawm cov khoom siv tam sim no rau cov cua sib txawv ntawm lub cav.
  • Kev qhia tshwj xeeb:

Cov zis tam sim no: 30A txuas ntxiv, 40A rau 10 vib nas this

Kauj Ruam 5: ESC Kev Tswj Hluav Taws Xob (ESC)

ESC Kev Tswj Hluav Taws Xob (ESC)
ESC Kev Tswj Hluav Taws Xob (ESC)

Kauj Ruam 6: PWM Servo Tsav Tswj

PWM Servo Motor Control
PWM Servo Motor Control

Peb yuav tsim PWM servo los ua haujlwm ntawm ESC cov ntaub ntawv nkag los ntawm kev coj ncaj qha channel 0 ntawm LED_PWM rau GPIO13, thiab siv lub zog ntsuas los tswj kev hloov pauv.

Rau kev ntes, peb yuav siv lub hwj chim ntawm 10k ua qhov faib hluav taws xob. Kev ntes yuav ua tiav ntawm channel ADC2_5, nkag tau los ntawm GPIO12.

Kauj ruam 7: Analog Capture

Analog ntes
Analog ntes
Analog ntes
Analog ntes

Analog rau digital conversion

Peb yuav hloov qhov txiaj ntsig ntawm AD rau PWM.

PWM ntawm servo yog 50Hz, yog li lub sijhawm mem tes yog 1/50 = 0.02 vib nas this lossis 20 milliseconds.

Peb yuav tsum ua yam tsawg 1 millisecond mus rau 2 milliseconds.

Thaum PWM nyob ntawm 4095, lub plawv dhia dav yog 20 milliseconds, txhais tau tias peb yuav tsum mus txog qhov siab tshaj ntawm 4095/10 kom mus txog 2 milliseconds, yog li PWM yuav tsum tau txais 410 *.

Thiab tom qab tsawg kawg 1 millisecond, yog li 409/2 (lossis 4095/20), PWM yuav tsum tau txais 205 *.

* Tus nqi yuav tsum yog tus lej

Kauj Ruam 8: Circuit - Kev Sib Txuas

Circuit Court - Kev sib txuas
Circuit Court - Kev sib txuas

Kauj ruam 9: Source Code

Lub taub hau

#include // Necessário apenas para o Arduino 1.6.5 e posterior #suav nrog "SSD1306.h" // o mesmo que #include "SSD1306Wire.h" // OLED_SDA -GPIO4 // OLED_SCL -GPIO15 // OLED_RST - GPIO16 #define SDA 4 #define SCL 15 #define RST 16 SSD1306 zaub (0x3c, SDA, SCL, RST); // Instanciando e ajustando os pinos do objeto "display"

Ntau yam

const int freq = 50; const int canal_A = 0; const koj resolucao = 12; const int pin_Atuacao_A = 13; const int Leitura_A = 12; cov potencia = 0; int cov = 0; int ciclo_A = 0;

Teeb

teeb tsa tsis muaj dab tsi () {pinMode (pin_Atuacao_A, OUTPUT); ledcSetup (channel_A, freq, resolucao); ledcAttachPin (pin_Atuacao_A, channel_A); ledcWrite (channel_A, ciclo_A); display.init (); display.flipScreenVertically (); // Vira a tela verticalmente display.clear (); // ajusta o alinhamento para a esquerda display.setTextAlignment (TEXT_ALIGN_LEFT); // ajusta a fonte para Arial 16 display.setFont (ArialMT_Plain_16); }

Loop

void loop () {leitura = analogRead (Leitura_A); ciclo_A = daim ntawv qhia (leitura, 0, 4095, 205, 410); ledcWrite (channel_A, ciclo_A); potencia = daim ntawv qhia (leitura, 0, 4095, 0, 100); display.clear (); // limpa o tsis ua zaub display.drawString (0, 0, String ("AD:")); display.drawString (32, 0, Txoj hlua (leitura)); display.drawString (0, 18, String ("PWM:")); display.drawString (48, 18, Txoj hlua (ciclo_A)); display.drawString (0, 36, Txoj hlua ("Potência:")); display.drawString (72, 36, Txoj hlua (potencia)); display.drawString (98, 36, Txoj hlua ("%")); display.display (); // feem ntau tsis muaj zaub}

Kauj ruam 10: Cov ntaub ntawv

Rub tawm cov ntawv

INO

PDF

Pom zoo: