The main goal of the project is to get familiar with various hardware concepts while trying to build some sort of self-stabilizing aerial vehicle (e.g. drone, plane, etc.).
- Choose hardware (main uC, accelerometer, barometer, motors, props)
- Choose software stack (uC, base station, persistence)
- Display fake sensor data
- Display live sensor data
- Controll two motors to properly balance a see-saw
- Get reliable sensor readings under motor vibrations
- Persist sensor data and display historical data
- TBD
A quick guide to get the project up and running.
The following software packages need to be installed to successfully compile the project:
All previously mentioned packaged are usually available via the inbuilt package manager of the OS. The Raspberry Pi Pico SDK on the other hand needs some special setup that is described in the next section.
-
Pico SDK & picotool
The Raspberry Pi Foundation provides a rather extensive set of libraries that provide ready to use functions for most common features of the platform and abstracts the concrete hardware of the used RP2040 board (e.g. Pico vs. Pico W) so it will work with all of them with minimal changes. This project makes use of the Pico SDK and therefore an initial setup is required.
-
Clone the pico-sdk & picotool repositories into a folder named
pico
into your work directory that sits on the same level as this project's root directory:mkdir pico cd pico git clone [email protected]:raspberrypi/pico-sdk.git git clone [email protected]:raspberrypi/picotool.git
This should result in the following hierarchy:
<work-dir> - project-ikarus - pico - pico-sdk - picotool
-
Install all required dependencies for pico-sdk & picotool. The following commands only apply to macOS using brew:
brew install gcc-arm-embedded libusb cmake
-
Build the pico-sdk project:
cd pico-sdk git submodule update --init
-
Build the picotool project:
cd pico-tool mkdir build cd build export PICO_SDK_PATH=../../pico-sdk cmake .. make
Also make sure to add the
picotool
executable to your path. -
To enable hands off flashing of your Raspberry Pi Pico you need to flash it once manually with any program thas has
stdio_usb
support enabled. After that all subsequent updates can be applied withmake flash-pico
.
-
To download all dependencies and initialize the project run make init
. This will download Go dependencies, required npm packages
and some additional tools. Running make
in the project root
will compile all subprojects and output their binaries to bin/
.
A short reference on the most used make targets:
Target | Description |
---|---|
make init | Download dependencies and tools |
make | Compile all subprojects |
make run | Runs the tower backend |
make test | Runs tests for all subprojects |
make flash-pico | Flashes software changes to the Raspberry Pi Pico |
make clean | Deletes bin/* |
Some thoughts on different hardware options that could be used.
Possible microcontrollers to execute the control loop on.
-
Raspberry Pi RP2040
The RP2040 is an ARM Cortex MO+ based processor with two cores and plenty of other features.
The documentation is pretty great and it ships with a dedicated C/C++ SDK including a CLI tool to upload new firmware which makes integration with the existing project quite easy. It also has a whopping 16 PWM channels and 8 PIO state machines which are a quite unique feature and for sure interesting to play around. There are different breakout boards available (even one with WIFI which could be interesting). Price wise those breakout boards are also a lot cheaper than for example competing Adafruit projects. Costing only around 5 € (or 8 € with WIFI).
Possible accelerometer sensors.
-
Invensense MPU-6050
The MPU-6050 is a 6-axis gyro/accelerometer combi chip that also features a basic temperature sensor. It can be addressed via SPI or I2C.
Invensense states that this chip is already obsolete and shouldn't be used for new projects but it still looks like a good choice, is widely available and pretty cheap (breakout boards go for under 10 €). A big plus is the built in digital motion processor (DMP) which basically is a small chip that can calculate motion fusion algorithms on the sensor itself, freeing up resources on the main uC.
TBD
- Flight Controller (uC)
- Tower (GUI app)
The flight controller is the main data source of the system and submits all available events to the message broker for live monitoring and after the fact data analysis.
The implementation will initially be done in C but later on I want to give Forth a try.
-
Features
- Sends sensor data via serial port to the base station
- Runs a simple PID loop to control a single actuator
- Sends sensor data via WIFI to the Message Broker directly
- Controls multiple actuators
Tower is a native GUI application to display graph data sent from the flight controller and in return send some controlling data back to arm/disarm and tune the PID controllers.
For the actual GUI drawing raylib
and raylibgui
are used. The
graphs are drawn by a custom implementation.