{"id":3456,"date":"2025-05-15T09:16:24","date_gmt":"2025-05-15T09:16:24","guid":{"rendered":"https:\/\/blog.embeddedexpert.io\/?p=3456"},"modified":"2025-05-22T12:11:00","modified_gmt":"2025-05-22T12:11:00","slug":"using-micropython-for-stm32f411-i2c-read","status":"publish","type":"post","link":"https:\/\/blog.embeddedexpert.io\/?p=3456","title":{"rendered":"Using Micropython for STM32F411: I2C Read"},"content":{"rendered":"\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"1024\" src=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/05\/DALL\u00b7E-2025-02-13-09.56.17-A-detailed-high-quality-digital-illustration-depicting-the-process-of-compiling-and-flashing-MicroPython-onto-an-STM32F411-Nucleo-board.-The-image-sh-1.webp\" alt=\"\" class=\"wp-image-3457\" srcset=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/05\/DALL\u00b7E-2025-02-13-09.56.17-A-detailed-high-quality-digital-illustration-depicting-the-process-of-compiling-and-flashing-MicroPython-onto-an-STM32F411-Nucleo-board.-The-image-sh-1.webp 1024w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/05\/DALL\u00b7E-2025-02-13-09.56.17-A-detailed-high-quality-digital-illustration-depicting-the-process-of-compiling-and-flashing-MicroPython-onto-an-STM32F411-Nucleo-board.-The-image-sh-1-300x300.webp 300w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/05\/DALL\u00b7E-2025-02-13-09.56.17-A-detailed-high-quality-digital-illustration-depicting-the-process-of-compiling-and-flashing-MicroPython-onto-an-STM32F411-Nucleo-board.-The-image-sh-1-150x150.webp 150w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/05\/DALL\u00b7E-2025-02-13-09.56.17-A-detailed-high-quality-digital-illustration-depicting-the-process-of-compiling-and-flashing-MicroPython-onto-an-STM32F411-Nucleo-board.-The-image-sh-1-768x768.webp 768w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/05\/DALL\u00b7E-2025-02-13-09.56.17-A-detailed-high-quality-digital-illustration-depicting-the-process-of-compiling-and-flashing-MicroPython-onto-an-STM32F411-Nucleo-board.-The-image-sh-1-750x750.webp 750w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/05\/DALL\u00b7E-2025-02-13-09.56.17-A-detailed-high-quality-digital-illustration-depicting-the-process-of-compiling-and-flashing-MicroPython-onto-an-STM32F411-Nucleo-board.-The-image-sh-1-400x400.webp 400w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/05\/DALL\u00b7E-2025-02-13-09.56.17-A-detailed-high-quality-digital-illustration-depicting-the-process-of-compiling-and-flashing-MicroPython-onto-an-STM32F411-Nucleo-board.-The-image-sh-1-250x250.webp 250w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>I2C (Inter-Integrated Circuit) is a widely used communication protocol that allows microcontrollers to interface with various peripheral devices using just two wires. In this guide, we demonstrate how to perform I2C read operations in MicroPython using an STM32F411 microcontroller.<\/p>\n\n\n\n<p>In this guide, we shall cover the following:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>What is I2C bus.<\/li>\n\n\n\n<li>Firmware Development.<\/li>\n\n\n\n<li>Connection.<\/li>\n\n\n\n<li>Results.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">1. What is I2C Bus:<\/h2>\n\n\n\n<p>With I2C, data is transferred in&nbsp;<em>messages.&nbsp;<\/em>Messages are broken up into&nbsp;<em>frames<\/em>&nbsp;of data. Each&nbsp;message has an address frame that contains the binary address of the slave, and one or more data frames that contain the data being transmitted. The message also includes&nbsp;start and stop conditions, read\/write bits, and ACK\/NACK bits between each data frame:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/www.circuitbasics.com\/wp-content\/uploads\/2016\/01\/Introduction-to-I2C-Message-Frame-and-Bit-2.png\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" src=\"https:\/\/www.circuitbasics.com\/wp-content\/uploads\/2016\/01\/Introduction-to-I2C-Message-Frame-and-Bit-2-1024x258.png\" alt=\"Introduction to I2C - Message, Frame, and Bit\" class=\"wp-image-420891\" \/><\/a><\/figure>\n\n\n\n<p><strong>Start Condition:<\/strong>&nbsp;The SDA line switches from a high voltage&nbsp;level to a low voltage level&nbsp;<em>before<\/em>&nbsp;the SCL line switches from high to low.<\/p>\n\n\n\n<p><strong>Stop Condition:<\/strong>&nbsp;The SDA line switches from a low voltage&nbsp;level to a high voltage level&nbsp;<em>after<\/em>&nbsp;the SCL line switches from low to high.<\/p>\n\n\n\n<p><strong>Address Frame:<\/strong>&nbsp;A 7 or 10 bit sequence unique to each slave that identifies the slave when the master wants to talk to it.<\/p>\n\n\n\n<p><strong>Read\/Write Bit:&nbsp;<\/strong>A single bit specifying whether the master is sending data to the slave (low voltage level) or requesting data from it (high voltage level).<\/p>\n\n\n\n<p><strong>ACK\/NACK Bit:<\/strong>&nbsp;Each frame in a&nbsp;message is followed by an acknowledge\/no-acknowledge bit. If an&nbsp;address frame or data frame was successfully received, an ACK bit is returned to the sender from the receiving device.<\/p>\n\n\n\n<p>For more information and detailed explanations refer to this NXP documentation (<a rel=\"noreferrer noopener\" href=\"https:\/\/www.nxp.com\/docs\/en\/user-guide\/UM10204.pdf\" target=\"_blank\">here<\/a>).<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">2. Firmware Development:<\/h2>\n\n\n\n<p>Before we start the firmware development, we need to install and configure thonny. For more details, please refer to this guide\u00a0<a href=\"https:\/\/blog.embeddedexpert.io\/?p=3237\" target=\"_blank\" rel=\"noreferrer noopener\">here<\/a>.<\/p>\n\n\n\n<p>After the configuration, we can develop the firmware.<\/p>\n\n\n\n<p>We start by importing from machine the following:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;clike&quot;,&quot;mime&quot;:&quot;text\/x-csrc&quot;,&quot;theme&quot;:&quot;dracula&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;C&quot;,&quot;language&quot;:&quot;C&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;c&quot;}\">from machine import I2C, Pin<\/pre><\/div>\n\n\n\n<p>This will allow us to use I2C functions.<\/p>\n\n\n\n<p>Also, import time for delay purposes:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;clike&quot;,&quot;mime&quot;:&quot;text\/x-csrc&quot;,&quot;theme&quot;:&quot;dracula&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;C&quot;,&quot;language&quot;:&quot;C&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;c&quot;}\">import time<\/pre><\/div>\n\n\n\n<p>Next, initialize i2c bus as following:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;clike&quot;,&quot;mime&quot;:&quot;text\/x-csrc&quot;,&quot;theme&quot;:&quot;dracula&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;C&quot;,&quot;language&quot;:&quot;C&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;c&quot;}\">i2c = I2C(1,freq=100_000)<\/pre><\/div>\n\n\n\n<p>The function takes two arguments:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>I2C bus number which is 1 in this case.<\/li>\n\n\n\n<li>Frequency of the clock data, which is 100KHz (Can be 400K or 1MHz).<\/li>\n<\/ul>\n\n\n\n<p>Since this guide uses DS3231 RTC as slave device, we shall declare the address as following:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;clike&quot;,&quot;mime&quot;:&quot;text\/x-csrc&quot;,&quot;theme&quot;:&quot;dracula&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;C&quot;,&quot;language&quot;:&quot;C&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;c&quot;}\">DS3231_ADDR = 0x68  # I2C address for DS3231<\/pre><\/div>\n\n\n\n<p>Next, a function to read the time from DS3231:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;clike&quot;,&quot;mime&quot;:&quot;text\/x-csrc&quot;,&quot;theme&quot;:&quot;dracula&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;C&quot;,&quot;language&quot;:&quot;C&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;c&quot;}\">def read_time():\n    # Read from register 0x00 to 0x02: seconds, minutes, hours\n    data = i2c.readfrom_mem(DS3231_ADDR, 0x00, 3)\n    \n    seconds = bcd2dec(data[0])\n    minutes = bcd2dec(data[1])\n    \n    # For 24-hour format\n    hours = bcd2dec(data[2] &amp; 0x3F)\n    \n    return hours, minutes, seconds\n<\/pre><\/div>\n\n\n\n<p>The function:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;clike&quot;,&quot;mime&quot;:&quot;text\/x-csrc&quot;,&quot;theme&quot;:&quot;dracula&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;C&quot;,&quot;language&quot;:&quot;C&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;c&quot;}\">data = i2c.readfrom_mem(DS3231_ADDR, 0x00, 3)<\/pre><\/div>\n\n\n\n<p>Will read the I2C slave device and takes the following:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Slave address which is DS3231 address.<\/li>\n\n\n\n<li>Memory address to be read which is 0x00 (seconds).<\/li>\n\n\n\n<li>Size of the data to be read which is 3.<\/li>\n<\/ul>\n\n\n\n<p>The function returns to data array of the read values as following:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>data[0]-&gt; Seconds.<\/li>\n\n\n\n<li>data[1]-&gt; Minutes.<\/li>\n\n\n\n<li>data[2]-&gt; Hours.<\/li>\n<\/ul>\n\n\n\n<p>The rest is converting the BCD to dec to be readable.<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;clike&quot;,&quot;mime&quot;:&quot;text\/x-csrc&quot;,&quot;theme&quot;:&quot;dracula&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;C&quot;,&quot;language&quot;:&quot;C&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;c&quot;}\"># BCD to Decimal\ndef bcd2dec(bcd):\n    return (bcd &gt;&gt; 4) * 10 + (bcd &amp; 0x0F)\n<\/pre><\/div>\n\n\n\n<p>In while 1 loop:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;clike&quot;,&quot;mime&quot;:&quot;text\/x-csrc&quot;,&quot;theme&quot;:&quot;dracula&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;C&quot;,&quot;language&quot;:&quot;C&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;c&quot;}\">while True:\n    h, m, s = read_time()\n    print(f&quot;{h:02}:{m:02}:{s:02}&quot;)\n    time.sleep(1)<\/pre><\/div>\n\n\n\n<p>Hence, the entire code as following:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;clike&quot;,&quot;mime&quot;:&quot;text\/x-csrc&quot;,&quot;theme&quot;:&quot;dracula&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;C&quot;,&quot;language&quot;:&quot;C&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;c&quot;}\">from machine import I2C, Pin\nimport time\n\n# BCD to Decimal\ndef bcd2dec(bcd):\n    return (bcd &gt;&gt; 4) * 10 + (bcd &amp; 0x0F)\n\n# Initialize I2C (adjust pins to your STM32F411 board)\ni2c = I2C(1,freq=100_000)\n\nDS3231_ADDR = 0x68  # I2C address for DS3231\n\ndef read_time():\n    # Read from register 0x00 to 0x02: seconds, minutes, hours\n    data = i2c.readfrom_mem(DS3231_ADDR, 0x00, 3)\n    \n    seconds = bcd2dec(data[0])\n    minutes = bcd2dec(data[1])\n    \n    # For 24-hour format\n    hours = bcd2dec(data[2] &amp; 0x3F)\n    \n    return hours, minutes, seconds\n\nwhile True:\n    h, m, s = read_time()\n    print(f&quot;{h:02}:{m:02}:{s:02}&quot;)\n    time.sleep(1)\n<\/pre><\/div>\n\n\n\n<p>Click on run as following:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"706\" src=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/02\/2025-02-15_15-36-02-1024x706.jpg\" alt=\"\" class=\"wp-image-3246\" srcset=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/02\/2025-02-15_15-36-02-1024x706.jpg 1024w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/02\/2025-02-15_15-36-02-300x207.jpg 300w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/02\/2025-02-15_15-36-02-768x530.jpg 768w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/02\/2025-02-15_15-36-02-1536x1059.jpg 1536w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/02\/2025-02-15_15-36-02-2048x1412.jpg 2048w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/02\/2025-02-15_15-36-02-1150x793.jpg 1150w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/02\/2025-02-15_15-36-02-750x517.jpg 750w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/02\/2025-02-15_15-36-02-400x276.jpg 400w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/02\/2025-02-15_15-36-02-250x172.jpg 250w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">3. Connection:<\/h2>\n\n\n\n<p>The connection as following:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"715\" src=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2021\/10\/Screen-Shot-2021-10-19-at-8.03.15-AM-1024x715.png\" alt=\"\" class=\"wp-image-510\" srcset=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2021\/10\/Screen-Shot-2021-10-19-at-8.03.15-AM-1024x715.png 1024w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2021\/10\/Screen-Shot-2021-10-19-at-8.03.15-AM-300x209.png 300w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2021\/10\/Screen-Shot-2021-10-19-at-8.03.15-AM-768x536.png 768w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2021\/10\/Screen-Shot-2021-10-19-at-8.03.15-AM-1536x1072.png 1536w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2021\/10\/Screen-Shot-2021-10-19-at-8.03.15-AM-2048x1430.png 2048w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2021\/10\/Screen-Shot-2021-10-19-at-8.03.15-AM-1150x803.png 1150w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2021\/10\/Screen-Shot-2021-10-19-at-8.03.15-AM-750x524.png 750w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2021\/10\/Screen-Shot-2021-10-19-at-8.03.15-AM-400x279.png 400w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2021\/10\/Screen-Shot-2021-10-19-at-8.03.15-AM-250x175.png 250w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td>STM32L053-Nucleo64<\/td><td>DS3231 module<\/td><\/tr><tr><td>5V<\/td><td>Vcc<\/td><\/tr><tr><td>GND<\/td><td>GND<\/td><\/tr><tr><td>D15 (PB8)<\/td><td>SCL<\/td><\/tr><tr><td>D14 (PB9)<\/td><td>SDA<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">4. Results:<\/h2>\n\n\n\n<p>In the shell, you should see the results as following:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"528\" src=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/05\/2025-05-15_11-26-05-1024x528.jpg\" alt=\"\" class=\"wp-image-3458\" srcset=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/05\/2025-05-15_11-26-05-1024x528.jpg 1024w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/05\/2025-05-15_11-26-05-300x155.jpg 300w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/05\/2025-05-15_11-26-05-768x396.jpg 768w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/05\/2025-05-15_11-26-05-750x386.jpg 750w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/05\/2025-05-15_11-26-05-400x206.jpg 400w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/05\/2025-05-15_11-26-05-250x129.jpg 250w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/05\/2025-05-15_11-26-05.jpg 1052w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>Happy coding \ud83d\ude09<\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I2C (Inter-Integrated Circuit) is a widely used communication protocol that allows microcontrollers to interface with various peripheral devices using just two wires. In this guide, we demonstrate how to perform I2C read operations in MicroPython using an STM32F411 microcontroller. In this guide, we shall cover the following: 1. What is I2C Bus: With I2C, data [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2,11,12],"tags":[],"class_list":["post-3456","post","type-post","status-publish","format-standard","hentry","category-embedded-systems","category-peripheral-drivers","category-stm32"],"_links":{"self":[{"href":"https:\/\/blog.embeddedexpert.io\/index.php?rest_route=\/wp\/v2\/posts\/3456"}],"collection":[{"href":"https:\/\/blog.embeddedexpert.io\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.embeddedexpert.io\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.embeddedexpert.io\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.embeddedexpert.io\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3456"}],"version-history":[{"count":1,"href":"https:\/\/blog.embeddedexpert.io\/index.php?rest_route=\/wp\/v2\/posts\/3456\/revisions"}],"predecessor-version":[{"id":3459,"href":"https:\/\/blog.embeddedexpert.io\/index.php?rest_route=\/wp\/v2\/posts\/3456\/revisions\/3459"}],"wp:attachment":[{"href":"https:\/\/blog.embeddedexpert.io\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3456"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.embeddedexpert.io\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3456"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.embeddedexpert.io\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3456"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}