{"id":40,"date":"2022-04-29T05:51:31","date_gmt":"2022-04-29T05:51:31","guid":{"rendered":"https:\/\/blogs.oregonstate.edu\/spudlaunching\/?p=40"},"modified":"2022-04-29T05:51:31","modified_gmt":"2022-04-29T05:51:31","slug":"week-5-i2c","status":"publish","type":"post","link":"https:\/\/blogs.oregonstate.edu\/spudlaunching\/2022\/04\/29\/week-5-i2c\/","title":{"rendered":"Week 5 &#8211; I2C"},"content":{"rendered":"\n<p>This week I&#8217;m trying out a different IMU, the <a href=\"https:\/\/learn.sparkfun.com\/tutorials\/mpu-9250-hookup-guide\/all\">MPU-9250<\/a>. The Raspberry Pi communicates with this unit using the I2C protocol which is accessed through the GPIO pins on the Pi instead of USB. The purpose of the I2C protocol is to allow many peripheral devices to communicate with one or more controllers. On the Raspberry Pi, the two other options for protocols are UART and SPI. UART is intended for communication between only 2 devices and has no clock syncing. SPI can communicate from one controller to many peripherals, but uses many more wires that I2C. <\/p>\n\n\n\n<p>I2C allows for communication between many peripherals and many controllers, has clock syncing, and does this all over two wires: SDA (serial data line) and SCL (serial clock line). So I2C is an ideal protocol for communicating with peripherals like the MPU-9250. The Raspberry Pi has GPIO pins for SDA and SCL lines, as well as power and ground. <\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"768\" src=\"https:\/\/osu-wams-blogs-uploads.s3.amazonaws.com\/blogs.dir\/5530\/files\/2022\/04\/IMG_20220428_221919-1024x768.jpg\" alt=\"\" class=\"wp-image-44\" srcset=\"https:\/\/osu-wams-blogs-uploads.s3.amazonaws.com\/blogs.dir\/5530\/files\/2022\/04\/IMG_20220428_221919-1024x768.jpg 1024w, https:\/\/osu-wams-blogs-uploads.s3.amazonaws.com\/blogs.dir\/5530\/files\/2022\/04\/IMG_20220428_221919-300x225.jpg 300w, https:\/\/osu-wams-blogs-uploads.s3.amazonaws.com\/blogs.dir\/5530\/files\/2022\/04\/IMG_20220428_221919-768x576.jpg 768w, https:\/\/osu-wams-blogs-uploads.s3.amazonaws.com\/blogs.dir\/5530\/files\/2022\/04\/IMG_20220428_221919-1536x1152.jpg 1536w, https:\/\/osu-wams-blogs-uploads.s3.amazonaws.com\/blogs.dir\/5530\/files\/2022\/04\/IMG_20220428_221919-2048x1536.jpg 2048w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><figcaption>The MPU-9250 plugged into the Raspberry Pi<\/figcaption><\/figure>\n\n\n\n<p>On the Pi, you can check what I2C devices are connected with the command <code>i2cdetect -y 1<\/code>. This shows the address of each device. Right now the MPU-9250 is at the address 0x68. This is the address to use for accessing the IMU in an application.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"728\" height=\"242\" src=\"https:\/\/osu-wams-blogs-uploads.s3.amazonaws.com\/blogs.dir\/5530\/files\/2022\/04\/Screenshot-2022-04-28-224016.png\" alt=\"\" class=\"wp-image-45\" srcset=\"https:\/\/osu-wams-blogs-uploads.s3.amazonaws.com\/blogs.dir\/5530\/files\/2022\/04\/Screenshot-2022-04-28-224016.png 728w, https:\/\/osu-wams-blogs-uploads.s3.amazonaws.com\/blogs.dir\/5530\/files\/2022\/04\/Screenshot-2022-04-28-224016-300x100.png 300w\" sizes=\"auto, (max-width: 728px) 100vw, 728px\" \/><\/figure>\n\n\n\n<p>Up next I will be creating a simple program to read this data and sync it with the GPS!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This week I&#8217;m trying out a different IMU, the MPU-9250. The Raspberry Pi communicates with this unit using the I2C protocol which is accessed through the GPIO pins on the Pi instead of USB. The purpose of the I2C protocol is to allow many peripheral devices to communicate with one or more controllers. On the [&hellip;]<\/p>\n","protected":false},"author":12370,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-40","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/blogs.oregonstate.edu\/spudlaunching\/wp-json\/wp\/v2\/posts\/40","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.oregonstate.edu\/spudlaunching\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.oregonstate.edu\/spudlaunching\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.oregonstate.edu\/spudlaunching\/wp-json\/wp\/v2\/users\/12370"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.oregonstate.edu\/spudlaunching\/wp-json\/wp\/v2\/comments?post=40"}],"version-history":[{"count":6,"href":"https:\/\/blogs.oregonstate.edu\/spudlaunching\/wp-json\/wp\/v2\/posts\/40\/revisions"}],"predecessor-version":[{"id":48,"href":"https:\/\/blogs.oregonstate.edu\/spudlaunching\/wp-json\/wp\/v2\/posts\/40\/revisions\/48"}],"wp:attachment":[{"href":"https:\/\/blogs.oregonstate.edu\/spudlaunching\/wp-json\/wp\/v2\/media?parent=40"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.oregonstate.edu\/spudlaunching\/wp-json\/wp\/v2\/categories?post=40"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.oregonstate.edu\/spudlaunching\/wp-json\/wp\/v2\/tags?post=40"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}