Orodha ya maudhui:

Turbine ya Umeme Na ESP32: Hatua 9
Turbine ya Umeme Na ESP32: Hatua 9

Video: Turbine ya Umeme Na ESP32: Hatua 9

Video: Turbine ya Umeme Na ESP32: Hatua 9
Video: Sinko 80A MPPT Hybrid Solar Charge Controller Connections. #mppt #sinkomppt #sinko #HybridMPPT 2024, Novemba
Anonim
Image
Image
Maandamano
Maandamano

Leo, nitazungumzia turbine ya umeme na ESP32. Mkutano una sehemu ambayo ilichapishwa kwa 3D. Nitawasilisha kazi ya PWM ya ESP32 ambayo inafaa kudhibiti motors za umeme. Hii itatumika katika motor DC. Nitaonyesha pia utendaji wa hii MCPWM (Motor Control PWM) katika maombi ya vitendo.

Nilitumia ESP32 LoRa katika mradi huu, na nadhani ni muhimu kutambua hapa kwamba microcontroller hii ina vizuizi viwili ndani yake. Vitalu hivi vina uwezo wa kudhibiti motors tatu kila moja. Kwa hivyo, inawezekana kudhibiti hadi motors sita na PWM, zote kwa kujitegemea. Hii inamaanisha kuwa udhibiti nitakaotumia hapa sio kiwango (ambacho ni sawa na Arduino). Badala yake, udhibiti ni chip yenyewe, ambayo inahakikishia ESP32 kubadilika sana kwa heshima na udhibiti wa magari.

Hatua ya 1: Maonyesho

Hatua ya 2: Udhibiti wa Magari ya PWM

Udhibiti wa Magari ya PWM
Udhibiti wa Magari ya PWM
Udhibiti wa Magari ya PWM
Udhibiti wa Magari ya PWM

Mchoro Mkuu:

Kazi ya MCPWM ya ESP32 inaweza kutumika kudhibiti aina anuwai ya motors za umeme. Ina vitengo viwili.

• Kila kitengo kina jozi tatu za PWM.

• Kila pato la A / B linaweza kusawazishwa na moja ya vipima muda vya maingiliano 0, 1, au 2.

• Timer moja inaweza kutumika kulandanisha zaidi ya jozi moja ya pato ya PWM

Mchoro Kamili:

• Kila kitengo pia kina uwezo wa kukusanya ishara za kuingiza kama DALILI ZA KUSAINISHA;

• Tambua DALILI ZA KOSA kwa overvur Voltage au motor;

• Pata maoni na SIGNALI ZA KUTEKA, kama vile nafasi ya Injini

Hatua ya 3: Rasilimali Zilizotumiwa

Rasilimali Zilizotumiwa
Rasilimali Zilizotumiwa

• Rukia kwa unganisho

• Heltec Wifi LoRa 32

• Dereva wa kawaida wa DC

• Daraja H - L298N

• kebo ya USB

• Kitabu cha ulinzi

• Ugavi wa umeme

Hatua ya 4: ESP 32 Dev Kit - Pinout

Kitengo cha ESP 32 Dev - Pinout
Kitengo cha ESP 32 Dev - Pinout

Hatua ya 5: Upandaji wa Turbine

Ufungaji wa Turbine
Ufungaji wa Turbine
Ufungaji wa Turbine
Ufungaji wa Turbine

Hatua ya 6: Mzunguko - Uunganisho

Mzunguko - Uunganisho
Mzunguko - Uunganisho

Hatua ya 7: Upimaji juu ya Oscilloscope

Upimaji juu ya Oscilloscope
Upimaji juu ya Oscilloscope

Hatua ya 8: Nambari ya Chanzo

Kichwa

#pamoja // Não é needário caso use Arduino IDE # include "driver / mcpwm.h" // inclui a biblioteca "Motor Control PWM" nativa do ESP32 #include // Necessário apenas para o Arduino 1.6.5 e posterior #include " SSD1306.h "// o mesmo que # pamoja na" SSD1306Wire.h "// OLED_SDA - GPIO4 // OLED_SCL - GPIO15 // OLED_RST - GPIO16 #fafanua SDA 4 #fafanua SCL 15 #fafanua RST 16 SSD1306 onyesho (0x3cc, SDA, SCL, RST); // Instanciando e ajustando os pinos do objeto "display" #fasili GPIO_PWM0A_OUT 12 // Declara GPIO 12 como PWM0A #define GPIO_PWM0B_OUT 14 // Declara GPIO 14 como PWM0B

Sanidi

