Oscar Varney and Jotham Gates, 2024
This is the code repository for a Final Year Project (FYP) to develop a crankset and power meter for Human Powered Vehicles (HPVs).
- See here for some instructions on getting the power meter to work with MQTT and WiFi.
- See here for information on configuring the power meter.
- See here for information on MQTT topics used when communicating using this protocol.
- If you are a member of MHP, then the Notion page for this project can be found here.
The schematic and PCB layout were completed using KiCAD 8. The design files are in the power-meter-pcb
folder.
The firmware is written to use the Arduino environment of Platform IO and is located in the power-meter-code
directory.
Install the following libraries, either by using the Arduino library manager or going to their GitHub repository and cloning them.
- ArduinoJson library for JSON encoding and decoding.
- ICM42670P library for communicating with the IMU.
- BasicLinearAlgebra library for matrix maths. This is also added as a submodule for testing the Kalman filter on a computer.
- ArduinoBLE library for Bluetooth Low Energy (BLE) communications.
- PubSubClient library for communicating using MQTT over WiFi.
A bash script has been written to update the dates on all modified or staged files (not including untracked files). To perform this operation, run:
./tools/update_date.sh
Another script is included to update the version info on all files and definitions for the code. The files and elements updated include:
- Any
@version
tags in the code directory. - The
VERSION
definition indefines.h
. - The Doxygen version number in
Doxyfile
.
As an example:
./tools/update_version.sh 1.2.3
This needs to be modified to work with the platform IO structure. Copy the
pre-commit
file into.git/hooks/pre-commit
. This will check the date of code files and make sure they are up to date.
Documentation can be automatically generated using Doxygen by running doxygen
from the root folder of the repository. You might need to install doxygen and graphviz first. The output will be placed in the docs
folder. GitHub actions may be set up later down the track to automatically generate and deploy to GitHub pages on commit- however that would require a public repository and documentation.
To generate a massive appendix for the report, run ./tools/generate_refman.sh
The output file will be refman.pdf
.
Scripts for testing the board hardware and easing development of certain sections can be found in the scripts-testing
directory. This includes python scripts used to log data over MQTT and plot it.