{"id":34390,"date":"2020-07-07T13:09:16","date_gmt":"2020-07-07T05:09:16","guid":{"rendered":"\/blog\/?p=34390"},"modified":"2021-06-10T14:55:29","modified_gmt":"2021-06-10T06:55:29","slug":"raspberry-pi-rtc-tutorial-using-ds1307-and-ds3231-rtcs-with-raspberry-pi-m","status":"publish","type":"post","link":"https:\/\/www.seeedstudio.com\/blog\/2020\/07\/07\/raspberry-pi-rtc-tutorial-using-ds1307-and-ds3231-rtcs-with-raspberry-pi-m\/","title":{"rendered":"Raspberry Pi RTC Tutorial: Using DS1307 and DS3231 RTCs with Raspberry Pi"},"content":{"rendered":"\n<figure class=\"wp-block-image size-large\"><img fetchpriority=\"high\" decoding=\"async\" width=\"1030\" height=\"579\" src=\"https:\/\/blog.seeedstudio.com\/wp-content\/uploads\/2020\/07\/cover-2-1030x579.png\" alt=\"\" class=\"wp-image-34409\" srcset=\"https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2020\/07\/cover-2-1030x579.png 1030w, https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2020\/07\/cover-2-300x169.png 300w, https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2020\/07\/cover-2-768x432.png 768w, https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2020\/07\/cover-2-1024x576.png 1024w, https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2020\/07\/cover-2.png 1200w\" sizes=\"(max-width: 1030px) 100vw, 1030px\" \/><\/figure>\n\n\n\n<p>Do you want to maintain hours, minutes, and seconds, as well as, day, month, and year information for your <a href=\"https:\/\/www.seeedstudio.com\/Raspberry-Pi-4-Computer-Model-B-4GB-p-4077.html\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"Raspberry Pi (opens in a new tab)\">Raspberry Pi<\/a> Project? Well then using an RTC (Real Time Clock), will be for you!<\/p>\n\n\n\n<p>Through this\nblog, you will learn how to use an RTC module with your Raspberry in a few easy\nsteps!<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">What is an RTC (Real-Time Clock)?<\/h2>\n\n\n\n<p>RTC stands for real-time clock and it refers to a clock, usually in the form of an integrated circuit that tracks the current time with seconds, minutes, hours, day, date, month, and year information. It can be used to execute various actions at a specific time. <\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Why do you need an RTC for your Raspberry Pi?<\/h2>\n\n\n\n<p>Raspberry Pi\nand almost all other microcontrollers have built-in timers, they can run as\nlong as there is power. However, once the power is turned off (either manually\nor due to a power failure), all timers will be reset to 0.<\/p>\n\n\n\n<p>It is acceptable to use the internal timer for timing for simple projects if you don\u2019t mind when the timer resets to zero once there is no power. But for projects such as data loggers, clocks, alarms, which require the timer to run independently of the external power supply, you need to use an RTC.<\/p>\n\n\n\n<p>By using an\nRTC with your Raspberry Pi, you can continue to keep track of the time even if\nyou need to reprogram your Raspberry Pi or disconnect it from the main power.\n<\/p>\n\n\n\n<p>Almost all\nRTC are low-current built-in ICs and able to run on a single lithium cell battery\nfor many years. <\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Raspberry Pi RTC modules offered by Seeed<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\"><a href=\"https:\/\/www.seeedstudio.com\/Pi-RTC-DS1307.html\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"RTC (DS1307) for Raspberry Pi (opens in a new tab)\">RTC (DS1307) for Raspberry Pi<\/a><\/h3>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><a href=\"https:\/\/www.seeedstudio.com\/Pi-RTC-DS1307.html\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" src=\"https:\/\/blog.seeedstudio.com\/wp-content\/uploads\/2020\/07\/15940354171.png\" alt=\"\" class=\"wp-image-34392\" width=\"243\" height=\"224\"\/><\/a><\/figure><\/div>\n\n\n\n<p>This is based on the clock chip DS1307 and it can provide a real-time clock(RTC) for  Raspberry Pi  Zero, 2, 3B\/B+, 4  via the I2C interface. The real-time clock of this module counts seconds, minutes, hours, date of the month, month, day of the week, and year with leap-year compensation valid up to 2100. The clock operates in either the 24-hour or 12-hour format with AM\/PM indicator. <\/p>\n\n\n\n<p>Also, it has a 56-byte, battery-backed, nonvolatile (NV) RAM for data storage and has a programmable square-wave output signal. If you want to keep this module timing when the Raspberry Pi is powered off, you need to insert a 3-Volt CR1225 lithium cell into the battery-holder. This is equipped with an automatic power-fail detect and switch circuit.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><a href=\"https:\/\/www.seeedstudio.com\/High-Accuracy-Pi-RTC-DS3231.html\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"High Accuracy RTC (DS3231) for Raspberry Pi (opens in a new tab)\">High Accuracy RTC (DS3231) for Raspberry Pi<\/a><\/h3>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><a href=\"https:\/\/www.seeedstudio.com\/High-Accuracy-Pi-RTC-DS3231.html\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" src=\"https:\/\/blog.seeedstudio.com\/wp-content\/uploads\/2020\/07\/15940354561.png\" alt=\"\" class=\"wp-image-34393\" width=\"310\" height=\"200\" srcset=\"https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2020\/07\/15940354561.png 659w, https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2020\/07\/15940354561-300x195.png 300w\" sizes=\"(max-width: 310px) 100vw, 310px\" \/><\/a><\/figure><\/div>\n\n\n\n<p>The High Accuracy Pi RTC is based on the clock chip DS3231. The DS3231 is a low-cost, extremely accurate I2C realtime clock (RTC). It provides an RTC for Raspberry Pi via the I2C interface. With the clock source from the TCXO(temperature compensated crystal oscillator), the&nbsp;RTC maintains seconds, minutes, hours, day, date, month, and year information.&nbsp;<\/p>\n\n\n\n<p>The date at the end of the month is automatically adjusted for months with fewer than 31 days, including corrections for leap year. The clock operates in either the 24-hour or 12-hour format with an AM\/PM indicator.<\/p>\n\n\n\n<p>The clock provides two programmable time-of-day alarms and programmable square-wave output. The INT\/SQW pin either generates an interrupt due to alarm condition or outputs a square-wave signal and the&nbsp;selection is controlled by the bit INTCN.<\/p>\n\n\n\n<p>If you want to retain the time information even when the Raspberry Pi is powered off, you need to insert a 3V CR1225 lithium cell into the battery holder.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">What\u2019s the difference between DS1307 and DS3231 RTC?<\/h2>\n\n\n\n<p>Now that we have discussed about the RTCs with clock chips DS1307 and DS3231, let&#8217;s understand the difference between them.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/blog.seeedstudio.com\/wp-content\/uploads\/2020\/07\/vs-1030x429.png\" alt=\"\" class=\"wp-image-34403\" width=\"773\" height=\"322\" srcset=\"https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2020\/07\/vs-1030x429.png 1030w, https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2020\/07\/vs-300x125.png 300w, https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2020\/07\/vs-768x320.png 768w, https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2020\/07\/vs-1024x426.png 1024w, https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2020\/07\/vs.png 1300w\" sizes=\"(max-width: 773px) 100vw, 773px\" \/><\/figure><\/div>\n\n\n\n<p>Generally, RTC modules such as the DS1307 are equipped with an external 32kHz crystal for time-keeping. However, the issue with crystals is that their oscillation frequency is affected by external temperature. This results in the clock being off by around 5 minutes per month. Even though this is a small change, it is not recommended to neglect it.<\/p>\n\n\n\n<p>In order to minimize these effects, we can use an RTC based on the DS3231 clock chip. But how can it solve the above issue? Well. It has a 32kHz temperature compensated crystal oscillator (TCXO) and this is not affected by external temperature changes. <\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/blog.seeedstudio.com\/wp-content\/uploads\/2020\/07\/new-1030x730.png\" alt=\"\" class=\"wp-image-34398\" width=\"773\" height=\"548\" srcset=\"https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2020\/07\/new-1030x730.png 1030w, https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2020\/07\/new-300x213.png 300w, https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2020\/07\/new-768x544.png 768w, https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2020\/07\/new-1024x726.png 1024w, https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2020\/07\/new.png 1500w\" sizes=\"(max-width: 773px) 100vw, 773px\" \/><\/figure><\/div>\n\n\n\n<p>This sensor compensates frequency changes as the name suggests, by adding or removing clock ticks to make sure the timekeeping stays on track. Overall, this kind of RTC provides a much stable and accurate reference clock and maintains the accuracy of the RTC to around 2 minutes per year.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Tutorial: Using DS1307 and DS3231 RTC with Raspberry Pi <\/h2>\n\n\n\n<p>Now let\u2019s\nlook at how these RTC modules can be used with a Raspberry Pi. Even though we\nhave introduced two different RTC modules, the steps to set them up will be\nquite similar.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">What do you need?<\/h3>\n\n\n\n<ul class=\"wp-block-list\"><li><a href=\"https:\/\/www.seeedstudio.com\/Raspberry-Pi-4-Computer-Model-B-4GB-p-4077.html\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"Raspberry Pi  (opens in a new tab)\">Raspberry Pi <\/a><\/li><li><a href=\"https:\/\/www.seeedstudio.com\/Pi-RTC-DS1307.html\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"RTC (DS1307) for Raspberry Pi (opens in a new tab)\">RTC (DS1307) for Raspberry Pi<\/a>\/ <a href=\"https:\/\/www.seeedstudio.com\/High-Accuracy-Pi-RTC-DS3231.html\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"High Accuracy RTC (DS3231) for Raspberry Pi (opens in a new tab)\">High Accuracy RTC (DS3231) for Raspberry Pi<\/a><\/li><\/ul>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1030\" height=\"284\" src=\"https:\/\/blog.seeedstudio.com\/wp-content\/uploads\/2020\/07\/Untitled-1-2-1030x284.png\" alt=\"\" class=\"wp-image-34400\" srcset=\"https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2020\/07\/Untitled-1-2-1030x284.png 1030w, https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2020\/07\/Untitled-1-2-300x83.png 300w, https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2020\/07\/Untitled-1-2-768x212.png 768w, https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2020\/07\/Untitled-1-2-1536x424.png 1536w, https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2020\/07\/Untitled-1-2-1024x283.png 1024w, https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2020\/07\/Untitled-1-2.png 1663w\" sizes=\"(max-width: 1030px) 100vw, 1030px\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Setting up<\/h3>\n\n\n\n<p><strong>Step 1. Driver Installation<\/strong> <\/p>\n\n\n\n<p>Type the following command in your Raspberry Pi terminal to clone the pi-hats repository<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>git clone https:\/\/github.com\/Seeed-Studio\/pi-hats.git<\/code><\/pre>\n\n\n\n<p>When the download is finished, type the following command in your terminal.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>cd pi-hats<\/code><\/pre>\n\n\n\n<p>Install the drivers according to your RTC. <\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>If you have a DS1307, type the following<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo .\/install.sh -u rtc_ds1307<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\"><li> If you have a DS3231 type the following <\/li><\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo .\/install.sh -u rtc_ds3231<\/code><\/pre>\n\n\n\n<p><strong>Step 2. Power off Raspberry Pi<\/strong> <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo shutdown -h now<\/code><\/pre>\n\n\n\n<p><strong>Step 3. Insert the RTC HAT to Raspberry Pi<\/strong> <\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/files.seeedstudio.com\/wiki\/High_Accuracy_Pi_RTC-DS3231\/img\/connect.jpg\" alt=\"\" width=\"538\" height=\"404\"\/><\/figure><\/div>\n\n\n\n<p class=\"has-background has-cyan-bluish-gray-background-color\">Please make sure to insert the pin 1 of this HAT into the pin 1 of raspberry GPIO, just like the picture above. <\/p>\n\n\n\n<p><strong>Step 4. Power up the Raspberry Pi<\/strong> <\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Using the RTC with Raspberry Pi<\/h3>\n\n\n\n<p>Now you can use the following command to check whether the driver is installed successfully. <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/install.sh -l<\/code><\/pre>\n\n\n\n<p>If you want to uninstall the driver, you can use the command below<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo .\/install.sh -u<\/code><\/pre>\n\n\n\n<p> <strong>Now let&#8217;s see what the RTC module can do:<\/strong> <\/p>\n\n\n\n<ul class=\"wp-block-list\"><li> Read hardware clock and print result <\/li><\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo hwclock -r<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\"><li> Set the system time from the hardware clock <\/li><\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo hwclock -s<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\"><li>Set the hardware clock from the current system time<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo hwclock -w<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\"><li> Access help for more usage <\/li><\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>hwclock --help<\/code><\/pre>\n\n\n\n<p class=\"has-background has-cyan-bluish-gray-background-color\">If you are interested to use RTCs with Arduino boards, check our blog  <a rel=\"noreferrer noopener\" href=\"https:\/\/www.seeedstudio.com\/blog\/2019\/11\/19\/arduino-tutorial-using-ds1307-rtc-with-arduino\/\" target=\"_blank\">Arduino RTC Tutorial: Using DS1307 RTC with Arduino<\/a> <\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p>We believe that you got a clear understanding of using RTC modules with your Raspberry Pi for your timekeeping projects and we hope to see you build your next awesome Raspberry Pi project combined with an RTC module!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Do you want to maintain hours, minutes, and seconds, as well as, day, month, and<\/p>\n","protected":false},"author":141,"featured_media":34409,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_lmt_disableupdate":"","_lmt_disable":"","_price":"","_stock":"","_tribe_ticket_header":"","_tribe_default_ticket_provider":"","_tribe_ticket_capacity":"0","_ticket_start_date":"","_ticket_end_date":"","_tribe_ticket_show_description":"","_tribe_ticket_show_not_going":false,"_tribe_ticket_use_global_stock":"","_tribe_ticket_global_stock_level":"","_global_stock_mode":"","_global_stock_cap":"","_tribe_rsvp_for_event":"","_tribe_ticket_going_count":"","_tribe_ticket_not_going_count":"","_tribe_tickets_list":"[]","_tribe_ticket_has_attendee_info_fields":false,"iawp_total_views":0,"footnotes":""},"categories":[1],"tags":[2035,142,247,1123],"class_list":["post-34390","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-news","tag-ds1307","tag-open-hardware","tag-raspberry-pi","tag-rtc"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.0 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Raspberry Pi RTC Tutorial: Using DS1307 and DS3231 RTCs with Raspberry Pi - Latest News from Seeed Studio<\/title>\n<meta name=\"description\" content=\"Set up an RTC (Real Time Clock) to maintain hours, minutes, and seconds, as well as, day, month, and year information for your Raspberry Pi Project easily!\" \/>\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.seeedstudio.com\/blog\/2020\/07\/07\/raspberry-pi-rtc-tutorial-using-ds1307-and-ds3231-rtcs-with-raspberry-pi-m\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Raspberry Pi RTC Tutorial: Using DS1307 and DS3231 RTCs with Raspberry Pi - Latest News from Seeed Studio\" \/>\n<meta property=\"og:description\" content=\"Set up an RTC (Real Time Clock) to maintain hours, minutes, and seconds, as well as, day, month, and year information for your Raspberry Pi Project easily!\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.seeedstudio.com\/blog\/2020\/07\/07\/raspberry-pi-rtc-tutorial-using-ds1307-and-ds3231-rtcs-with-raspberry-pi-m\/\" \/>\n<meta property=\"og:site_name\" content=\"Latest News from Seeed Studio\" \/>\n<meta property=\"article:published_time\" content=\"2020-07-07T05:09:16+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-06-10T06:55:29+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2020\/07\/cover-2.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"675\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Lakshan\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Lakshan\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.seeedstudio.com\/blog\/2020\/07\/07\/raspberry-pi-rtc-tutorial-using-ds1307-and-ds3231-rtcs-with-raspberry-pi-m\/\",\"url\":\"https:\/\/www.seeedstudio.com\/blog\/2020\/07\/07\/raspberry-pi-rtc-tutorial-using-ds1307-and-ds3231-rtcs-with-raspberry-pi-m\/\",\"name\":\"Raspberry Pi RTC Tutorial: Using DS1307 and DS3231 RTCs with Raspberry Pi - Latest News from Seeed Studio\",\"isPartOf\":{\"@id\":\"https:\/\/www.seeedstudio.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.seeedstudio.com\/blog\/2020\/07\/07\/raspberry-pi-rtc-tutorial-using-ds1307-and-ds3231-rtcs-with-raspberry-pi-m\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.seeedstudio.com\/blog\/2020\/07\/07\/raspberry-pi-rtc-tutorial-using-ds1307-and-ds3231-rtcs-with-raspberry-pi-m\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2020\/07\/cover-2.png\",\"datePublished\":\"2020-07-07T05:09:16+00:00\",\"dateModified\":\"2021-06-10T06:55:29+00:00\",\"author\":{\"@id\":\"https:\/\/www.seeedstudio.com\/blog\/#\/schema\/person\/75eb10f611f7c10a195a98452628bba5\"},\"description\":\"Set up an RTC (Real Time Clock) to maintain hours, minutes, and seconds, as well as, day, month, and year information for your Raspberry Pi Project easily!\",\"breadcrumb\":{\"@id\":\"https:\/\/www.seeedstudio.com\/blog\/2020\/07\/07\/raspberry-pi-rtc-tutorial-using-ds1307-and-ds3231-rtcs-with-raspberry-pi-m\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.seeedstudio.com\/blog\/2020\/07\/07\/raspberry-pi-rtc-tutorial-using-ds1307-and-ds3231-rtcs-with-raspberry-pi-m\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.seeedstudio.com\/blog\/2020\/07\/07\/raspberry-pi-rtc-tutorial-using-ds1307-and-ds3231-rtcs-with-raspberry-pi-m\/#primaryimage\",\"url\":\"https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2020\/07\/cover-2.png\",\"contentUrl\":\"https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2020\/07\/cover-2.png\",\"width\":1200,\"height\":675},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.seeedstudio.com\/blog\/2020\/07\/07\/raspberry-pi-rtc-tutorial-using-ds1307-and-ds3231-rtcs-with-raspberry-pi-m\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.seeedstudio.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Raspberry Pi RTC Tutorial: Using DS1307 and DS3231 RTCs with Raspberry Pi\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.seeedstudio.com\/blog\/#website\",\"url\":\"https:\/\/www.seeedstudio.com\/blog\/\",\"name\":\"Latest News from Seeed Studio\",\"description\":\"Emerging IoT, AI and Autonomous Applications on the Edge\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.seeedstudio.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.seeedstudio.com\/blog\/#\/schema\/person\/75eb10f611f7c10a195a98452628bba5\",\"name\":\"Lakshan\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.seeedstudio.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/c1688294d55a746c8c80f4b85eb94989?s=96&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/c1688294d55a746c8c80f4b85eb94989?s=96&r=g\",\"caption\":\"Lakshan\"},\"url\":\"https:\/\/www.seeedstudio.com\/blog\/author\/lakshan\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Raspberry Pi RTC Tutorial: Using DS1307 and DS3231 RTCs with Raspberry Pi - Latest News from Seeed Studio","description":"Set up an RTC (Real Time Clock) to maintain hours, minutes, and seconds, as well as, day, month, and year information for your Raspberry Pi Project easily!","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.seeedstudio.com\/blog\/2020\/07\/07\/raspberry-pi-rtc-tutorial-using-ds1307-and-ds3231-rtcs-with-raspberry-pi-m\/","og_locale":"en_US","og_type":"article","og_title":"Raspberry Pi RTC Tutorial: Using DS1307 and DS3231 RTCs with Raspberry Pi - Latest News from Seeed Studio","og_description":"Set up an RTC (Real Time Clock) to maintain hours, minutes, and seconds, as well as, day, month, and year information for your Raspberry Pi Project easily!","og_url":"https:\/\/www.seeedstudio.com\/blog\/2020\/07\/07\/raspberry-pi-rtc-tutorial-using-ds1307-and-ds3231-rtcs-with-raspberry-pi-m\/","og_site_name":"Latest News from Seeed Studio","article_published_time":"2020-07-07T05:09:16+00:00","article_modified_time":"2021-06-10T06:55:29+00:00","og_image":[{"width":1200,"height":675,"url":"https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2020\/07\/cover-2.png","type":"image\/png"}],"author":"Lakshan","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Lakshan","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.seeedstudio.com\/blog\/2020\/07\/07\/raspberry-pi-rtc-tutorial-using-ds1307-and-ds3231-rtcs-with-raspberry-pi-m\/","url":"https:\/\/www.seeedstudio.com\/blog\/2020\/07\/07\/raspberry-pi-rtc-tutorial-using-ds1307-and-ds3231-rtcs-with-raspberry-pi-m\/","name":"Raspberry Pi RTC Tutorial: Using DS1307 and DS3231 RTCs with Raspberry Pi - Latest News from Seeed Studio","isPartOf":{"@id":"https:\/\/www.seeedstudio.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.seeedstudio.com\/blog\/2020\/07\/07\/raspberry-pi-rtc-tutorial-using-ds1307-and-ds3231-rtcs-with-raspberry-pi-m\/#primaryimage"},"image":{"@id":"https:\/\/www.seeedstudio.com\/blog\/2020\/07\/07\/raspberry-pi-rtc-tutorial-using-ds1307-and-ds3231-rtcs-with-raspberry-pi-m\/#primaryimage"},"thumbnailUrl":"https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2020\/07\/cover-2.png","datePublished":"2020-07-07T05:09:16+00:00","dateModified":"2021-06-10T06:55:29+00:00","author":{"@id":"https:\/\/www.seeedstudio.com\/blog\/#\/schema\/person\/75eb10f611f7c10a195a98452628bba5"},"description":"Set up an RTC (Real Time Clock) to maintain hours, minutes, and seconds, as well as, day, month, and year information for your Raspberry Pi Project easily!","breadcrumb":{"@id":"https:\/\/www.seeedstudio.com\/blog\/2020\/07\/07\/raspberry-pi-rtc-tutorial-using-ds1307-and-ds3231-rtcs-with-raspberry-pi-m\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.seeedstudio.com\/blog\/2020\/07\/07\/raspberry-pi-rtc-tutorial-using-ds1307-and-ds3231-rtcs-with-raspberry-pi-m\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.seeedstudio.com\/blog\/2020\/07\/07\/raspberry-pi-rtc-tutorial-using-ds1307-and-ds3231-rtcs-with-raspberry-pi-m\/#primaryimage","url":"https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2020\/07\/cover-2.png","contentUrl":"https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2020\/07\/cover-2.png","width":1200,"height":675},{"@type":"BreadcrumbList","@id":"https:\/\/www.seeedstudio.com\/blog\/2020\/07\/07\/raspberry-pi-rtc-tutorial-using-ds1307-and-ds3231-rtcs-with-raspberry-pi-m\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.seeedstudio.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Raspberry Pi RTC Tutorial: Using DS1307 and DS3231 RTCs with Raspberry Pi"}]},{"@type":"WebSite","@id":"https:\/\/www.seeedstudio.com\/blog\/#website","url":"https:\/\/www.seeedstudio.com\/blog\/","name":"Latest News from Seeed Studio","description":"Emerging IoT, AI and Autonomous Applications on the Edge","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.seeedstudio.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.seeedstudio.com\/blog\/#\/schema\/person\/75eb10f611f7c10a195a98452628bba5","name":"Lakshan","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.seeedstudio.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/c1688294d55a746c8c80f4b85eb94989?s=96&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/c1688294d55a746c8c80f4b85eb94989?s=96&r=g","caption":"Lakshan"},"url":"https:\/\/www.seeedstudio.com\/blog\/author\/lakshan\/"}]}},"modified_by":"Lily","views":33976,"featured_image_urls":{"full":["https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2020\/07\/cover-2.png",1200,675,false],"thumbnail":["https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2020\/07\/cover-2-80x80.png",80,80,true],"medium":["https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2020\/07\/cover-2-300x169.png",300,169,true],"medium_large":["https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2020\/07\/cover-2-768x432.png",640,360,true],"large":["https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2020\/07\/cover-2-1030x579.png",640,360,true],"1536x1536":["https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2020\/07\/cover-2.png",1200,675,false],"2048x2048":["https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2020\/07\/cover-2.png",1200,675,false],"visody_icon":["https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2020\/07\/cover-2.png",32,18,false],"magazine-7-slider-full":["https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2020\/07\/cover-2.png",1200,675,false],"magazine-7-slider-center":["https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2020\/07\/cover-2-936x675.png",936,675,true],"magazine-7-featured":["https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2020\/07\/cover-2-1024x576.png",1024,576,true],"magazine-7-medium":["https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2020\/07\/cover-2-720x380.png",720,380,true],"magazine-7-medium-square":["https:\/\/www.seeedstudio.com\/blog\/wp-content\/uploads\/2020\/07\/cover-2-675x450.png",675,450,true]},"author_info":{"display_name":"Lakshan","author_link":"https:\/\/www.seeedstudio.com\/blog\/author\/lakshan\/"},"category_info":"<a href=\"https:\/\/www.seeedstudio.com\/blog\/category\/news\/\" rel=\"category tag\">News<\/a>","tag_info":"News","comment_count":"0","_links":{"self":[{"href":"https:\/\/www.seeedstudio.com\/blog\/wp-json\/wp\/v2\/posts\/34390","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.seeedstudio.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.seeedstudio.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.seeedstudio.com\/blog\/wp-json\/wp\/v2\/users\/141"}],"replies":[{"embeddable":true,"href":"https:\/\/www.seeedstudio.com\/blog\/wp-json\/wp\/v2\/comments?post=34390"}],"version-history":[{"count":17,"href":"https:\/\/www.seeedstudio.com\/blog\/wp-json\/wp\/v2\/posts\/34390\/revisions"}],"predecessor-version":[{"id":34419,"href":"https:\/\/www.seeedstudio.com\/blog\/wp-json\/wp\/v2\/posts\/34390\/revisions\/34419"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.seeedstudio.com\/blog\/wp-json\/wp\/v2\/media\/34409"}],"wp:attachment":[{"href":"https:\/\/www.seeedstudio.com\/blog\/wp-json\/wp\/v2\/media?parent=34390"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.seeedstudio.com\/blog\/wp-json\/wp\/v2\/categories?post=34390"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.seeedstudio.com\/blog\/wp-json\/wp\/v2\/tags?post=34390"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}