How to Communicate using SPI with the STM32 ARM MCU and a 400g Accelerometer - GPT-4o vs Claude

preview_player
Показать описание


The video above will give you an in-depth understanding of who I am and how I tick!

In this video, I continue my series on using AI language models like ChatGPT and Claude to help program embedded systems. This time, I tackle a more challenging task: communicating with a high-G accelerometer using SPI on an STM32 microcontroller.
I start by explaining the unique aspects of high-G accelerometers and show how I connect one to my microcontroller. Then, I walk through my process of using AI to generate the necessary code, encountering various challenges along the way.
Throughout the video, I demonstrate my hands-on approach, from wiring the accelerometer to a breadboard, to creatively mounting it on a hammer for testing. I also share my experiences debugging and iterating on the AI-generated code.
The video culminates in a practical test where I use the hammer to generate impacts and measure the accelerometer's response. I analyze the results using STM Studio, showing real-time data across different axes.
For those interested in diving deeper into microcontroller programming, I recommend my book, which offers a comprehensive, beginner-friendly guide to getting started with these fascinating devices.
This project showcases the potential and current limitations of using AI in embedded systems programming, providing valuable insights for both beginners and experienced developers in the field.

0:00 Introduction and Project Overview
0:35 Discussing High-G Accelerometers
2:15 Connecting the Accelerometer to the Microcontroller
4:00 Using ChatGPT for Initial Programming Attempt
5:34 Modifying the Accelerometer for Testing
7:52 Debugging with ChatGPT (Unsuccessful Attempts)
8:58 Trying Claude AI from Scratch
9:52 Testing the Accelerometer with Claude's Code
12:25 Book Recommendation and Conclusion
Рекомендации по теме
Комментарии
Автор

I think you really missed an opportunity for throwing the electronics at the wall here hahaha

aarondcmedia
Автор

When i was in college i told my professor that i thought human damage due to G force in a crash was highly dependant on the time that G-force was endured.

An impulse of a high G won't hurt the body because cell walls and their contents don't have time to move relative to each other. Same for bones vs flesh's relative movement.

It seemed like a new concept for him to hear but he was intrigued.

Now watching those hammer impacts, i wonder why some of the hits cause longer pulses.

Is there something you can do to cause a short pulse vs a long pulse (for the same peak G)?

Does the taped sensor come into play?

Interesting video!

TheRainHarvester
Автор

I think the 400G accelerometer would pair well with a vehicle airbag system.

ScroogeyTheGod
Автор

Register level programming is tedious, and you have to lean on the datasheet heavily, but it makes more sense to me than using HAL. It just feels like hiding implementation details isn't helpful to someone trying to learn a platform and you have to learn how to use the library that does the abstraction anyways. I don't know, maybe it's easier for professionals who already know what they're doing, but the skills don't transfer to other MCU architectures.

adammontgomery
Автор

Sir, why do you even promote books if claude can code everything? Knowlege and experience now cost nothing, so why bother learning anything at all?

superbeef