docs - it finally compiles now except the IMU is dead
BIN
docs/Assignments/week_4_programming/IMG_8200.jpg
Normal file
After Width: | Height: | Size: 176 KiB |
BIN
docs/Assignments/week_4_programming/IMG_8212.jpg
Normal file
After Width: | Height: | Size: 361 KiB |
BIN
docs/Assignments/week_4_programming/IMG_8213.jpg
Normal file
After Width: | Height: | Size: 389 KiB |
BIN
docs/Assignments/week_4_programming/image-26.jpg
Normal file
After Width: | Height: | Size: 54 KiB |
BIN
docs/Assignments/week_4_programming/image-27.jpg
Normal file
After Width: | Height: | Size: 14 KiB |
BIN
docs/Assignments/week_4_programming/image-28.jpg
Normal file
After Width: | Height: | Size: 16 KiB |
BIN
docs/Assignments/week_4_programming/image-29.jpg
Normal file
After Width: | Height: | Size: 64 KiB |
BIN
docs/Assignments/week_4_programming/image-30.jpg
Normal file
After Width: | Height: | Size: 215 KiB |
BIN
docs/Assignments/week_4_programming/image-31.jpg
Normal file
After Width: | Height: | Size: 102 KiB |
BIN
docs/Assignments/week_4_programming/image-32.jpg
Normal file
After Width: | Height: | Size: 122 KiB |
BIN
docs/Assignments/week_4_programming/image-33.jpg
Normal file
After Width: | Height: | Size: 212 KiB |
BIN
docs/Assignments/week_4_programming/image-34.jpg
Normal file
After Width: | Height: | Size: 212 KiB |
BIN
docs/Assignments/week_4_programming/image-35.jpg
Normal file
After Width: | Height: | Size: 29 KiB |
BIN
docs/Assignments/week_4_programming/image-36.jpg
Normal file
After Width: | Height: | Size: 31 KiB |
BIN
docs/Assignments/week_4_programming/image-37.jpg
Normal file
After Width: | Height: | Size: 60 KiB |
BIN
docs/Assignments/week_4_programming/image-38.jpg
Normal file
After Width: | Height: | Size: 39 KiB |
@@ -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.
|
||||
|
||||

|
||||

|
||||
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.
|
||||
|
||||

|
||||

|
||||
|
||||
#### 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.
|
||||
|
||||

|
||||

|
||||
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.
|
||||
|
||||

|
||||

|
||||
|
||||
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.
|
||||
|
||||

|
||||

|
||||
|
||||
After that I added the global variables for the ESPNow protocol.
|
||||
|
||||

|
||||

|
||||
|
||||
Then I uncommented `RadioSetup()` again so it could be used again and I added a case for my ESPNow protocol.
|
||||

|
||||

|
||||
|
||||
|
||||
In the PWM receive function I added an additional case so my PWM values actually get intergrated into the code.
|
||||
|
||||

|
||||

|
||||
|
||||
At the end of the program I added the ESPNow Initialisation function and the callback function for when the data is received.
|
||||
|
||||

|
||||

|
||||
|
||||
When I comppile it now it should work.
|
||||
When I compile it now it should work. Except that it doesn't work.
|
||||
|
||||

|
||||
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:
|
||||

|
||||
|
||||
To:
|
||||

|
||||
|
||||
Result:
|
||||

|
||||
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.
|
||||
|
||||

|
||||
|
||||
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:
|
||||

|
||||
|
||||
Instead of like this.
|
||||

|
||||
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)
|
||||
|
@@ -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
|