esp32_MPU6050/README.md
2024-04-11 13:01:50 +02:00

3.1 KiB
Raw Blame History

Work yourself from the Main, to the rest of the branches step by step, as they build on each other. Follow the following steps in this README before doing the branches and Main though for a good setup.

Tutorial additions (Everything not present in the Git folder) (origin: docx file) Installing the PlatformIO IDE extension In Visual Studio Code, go to “Extensions”. Search for “PlatformIO“ and install said extension. A little Icon should appear on the left sidebar, click on it to initialize everything. And youre good to go!

Basics of the PlatformIO IDE There are the 3 most important features it provides:

Building your project and flashing it to the Board of choice (example: ESP32) A .ini file to manage everything you need for a setup (for example what framework to use, what board, library dependencies etc) Practical inbuilt terminal How do you build a project? You click on the little checkmark at the bottom bar. How do you flash / install your program on the board of choice? Right next to said little checkmark is an arrow pointing right. Click on it, and it builds your program and flashes it. How do you access the terminal quickly? You click on the cable-head symbol on the same bar.

“Oh no, none of those symbols are there?!” Do not worry. Check whether you initialized the extension by clicking on it and checking if “PIO Home” -> “Open” opens a site or not. If the second is not the case, deinstall and reinstall the extension to see if that solves the issue.

Creating a new project in PlatformIO You have now successfully installed the extension. Well done! Now you can start the coding. Almost. Go to “PlatformIO” -> “PIO Home” -> “Open” -> “New Project” If you are working on the ESP32 S1, you can use the exact board selected in the picture. If not, you must check what other board selection works for your board.

Once that is all said and done, click Finish and your new project opens. You want to mainly work in “src”, “main.cpp” for now.

Installing the library you need for the MPU6050 This is one method as to how to include and install this library for your project, but I personally deem this method the best. Here are the steps:

Go to the little icon of the PlatformIO extension and click on it. Then go to the “Libraries” option. Once there, search for “Adafruit MPU6050”, there should be 5 results. Click on it, and then on “Add to Project” Select your project and the version, then click “Add”. This will take a little moment before its added, but once thats done, youre all good to go regarding including the .h files in your program.

The test and setup of the ESP32 itself. What do you need?

An esp32 (s1 optionally, mind the board selection in vs code) An MPU6050 (Check datasheet if unsure) A few cables of your choice (Jumpwires for example) A USB cable to sustain the ESP Here are the pins you need to connect to each other: (ESP Pin -> MPU6050 Pin) 3v3 -> VCC (IMPORTANT! Not 5V) | GND -> GND | G22 -> SCL | G21 -> SDA

The other pins can be used for other specific stuff if curious check the datasheet.