https://github.com/RomeroPablo/Pre-reqs:
Electrical General Documentation
Make a branch on the following GitHub:
Name it lastfirst-DAQSTARTER
The Data Acquisition System for Longhorn Racing Solar can be divided into the following subsystems:
...
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://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:
...
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).
Checkout page 38 for tips on reading a datasheet:
https://drive.google.com/file/d/1ncT20jXJit8rNf8lYBwRSi9BwHNnSHLV/view?usp=drive_link
Some helpful pages:
...
Firmware
...
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.
setup stm
generate hal
dev firmware
output to terminal
done with this part
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
...
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:
Code Block |
---|
$ make |
in the “DAQStarterProjectMCU” directory.
Reading and writing to the serial terminal
Code Block |
---|
/* 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:
Code Block |
---|
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-2024WIP
setup chrono
https://apidrive.projectchrono.org/pychrono_installation.html
Use Python script to simulate the motion of a mechanical system
Helpful Links
Display/Analysis BootCamp: 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
Reference Text: https://drive.google.com/file/d/1WcelXRpiBJWYGkKvwAVdFLVyTp6dLY5V/view
...