The Data Acquisition System for Longhorn Racing Solar can be divided into the following subsystems:
Telemetry Acquisition
This subsystem is responsible for capturing real-time signals from the vehicle’s electrical, mechanical, and environmental systems, and also handles the transmission of this data to the display subsystem.Telemetry Display
The Telemetry Display subsystem is responsible for creating and maintaining the dashboard that displays critical telemetry to relevant systems. This involves designing user-friendly interfaces, integrating real-time data streams, and providing customizable views for the various systems.Telemetry Analysis
This subsystem uses the telemetry data to inform race strategies and verify system performance. The team working on analysis applies advanced data processing techniques, such as data analytics, simulation modeling, and machine learning, to optimize race conditions and suggest improvements to vehicle performance and mechanical design.
This project is designed to introduce you to some key technologies utilized across the various subsystems of Data Acq. While it doesn't serve as an exhaustive overview or an in-depth tutorial on any single technology, its purpose is to help you understand the broader data acquisition pipeline and how the different components come together.
Even if your role focuses on just one of these technologies, it's crucial to have a solid grasp of the overall system. This knowledge not only enhances collaboration with your teammates but also allows you to integrate your work with theirs, ensuring a cohesive design.
Development Environment
Ensure you have properly setup the following software packages before continuing:
https://www.st.com/en/development-tools/stm32cubeide.html
https://www.python.org/downloads/
https://anaconda.org/anaconda/conda
https://projectchrono.org/pychrono/
Objective
Develop a real-time telemetry system that captures, transmits, and analyzes data from an Inertial Measurement Unit (IMU) connected to an STM32 microcontroller, visualizes the data through a web dashboard, and performs dynamic simulations using the PyChrono library for mechanical analysis.
Acquisition
Hardware
The first step in the data acquisition pipeline is digitizing the target signal—in our case, vehicle positional information. We use the LSM6 IMU, an always-on 3-axis accelerometer and 3-axis gyroscope to achieve this. Since there are several revisions of this IMU, it’s essential to ensure that the datasheet you reference corresponds to the specific version you're working with. Below is the link to the datasheet for the IMU you are likely using for this project:
https://www.st.com/en/mems-and-sensors/lsm6ds3tr-c.html
We also require a Micro Controller Unit (MCU), to interface, process, and transmit the data from the IMU. On LHRS we primarily utilized low-power MCUs developed by STMicroelectronics, which provide MCUs with varying clock speeds, onboard memory, and I/O peripherals. There are several STM MCU product lines, so make sure the data sheet you work with corresponds to the MCU you are targeting. Attached is a link for the MCU you are likely using for this project:
https://www.st.com/en/microcontrollers-microprocessors/stm32f042k6.html
We also need a way to communicate between the MCU and our laptop. For this purpose, we will be utilizing a UART to USB IC. Attached is a link to the peripheral you are likely to be using for this project:
https://ftdichip.com/products/ft230xs/
On LHRS, we design and develop custom Printed Circuit Boards (PCBs) which are mounted inside the car. These PCBs act as platforms for integrating the electrical components required for our design objectives. For this project, the PCB will provide an interface between the IMU and the MCU, and USB IC.
We will be using KiCad for our PCB prototyping/design, and I have provided a KiCad project folder in the starter project GitHub. The project already contains the appropriate symbols for the design. Using the data sheets, it is your job to make the correct electrical connections on the schematic and PCB between the different peripherals. (Clue: we are using SPI to communicate from the IMU to STM32, and UART to communicate from the STM32 to the USB).
Some helpful pages:
Firmware
Once the hardware is complete, it is time to develop the firmware that will be running on our MCU. The goal of this firmware is to configure the correct peripherals on the MCU and to transmit the data from the IMU to the USB.
To accomplish this, we will be using the STM32Cube IDE. I have already generated the project using the correct MCU, it is now your job to enable the correct pins on the MCU based on your electrical schematic.
Once you have configured the correct pins, go ahead and generate the code using the button in the top right corner.
If done correctly, you should have a file structure that looks similar to this -
The files that you should take note of are:
accelero.h - header file for lsm6 accelerometer drivers
gyro.h - header file for lsm6 gyroscope drivers
lsm6.h / lsm6.c- files for IMU drivers
spi.h / spi.c - files for SPI drivers
usart.h / usart.h - files for UART drivers
main.h / main.c - initializes and calls drivers
At this point, I recommend making sure your program can compile by running:
$ make
in the “DAQStarterProjectMCU” directory.
Reading and writing to the serial terminal
/* USER CODE BEGIN WHILE */ uint8_t msg[] = "Test 0x01 :: UART COMMUNICATION\n\r"; while (1) { HAL_UART_Transmit(&huart1, (uint8_t *)msg, sizeof(msg), 100); /* USER CODE END WHILE */ /* USER CODE BEGIN 3 */ } /* USER CODE END
Make sure you have an appropriate program to read from devices, such as PuTTY (Windows) or Minicom (Linux). Bind the program to the appropriate port, maintaining the same baud rate and formatting you configured using the STM32Cube IDE.
Once you confirm this works, try modifying the code to send a different text message, and then try sending a counter.
Reading and writing to the IMU
Display
https://github.com/astrolancing/lhr-svt-da-bootcamp-2024
WIP
setup npm, setup next.js …
we are feeding the imu data to a terminal, now take this data and display it on a locally hosted website
Analysis
https://github.com/astrolancing/lhr-svt-da-bootcamp-2024
WIP
setup chrono
https://api.projectchrono.org/pychrono_installation.html
Use Python script to simulate the motion of a mechanical system
Helpful Links
Display/Analysis BootCamp: https://github.com/astrolancing/lhr-svt-da-bootcamp-2024
Reference Text: https://drive.google.com/file/d/1WcelXRpiBJWYGkKvwAVdFLVyTp6dLY5V/view