Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 10 Next »

Pre-reqs:

Electrical General Documentation

DataAcq-StarterProject

The Data Acquisition System for Longhorn Racing Solar can be divided into the following subsystems:

  1. 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.

  2. 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.

  3. 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://code.visualstudio.com

https://www.kicad.org/

https://www.st.com/en/development-tools/stm32cubeide.html

https://www.npmjs.com/

https://nextjs.org/

https://www.python.org/downloads/

https://anaconda.org/anaconda/conda

https://projectchrono.org/pychrono/

If you are unfamiliar or want to get more comfortable working within a Linux environment, check out: https://missing.csail.mit.edu/

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:

image-20240927-190054.png

image-20240927-190240.png

image-20240927-190832.png

image-20240927-191009.png

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.

image-20240927-185801.png

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 -

image-20240927-211521.png

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

Your job is to modify the accelerometer, gyroscope, and imu drivers to properly interface between the STM32 and the LSM6.

The following is a code snippet found in the lsm6.c file:

uint8_t LSM6DSL_AccReadID(void)
{  
  /* IO interface initialization */
  SENSOR_IO_Init();
  /* Read value at Who am I register address */
  return (SENSOR_IO_Read(LSM6DSL_ACC_GYRO_I2C_ADDRESS_LOW, LSM6DSL_ACC_GYRO_WHO_AM_I_REG));
}

However, the SENSOR_IO_Read is a generic function, and it is your responsibility to replace it with the proper STM SPI communication function.

Make sure you understand what the function is doing, and verify you are sending the correct packages to the IMU. Check out section 9. Register Mapping to verify the packages.

Want some more practice or another introduction to electrical work?

check out: PCB Starter Project - Fan Board

Display

10/05/24

Ahead of Schedule?

Check out:

https://missing.csail.mit.edu/

https://github.com/astrolancing/lhr-svt-da-bootcamp-2024

https://drive.google.com/file/d/1WcelXRpiBJWYGkKvwAVdFLVyTp6dLY5V/view

Analysis

10/12/24

Ahead of Schedule?

Check out:

https://missing.csail.mit.edu/

https://github.com/astrolancing/lhr-svt-da-bootcamp-2024

https://drive.google.com/file/d/1WcelXRpiBJWYGkKvwAVdFLVyTp6dLY5V/view

  • No labels