Block Diagram

results

Electronics Schematic

results

FPGA Hardware Design Schematic

results

Source Code Overview

Source code for the self balancing robot can be found with documentation here. The MCU and FPGA code is located in their respective folders.

The MCU code is intended for the STM32L432KC. Within the MCU folder, there are several files with helper functions in the $\texttt{/lib}$ folder for using GPIO pins, timers, and SPI communication. The main function is located in spi.c and the PID control loop critical for self balancing is located in the pid.c.

The FPGA code is written for the iCE40 UP5K. The top module is located in top.sv. motor_controller.sv contains code for generating a PWM signal to control the motors, and the spi.sv contains the module for receiving messages from our microcontroller. Files ending in $\texttt{tb}$ are testbench files.

For more information on our methods, check out our project report.

Bill of Materials

Item Part Number Quantity Unit Price Link
4xAA Battery N.A 1 $7.00 N.A
Adafruit 6 DoF IMU 4502 1 $19.95 link
Battery Holder 3859 1 $2.95 link
Adafruit Robot Kit 3244 1 $24.95 link
H-Bridge STM L293D 1 $8.52 link

Total cost: $56.37