Getting Started With STM32 and Nucleo Part 2: How to Use I2C to Read Temperature Sensor TMP102

preview_player
Показать описание
Let’s take our STM32 to the next level and communicate with a sensor. We’ll use the I2C protocol to send and receive messages with a TI TMP102.

In this video, we’ll show you how to use the STM32CubeIDE to create a new project and write a few simple STM32 HAL commands to transmit messages across the I2C bus. We’ll read temperature data from a TMP102 sensor and then calculate a readable temperature in Celsius from that information. Finally, we’ll use the STM32’s UART peripheral to transmit that temperature data back to our computer to read on a serial console.

The STM32 series is based on the ARM Cortex architectures. Specifically, we’ll be looking at the STM32 Arm Cortex-M microcontrollers. To make life easier, we’ll be using STMicroelectronics’ official Nucleo development boards (the Nucleo-L476RG in particular).

WRITTEN TUTORIAL

ADDITIONAL RESOURCES

Рекомендации по теме
Комментарии
Автор

The best explanation I've found so far, one video about SPI and CAN communication would be amazing!

gustavoghedim
Автор

These videos are the gift that keeps giving. I used this very video over a year ago to help me get up to speed and it was invaluable today as well. Thanks Shawn!!

printf and its derivatives are capable of printing floating point numbers by the way, no need to juggle the number and print the integer and fractional parts separately.

shambles
Автор

Awesome vid, can you make one for SPI as well?

David-ypoz
Автор

Excellent explanation! Even as a mechanical engineer with no previous formal knowledge on this, I am able to understand! Now I understand how "easy" arduino makes all this, for beginners

filmweaver
Автор

Amazing explanation about I2C. Please make one for SPI

kumarghz
Автор

Incredibly sharp and concise tutorial!

Hirnlappen
Автор

I'd really like to see your simple, concise explanation for reading and writing to an SD card with SPI. That would also solve other stuff I want to do with SPI.

DownhillAllTheWay
Автор

Bro, these tutorials as a refresher from my final year course has been a life saver! I can't thank you enough!

jamesdavid
Автор

Many thanks Shawn!
I'm really motivated to finish this course, but already in this second lesson I'm running into the complexity of STM32 programming. It's not like the standard C to me, especially with those crazy HAL functions. Also, your programs are quite elegant and professional, which means in plain language that they are not friendly for C beginners, or at least not for me. But I don't give up and keep going.

electronichome
Автор

Man your explanations are perfect. It's just the right rythme I need, thank you !

igabo
Автор

I would like to complement this amazing tutorial by pointing out a few issues:
1) the 2s complement comment should state that you are actually extending the 2s complement encoding from 12 bits to 16 bits;
2) the float value is converted to unsigned int in the printf, so negative values will not be displayed correctly.

fernandoi
Автор

Are u an unit vector? Because you give my life direction

nereamonrio
Автор

I just bought 3 STM32 Disco boards from Digikey. These videos are great. Thanks Digikey!

ValiRossi
Автор

Your explanation to every topic is very good and easy to understand.
Thank you

dnyaneshvarsalve
Автор

Great tutorial, used this in part to setup an ADS1115 connected to a LM60 on the BluePill.
Just one thing though:
sprintf((char*)buf,
"%u.%02u C\r\n",
((unsigned int)temp_c / 100),
((unsigned int)temp_c % 100));
}
This will fix chopping of leading zeros for the decimal value. (ex: 20.09 = 20.09 and not 20.9)

danndemetre
Автор

Why the address for reading/writing stay the same ? We should do something like this "TMP102_ADDR | 0x01" in order to add 1 ?

pseudounknow
Автор

Very very nice explaination dear! You're the Reason I understand the programming of stm for the first time.

moinshaikh
Автор

these videos are brilliant, so clear, to the point and highlights all the important stuff including error handling... and I love the bow tie!

shelbypereira
Автор

Very nice to see digikey getting into the STM32 tutorial game.

damnyutoobe
Автор

Why my browser insists in showing me subtitle for this video in Korean language???

itsme.