Home
Grove - RTC User Manual
Contents
1. 1 Introduction The RTC module is based on the clock chip DS1307 which supports the I2C protocol It utilizes a Lithium cell battery CR1225 The clock calendar provides seconds minutes hours day date month and year The end of the month date is automatically adjusted for months with fewer than 31 days including corrections for leap years The clock operates in either the 24 hour or 12 hour format with AM PM indicator And it is valid up to 2100 In order to gain a robust performance you must put a 3 Volt CR1225 lithium cell in the battery holder If you use the primary power only the module may not work normally because the crystal may not oscillate Previous Version V0 9b Note The battery is not included y seeed Grow the Difference 2 Specification PCB Size 2 0cm 4 0cm Interface 2 0mm pitch pin header OStructure SCL SDA VCC GND ROHS YES VCC 4 5 5 5V Logic High Level Input 2 2 VCC40 3 V 9 Logic Low Level Input 0 3 0 8 V Battery Voltage 2 0 3 5 V y seeed Grow the Difference 3 Demonstration 3 1 With Arduino The following sketch demonstrates a simple application of setting the time and reading it out Connect the module to the I2C Interface of Grove Base Shield Plug Grove Base Shield into Arduino Connect Arduino to PC via a USB cable Download the library File RTC Library Unzip it into the libraries file of Arduino IDE by the path
2. arduino 1 O libraries Open the code directly by the path File gt Example gt RTC gt SetTimeAndDisplay include lt Wire h gt amp include DS1307 h DS1307 clock define a object of DS1307 class void setup Serial begin 9600 clock begin clock fil 1ByYMD 2013 1 19 Jan 19 2013 clock fillByHMS 15 28 30 15 28 30 clock fillDayOfWeek SAT Saturday clock setTime write time to the RTC chip j void loop peinelime o j Function Display time on the serial monitor void printTime clock getTime Serial print clock hour DEC Serie REN Serial print clock minute DEC Serial prii Serial print clock second DEC Serial print OF Serial print clock month DEC y seeed Grow the Difference Serial printi I Serial print clock dayOfMonth DEC Serial printi Serial print clock year 2000 DEC Serial print Ole Serial print clock dayOfMonth Serial priini switch clock dayOfWeek Friendly printout the weekday case MON Serial print MON break case TUE Ser WERE MUIR Vs break case WED Serial print WED break case THU Serial print IHU break case FRI Serial print PRI break case SAT Serial print SAT break case SUN Serial print SUN break j Seria po s Set the time Put function arguments change to current date time The attention should be paid to t
3. decToBcd self minute self decToBcd self hour self decToBcd self dayOfWeek self decToBed self dayOfMonth self decToBcd self month self decToBcd self year bus write byte self DS1307_ I2C ADDRESS 0x00 bus write i2c block data self DS1307 I2C ADDRESS 0x00 data print eiline def getTime self bus write byte self DS1307 I2C ADDRESS 0x00 data bus read i2c block data self DS1307 I2C ADDRESS 0x00 A few of these need masks because certain bits are control bits self bedToDec data 0 amp Ox7f self minute self bedToDec datal1 self second self hour self bcdToDec data 2 amp Ox3f Need to change this if 12 hour am pm self dayOfWeek self bcdToDec data 3 self dayOfMonth self bedToDec data 4 self month self bcdToDec data 5 self year self bcdToDec data 6 print oorl ime def fillByHMS self hour minute second self hour hour self minute minute self second second print fillByHMS def fillByYMD self year month day self year year 2000 self month month self dayOfMonth day print fillByYMD def fillDayOfWeek self dow self dayOfWeek dow y seeed Grow the Difference print fillDayOfWeek il nae CONGU e clock DS1307 0 clock fillByYMD 2015 3 5 clock fillByHMS 12 42 30 clock fillDayOfWeek clock THU clock setTime while True clock getTime print clock hour cloc
4. 285 255 2585 235 285 4255 do 499 268 499 49D 499 499 499 299 255 255 0 12 43 27 3 S5 15 5 4 255 255 255 255 255 255 255 255 255 255 5 255 255 255 255 255 255 255 255 255 255 6 212 43 28 3 5 19 8 4 255 255 2558 455 2595 4255 255 255 255 255 5 2535 255 2585 288 2355 RAS 255 238 258 233 0 212 43 28 3 5 15 5 4 255 255 255 255 255 255 295 255 255 255 5 255 255 255 255 255 255 255 255 255 255 PEE Grove RIC py Demo for Raspberry Pi x Copyright c 2014 seeed technology inc Website www seeed cc Author Lambor Create Time Nov 2014 Change Log x The MIT License MIT x x Permission is hereby granted free of charge to any person obtaining a co of this software and associated documentation files the Software to d in the Software without restriction including without limitation the righ to use copy modify merge publish distribute sulelicense and or sell copies of the Software and to permit persons to whom the Software is furnished to do so subject to the following conditions x x The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software x THE SOFTWARE IS PROVIDED AS IS WITHOUT WARRANTY OF ANY KIND EXPRESS OR MPLIED INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY FITNESS FOR A PAR
5. TICULAR PURPOSE AND NONINFRINGEMENT IN NO EVENT SHALL TH AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM DAMAGES OR OTHER LIABILITY WHETHER IN AN ACTION OF CONTRACT TORT OR OTHERWISE ARISING FR h ut un fh in in fu gi un un gt 2 in hi ut ut gt py eal TS E OM b hs in on y seeed Grow the Difference OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE usr bin python import time import smbus bus smbus SMBus 1 sius deny Pe Oe 60 lb dev bb mont ei class DS1307 Q Sie mu eel self MON 1 self TUE self WED self THU self FRI self SAT self SUN self DS1307 I2C ADDRESS 0x68 D S 4 D 6 i print begin def decToBcd self val return val 10 16 val 10 def bcdToDec self val return val 16 10 val 16 def begin self news print news def startClock self bus write byte self DS1307 I2C ADDRESS 0x00 self second bus read byte self DS1307 I2C ADDRESS amp Ox7f bus write byte data self DS1307 I2C ADDRESS 0x00 self second GIL Stick def stopClock self bus write byte self DS1307 I2C ADDRESS 0x00 self second bus read byte self DS1307 I2C ADDRESS 0x80 bus write byte data self DS1307 I2C ADDRESS 0x00 self second y seeed Grow the Difference print stopClock def setTime self data self decToBcd self second self
6. he arguments format clock fillByYMD 2013 1 19 Jan 19 2013 clock fillByHMS 15 28 30 15 28 30 clock fillDayOfWeek SAT Saturday Upload the code Open the serial monitor to see the result y seeed Grow the Difference k SSCOM3 2 Author NieXiaoMeng http www mcuS1 com Email Lco Es 1 19 2013 T SUN 1 19 2013 T SUN 1 19 2013 T SUN 1 19 2013 T SUN 1 19 2013 T SUN 1 19 2013 T SUN 1 19 2013 T SUN 1 19 2013 T SUN 1 19 2013 T SUN 1 19 2013 T SUN 1 19 2013 T SUN 1 19 2013 T SUN 1 19 2013 T SUN 1 19 2013 T SUN 1 1 19 2013 T SUN 1 19 2013 T SUN 1 19 2013 T SUN OpenFile FileNm SendFile SaveData Clear a HexDats ComNum cons e CloseCon Help WWW MCUS1 COM EXT Ne LH F T2 E 1 Send eve 1000 ms Time Wwhttp www daxi a df och i M SendNew WMA SEE FRE ERE dz dec31x8B BHA www daxia com bibis mcu51 cor S 0 R 1556 COMS opened 9600bps i CTS 0 DSR ORL The output time is changing like the clock 3 2 With Raspberry Pi 1 You should have got a raspberry pi and a grovepi or grovepi 2 You should have completed configuring the development enviroment otherwise follow here 3 Connection Plug the sensor to grovepi socket 12c x 1 3 by using a grove cable 4 Navigate to the demos directory cd yourpath GrovePi Software Python To see the code nano grove i2e rie py f Culrk oeit import time import grovepi Con
7. k minute A clock second clock dayOfMonth clock month clock year weekday 1 clock dayOfWeek time sleep 1 8 Create grove rtc py and copy codes above 9 Run the code sudo python grove rtc py 10 Result ap pi amp eraspberrypt saftware Raspi Grove Grove Adapter Grove KIL pifraspberrypi software Raspi Grove Grove Adapter Grove RTC sudo python Grove RIC py begin fillByYMD fillByHMS fillDayOfWeek seclime gerclime 12 42 30 5 f 3 f 15 Weekday 4 getTime 12 AZ 31 5 r3 LB weekday 4 geclime 12 42 32 5 3 15 weekday 4 getTime 12 1 42 t 33 5 3 15 Weekday 4 getTime 12 42 34 Sy 3 15 weekday 4 geclime 12 42 35 Faf 15 Weekday 4 gecTime l 42 36 Sy af 1E weekday 4 getlime 12 42 37 5737 15 weekday 4 gerrime i 10 y seeed Grow the Difference 4 Resources RealTime Clock Eagle File zip github repository for RTC e DS1307 datasheet 11
8. nect the Grove Real Time Clock to any I2C port eg I2C 1 Can be found at I2C address 0x68 SCL SDA VCC GND while True JETER print grovepi rtc getTime time sleep 5 except IOError print Error 5 Run the demo seeed Grow the Difference Ww sudo python grove i2c rtc py 6 Result ae pi raspberrypi software GrovePi Software Python piBraapberrypi software GrovePi Software Python sudo python grove i2c rtc py LO 12 49 22 3 0 18 8 4 299 296 268 26 255 255 239 N35 255 255 5 299 235 255 255 255 255 255 255 255 255 0 12 43 23 3 5 15 5 4 255 255 255 255 255 255 255 255 255 255 5 255 255 255 255 255 255 255 255 255 255 10 id 43 44 3 B 15 S 4 A35 4383 285 4285 255 42858 285 4238 255 2855 D 255 255 255 285 295 255 255 255 255 253 9 12 43 24 3 5 15 5 4 255 255 255 255 255 255 255 255 255 255 5 499 255 255 255 255 255 255 255 255 255 0 12 43 25 3 8 15 B 4 255 255 255 255 255 2558 255 255 255 255 Dr 4335 235 283 28858 26 2858 255 2588 23958 238 10 12 43 25 3 5 15 5 4 255 255 255 255 255 255 255 255 255 255 5 95 255 255 255 255 255 255 255 255 255 0 12 43 26 3 5 15 5 4 255 255 255 255 255 255 255 255 255 255 5 455 455 255 255 255 255 255 455 255 255 10 12 43 27 3 3 15 2595 235 255 255
9. seeed Grow the Difference OY Grove RIC User Manual Release date 2015 9 23 Version 1 0 Wiki http www seeedstudio com wiki index php title Twig RIG Bazaar http www seeedstudio com depot Grove H TC p 758 html y seeed Grow the Difference Document Revision History y seeed Grow the Difference Contents Document Revision History EE ee 2 i Introd ttObD er Co ee AR Pact moe ed vlt ud URN o d UR aH UR dE I Esa DNE qs 2 2 Specification 3 3 be ei DOE ei Vai qo atc a iode ER DR dE RR RE de be RO ACE Oe Ua aer doa e ene 4 3 1 SUL DATED e ed EE EE TUA DR MEE 4 32 With Raspberry Pi Hmmm 6 4 Resources y seeed Grow the Difference Disclaimer For physical injuries and possessions loss caused by those reasons which are not related to product quality such as operating without following manual guide natural disasters or force majeure we take no responsibility for that Under the supervision of Seeed Technology Inc this manual has been compiled and published which covered the latest product description and specification The content of this manual is subject to change without notice Copyright The design of this product including software and its accessories is under tutelage of laws Any action to violate relevant right of our product will be penalized through law Please consciously observe relevant local laws in the use of this product y seeed Grow the Difference
Download Pdf Manuals
Related Search
Related Contents
H25 User Manual Samsung B1930HD Uživatelská přiručka da qui HT-102 Troubleshooting Guide リアロック1取扱説明書 ProCurve Series 3500yl and 6200yl Switches Installation - ftp invitation for supply of various lab equipments (paquete de 2 unidades) Solución de problemas Con GELDELIS FICHES QTT INDIVIDUELLES Copyright © All rights reserved.
Failed to retrieve file