
This project implements a simplified 1D Kalman Filter (Complementary Filter logic) to fuse Accelerometer and Gyroscope data from an MPU-6500 sensor. It calculates Roll and Pitch angles using a CORDIC algorithm for the accelerometer and integrates gyroscope data with a steady-state Kalman gain.
The system consists of:
atan2 for Roll and Pitch estimation from accelerometer data.Data Format (8 bytes per packet):
0xDE0xADTo test the design on real hardware, you can use the FPGA ASIC simulator breakout with an MPU-6500 sensor module and an FT232 serial probe.
The default configuration assumes a 10MHz system clock.
Wiring Instructions:
ui[0] -> MPU6500 ADOuo[0] -> MPU6500 SDAuo[1] -> MPU6500 SCLuo[2] -> MPU6500 NCSuo[3] -> FT232 RXRunning on the FPGA Breakout (macOS):
fpga_bitstream artifact from the latest passing GitHub Action run..bin file (e.g., tt_um_intv0id_kalman.bin).tt-support-tools repository:git clone https://github.com/TinyTapeout/tt-support-tools.git tt
pip install -r tt/requirements.txt
tt_fpga.py script to upload the bitstream. Specifying the serial port for Mac (typically /dev/cu.usbmodem*):./tt/tt_fpga.py configure --port /dev/cu.usbmodem<your_port_number> --upload --name path/to/extracted/tt_um_intv0id_kalman.bin --set-default --clockrate 10000000
Running on the Demoboard ETR (using mpremote):
mpremote:pip install mpremote
mpremote and enable the project:mpremote repl
# Enable the project
tt.shuttle.tt_um_intv0id_kalman.enable()
Live Plotting:
To plot the data live using Python from the FT232, you can use the provided plot_serial.py script.
pip install pyserial matplotlibpython3 plot_serial.py --port /dev/ttyUSB0For simulation, run make in the test/ directory.
| # | Input | Output | Bidirectional |
|---|---|---|---|
| 0 | SPI_MOSI | SPI_MISO | |
| 1 | SPI_SCLK | ||
| 2 | SPI_CS_N | ||
| 3 | UART_TX | ||
| 4 | |||
| 5 | |||
| 6 | |||
| 7 |