docs - it finally compiles now except the IMU is dead

This commit is contained in:
2025-02-19 10:56:04 +01:00
parent a08ed6c5a8
commit df4145c734
19 changed files with 461 additions and 274 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 176 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 361 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 389 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 215 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 102 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 122 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 212 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 212 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

View File

@@ -457,7 +457,7 @@ I am following [this](https://randomnerdtutorials.com/esp-now-esp32-arduino-ide/
What I first need to do according to the tutorial is get the receiver esp their mac adress. Luckily that gets displayed when uploading to the esp.
![alt text](image-26.png)
![alt text](image-26.jpg)
After `MAC` there is the mac address. I've saved it in my controller code as a compiler flag `#define receiverMAC "d8:3b:da:37:66:00";` So I could use it later on. I don't know if the libraries accepts this compiler flag but I will find out soon enough.
I first need to create a struct with the data I wanna send. A stuct is a collection of variables named under one big variable.
@@ -573,7 +573,7 @@ I added that it could connect to the internet and that it attempts to send data.
Now when I compile it I get errors that the data isn't being send correctly. The issue could be that the second microcontroller isn't turned on with the receiver code.
![alt text](image-27.png)
![alt text](image-27.jpg)
#### Drone side
@@ -651,10 +651,10 @@ A weird thing I found out is that my esp32C3 Supermini doesn't work wirelessly t
I've delved a bit deeper into it and then I found online that with the first batches of espC3 supermini's have issues with the antenna. When I was debugging it I noticed that connecting the ground to the antenne fixed it when I tried it with a pin. But when soldered on it didn't work anymore and then only thing that worked was my finger.
![alt text](IMG_8200.JPEG)
![alt text](IMG_8200.jpg)
Result of bridging ground and the antenna. Sadly didn't work. After that I grabbed the Xiao espC3 and connected it. It almost worked like a drop in replacement I only needed to change the Potpin. After that it worked flawlessly.
![alt text](image-28.png)
![alt text](image-28.jpg)
Now I can start intergrating the code into the drone driver.
@@ -670,25 +670,51 @@ The first thing I did is add the correct libraries at the top of the file. So it
After that I added my own ESPNow define so I could use that later on in the code. I want the code to stay variable and user specified so thats why im continuing the way it was made.
![alt text](image-29.png)
![alt text](image-29.jpg)
After that I added the global variables for the ESPNow protocol.
![alt text](image-30.png)
![alt text](image-30.jpg)
Then I uncommented `RadioSetup()` again so it could be used again and I added a case for my ESPNow protocol.
![alt text](image-31.png)
![alt text](image-31.jpg)
In the PWM receive function I added an additional case so my PWM values actually get intergrated into the code.
![alt text](image-32.png)
![alt text](image-32.jpg)
At the end of the program I added the ESPNow Initialisation function and the callback function for when the data is received.
![alt text](image-33.png)
![alt text](image-33.jpg)
When I comppile it now it should work.
When I compile it now it should work. Except that it doesn't work.
![alt text](image-34.jpg)
From looking at the errors it looked like the PWMServo library wasn't compatible with the ESP32. When looking around on google from PWMservo libraries for the ESP32 I found the correct library on [this](https://randomnerdtutorials.com/esp32-servo-motor-web-server-arduino-ide/) website. When I added that I needed to edit the class creation to the correct library and then it finaly compiled!
From:
![alt text](image-35.jpg)
To:
![alt text](image-36.jpg)
Result:
![alt text](image-37.jpg)
It compiles!
The next day when testing the code. The microcontroller would suddenly disconnect. First I tried setting every pin to something else because there where pins being defined the espC6 doesn't have. When I finally set the debug level to verbose. So I can see everything that the microcontroller is doing. I saw that it used pin 12 and 13 for USB. And somewhere in the program pin 12 and 13 where re-assigned. So I removed that it got reassigned and then the communication worked flawlessly again.
![alt text](image-38.jpg)
Now I can finally test. When adding debug print statements for my sensor I found out it wasn't responding. Then I looked at the pins of the sensor and found out when I re-seated it I acciddentally killed it.
I had it like this:
![alt text](IMG_8212.jpg)
Instead of like this.
![alt text](IMG_8213.jpg)
So I had the 3v3 connected to the sensor it's ground and the ground connected to the SCL pin. So that killed it.
## Sources
### Code
@@ -697,6 +723,7 @@ When I comppile it now it should work.
* [BNO085 library examples](https://github.com/sparkfun/SparkFun_BNO080_Arduino_Library/tree/main/examples)
* [PlatformIO espC6](https://wiki.seeedstudio.com/xiao_esp32c6_with_platform_io)
* [ESC calibration and PWM](https://ardupilot.org/copter/docs/esc-calibration.html)
* [ESP32PWMServo lib](https://randomnerdtutorials.com/esp32-servo-motor-web-server-arduino-ide/)
### Parts
* [PotSlider](https://nl.aliexpress.com/item/1005006733220962.html)

View File

@@ -11,10 +11,12 @@
[env:seeed_xiao_esp32c6]
platform = https://github.com/mnowak32/platform-espressif32.git#boards/seeed_xiao_esp32c6
platform_packages =
framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#3.0.2
framework-arduinoespressif32-libs @ https://github.com/espressif/arduino-esp32/releases/download/3.0.2/esp32-arduino-libs-3.0.2.zip
framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#3.0.2
framework-arduinoespressif32-libs @ https://github.com/espressif/arduino-esp32/releases/download/3.0.2/esp32-arduino-libs-3.0.2.zip
framework = arduino
board = seeed_xiao_esp32c6
lib_deps =
paulstoffregen/PWMServo@^2.1
sparkfun/SparkFun BNO080 Cortex Based IMU@^1.1.12
madhephaestus/ESP32Servo@^3.0.6
build_flags = -DCORE_DEBUG_LEVEL=5

File diff suppressed because it is too large Load Diff