{"id":320,"date":"2023-06-28T09:40:31","date_gmt":"2023-06-28T09:40:31","guid":{"rendered":"http:\/\/localhost\/embeddedwala\/?p=320"},"modified":"2023-07-27T04:13:42","modified_gmt":"2023-07-27T04:13:42","slug":"getting-started-with-i2c-hardware-connection","status":"publish","type":"post","link":"https:\/\/embeddedwala.com\/beta\/blogs\/digital-communication\/getting-started-with-i2c-hardware-connection\/","title":{"rendered":"Getting Started with I2C: Hardware Connection"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-post\" data-elementor-id=\"320\" class=\"elementor elementor-320\" data-elementor-post-type=\"post\">\n\t\t\t\t\t\t\t\t\t<section data-particle_enable=\"false\" data-particle-mobile-disabled=\"false\" class=\"elementor-section elementor-top-section elementor-element elementor-element-899365e elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"899365e\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-15d2ce5\" data-id=\"15d2ce5\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t\t<section data-particle_enable=\"false\" data-particle-mobile-disabled=\"false\" class=\"elementor-section elementor-inner-section elementor-element elementor-element-63b504a elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"63b504a\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-inner-column elementor-element elementor-element-328cc2e\" data-id=\"328cc2e\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-element elementor-element-ffe8d09 elementor-widget elementor-widget-text-editor\" data-id=\"ffe8d09\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p><strong>I2C<\/strong>, or Inter-Integrated Circuit, is a well-known communication protocol utilized for linking microcontrollers and integrated circuits in embedded systems.\u00a0In order to guarantee dependable communication among devices in I2C,\u00a0<strong>hardware components<\/strong>\u00a0like resistors and capacitors perform a critical role. These components maintain signal integrity and timing accuracy, both of which are fundamental to the success of data transmission.<\/p><p><b><span data-contrast=\"auto\">Why are resistors and capacitors needed in I2C?<\/span><\/b>\u00a0<\/p><p>The<strong>\u00a0I2C protocol<\/strong>\u00a0employs two signals &#8211; the\u00a0<strong>data (SDA)<\/strong>\u00a0and<strong>\u00a0clock (SCL)<\/strong>\u00a0lines &#8211; which are\u00a0<strong>open-drain (or open-collector)<\/strong>\u00a0pins. An open-drain pin uses a single transistor\/FET to connect the output pin to ground when the transistor\/FET is on, while a pull-up resistor pulls the line up to\u00a0<strong>VCC<\/strong>\u00a0when the transistor is off. This type of pin is suitable for bidirectional data buses with multiple devices initiating data transfer, as the pull-up resistor limits current and prevents a short circuit when one device attempts to place logic 1 on the line while another tries to drive logic 0.<\/p><p>Standard GPIO pins, on the other hand, actively drive logic 1 and 0 on a signal without a\u00a0<strong>pull-up<\/strong>\u00a0resistor, making them unsuitable for bidirectional data transmissions as two devices driving opposite logic values could cause a short circuit and damage both devices.<\/p><p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-321\" src=\"http:\/\/localhost\/embeddedwala\/wp-content\/uploads\/2023\/06\/Open-drain-blog.png\" alt=\"\" width=\"1920\" height=\"1080\" \/><\/p><p>\u00a0<\/p><p><span data-contrast=\"auto\">The\u00a0<strong>capacitance<\/strong>\u00a0of the I2C bus is also an important consideration because it affects the timing and signal integrity of the communication. Capacitance can cause\u00a0<strong>signal reflections, ringing, and delays<\/strong>, leading to communication errors and data loss. Capacitors can be used to filter out noise and stabilize the voltage on the bus, improving the reliability of the communication.<\/span>\u00a0<\/p><p><b><span data-contrast=\"auto\">Resistors:<\/span><\/b>\u00a0<\/p><p><span data-contrast=\"auto\">I2C communication requires two\u00a0<strong>pull-up resistors<\/strong>\u00a0on the SDA (Serial Data) and SCL (Serial Clock) lines. These resistors ensure that the data lines remain in the high state when no data is being transmitted, and they provide a path for the data lines to return to the high state after a device has transmitted a low state.<\/span>\u00a0<\/p><p><span data-contrast=\"auto\">The formula for calculating the value of the pull-up resistor for I2C communication is:<\/span>\u00a0<\/p><p><strong>R = (Vcc\u00a0&#8211; Voh) \/\u00a0Iol\u00a0<\/strong><\/p><p><span data-contrast=\"auto\">where:<\/span>\u00a0<\/p><p><span data-contrast=\"auto\"><strong>R<\/strong>\u00a0= resistance of the pull-up resistor (in ohms)\u00a0<\/span>\u00a0<\/p><p><span data-contrast=\"auto\"><strong>Vcc\u00a0<\/strong>= supply voltage of the I2C bus (in volts)\u00a0<\/span>\u00a0<\/p><p><span data-contrast=\"auto\"><strong>Voh<\/strong>\u00a0= minimum high-level output voltage of the I2C driver (in volts)\u00a0<\/span>\u00a0<\/p><p><span data-contrast=\"auto\"><strong>Iol<\/strong>\u00a0= maximum sinking current of the I2C driver (in amperes)<\/span>\u00a0<\/p><p><span data-contrast=\"auto\">The value of Voh and\u00a0Iol\u00a0are specified in the datasheet of the I2C driver. For example, if the\u00a0Vcc\u00a0of the I2C bus is 5V, the Voh of the I2C driver is 3.3V, and the\u00a0Iol\u00a0is 3mA, then the value of the pull-up resistor can be calculated as follows:<\/span>\u00a0<\/p><p><strong>R = (5V &#8211; 3.3V) \/ 0.003A R = 566 ohms\u00a0<\/strong><\/p><p><span data-contrast=\"auto\">In practice, the value of the pull-up resistor is typically between 1k\u03a9 to 10k\u03a9, depending on the bus capacitance and the number of devices connected to the bus. It is important to choose the appropriate value of the pull-up resistor to ensure reliable communication between devices. If the value of the pull-up resistor is too low, it can cause excessive current flow and damage the I2C driver. If the value of the pull-up resistor is too high, it can cause signal degradation and errors in communication.<\/span>\u00a0<\/p><p><b><span data-contrast=\"auto\">Bus Capacitance:<\/span><\/b>\u00a0<\/p><p><span data-contrast=\"auto\">The formula for calculating the maximum allowable bus capacitance for I2C communication is:<\/span>\u00a0<\/p><p><strong>C = (Iol\u00a0\/ (dV\/dt)) * 1.2\u00a0<\/strong><\/p><p><span data-contrast=\"auto\">Where:<\/span>\u00a0<\/p><p><span data-contrast=\"auto\"><strong>C<\/strong>\u00a0= maximum allowable bus capacitance (in farads)\u00a0<\/span>\u00a0<\/p><p><span data-contrast=\"auto\"><strong>Iol\u00a0<\/strong>= maximum sinking current of the I2C driver (in amperes)\u00a0<\/span>\u00a0<\/p><p><span data-contrast=\"auto\"><strong>dV\/dt<\/strong>\u00a0= maximum allowed change in voltage per unit time (in volts\/second)<\/span>\u00a0<\/p><div class=\"google-auto-placed ap_container\"><ins class=\"adsbygoogle adsbygoogle-noablate\" data-ad-format=\"auto\" data-ad-client=\"ca-pub-9369030695222829\" data-adsbygoogle-status=\"done\" data-ad-status=\"unfilled\"><div id=\"aswift_2_host\" tabindex=\"0\" title=\"Advertisement\" aria-label=\"Advertisement\"><iframe loading=\"lazy\" id=\"aswift_2\" src=\"https:\/\/googleads.g.doubleclick.net\/pagead\/ads?client=ca-pub-9369030695222829&amp;output=html&amp;h=280&amp;adk=3198665963&amp;adf=381872489&amp;pi=t.aa~a.74794149~i.49~rp.4&amp;w=653&amp;fwrn=4&amp;fwrnh=100&amp;lmt=1687945081&amp;num_ads=1&amp;rafmt=1&amp;armr=3&amp;sem=mc&amp;pwprc=3294774346&amp;ad_type=text_image&amp;format=653x280&amp;url=https%3A%2F%2Fembeddedwala.com%2FBlogs%2FDigitalCommunication%2FGetting-Started-with-I2C%3A-Hardware-Connection&amp;fwr=0&amp;pra=3&amp;rh=163&amp;rw=652&amp;rpe=1&amp;resp_fmts=3&amp;wgl=1&amp;fa=27&amp;uach=WyJXaW5kb3dzIiwiMTUuMC4wIiwieDg2IiwiIiwiMTE0LjAuNTczNS4xMzQiLFtdLDAsbnVsbCwiNjQiLFtbIk5vdC5BL0JyYW5kIiwiOC4wLjAuMCJdLFsiQ2hyb21pdW0iLCIxMTQuMC41NzM1LjEzNCJdLFsiR29vZ2xlIENocm9tZSIsIjExNC4wLjU3MzUuMTM0Il1dLDBd&amp;dt=1687945080470&amp;bpp=2&amp;bdt=920&amp;idt=2&amp;shv=r20230620&amp;mjsv=m202306161001&amp;ptt=9&amp;saldr=aa&amp;abxe=1&amp;cookie=ID%3Df7bf496a32581f7d-22f1f0b7fee10050%3AT%3D1687927591%3ART%3D1687945079%3AS%3DALNI_MbKCnwOYlc0usiwYNN80vuP20r_gQ&amp;gpic=UID%3D00000c77395d5fb3%3AT%3D1687927591%3ART%3D1687945079%3AS%3DALNI_MZYuo85v3-A-fAF3tJvHl-JDdq48Q&amp;prev_fmts=0x0%2C653x280%2C233x600%2C233x240&amp;nras=5&amp;correlator=7977177078856&amp;frm=20&amp;pv=1&amp;ga_vid=1656006615.1687927592&amp;ga_sid=1687945080&amp;ga_hid=555086&amp;ga_fc=1&amp;u_tz=330&amp;u_his=1&amp;u_h=768&amp;u_w=1366&amp;u_ah=720&amp;u_aw=1366&amp;u_cd=24&amp;u_sd=1&amp;dmc=8&amp;adx=300&amp;ady=2282&amp;biw=1349&amp;bih=592&amp;scr_x=0&amp;scr_y=0&amp;eid=44759876%2C44759927%2C42532277%2C44759837%2C42532279%2C31075309%2C31075510%2C31075643%2C44788441%2C44783616&amp;oid=2&amp;pvsid=1460804264709833&amp;tmod=250679990&amp;uas=0&amp;nvt=1&amp;fc=1408&amp;brdim=0%2C0%2C0%2C0%2C1366%2C0%2C1366%2C720%2C1366%2C592&amp;vis=1&amp;rsz=%7C%7Cs%7C&amp;abl=NS&amp;fu=128&amp;bc=31&amp;nt=1&amp;ifi=3&amp;uci=a!3&amp;btvi=4&amp;fsb=1&amp;xpc=UTJhL36Teo&amp;p=https%3A\/\/embeddedwala.com&amp;dtd=609\" name=\"aswift_2\" width=\"653\" height=\"0\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\" sandbox=\"allow-forms allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-scripts allow-top-navigation-by-user-activation\" data-google-container-id=\"a!3\" data-google-query-id=\"CO74sLfV5f8CFaxCwgUdVuYNRw\" data-load-complete=\"true\" data-mce-fragment=\"1\"><\/iframe><\/div><\/ins><\/div><p><span data-contrast=\"auto\">The value of\u00a0Iol\u00a0is specified in the datasheet of the I2C driver, and the value of\u00a0dV\/dt is typically 1V\/\u03bcs\u00a0for I2C communication.<\/span>\u00a0<\/p><p><span data-contrast=\"auto\">For example, if the maximum sinking current of the I2C driver is 3mA, then the maximum allowable bus capacitance can be calculated as follows:<\/span>\u00a0<\/p><p><strong>C = (0.003A \/ (1V\/\u03bcs)) * 1.2 C = 3.6nF\u00a0<\/strong><\/p><p>In practice, the actual capacitance of an I2C bus is often lower than the maximum allowable capacitance due to various factors such as the number of devices connected to the bus, the length of the bus, and the value of the pull-up resistor. However, it is still important to calculate the maximum allowable capacitance to ensure reliable operation and avoid potential issues such as signal distortion, signal integrity problems, and communication errors. Therefore, although the actual capacitance may be lower, it is still necessary to consider and control the capacitance on the I2C bus.\u00a0<span data-contrast=\"auto\">It is important to keep the bus capacitance within the allowable limit to ensure reliable communication between devices. If the bus capacitance is too high, it can cause signal degradation, longer rise and fall times, and errors in communication.<\/span>\u00a0<\/p><p>\u00a0<\/p><p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-315 size-full\" src=\"http:\/\/localhost\/embeddedwala\/wp-content\/uploads\/2023\/06\/I2C-frame-blog-image.png\" alt=\"\" width=\"1920\" height=\"1080\" \/><\/p><p><span data-contrast=\"auto\">In conclusion, resistors and capacitors are essential hardware components in I2C communication. Pull-up resistors ensure that the data lines remain in a defined state and prevent the lines from floating. Capacitance affects the timing and signal integrity of the communication and can be reduced by limiting the number of devices on the bus and using high-quality cables and connectors. Proper use of resistors and capacitors is critical for reliable communication between devices in an I2C system.<\/span>\u00a0<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"<p>I2C, or Inter-Integrated Circuit, is a well-known communication protocol utilized for linking microcontrollers and integrated&#8230;<\/p>\n","protected":false},"author":1,"featured_media":352,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[34],"tags":[84,54,83,73],"class_list":["post-320","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-digital-communication","tag-hardware-connection","tag-i2c","tag-multi-master","tag-serial-communication"],"acf":[],"views":468,"featured_image_urls":{"full":["https:\/\/embeddedwala.com\/beta\/wp-content\/uploads\/2023\/06\/hardware-connection-i2c-bigginer.png",520,350,false],"thumbnail":["https:\/\/embeddedwala.com\/beta\/wp-content\/uploads\/2023\/06\/hardware-connection-i2c-bigginer.png",150,101,false],"medium":["https:\/\/embeddedwala.com\/beta\/wp-content\/uploads\/2023\/06\/hardware-connection-i2c-bigginer.png",300,202,false],"medium_large":["https:\/\/embeddedwala.com\/beta\/wp-content\/uploads\/2023\/06\/hardware-connection-i2c-bigginer.png",520,350,false],"large":["https:\/\/embeddedwala.com\/beta\/wp-content\/uploads\/2023\/06\/hardware-connection-i2c-bigginer.png",520,350,false],"1536x1536":["https:\/\/embeddedwala.com\/beta\/wp-content\/uploads\/2023\/06\/hardware-connection-i2c-bigginer.png",520,350,false],"2048x2048":["https:\/\/embeddedwala.com\/beta\/wp-content\/uploads\/2023\/06\/hardware-connection-i2c-bigginer.png",520,350,false],"tp-image-grid":["https:\/\/embeddedwala.com\/beta\/wp-content\/uploads\/2023\/06\/hardware-connection-i2c-bigginer.png",520,350,false],"covernews-slider-full":["https:\/\/embeddedwala.com\/beta\/wp-content\/uploads\/2023\/06\/hardware-connection-i2c-bigginer.png",520,350,false],"covernews-slider-center":["https:\/\/embeddedwala.com\/beta\/wp-content\/uploads\/2023\/06\/hardware-connection-i2c-bigginer.png",520,350,false],"covernews-featured":["https:\/\/embeddedwala.com\/beta\/wp-content\/uploads\/2023\/06\/hardware-connection-i2c-bigginer.png",520,350,false],"covernews-medium":["https:\/\/embeddedwala.com\/beta\/wp-content\/uploads\/2023\/06\/hardware-connection-i2c-bigginer.png",505,340,false],"covernews-medium-square":["https:\/\/embeddedwala.com\/beta\/wp-content\/uploads\/2023\/06\/hardware-connection-i2c-bigginer.png",371,250,false],"_nx_notification_thumb":["https:\/\/embeddedwala.com\/beta\/wp-content\/uploads\/2023\/06\/hardware-connection-i2c-bigginer.png",100,67,false]},"author_info":{"display_name":"embeddedwala","author_link":"https:\/\/embeddedwala.com\/beta\/author\/embeddedwala\/"},"category_info":"<a href=\"https:\/\/embeddedwala.com\/beta\/category\/blogs\/digital-communication\/\" rel=\"category tag\">Digital Communication<\/a>","tag_info":"Digital Communication","comment_count":"0","_links":{"self":[{"href":"https:\/\/embeddedwala.com\/beta\/wp-json\/wp\/v2\/posts\/320","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/embeddedwala.com\/beta\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/embeddedwala.com\/beta\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/embeddedwala.com\/beta\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/embeddedwala.com\/beta\/wp-json\/wp\/v2\/comments?post=320"}],"version-history":[{"count":5,"href":"https:\/\/embeddedwala.com\/beta\/wp-json\/wp\/v2\/posts\/320\/revisions"}],"predecessor-version":[{"id":354,"href":"https:\/\/embeddedwala.com\/beta\/wp-json\/wp\/v2\/posts\/320\/revisions\/354"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/embeddedwala.com\/beta\/wp-json\/wp\/v2\/media\/352"}],"wp:attachment":[{"href":"https:\/\/embeddedwala.com\/beta\/wp-json\/wp\/v2\/media?parent=320"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/embeddedwala.com\/beta\/wp-json\/wp\/v2\/categories?post=320"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/embeddedwala.com\/beta\/wp-json\/wp\/v2\/tags?post=320"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}