kuanzisha batili () {Serial.begin (115200); onyesha.init (); //display.flipScreenVertically (); // Vira onyesho la wima la kuonyesha. Wazi (); // ajusta o alinhamento kwa onyesho la esquerda.setTextAlignment (TEXT_ALIGN_LEFT); // ajusta font kwa kuonyesha Arial 16.setFont (ArialMT_Plain_16); // mcpwm_gpio_init (unidade PWM 0, saida A, porta GPIO) => Instancia o MCPWM0A hakuna pino GPIO_PWM0A_OUT declarado no começo do código mcpwm_gpio_init (MCPWM_UNIT_0, MCPWM0A, GPIO_0A, GPIO_0A, GPIO_0A, GPIO_0A, GPIO_0A; GPIO_0A; // mcpwm_gpio_init (unidade PWM 0, saida B, porta GPIO) => Instancia o MCPWM0B hakuna pino GPIO_PWM0B_OUT declarado no começo do código mcpwm_gpio_init (MCPWM_UNIT_0, MCPWM0B, GPIO_P0) mcpwm_config_t pwm_config; pwm_config.frequency = 1000; // frequencyência = 500Hz, pwm_config.cmpr_a = 0; // Ciclo de trabalho (mzunguko wa ushuru) fanya PWMxA = 0 pwm_config.cmpr_b = 0; // Ciclo de trabalho (mzunguko wa ushuru) fanya PWMxb = 0 pwm_config.counter_mode = MCPWM_UP_COUNTER; // Para MCPWM assimetrico pwm_config.duty_mode = MCPWM_DUTY_MODE_0; // Fafanua ciclo de trabalho em nível alto // Inicia (Unidade 0, Timer 0, Config PWM) mcpwm_init (MCPWM_UNIT_0, MCPWM_TIMER_0, & pwm_config); // Fafanua PWM0A & PWM0B com kama mipangilio ya acima}

Kazi

// Função que usanidi wa opareta ya MCPWM A (Unidade, Timer, Porcentagem (ciclo de trabalho)) tuli tuli brushed_motor_forward (mcpwm_unit_t mcpwm_num, mcpwm_timer_t timer_num, float duty_cycle) {// mcpw (0, 1 ou 2), Operador (A ou B)); => Desliga o sinal do MCPWM no Operador B (Define o sinal em Baixo) mcpwm_set_signal_low (mcpwm_num, timer_num, MCPWM_OPR_B); // mcpwm_set_duty (unidade PWM (0 ou 1), Número do timer (0, 1 ou 2), Operador (A ou B), Ciclo de trabalho (% fanya PWM)); => Usanidi programu ya kufanya PWM hakuna Operador A (Ciclo de trabalho) mcpwm_set_duty (mcpwm_num, timer_num, MCPWM_OPR_A, duty_cycle); // mcpwm_set_duty_tyoe (unidade PWM (0 ou 1), Número do timer (0, 1 ou 2), Operador (A ou B), Nível do ciclo de trabalho (alto ou baixo)); => fafanua aina nyingine ya maandishi (alto ou baixo) mcpwm_set_duty_type (mcpwm_num, timer_num, MCPWM_OPR_A, MCPWM_DUTY_MODE_0); // Nota: Chame essa função toda vez que for chamado "mcpwm_set_signal_low" ou "mcpwm_set_signal_high" para manter o ciclo de trabalho configurado anteriormente} // Função que configura o MCPWM Do operador B (Unidade, Timer, Porcentagem) tuli tuli iliyosafirishwa_motor_ya nyuma (mcpwm_unit_t mcpwm_num, mcpwm_timer_t timer_num, float duty_cycle) {mcpwm_set_signal_low (mcpwm_num, timer_num, MCPWM_OPR_A); // Desliga o sinal do MCPWM no Operador A (Define o sinal em Baixo) mcpwm_set_duty (mcpwm_num, timer_num, MCPWM_OPR_B, duty_cycle); // Kusanidi porcentagem kufanya PWM hakuna Operador B (Ciclo de trabalho) mcpwm_set_duty_type (mcpwm_num, timer_num, MCPWM_OPR_B, MCPWM_DUTY_MODE_0); // kufafanua o Nivel kufanya Ciclo de Trabalho (alto ou Baixo)} // Função que para o MCPWM de ambos os Operadores tuli utupu brushed_motor_stop (mcpwm_unit_t mcpwm_num, mcpwm_timer_t timer_num) {mcpwm_set_signal_low (mcpwm_num, timer_num, MCPWM_OPR_A); // Desliga o sinal do MCPWM no Operador A mcpwm_set_signal_low (mcpwm_num, timer_num, MCPWM_OPR_B); // Desliga o sinal do MCPWM no Operador B}

Kitanzi

kitanzi batili () {// Hamisha o motor hakuna sentido horário brushed_motor_forward (MCPWM_UNIT_0, MCPWM_TIMER_0, 50.0); oled ("50"); kuchelewa (2000); // Para o motor brushed_motor_stop (MCPWM_UNIT_0, MCPWM_TIMER_0); oled ("0"); kuchelewa (2000); // Sogeza o motor hakuna sentido antihorário brushed_motor_backward (MCPWM_UNIT_0, MCPWM_TIMER_0, 25.0); oled ("25"); kuchelewa (2000); // Para o motor brushed_motor_stop (MCPWM_UNIT_0, MCPWM_TIMER_0); oled ("0"); kuchelewa (2000); // Aceleracao i de 1 a 100 kwa (int i = 10; i <= 100; i ++) {brushed_motor_forward (MCPWM_UNIT_0, MCPWM_TIMER_0, i); oled (Kamba (i)); kuchelewesha (200); } // Desaceleração i de 100 kuchelewa 1 (5000); kwa (int i = 100; i> = 10; i -) {brushed_motor_forward (MCPWM_UNIT_0, MCPWM_TIMER_0, i); oled (Kamba (i)); kuchelewesha (100); } kuchelewa (5000); }

Hatua ya 9: Pakua faili

PDF

INO

Kuchora

Ilipendekeza: