mirror of
https://gitlab.waag.org/make/fablab/interns/2025/sam.git
synced 2025-08-03 11:54:58 +00:00
docs about adding sensor code
This commit is contained in:
@@ -158,8 +158,6 @@ When it created the project. I copied all the files over to the src folder and r
|
|||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#### Setting the correct board
|
#### Setting the correct board
|
||||||
|
|
||||||
Before
|
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`
|
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
|
### 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.
|
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 |
|
| #error | Throws an error during compiling when it is compiled |
|
||||||
| #endif | end of a #if, #elif or #else |
|
| #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.
|
||||||
|

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

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

|
||||||
|
I first clicked the data type I needed.
|
||||||
|

|
||||||
|
Then I copied the line that enabled the data output.
|
||||||
|
|
||||||
|

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

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

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

|
||||||
|
|
||||||
|
The same also has to be done later on in the error correction algorithm
|
||||||
|
|
||||||
|

|
||||||
|
That was the last we needed to change. Hopefully it works now since I still need to fix some compile errors.
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user