docs about adding sensor code

This commit is contained in:
2025-02-17 13:03:07 +01:00
parent 73b03cfc1c
commit b6a6f04333

View File

@@ -158,8 +158,6 @@ When it created the project. I copied all the files over to the src folder and r
![alt text](image-4.png)
#### Setting the correct board
Before
@@ -190,6 +188,8 @@ To install a library click the platformIO icon. In there click the libraries but
After that it will edit platformio.ini and there you will see the library added to the project. It's also in `.pio/libdeps`
### Important for linux users.
When setting up PlatformIO on another system we ran into the issue that the machine couldn't upload the code properly. We first checked how the OS interacted with `dmesg`. `dmesg` on linux shows the kernel activity.
### Programming and compiling and uploading
Using platformIO is really straight forward. The only folder you should look at in your platformIO project is the `src` folder.
@@ -225,3 +225,44 @@ The purple text are compiler flags. They tell the compiler what to do with certa
| #error | Throws an error during compiling when it is compiled |
| #endif | end of a #if, #elif or #else |
### Setting the correct library
I added a compiler case for my sensor and added the correct library to it.
![alt text](image-8.png)
### Setting correct value selection
I am not sure what it does. It sets some values for the calculations later on. So I copied over the configuration for the MPU6050 because it was the most similar to the BNO085. ![alt text](image-9.png)
### Setting up the sensor
For this part I went into the documentation of the Sparkfun BNO0xx library. I first looked through the rest of the code what values it wanted because with the BNO085 you need to enable which information you want.
![alt text](image-11.png)
When digging deeper into the driver to where it pulls the data from the sensors you can see what values it want's and according to that I can go through the documentation to enable the correct data outputs.
I went to the [examples list](https://github.com/sparkfun/SparkFun_BNO080_Arduino_Library/tree/main/examples) of the library and clicked every data example I needed.
![alt text](image-12.png)
I first clicked the data type I needed.
![alt text](image-13.png)
Then I copied the line that enabled the data output.
![alt text](image-10.png)
Then I inserted it into the driver code.
### Getting data from the sensors
This step goes similar to the last step except you need to copy over another bit.
![alt text](image-14.png)
What this part does is acquire the sensor data and storing it in a variable. The same needs to be done in the driver like this.
![alt text](image-15.png)
The only issue is that the BNO085 can't output degrees. So we need to convert the radians to degrees using a simple formula I found on google.
![alt text](image-16.png)
The same also has to be done later on in the error correction algorithm
![alt text](image-17.png)
That was the last we needed to change. Hopefully it works now since I still need to fix some compile errors.