Skip to content

hewittmcg/mte380

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mte380

Background

This repository holds the software developed for MTE380, our third-year design project course. In this iteration of the course, the primary objective was to develop a robot to successfully navigate a 2m x 2m course comprised of various types of terrain.

Watch it in action here!

Hardware

The microcontroller used on the robot is a STM32 NUCLEO-F446RE.

The following sensors were used to determine the robot's position in the course:

  • Three VL53L0X time-of-flight (ToF) sensors, one forward-facing and two left-facing.
  • An ICM20948 9-DoF inertial measurement unit (IMU) to detect the robot's rotation.
  • A downward-facing photoresistor to measure the colour of the terrain below.

The robot was moved by controlling four brushed DC micro metal gearmotors using two L298N motor controllers.

Software

Robot Microcontroller

The embedded C written to govern the robot's movement can be found in mte380/stm32. To run it, a recent STM32CubeIDE install is required. Importing mte380/stm32 into STM32CubeIDE should be possible, but will likely require some troubleshooting.

The robot code consists of the following modules:

Module Filename Function
main main.c Driver initialization and superloop calling course correction and position determination functions.
IMU Tracking imu_tracking.c Functionality to calculate the robot's rotation about the x-axis by numerically integrating each rotational veloicty reading. Used to determine whether the robot's chassis is parallel to the ground, which can affect ToF readings.
Motor Controller Driver l298n_motor_controller.c Motor controller driver.
Logger logger.c Creates a large buffer to store logs to and outputs logs over serial when requested.
Movement movement.c Governs acceleration, enging braking, and turning.
Photoresistor Driver photoresistor.c Uses an ADC to estimate the photoresistor's resistance and evaluate the type of surface the robot is above.
Positioning position.c Reads from the side ToFs and uses them to make slight corrections to keep the robot heading straight. Reads from the front ToF to assess when to stop and turn.
Position Tracking position_tracking.c Very similar to imu_tracking.c. Tracks readings from the front-facing ToF to attempt to discard erroneous readings. Currently unused.

Scripts

Some basic python scripts to read logs over serial and graph the data generated by logger.c can be found at mte380/scripts. Below is an example graph generated by the scripting software:

Section_0 Section_1 Section_2 Section_3

UART Forwarding

To be able to read the logs generated by logger.c and feed, it was necessary to have a way to connect UART to a computer after previously disconnecting the NUCLEO's ST-Link. Due to how the onboard ST-Link works, a reconnection will trigger a reset of the micro and loss of the logs. The workaround for this is to flash the code found in uart_forward to a second STM32 NUCLEO-F401RE, and connect UART6 on that board to UART6 on the onboard robot microcontroller. The logs generated by the robot are read by the F401RE and sent to the computer running the scripts over serial, avoiding the reset.

Credits

The driver used for the VL53L0X ToF sensor can be found here. It is designed primarily for taking single measurements with polling, but we are using the ToF sensor in continuous ranging mode.

The driver used for the ICM20948 IMU can be found here.

These drivers are licensed under their own respective license terms rather than those of this repository.

About

Autonomous Terrain-Navigating Robot.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages