Building a mini drone use ESP32

@skimans This one:diymore 2PCS ESP32 Tipo C Scheda di Sviluppo,ESP32-WROOM-32 Module 2,4 GHz WLAN WiFi Bluetooth con CP2102 Chip : Amazon.it: Informatica

1 Like

@Leon90 arrived today. i have install firmware in many way, but not work :sleepy: :sleepy: :sleepy:
is ESP32-D0WD-V3 (revision 3)

@skimans Try to catch the printout info and post here to check what happen.

@Leon90

Click Connect to start
Connecting…
Connected successfully.
Try hard reset.
Chip type ESP32
Connected to ESP32
MAC Address: 24:DC:C3:A0:5F:A0
Uploading stub…
Running stub…
Stub is now running…
Detecting Flash Size
FlashId: 0x16405E
Flash Manufacturer: 5e
Flash Device: 4016
Auto-detected Flash size: 4MB
Start erasing
Finished. Took 1871ms to erase.
Image header, Magic=0xE9, FlashMode=0x02, FlashSizeFreq=0x2F
Writing data with filesize: 24144
Erase size 24144, blocks 2, block size 0x4000, offset 0x1000, encrypted no
Flashing… 67%
Flashing… 100%
Took 2990ms to write 24144 bytes
Erase size 0, blocks 0, block size 0x4000, offset 0x0000, encrypted no
Image header, Magic=0xAA, FlashMode=0x01, FlashSizeFreq=0x02
Writing data with filesize: 3072
Erase size 3072, blocks 1, block size 0x4000, offset 0x8000, encrypted no
Flashing… 100%
Took 1447ms to write 3072 bytes
Erase size 0, blocks 0, block size 0x4000, offset 0x0000, encrypted no
Image header, Magic=0xE9, FlashMode=0x02, FlashSizeFreq=0x2F
Writing data with filesize: 1823936
Erase size 1823936, blocks 112, block size 0x4000, offset 0x10000, encrypted no
Flashing… 0%
Flashing… 1%
Flashing… 2%
Flashing… 3%
Flashing… 4%
Flashing… 5%
Flashing… 6%
Flashing… 7%
Flashing… 8%
Flashing… 8%
Flashing… 9%
Flashing… 10%
Flashing… 11%
Flashing… 12%
Flashing… 13%
Flashing… 14%
Flashing… 15%
Flashing… 16%
Flashing… 17%
Flashing… 17%
Flashing… 18%
Flashing… 19%
Flashing… 20%
Flashing… 21%
Flashing… 22%
Flashing… 23%
Flashing… 24%
Flashing… 25%
Flashing… 26%
Flashing… 26%
Flashing… 27%
Flashing… 28%
Flashing… 29%
Flashing… 30%
Flashing… 31%
Flashing… 32%
Flashing… 33%
Flashing… 34%
Flashing… 35%
Flashing… 35%
Flashing… 36%
Flashing… 37%
Flashing… 38%
Flashing… 39%
Flashing… 40%
Flashing… 41%
Flashing… 42%
Flashing… 43%
Flashing… 44%
Flashing… 44%
Flashing… 45%
Flashing… 46%
Flashing… 47%
Flashing… 48%
Flashing… 49%
Flashing… 50%
Flashing… 51%
Flashing… 52%
Flashing… 52%
Flashing… 53%
Flashing… 54%
Flashing… 55%
Flashing… 56%
Flashing… 57%
Flashing… 58%
Flashing… 59%
Flashing… 60%
Flashing… 61%
Flashing… 61%
Flashing… 62%
Flashing… 63%
Flashing… 64%
Flashing… 65%
Flashing… 66%
Flashing… 67%
Flashing… 68%
Flashing… 69%
Flashing… 70%
Flashing… 70%
Flashing… 71%
Flashing… 72%
Flashing… 73%
Flashing… 74%
Flashing… 75%
Flashing… 76%
Flashing… 77%
Flashing… 78%
Flashing… 79%
Flashing… 79%
Flashing… 80%
Flashing… 81%
Flashing… 82%
Flashing… 83%
Flashing… 84%
Flashing… 85%
Flashing… 86%
Flashing… 87%
Flashing… 88%
Flashing… 88%
Flashing… 89%
Flashing… 90%
Flashing… 91%
Flashing… 92%
Flashing… 93%
Flashing… 94%
Flashing… 95%
Flashing… 96%
Flashing… 97%
Flashing… 97%
Flashing… 98%
Flashing… 99%
Flashing… 100%
Took 186660ms to write 1823936 bytes
Erase size 0, blocks 0, block size 0x4000, offset 0x0000, encrypted no
Done!
To run the new firmware please reset your device.
Made with :heart: by Spacehuhn

