{"id":19880,"date":"2020-01-04T18:16:42","date_gmt":"2020-01-04T17:16:42","guid":{"rendered":"https:\/\/www.recantha.co.uk\/blog\/?p=19880"},"modified":"2020-01-04T18:16:42","modified_gmt":"2020-01-04T17:16:42","slug":"adventures-in-i2c-clock-stretching-on-the-raspberry-pi","status":"publish","type":"post","link":"https:\/\/www.recantha.co.uk\/blog\/?p=19880","title":{"rendered":"Adventures in I2C: clock stretching on the Raspberry Pi"},"content":{"rendered":"<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-19882\" src=\"https:\/\/i0.wp.com\/www.recantha.co.uk\/blog\/wp-content\/uploads\/2020\/01\/I%C2%B2C_bus_logo.svg_.png?resize=560%2C615&#038;ssl=1\" alt=\"\" width=\"560\" height=\"615\" srcset=\"https:\/\/i0.wp.com\/www.recantha.co.uk\/blog\/wp-content\/uploads\/2020\/01\/I%C2%B2C_bus_logo.svg_.png?w=1200&amp;ssl=1 1200w, https:\/\/i0.wp.com\/www.recantha.co.uk\/blog\/wp-content\/uploads\/2020\/01\/I%C2%B2C_bus_logo.svg_.png?resize=273%2C300&amp;ssl=1 273w, https:\/\/i0.wp.com\/www.recantha.co.uk\/blog\/wp-content\/uploads\/2020\/01\/I%C2%B2C_bus_logo.svg_.png?resize=933%2C1024&amp;ssl=1 933w, https:\/\/i0.wp.com\/www.recantha.co.uk\/blog\/wp-content\/uploads\/2020\/01\/I%C2%B2C_bus_logo.svg_.png?resize=768%2C843&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.recantha.co.uk\/blog\/wp-content\/uploads\/2020\/01\/I%C2%B2C_bus_logo.svg_.png?resize=560%2C615&amp;ssl=1 560w, https:\/\/i0.wp.com\/www.recantha.co.uk\/blog\/wp-content\/uploads\/2020\/01\/I%C2%B2C_bus_logo.svg_.png?resize=260%2C285&amp;ssl=1 260w, https:\/\/i0.wp.com\/www.recantha.co.uk\/blog\/wp-content\/uploads\/2020\/01\/I%C2%B2C_bus_logo.svg_.png?resize=160%2C176&amp;ssl=1 160w, https:\/\/i0.wp.com\/www.recantha.co.uk\/blog\/wp-content\/uploads\/2020\/01\/I%C2%B2C_bus_logo.svg_.png?w=1120&amp;ssl=1 1120w\" sizes=\"auto, (max-width: 560px) 100vw, 560px\" \/><\/p>\n<p><em>This is a bit complicated, technically, but I&#8217;ve been asked to document the issue just in case someone comes across it.<\/em><\/p>\n<p>I was getting I2C read errors when using the new <a href=\"http:\/\/te.com\/ambimate\" target=\"_blank\" rel=\"noopener noreferrer\">TE AmbiMate<\/a> MS4 sensor board (review coming soon!) with the Raspberry Pi 4. I contacted TE about it and they asked me to try a Pi 3. So I did, and it worked absolutely fine.<\/p>\n<p>It was an intermittent issue on the Pi 4 (everyone&#8217;s favourite sort of error!), and so I did some research and found some information on something called &#8216;<a href=\"https:\/\/www.i2c-bus.org\/clock-stretching\/\" target=\"_blank\" rel=\"noopener noreferrer\">clock stretching<\/a>&#8216;.<\/p>\n<p>This apparently affects the Raspberry Pi and was documented in a lot of detail, back in 2013 by someone at Advamation. <a href=\"https:\/\/www.advamation.com\/knowhow\/raspberrypi\/rpi-i2c-bug.html\" target=\"_blank\" rel=\"noopener noreferrer\">Here is that post<\/a>.<\/p>\n<p>Although I found evidence on the Raspberry Pi forums that it had been fixed on the Pi 4, this is apparently not the case as it was a Pi 4 I was getting the problem on.<\/p>\n<p>I tried a good old-fashioned apt-get update and upgrade and tried it again. No joy.<\/p>\n<p>I was pointed at <a href=\"https:\/\/github.com\/raspberrypi\/linux\/issues\/3064\" target=\"_blank\" rel=\"noopener noreferrer\">this GitHub issue<\/a> which implied that the problem still exists. It suggested adding a line to \/boot\/config.txt<\/p>\n<pre>dtoverlay=i2c-bcm2708<\/pre>\n<p>which forces the Pi to use the old I2C driver. This failed to work, in fact it made the problem worse because suddenly it wouldn&#8217;t read <em>anything<\/em> from the sensor. I reversed this.<\/p>\n<p>I tried an rpi-update to get the latest firmware, just in case a fix had been implemented on a newer version. This again failed to work.<\/p>\n<p>Eventually, after some searching around (good ol&#8217; Google!) I came across <a href=\"https:\/\/github.com\/fivdi\/i2c-bus\/issues\/36\" target=\"_blank\" rel=\"noopener noreferrer\">this issue on GitHub<\/a> which suggested that the problem was the speed at which I was trying to read the I2C bus. So, I added a config option to \/boot\/config.txt as follows to reduce the read speed from 100000 baud to 10000 baud:<\/p>\n<pre>dtparam=i2c_baudrate=10000<\/pre>\n<p>Miraculously, this worked and I received stable readings from all the sensors on the AmbiMate without the errors occurring.<\/p>\n<p>I came across an alternative solution (which I haven&#8217;t tried). Apparently, the bug only affects <strong>hardware clock stretching<\/strong>. However, it is possible to use an alternate set of pins for I2C and use <strong>software clock stretching.<\/strong> This is <a href=\"https:\/\/github.com\/fivdi\/i2c-bus\/blob\/master\/doc\/raspberry-pi-software-i2c.md\" target=\"_blank\" rel=\"noopener noreferrer\">documented on GitHub here<\/a>. Here is the relevant bit:<\/p>\n<p style=\"padding-left: 40px;\">Raspbian has a software I2C driver that can be enabled by adding the following line to \/boot\/config.txt:<\/p>\n<pre style=\"padding-left: 40px;\"><code>dtoverlay=i2c-gpio,bus=3\r\n<\/code><\/pre>\n<p style=\"padding-left: 40px;\">This will create an I2C bus called\u00a0\/dev\/i2c-3. SDA will be on GPIO23 and SCL will be on GPIO24 which are pins 16 and 18 on the GPIO header respectively.<\/p>\n<p>I hope this is of some use to someone!<\/p>\n<p style=\"padding-left: 40px;\">\n","protected":false},"excerpt":{"rendered":"<p>This is a bit complicated, technically, but I&#8217;ve been asked to document the issue just in case someone comes across it. I was getting I2C read errors when using the new TE AmbiMate MS4 sensor board (review coming soon!) with&hellip;<\/p>\n<p class=\"more-link-p\"><a class=\"more-link\" href=\"https:\/\/www.recantha.co.uk\/blog\/?p=19880\">Read more &rarr;<\/a><\/p>\n","protected":false},"author":1,"featured_media":19882,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[43,62],"tags":[886,443],"class_list":["post-19880","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-research","category-sensors","tag-ambimate","tag-i2c"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Adventures in I2C: clock stretching on the Raspberry Pi - Raspberry Pi Pod<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.recantha.co.uk\/blog\/?p=19880\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Adventures in I2C: clock stretching on the Raspberry Pi - Raspberry Pi Pod\" \/>\n<meta property=\"og:description\" content=\"This is a bit complicated, technically, but I&#8217;ve been asked to document the issue just in case someone comes across it. I was getting I2C read errors when using the new TE AmbiMate MS4 sensor board (review coming soon!) with&hellip;Read more &rarr;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.recantha.co.uk\/blog\/?p=19880\" \/>\n<meta property=\"og:site_name\" content=\"Raspberry Pi Pod\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/recantha\/\" \/>\n<meta property=\"article:published_time\" content=\"2020-01-04T17:16:42+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/i1.wp.com\/www.recantha.co.uk\/blog\/wp-content\/uploads\/2020\/01\/I\u00b2C_bus_logo.svg_.png?fit=1200%2C1317&ssl=1\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"1317\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Michael Horne\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@recantha\" \/>\n<meta name=\"twitter:site\" content=\"@recantha\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Michael Horne\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.recantha.co.uk\/blog\/?p=19880#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.recantha.co.uk\/blog\/?p=19880\"},\"author\":{\"name\":\"Michael Horne\",\"@id\":\"https:\/\/www.recantha.co.uk\/blog\/#\/schema\/person\/c27c4ef2ee1c18b130f1fcd5dcdbb263\"},\"headline\":\"Adventures in I2C: clock stretching on the Raspberry Pi\",\"datePublished\":\"2020-01-04T17:16:42+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.recantha.co.uk\/blog\/?p=19880\"},\"wordCount\":445,\"commentCount\":6,\"publisher\":{\"@id\":\"https:\/\/www.recantha.co.uk\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.recantha.co.uk\/blog\/?p=19880#primaryimage\"},\"thumbnailUrl\":\"https:\/\/i0.wp.com\/www.recantha.co.uk\/blog\/wp-content\/uploads\/2020\/01\/I%C2%B2C_bus_logo.svg_.png?fit=1200%2C1317&ssl=1\",\"keywords\":[\"ambimate\",\"i2c\"],\"articleSection\":[\"Research\",\"Sensors\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.recantha.co.uk\/blog\/?p=19880#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.recantha.co.uk\/blog\/?p=19880\",\"url\":\"https:\/\/www.recantha.co.uk\/blog\/?p=19880\",\"name\":\"Adventures in I2C: clock stretching on the Raspberry Pi - Raspberry Pi Pod\",\"isPartOf\":{\"@id\":\"https:\/\/www.recantha.co.uk\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.recantha.co.uk\/blog\/?p=19880#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.recantha.co.uk\/blog\/?p=19880#primaryimage\"},\"thumbnailUrl\":\"https:\/\/i0.wp.com\/www.recantha.co.uk\/blog\/wp-content\/uploads\/2020\/01\/I%C2%B2C_bus_logo.svg_.png?fit=1200%2C1317&ssl=1\",\"datePublished\":\"2020-01-04T17:16:42+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.recantha.co.uk\/blog\/?p=19880#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.recantha.co.uk\/blog\/?p=19880\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.recantha.co.uk\/blog\/?p=19880#primaryimage\",\"url\":\"https:\/\/i0.wp.com\/www.recantha.co.uk\/blog\/wp-content\/uploads\/2020\/01\/I%C2%B2C_bus_logo.svg_.png?fit=1200%2C1317&ssl=1\",\"contentUrl\":\"https:\/\/i0.wp.com\/www.recantha.co.uk\/blog\/wp-content\/uploads\/2020\/01\/I%C2%B2C_bus_logo.svg_.png?fit=1200%2C1317&ssl=1\",\"width\":1200,\"height\":1317},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.recantha.co.uk\/blog\/?p=19880#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.recantha.co.uk\/blog\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Adventures in I2C: clock stretching on the Raspberry Pi\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.recantha.co.uk\/blog\/#website\",\"url\":\"https:\/\/www.recantha.co.uk\/blog\/\",\"name\":\"Raspberry Pi Pod\",\"description\":\"Experiences with the Raspberry Pi micro computer and microcontroller\",\"publisher\":{\"@id\":\"https:\/\/www.recantha.co.uk\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.recantha.co.uk\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.recantha.co.uk\/blog\/#organization\",\"name\":\"Raspberry Pi Pod\",\"url\":\"https:\/\/www.recantha.co.uk\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.recantha.co.uk\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/i0.wp.com\/www.recantha.co.uk\/blog\/wp-content\/uploads\/2016\/03\/cropped-PiPod-Logo-v3.png?fit=800%2C337&ssl=1\",\"contentUrl\":\"https:\/\/i0.wp.com\/www.recantha.co.uk\/blog\/wp-content\/uploads\/2016\/03\/cropped-PiPod-Logo-v3.png?fit=800%2C337&ssl=1\",\"width\":800,\"height\":337,\"caption\":\"Raspberry Pi Pod\"},\"image\":{\"@id\":\"https:\/\/www.recantha.co.uk\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/recantha\/\",\"https:\/\/x.com\/recantha\",\"https:\/\/www.linkedin.com\/in\/recantha\/\",\"https:\/\/www.youtube.com\/channel\/UCK4F9blabxzmk8Inzhs8tpg\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.recantha.co.uk\/blog\/#\/schema\/person\/c27c4ef2ee1c18b130f1fcd5dcdbb263\",\"name\":\"Michael Horne\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.recantha.co.uk\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/479778b0677caadde0ceb54c4129804ef674914607e3ed0998808148357d10d8?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/479778b0677caadde0ceb54c4129804ef674914607e3ed0998808148357d10d8?s=96&d=mm&r=g\",\"caption\":\"Michael Horne\"},\"url\":\"https:\/\/www.recantha.co.uk\/blog\/?author=1\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Adventures in I2C: clock stretching on the Raspberry Pi - Raspberry Pi Pod","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.recantha.co.uk\/blog\/?p=19880","og_locale":"en_US","og_type":"article","og_title":"Adventures in I2C: clock stretching on the Raspberry Pi - Raspberry Pi Pod","og_description":"This is a bit complicated, technically, but I&#8217;ve been asked to document the issue just in case someone comes across it. I was getting I2C read errors when using the new TE AmbiMate MS4 sensor board (review coming soon!) with&hellip;Read more &rarr;","og_url":"https:\/\/www.recantha.co.uk\/blog\/?p=19880","og_site_name":"Raspberry Pi Pod","article_publisher":"https:\/\/www.facebook.com\/recantha\/","article_published_time":"2020-01-04T17:16:42+00:00","og_image":[{"width":1200,"height":1317,"url":"https:\/\/i1.wp.com\/www.recantha.co.uk\/blog\/wp-content\/uploads\/2020\/01\/I\u00b2C_bus_logo.svg_.png?fit=1200%2C1317&ssl=1","type":"image\/png"}],"author":"Michael Horne","twitter_card":"summary_large_image","twitter_creator":"@recantha","twitter_site":"@recantha","twitter_misc":{"Written by":"Michael Horne","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.recantha.co.uk\/blog\/?p=19880#article","isPartOf":{"@id":"https:\/\/www.recantha.co.uk\/blog\/?p=19880"},"author":{"name":"Michael Horne","@id":"https:\/\/www.recantha.co.uk\/blog\/#\/schema\/person\/c27c4ef2ee1c18b130f1fcd5dcdbb263"},"headline":"Adventures in I2C: clock stretching on the Raspberry Pi","datePublished":"2020-01-04T17:16:42+00:00","mainEntityOfPage":{"@id":"https:\/\/www.recantha.co.uk\/blog\/?p=19880"},"wordCount":445,"commentCount":6,"publisher":{"@id":"https:\/\/www.recantha.co.uk\/blog\/#organization"},"image":{"@id":"https:\/\/www.recantha.co.uk\/blog\/?p=19880#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/www.recantha.co.uk\/blog\/wp-content\/uploads\/2020\/01\/I%C2%B2C_bus_logo.svg_.png?fit=1200%2C1317&ssl=1","keywords":["ambimate","i2c"],"articleSection":["Research","Sensors"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.recantha.co.uk\/blog\/?p=19880#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.recantha.co.uk\/blog\/?p=19880","url":"https:\/\/www.recantha.co.uk\/blog\/?p=19880","name":"Adventures in I2C: clock stretching on the Raspberry Pi - Raspberry Pi Pod","isPartOf":{"@id":"https:\/\/www.recantha.co.uk\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.recantha.co.uk\/blog\/?p=19880#primaryimage"},"image":{"@id":"https:\/\/www.recantha.co.uk\/blog\/?p=19880#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/www.recantha.co.uk\/blog\/wp-content\/uploads\/2020\/01\/I%C2%B2C_bus_logo.svg_.png?fit=1200%2C1317&ssl=1","datePublished":"2020-01-04T17:16:42+00:00","breadcrumb":{"@id":"https:\/\/www.recantha.co.uk\/blog\/?p=19880#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.recantha.co.uk\/blog\/?p=19880"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.recantha.co.uk\/blog\/?p=19880#primaryimage","url":"https:\/\/i0.wp.com\/www.recantha.co.uk\/blog\/wp-content\/uploads\/2020\/01\/I%C2%B2C_bus_logo.svg_.png?fit=1200%2C1317&ssl=1","contentUrl":"https:\/\/i0.wp.com\/www.recantha.co.uk\/blog\/wp-content\/uploads\/2020\/01\/I%C2%B2C_bus_logo.svg_.png?fit=1200%2C1317&ssl=1","width":1200,"height":1317},{"@type":"BreadcrumbList","@id":"https:\/\/www.recantha.co.uk\/blog\/?p=19880#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.recantha.co.uk\/blog"},{"@type":"ListItem","position":2,"name":"Adventures in I2C: clock stretching on the Raspberry Pi"}]},{"@type":"WebSite","@id":"https:\/\/www.recantha.co.uk\/blog\/#website","url":"https:\/\/www.recantha.co.uk\/blog\/","name":"Raspberry Pi Pod","description":"Experiences with the Raspberry Pi micro computer and microcontroller","publisher":{"@id":"https:\/\/www.recantha.co.uk\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.recantha.co.uk\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.recantha.co.uk\/blog\/#organization","name":"Raspberry Pi Pod","url":"https:\/\/www.recantha.co.uk\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.recantha.co.uk\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/i0.wp.com\/www.recantha.co.uk\/blog\/wp-content\/uploads\/2016\/03\/cropped-PiPod-Logo-v3.png?fit=800%2C337&ssl=1","contentUrl":"https:\/\/i0.wp.com\/www.recantha.co.uk\/blog\/wp-content\/uploads\/2016\/03\/cropped-PiPod-Logo-v3.png?fit=800%2C337&ssl=1","width":800,"height":337,"caption":"Raspberry Pi Pod"},"image":{"@id":"https:\/\/www.recantha.co.uk\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/recantha\/","https:\/\/x.com\/recantha","https:\/\/www.linkedin.com\/in\/recantha\/","https:\/\/www.youtube.com\/channel\/UCK4F9blabxzmk8Inzhs8tpg"]},{"@type":"Person","@id":"https:\/\/www.recantha.co.uk\/blog\/#\/schema\/person\/c27c4ef2ee1c18b130f1fcd5dcdbb263","name":"Michael Horne","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.recantha.co.uk\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/479778b0677caadde0ceb54c4129804ef674914607e3ed0998808148357d10d8?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/479778b0677caadde0ceb54c4129804ef674914607e3ed0998808148357d10d8?s=96&d=mm&r=g","caption":"Michael Horne"},"url":"https:\/\/www.recantha.co.uk\/blog\/?author=1"}]}},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/www.recantha.co.uk\/blog\/wp-content\/uploads\/2020\/01\/I%C2%B2C_bus_logo.svg_.png?fit=1200%2C1317&ssl=1","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p2RsaV-5aE","jetpack-related-posts":[{"id":18099,"url":"https:\/\/www.recantha.co.uk\/blog\/?p=18099","url_meta":{"origin":19880,"position":0},"title":"Make this digital clock and inside\/outside temperature monitor with a Raspberry Pi Zero W","author":"Michael Horne","date":"18 January 2018","format":false,"excerpt":"Jeremiah Mattison has taken a Raspberry Pi Zero W, a seven-segment display with I2C backpack and an MCP9808\u00a0I2C temperature sensor and combined them to make this digital clock. The temperature sensor takes the temperature inside the room while the Zero W uses the OpenWeatherMap API\u00a0to get the outside temperature. You\u2026","rel":"","context":"In &quot;Accessories&quot;","block_context":{"text":"Accessories","link":"https:\/\/www.recantha.co.uk\/blog\/?cat=54"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.recantha.co.uk\/blog\/wp-content\/uploads\/2018\/01\/clock_time_7IztHkYsME.jpg?fit=900%2C675&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.recantha.co.uk\/blog\/wp-content\/uploads\/2018\/01\/clock_time_7IztHkYsME.jpg?fit=900%2C675&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.recantha.co.uk\/blog\/wp-content\/uploads\/2018\/01\/clock_time_7IztHkYsME.jpg?fit=900%2C675&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/www.recantha.co.uk\/blog\/wp-content\/uploads\/2018\/01\/clock_time_7IztHkYsME.jpg?fit=900%2C675&ssl=1&resize=700%2C400 2x"},"classes":[]},{"id":1532,"url":"https:\/\/www.recantha.co.uk\/blog\/?p=1532","url_meta":{"origin":19880,"position":1},"title":"Read two sensors on the same GPIO pins with the I2C bus on the #RaspberryPi @Raspberry_Pi","author":"Michael Horne","date":"27 January 2013","format":false,"excerpt":"This great Instructable finally opens my eyes to what can be achieved using I2C. In short, it gives instructions for reading\u00a0two sensors on the same GPIO pins. In other words, you wire both sensors up to the same two pins on the Pi and let the Pi access them via\u2026","rel":"","context":"In &quot;Making&quot;","block_context":{"text":"Making","link":"https:\/\/www.recantha.co.uk\/blog\/?cat=50"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":18407,"url":"https:\/\/www.recantha.co.uk\/blog\/?p=18407","url_meta":{"origin":19880,"position":2},"title":"Change the speed of the I2C bus on a Raspberry Pi with this config change","author":"Michael Horne","date":"28 February 2018","format":false,"excerpt":"Matt, over at Raspberry Pi Spy, has blogged about a way to improve the performance of the I2C bus on a Raspberry Pi. The bus, which is used for, among other things, sensor readings and outputting to OLED displays defaults to 100Kb\/s but can be made to go as fast\u2026","rel":"","context":"In &quot;Geeky Techiness&quot;","block_context":{"text":"Geeky Techiness","link":"https:\/\/www.recantha.co.uk\/blog\/?cat=22"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.recantha.co.uk\/blog\/wp-content\/uploads\/2018\/02\/i2c_bus_raspberry_pi-702x336.jpg?fit=702%2C336&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.recantha.co.uk\/blog\/wp-content\/uploads\/2018\/02\/i2c_bus_raspberry_pi-702x336.jpg?fit=702%2C336&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.recantha.co.uk\/blog\/wp-content\/uploads\/2018\/02\/i2c_bus_raspberry_pi-702x336.jpg?fit=702%2C336&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/www.recantha.co.uk\/blog\/wp-content\/uploads\/2018\/02\/i2c_bus_raspberry_pi-702x336.jpg?fit=702%2C336&ssl=1&resize=700%2C400 2x"},"classes":[]},{"id":4207,"url":"https:\/\/www.recantha.co.uk\/blog\/?p=4207","url_meta":{"origin":19880,"position":3},"title":"20\u00d74 RGB LCD over i2c with a #RaspberryPi","author":"Michael Horne","date":"21 May 2013","format":false,"excerpt":"Matt Dyson has used a 20x4 LCD display with an i2c backpack so that he only has to use 2 GPIO pins on his Raspberry Pi.\u00a0Read more here","rel":"","context":"In &quot;GPIO boards&quot;","block_context":{"text":"GPIO boards","link":"https:\/\/www.recantha.co.uk\/blog\/?cat=20"},"img":{"alt_text":"Using 20\u00d74 RGB LCD over i2c with a Raspberry Pi | Matt Dyson","src":"\/blog\/wp-content\/uploads\/2013\/05\/2013-05-02-21.36.11-300x2251.jpg","width":350,"height":200},"classes":[]},{"id":12576,"url":"https:\/\/www.recantha.co.uk\/blog\/?p=12576","url_meta":{"origin":19880,"position":4},"title":"Java, sensors and the I2C bus on the Raspberry Pi","author":"Michael Horne","date":"13 May 2015","format":false,"excerpt":"Jose Cruz has continued his series on using sensors on a Raspberry Pi with Java. (You can see part 1 here) This time he tackles initialising the I2C bus on the Pi and then using Java to read sensor data from the bus. Very useful if you're into Java! Read\u2026","rel":"","context":"In &quot;Accessories&quot;","block_context":{"text":"Accessories","link":"https:\/\/www.recantha.co.uk\/blog\/?cat=54"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/community.oracle.com\/servlet\/JiveServlet\/downloadImage\/102-914698-3-123793\/figure3.gif?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":17067,"url":"https:\/\/www.recantha.co.uk\/blog\/?p=17067","url_meta":{"origin":19880,"position":5},"title":"Very, very frightening indeed: Lightning detector uses a sensor and a Raspberry Pi","author":"Michael Horne","date":"9 July 2017","format":false,"excerpt":"France-based Hexalyse\u00a0has hooked up an\u00a0AS3935 Franklin Lightning Sensor\u00a0to his Raspberry Pi. This sensor is able to detect the approach of a storm by detecting lightning up to 40km away and it comes on a little breakout board that can interact with the Pi over the I2C bus. He used a\u2026","rel":"","context":"In &quot;Programming&quot;","block_context":{"text":"Programming","link":"https:\/\/www.recantha.co.uk\/blog\/?cat=39"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.recantha.co.uk\/blog\/wp-content\/uploads\/2017\/07\/lightning.jpg?fit=603%2C800&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.recantha.co.uk\/blog\/wp-content\/uploads\/2017\/07\/lightning.jpg?fit=603%2C800&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.recantha.co.uk\/blog\/wp-content\/uploads\/2017\/07\/lightning.jpg?fit=603%2C800&ssl=1&resize=525%2C300 1.5x"},"classes":[]}],"_links":{"self":[{"href":"https:\/\/www.recantha.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/posts\/19880","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.recantha.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.recantha.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.recantha.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.recantha.co.uk\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=19880"}],"version-history":[{"count":2,"href":"https:\/\/www.recantha.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/posts\/19880\/revisions"}],"predecessor-version":[{"id":19883,"href":"https:\/\/www.recantha.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/posts\/19880\/revisions\/19883"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.recantha.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/media\/19882"}],"wp:attachment":[{"href":"https:\/\/www.recantha.co.uk\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=19880"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.recantha.co.uk\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=19880"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.recantha.co.uk\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=19880"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}