@skimans No this one, but the printout when the module power on.
it looks like this (I send you before):

@Leon90: not appear nothing when i connect my ESP32 to terminal :sleepy: :sleepy: :sleepy:

@skimans remember that the baud rate is 115200, you should use the RST button on your board to reset it.
the step should be:
1.connect the USB port of your board with PC, and open the terminal software use 115200 baud rate.
2.use the RST button on your board to reset it, then the print info should be pop out.

@Leon90 i have reinstall firmware and after connecting to terminale software i have this message, but after 1 second the connect is lost and go out of terminal:

another screen that i have in terminal is this:

if i connect Gyro GY-521 i obtain this:


but in Mission Planner not connect still.
I have mission Planner portable version in pc becouse i cannot install on pc.

thanks

@Leon90 finally i have first informations from Terminal:

ets Jul 29 2019 12:21:46

rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)

configsip: 0, SPIWP:0xee

clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00

mode:DIO, clock div:2

load:0x3fff0030,len:4976

load:0x40078000,len:15300

ho 0 tail 12 room 4

load:0x40080400,len:3776

entry 0x40080620

e[0;32mI (614) cpu_start: Multicore appe[0m

e[0;32mI (614) cpu_start: Pro cpu up.e[0m

e[0;32mI (614) cpu_start: Starting app cpu, entry point is 0x4008dbcce[0m

e[0;32mI (0) cpu_start: App cpu up.e[0m

e[0;32mI (632) cpu_start: Pro cpu start user codee[0m

e[0;32mI (632) cpu_start: cpu freq: 240000000e[0m

e[0;32mI (632) cpu_start: Application information:e[0m

e[0;32mI (636) cpu_start: ELF file SHA256: 834a333402cbd37f…e[0m

e[0;32mI (642) cpu_start: ESP-IDF: v4.4.5-355-g1f00708c84e[0m

e[0;32mI (649) cpu_start: Min chip rev: v0.0e[0m

e[0;32mI (653) cpu_start: Max chip rev: v3.99 e[0m

e[0;32mI (658) cpu_start: Chip rev: v3.1e[0m

e[0;32mI (663) heap_init: Initializing. RAM available for dynamic allocation:e[0m

e[0;32mI (670) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAMe[0m

e[0;32mI (676) heap_init: At 3FFC5DF0 len 0001A210 (104 KiB): DRAMe[0m

e[0;32mI (682) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAMe[0m

e[0;32mI (689) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAMe[0m

e[0;32mI (695) heap_init: At 4009DF84 len 0000207C (8 KiB): IRAMe[0m

e[0;32mI (702) spi_flash: detected chip: generice[0m

e[0;32mI (706) spi_flash: flash io: qioe[0m

i2c_init: scl=27 sda=26 speed=4

e[0;32mI (713) gpio: GPIO[27]| InputEn: 0| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0 e[0m

e[0;32mI (722) gpio: GPIO[26]| InputEn: 0| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0 e[0m

e[0;32mI (731) gpio: GPIO[26]| InputEn: 1| OutputEn: 1| OpenDrain: 1| Pullup: 1| Pulldown: 0| Intr:0 e[0m

e[0;32mI (741) gpio: GPIO[27]| InputEn: 1| OutputEn: 1| OpenDrain: 1| Pullup: 1| Pulldown: 0| Intr:0 e[0m

e[0;32mI (761) esp_core_dump_uart: Init core dump to UARTe[0m

e[0;32mI (761) cpu_start: Starting scheduler on PRO CPU.e[0m

e[0;32mI (0) cpu_start: Starting scheduler on APP CPU.e[0m

float test:inf in 173 us

virtual void ESP32::Scheduler::init():77 running with CONFIG_FREERTOS_HZ=1000

OK created task _main_thread

AnalogIn: eFuse Two Point: NOT supported

AnalogIn: eFuse Vref: Supported

OK created task _timer_thread

oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo

OK created task _rcout_thread

RCOutput::init() - channels available: 4

oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo

OK created task _rcin_thread

OK created task _uart_thread

No sdcard�

Init ArduCopter V4.5.0-dev (2e84e273)

Free RAM: 110592

load_all took 611us

I (78) wifi:wifi driver task: 3ffd8e88, prio:23, stack:6656, core=0

e[0;32mI (919) system_api: Base MAC address is not sete[0m

e[0;32mI (920) system_api: read default base MAC address from EFUSEe[0m

I (926) wifi:wifi firmware version: 1ba8b6a

I (929) wifi:wifi certification version: v7.0

I (934) wifi:config NVS flash: disabled

I (937) wifi:config nano formating: disabled

I (941) wifi:Init data frame dynamic rx buffer num: 16

I (946) wifi:Init management frame dynamic rx buffer num: 16

I (951) wifi:Init management short buffer num: 32

I (956) wifi:Init dynamic tx buffer num: 16

I (960) wifi:Init static rx buffer size: 1600

I (964) wifi:Init static rx buffer num: 2

I (968) wifi:Init dynamic rx buffer num: 16

e[0;32mI (972) wifi_init: tcpip mbox: 32e[0m

e[0;32mI (975) wifi_init: udp mbox: 6e[0m

e[0;32mI (979) wifi_init: tcp mbox: 6e[0m

e[0;32mI (983) wifi_init: tcp tx win: 5744e[0m

e[0;32mI (987) wifi_init: tcp rx win: 5744e[0m

e[0;32mI (991) wifi_init: tcp mss: 1436e[0m

e[0;32mI (995) wifi_init: WiFi RX IRAM OP enablede[0m

e[0;32mI (1329) phy_init: phy_version 4670,719f9f6,Feb 18 2021,17:07:07e[0m

I (1423) wifi:mode : softAP (26:dc:c3:a0:5f:a0)

I (1425) wifi:Total power save buffer number: 8

I (1425) wifi:Init max length of beacon: 752/752

I (1426) wifi:Init max length of beacon: 752/752

OK created task _wifi_thread

GPIO: set pin15 output mode

e[0;32mI (1442) gpio: GPIO[15]| InputEn: 0| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0 e[0m

e[0;32mI (1444) gpio: GPIO[15]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0 e[0m

GPIO: set pin5 output mode

e[0;32mI (1456) gpio: GPIO[5]| InputEn: 0| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0 e[0m

e[0;32mI (1465) gpio: GPIO[5]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0 e[0m

OK created task bus_thread

AnalogIn: adding ardupin:255-> which is adc1_offset:-1

AnalogIn: channel:0 created but using delayed adc and gpio pin configuration

AP_Logger_File: buffer size=16384

RCOutput::set_output_mode: 1

RCOutput::set_output_mode: 1

No Compass backends available

Init Gyro**

I have connect SDA in IO21 and SCL in IO22.
but not connect of Mission Player.

@skimans it looks like the mavlink is already running, the red part is the heartbeat msg to GCS:

@Leon90 is the gyro connected.

But the principal problem is that not connect to Mission Planner

@skimans But you can see the heartbeat msg to GCS is send out from the module, it seem the Mavlink already runing, you can try again to connect the module to GCS when you see the red part data send out.

Hi nice project! Did you build the drone chassis on your own or did you buy one?

@Riebers I bought the first one, and I designed a new one:

Hi, looks nice. For which esp32 version did you compile ardupilot Firmware? I tried with ardupilot v.4.4 and esp32 Firmware 5.1.1 and it did not compile out of the box.

I changed esp32 Firmware to v4.4 and it built but could not link the executable. It is missing definition for some logging class. I will inspect this further and will post here when i manage to compile.

@Riebers There is a readme file in this path: “ardupilot\libraries\AP_HAL_ESP32\README.md”, you should follow its steps to build the environment, hope this can help you.

Hi thanks for your advice @Leon90 .

Now i can build ardupilot for esp32. I have to disable scripting because the linker could not find function log_content(). I dont know if this is maybe autogenerated code.

How do i define on which pin i connect which hardware. For example i have a GY-521 sensor. How can i configure to use this sensor? I thought hardware pin definition is defined in hwdef.dat under AP_HAL_ESP32/hwdef/ but all files are empty.

Thanks for your help.

Hi. Is it possible to compile ardupilot for ESP32 C3? Esp32 C3 does have an RISCV processor and i could compile to a degreee. But now i realised that c3 does not have mcpwm capability. Does any one know how to compile or what i could do to workaround this mcpwm lib used in ardupilot?

Greetings

@Leon90 i have one question. I build ardupilot for esp32 and flashed it successfully. Further I have an mp6050 sensor. On which pins i have to connect these sensor? The sensor uses i2c to communicate.

Thanks for your reply