i APLIKASI SISTEM KENDALI PADA PENETAS TELUR BURUNG KENARI SECARA OTOMATIS TUGAS AKHIR KARYA TULIS INI DIAJUKAN SEBAGAI SALAH SATU SYARAT UNTUK MEMPEROLEH GELAR AHLI MADYA DARI POLITEKNIK NEGERI BALIKPAPAN STEFANUS KRISTIAJI 140309247893 POLITEKNIK NEGERI BALIKPAPAN JURUSAN TEKNIK ELEKTRONIKA 2017
127
Embed
APLIKASI SISTEM KENDALI PADA PENETAS TELUR …spmi.poltekba.ac.id/spmi/fileTA/140309247893_2017.pdfaplikasi sistem kendali pada penetas telur burung kenari secara otomatis tugas akhir
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
i
APLIKASI SISTEM KENDALI PADA PENETAS TELUR
BURUNG KENARI SECARA OTOMATIS
TUGAS AKHIR
KARYA TULIS INI DIAJUKAN SEBAGAI SALAH SATU
SYARAT UNTUK MEMPEROLEH GELAR AHLI MADYA DARI
POLITEKNIK NEGERI BALIKPAPAN
STEFANUS KRISTIAJI
140309247893
POLITEKNIK NEGERI BALIKPAPAN
JURUSAN TEKNIK ELEKTRONIKA
2017
ii
LEMBAR PENGESAHAN
APLIKASI SISTEM KENDALI PADA PENETAS TELUR
BURUNG KENARI SECARA OTOMATIS
Diajukan oleh
STEFANUS KRISTIAJI
140309247893
Dosen Pembimbing 1 Dosen Pembimbing 2
Hilmansyah, ST., MT. Saiful Ghozi, S.Pd., M.Pd.
NIP : 1976082020210011013 NIP: 198105032014041001
Dosen Penguji 1 Dosen Penguji 2
Nur Yanti, S.T., M.T. Fathur Zaini R., ST.,MT.
NIP: 197611292007012020 NIP : 198508252014041002
Mengetahui,
Ketua Jurusan Teknik Elektronika
Drs. Suhaedi M.
iii
SURAT PERNYATAAN
Yang bertanda tangan di bawah ini:
Nama : Stefanus Kristiaji
Tempat/Tgl Lahir : Pati, 01 Agustus 1996
NIM : 140309247893
Menyatakan bahwa tugas akhir yang berjudul “APLIKASI SISTEM KENDALI
PADA PENETAS TELUR BURUNG KENARI SECARA OTOMATIS” adalah
bukan merupakan hasil karya tulisan orang lain, kecuali kutipan yang penulisan
cantumkan sumbernya.
Demikian pernyataan kami buat dengan sebenar-benarnya dan apabila ada
kekeliruan dengan pernyataan ini bisa dibicarakan kedepannya. Terima kasih.
Balikpapan, 28 Juli 2017
Mahasiswa,
Stefanus Kristiaji
NIM : 140309247893
iv
SURAT PERNYATAAN PERSETUJUAN
PUBLIKASI KARYA ILMIAH KEPENTINGAN AKADEMIS
Sebagai civitas akademis Politeknik Negeri Balikpapan, saya yang bertanda
tangan di bawah ini:
Nama : Stefanus Kristiaji
NIM : 140309247893
Program Studi : Teknik Elektronika
Judul TA : Aplikasi sistem kendali pada penetas telur bururng kenari
secara otomatis.
Demi pengembangan ilmu pengetahuan, saya menyetujui untuk memberikan
hak kepada Politeknik Negeri Balikpapan untuk menyimpan, mangalik media atau
format-kan, mengelola dalam bentuk pangkalan data (database), merawat dan
mempublikasikan tugas akhir saya selama tetap mencantumkan nama saya sebagai
penulis/pencipta.
Dibuat di : Balikpapan
Pada Tanggal : 07 Juli 2017
Yang menyatakan:
Stefanus Kristiaji
NIM : 140309247893
v
Tugas Akhir ini kupersembahkan
Kepada Ayah dan Ibu Terkasih
Bpk.Sudiarso dan Ibu Suratmi
Saudaraku yang kusayangi
Bernando Cahya Krisanda
Teruntuk teman – teman seperjuangan sekaligus keluarga
3 TE 1 angkatan 2014
vi
ABSTRACT
For hatching the canary eggs are generally done manually. In manual hatching of
canary eggs is usually a lot of failure due to lack of temperature and humidity are not
stable. For that we try to create a tool so that breeders can easily monitor the canary's
eggs according to the temperature and humidity specified. Temperature and humidity
will be displayed on the LCD. To measure the temperature and humidity used DHT
11 sensor.
Keywords: Egg canary, dht sensor 11, LCD
vii
ABSTRAK
Untuk penetasan telur burung kenari umumnya dilakukan secara manual. Pada
penetasan telur burung kenari secara manual biasanya banyak terjadi kegagalan
karena kurangnya suhu dan kelembaban yang tidak stabil. Untuk itu kami mencoba
menciptakan suatu alat sehingga peternak bisa dengan mudah memantau telur burung
kenari sesuai suhu dan kelembaban yang ditentukan. Suhu dan kelembaban akan
ditampilkan pada LCD. Untuk mengukur suhu dan kelembaban digunakan sensor
DHT 11.
Kata kunci : Telur burung kenari, sensor dht 11, LCD
viii
KATA PENGANTAR
Puji syukur kehadirat Tuhan Yang Maha Esa, karena berkat atas rahmat-Nya
penulis dapat menyelesaikan kegiatan Praktek Kerja Lapangan dan menyusun laporan
Tugas Akhir tepat waktu dan tanpa adanya halangan yang berarti. Laporan Tugas
Akhir ini disusun berdasarkan apa yang telah penulis lakukan pada saat mengerjakan
suatu alat. Laporan Tugas Akhir ini merupakan salah syarat wajib yang harus
ditempuh dalam jurusan Teknik Elektronika. Selain untuk menuntaskan jurusan yang
penulis tempuh, Laporan Tugas Akhir ini banyak memberikan manfaat kepada
penulis baik dari segi hardskill maupun softskill.
Penulisan laporan ini didasarkan pada observasi di lapangan, diskusi dengan
pembimbing dan kajian pustaka yang dilakukan selama melakukan pengerjaan
Laporan Tugas Akhir. Dengan ini, penulis juga menyampaikan terima kasih kepada :
1. Tuhan Yang Maha Esa. karena telah memberikan kelancaran, keberkahan,
dan keselamatan selama pembuatan laporan Tugas Akhir.
2. Orang tua dan keluarga yang telah memberikan dukungan baik materil
maupun spiritual.
3. Bapak Drs. Suhaedi, M.T., selaku Ketua Jurusan Teknik Elektronika
LiquidCrystal lcd(12, 11, 10, 9, 8, 7); //pin yang
dipakai LCD
Servo myservo;
int pos = 90;
AlarmId id;
RTC_DS1307 RTC;
uint32_t syncProvider()
return RTC.now().unixtime();
void setup()
lcd.begin(16, 2); //mengatur ukuran lcd yang
dipakai
dht.begin(); //program komunikasi atau setup
untuk sensor DHT
Serial.begin(9600); //program komunikasi atau
setup untuk serial monitor dan kecepatan
komunikasi (baudrate)
while (!Serial);
myservo.attach (3);
pinMode(relay, OUTPUT);
setTime(8,29,0,1,1,11);
Wire.begin();
RTC.begin();
RTC.adjust(DateTime(__DATE__,
__TIME__));
setSyncProvider(syncProvider);
void loop()
float kelembapan = dht.readHumidity();
//menyimpan nilai kelembapan pada variabel
kelembapan
float suhu = dht.readTemperature();
//menyimpan nilai suhu pada variabel suhu
delay(100); //mengatur jeda waktu pembacaan
sensor selama 500 milidetik
Serial.print(kelembapan); //menampilkan nilai
kelembapan pada Serial Monitor
Serial.print("%"); //Simbol persen satuan
kelembapan
Serial.print(" "); //menambahkan spasi
Serial.print(suhu); //menampilkan nilai suhu
pada Serial Monitor
Serial.println("*C"); //Satuan Derajat Suhu
//menampilkan nilai kelembapan pada LCD
lcd.setCursor(0, 0); //
lcd.print("kelembapan.: ");
lcd.print((int) kelembapan);
lcd.print("%");
//menampilkan nilai suhu pada LCD
lcd.setCursor(0, 1);
lcd.print("Suhu.: ");
lcd.print((int) suhu);
lcd.print((char)223); //Simbol Derajat di LCD
lcd.print("C ");
delay (1000);
Serial.print(hour());
Serial.print(":");
Serial.print(minute());
Serial.print(":");
Serial.print(second());
Serial.println();
Serial.print(day());
Serial.print("/");
Serial.print(month());
Serial.print("/");
Serial.print(year());
Serial.println();
if (suhu <= 34)
digitalWrite(relay,HIGH);
if (suhu >= 37)
digitalWrite(relay,LOW);
if (hour()==3 && minute()==0&&
second()==0)
Putarsatu();
if (hour()==6 && minute()==0&&
second()==0)
Putardua();
if (hour()==9 && minute()==0&&
second()==0)
Putartiga();
if (hour()==12 && minute()==0&&
second()==0)
Putarempat();
if (hour()==15 && minute()==0&&
second()==0)
Putarlima();
if (hour()==18 && minute()==0&&
second()==0)
Putarenam();
if (hour()==21 && minute()==0&&
second()==0)
Putartujuh();
if (hour()==24 && minute()==1&&
second()==0)
Putardelapan();
void Putarsatu()
Serial.println("Alarm: - servo on");
for(pos = 90; pos <= 110; pos+=1)
myservo.write(pos);
delay (500);
delay (1000);
for(pos = 110; pos>=70; pos-=1)
myservo.write(pos);
delay(500);
for(pos = 70; pos <= 110; pos+=1)
myservo.write(pos);
delay (500);
delay (1000);
for(pos = 110; pos>=70; pos-=1)
myservo.write(pos);
delay(500);
for(pos = 70; pos<=90; pos+=1)
myservo.write(pos);
delay(500);
void Putardua()
Serial.println("Alarm: - servo on");
for(pos = 90; pos <= 110; pos+=1)
myservo.write(pos);
delay (500);
delay (1000);
for(pos = 110; pos>=70; pos-=1)
myservo.write(pos);
delay(500);
for(pos = 70; pos <= 110; pos+=1)
myservo.write(pos);
delay (500);
delay (1000);
for(pos = 110; pos>=70; pos-=1)
myservo.write(pos);
delay(500);
for(pos = 60; pos<=70; pos+=1)
myservo.write(pos);
delay(500);
void Putartiga()
Serial.println("Alarm: - servo on");
for(pos = 90; pos <= 110; pos+=1)
myservo.write(pos);
delay (500);
delay (1000);
for(pos = 110; pos>=70; pos-=1)
myservo.write(pos);
delay(500);
for(pos = 70; pos <= 110; pos+=1)
myservo.write(pos);
delay (500);
delay (1000);
for(pos = 110; pos>=70; pos-=1)
myservo.write(pos);
delay(500);
for(pos = 70; pos<=90; pos+=1)
myservo.write(pos);
delay(500);
void Putarempat()
Serial.println("Alarm: - servo on");
for(pos = 90; pos <= 110; pos+=1)
myservo.write(pos);
delay (500);
delay (1000);
for(pos = 110; pos>=70; pos-=1)
myservo.write(pos);
delay(500);
for(pos = 70; pos <= 110; pos+=1)
myservo.write(pos);
delay (500);
delay (1000);
for(pos = 110; pos>=70; pos-=1)
myservo.write(pos);
delay(500);
for(pos = 70; pos<=90; pos+=1)
myservo.write(pos);
delay(500);
void Putarlima()
Serial.println("Alarm: - servo on");
for(pos = 90; pos <= 110; pos+=1)
myservo.write(pos);
delay (500);
delay (1000);
for(pos = 110; pos>=70; pos-=1)
myservo.write(pos);
delay(500);
for(pos = 70; pos <= 110; pos+=1)
myservo.write(pos);
delay (500);
delay (1000);
for(pos = 110; pos>=70; pos-=1)
myservo.write(pos);
delay(500);
for(pos = 70; pos<=90; pos+=1)
myservo.write(pos);
delay(500);
void Putarenam()
Serial.println("Alarm: - servo on");
for(pos = 90; pos <= 110; pos+=1)
myservo.write(pos);
delay (500);
delay (1000);
for(pos = 110; pos>=70; pos-=1)
myservo.write(pos);
delay(500);
for(pos = 70; pos <= 110; pos+=1)
myservo.write(pos);
delay (500);
delay (1000);
for(pos = 110; pos>=70; pos-=1)
myservo.write(pos);
delay(500);
for(pos = 70; pos<=90; pos+=1)
myservo.write(pos);
delay(500);
void Putartujuh()
Serial.println("Alarm: - servo on");
for(pos = 90; pos <= 110; pos+=1)
myservo.write(pos);
delay (500);
delay (1000);
for(pos = 110; pos>=70; pos-=1)
myservo.write(pos);
delay(500);
for(pos = 70; pos <= 110; pos+=1)
myservo.write(pos);
delay (500);
delay (1000);
for(pos = 110; pos>=70; pos-=1)
myservo.write(pos);
delay(500);
for(pos = 70; pos<=90; pos+=1)
myservo.write(pos);
delay(500);
void Putardelapan()
Serial.println("Alarm: - servo on");
for(pos = 90; pos <= 110; pos+=1)
myservo.write(pos);
delay (500);
delay (1000);
for(pos = 110; pos>=70; pos-=1)
myservo.write(pos);
delay(500);
for(pos = 70; pos <= 110; pos+=1)
myservo.write(pos);
delay (500);
delay (1000);
for(pos = 110; pos>=70; pos-=1)
myservo.write(pos);
delay(500);
for(pos = 70; pos<=90; pos+=1)
myservo.write(pos);
delay(500);
Data Sheet
Arduino Uno
Arduino Uno R3 Front Arduino Uno R3 Back
Arduino Uno R2 Front Arduino Uno SMD Arduino Uno Front Arduino Uno Back
Overview
The Arduino Uno is a microcontroller board based on the ATmega328 (datasheet). It has 14 digital input/output pins (of which 6 can be used as PWM outputs), 6 analog inputs, a 16
MHz ceramic resonator, a USB connection, a power jack, an ICSP header, and a reset button. It contains everything needed to support the microcontroller; simply connect it to a
computer with a USB cable or power it with a AC-to-DC adapter or battery to get started.
The Uno differs from all preceding boards in that it does not use the FTDI USB-to-serial driver chip. Instead, it features the Atmega16U2 (Atmega8U2 up to version R2) programmed as a USB-to-serial converter.
Revision 2 of the Uno board has a resistor pulling the 8U2 HWB line to ground, making it easier to put into DFU mode.
Revision 3 of the board has the following new features:
1.0 pinout: added SDA and SCL pins that are near to the AREF pin and two other new pins placed near to the RESET pin, the IOREF that allow the shields to adapt to the
voltage provided from the board. In future, shields will be compatible both with the board that use the AVR, which operate with 5V and with the Arduino Due that operate
with 3.3V. The second one is a not connected pin, that is reserved for future
purposes.
Stronger RESET circuit.
Atmega 16U2 replace the 8U2.
"Uno" means one in Italian and is named to mark the upcoming release of Arduino 1.0. The
Uno and version 1.0 will be the reference versions of Arduino, moving forward. The Uno is the latest in a series of USB Arduino boards, and the reference model for the Arduino platform; for a comparison with previous versions, see the index of Arduino boards.
Digital I/O Pins 14 (of which 6 provide PWM output)
Analog Input Pins 6
DC Current per I/O Pin 40 mA
DC Current for 3.3V Pin 50 mA
Flash Memory 32 KB (ATmega328) of which 0.5 KB used by bootloader
SRAM 2 KB (ATmega328)
EEPROM 1 KB (ATmega328)
Clock Speed 16 MHz
Schematic & Reference Design
EAGLE files: arduino-uno-Rev3-reference-design.zip (NOTE: works with Eagle 6.0 and newer)
Schematic: arduino-uno-Rev3-schematic.pdf
Note: The Arduino reference design can use an Atmega8, 168, or 328, Current models use an ATmega328, but an Atmega8 is shown in the schematic for reference. The pin
configuration is identical on all three processors.
Power
The Arduino Uno can be powered via the USB connection or with an external power supply. The power source is selected automatically.
External (non-USB) power can come either from an AC-to-DC adapter (wall-wart) or battery. The adapter can be connected by plugging a 2.1mm center-positive plug into the board's
power jack. Leads from a battery can be inserted in the Gnd and Vin pin headers of the POWER connector.
The board can operate on an external supply of 6 to 20 volts. If supplied with less than 7V,
however, the 5V pin may supply less than five volts and the board may be unstable. If using more than 12V, the voltage regulator may overheat and damage the board. The
recommended range is 7 to 12 volts. The power pins are as follows:
VIN. The input voltage to the Arduino board when it's using an external power
source (as opposed to 5 volts from the USB connection or other regulated power source). You can supply voltage through this pin, or, if supplying voltage via the
5V.This pin outputs a regulated 5V from the regulator on the board. The board can be supplied with power either from the DC power jack (7 - 12V), the USB connector
(5V), or the VIN pin of the board (7-12V). Supplying voltage via the 5V or 3.3V pins bypasses the regulator, and can damage your board. We don't advise it.
3V3. A 3.3 volt supply generated by the on-board regulator. Maximum current draw is 50 mA.
GND. Ground pins.
Memory
The ATmega328 has 32 KB (with 0.5 KB used for the bootloader). It also has 2 KB of SRAM
and 1 KB of EEPROM (which can be read and written with the EEPROM library).
Input and Output
Each of the 14 digital pins on the Uno can be used as an input or output, using pinMode(), digitalWrite(), and digitalRead() functions. They operate at 5 volts. Each pin can provide or
receive a maximum of 40 mA and has an internal pull-up resistor (disconnected by default) of 20-50 kOhms. In addition, some pins have specialized functions:
Serial: 0 (RX) and 1 (TX). Used to receive (RX) and transmit (TX) TTL serial data. These pins are connected to the corresponding pins of the ATmega8U2 USB-to-TTL
Serial chip.
External Interrupts: 2 and 3. These pins can be configured to trigger an interrupt on a low value, a rising or falling edge, or a change in value. See the
attachInterrupt() function for details.
PWM: 3, 5, 6, 9, 10, and 11. Provide 8-bit PWM output with the analogWrite() function.
SPI: 10 (SS), 11 (MOSI), 12 (MISO), 13 (SCK). These pins support SPI communication using the SPI library.
LED: 13. There is a built-in LED connected to digital pin 13. When the pin is HIGH value, the LED is on, when the pin is LOW, it's off.
The Uno has 6 analog inputs, labeled A0 through A5, each of which provide 10 bits of resolution (i.e. 1024 different values). By default they measure from ground to 5 volts,
though is it possible to change the upper end of their range using the AREF pin and the analogReference() function. Additionally, some pins have specialized functionality:
TWI: A4 or SDA pin and A5 or SCL pin. Support TWI communication using the
Wire library. There are a couple of other pins on the board:
AREF. Reference voltage for the analog inputs. Used with analogReference().
Reset. Bring this line LOW to reset the microcontroller. Typically used to add a reset button to shields which block the one on the board.
See also the mapping between Arduino pins and ATmega328 ports. The mapping for the Atmega8, 168, and 328 is identical.
Communication
The Arduino Uno has a number of facilities for communicating with a computer, another Arduino, or other microcontrollers. The ATmega328 provides UART TTL (5V) serial communication, which is available on digital pins 0 (RX) and 1 (TX). An ATmega16U2 on the
board channels this serial communication over USB and appears as a virtual com port to software on the computer. The '16U2 firmware uses the standard USB COM drivers, and no
external driver is needed. However, on Windows, a .inf file is required. The Arduino software includes a serial monitor which allows simple textual data to be sent to and from the Arduino
board. The RX and TX LEDs on the board will flash when data is being transmitted via the USB-to-serial chip and USB connection to the computer (but not for serial communication on
pins 0 and 1).
A SoftwareSerial library allows for serial communication on any of the Uno's digital pins.
The ATmega328 also supports I2C (TWI) and SPI communication. The Arduino software includes a Wire library to simplify use of the I2C bus; see the documentation for details. For
SPI communication, use the SPI library.
Programming
The Arduino Uno can be programmed with the Arduino software (download). Select "Arduino
Uno from the Tools > Board menu (according to the microcontroller on your board). For details, see the reference and tutorials.
The ATmega328 on the Arduino Uno comes preburned with a bootloader that allows you to upload new code to it without the use of an external hardware programmer. It communicates
using the original STK500 protocol (reference, C header files).
You can also bypass the bootloader and program the microcontroller through the ICSP (In-Circuit Serial Programming) header; see these instructions for details.
The ATmega16U2 (or 8U2 in the rev1 and rev2 boards) firmware source code is available . The ATmega16U2/8U2 is loaded with a DFU bootloader, which can be activated by:
On Rev1 boards: connecting the solder jumper on the back of the board (near the map of Italy) and then resetting the 8U2.
On Rev2 or later boards: there is a resistor that pulling the 8U2/16U2 HWB line to ground, making it easier to put into DFU mode.
You can then use Atmel's FLIP software (Windows) or the DFU programmer (Mac OS X and Linux) to load a new firmware. Or you can use the ISP header with an external
programmer (overwriting the DFU bootloader). See this user-contributed tutorial for more information.
Rather than requiring a physical press of the reset button before an upload, the Arduino Uno is designed in a way that allows it to be reset by software running on a connected computer.
One of the hardware flow control lines (DTR) of the ATmega8U2/16U2 is connected to the reset line of the ATmega328 via a 100 nanofarad capacitor. When this line is asserted (taken
low), the reset line drops long enough to reset the chip. The Arduino software uses this capability to allow you to upload code by simply pressing the upload button in the Arduino
environment. This means that the bootloader can have a shorter timeout, as the lowering of DTR can be well-coordinated with the start of the upload. This setup has other implications.
When the Uno is connected to either a computer running Mac OS X or Linux, it resets each time a connection is made to it from software (via USB). For the following half-second or so, the bootloader is running on the Uno. While it is programmed to ignore malformed data (i.e.
anything besides an upload of new code), it will intercept the first few bytes of data sent to the board after a connection is opened. If a sketch running on the board receives one-time
configuration or other data when it first starts, make sure that the software with which it communicates waits a second after opening the connection and before sending this data.
The Uno contains a trace that can be cut to disable the auto-reset. The pads on either side of
the trace can be soldered together to re-enable it. It's labeled "RESET-EN". You may also be able to disable the auto-reset by connecting a 110 ohm resistor from 5V to the reset line; see
this forum thread for details.
USB Overcurrent Protection
The Arduino Uno has a resettable polyfuse that protects your computer's USB ports from shorts and overcurrent. Although most computers provide their own internal protection, the
fuse provides an extra layer of protection. If more than 500 mA is applied to the USB port, the fuse will automatically break the connection until the short or overload is removed.
Physical Characteristics
The maximum length and width of the Uno PCB are 2.7 and 2.1 inches respectively, with the USB connector and power jack extending beyond the former dimension. Four screw holes
allow the board to be attached to a surface or case. Note that the distance between digital pins 7 and 8 is 160 mil (0.16"), not an even multiple of the 100 mil spacing of the other pins.
This High-Torque MG996R Digital Servo features metal gearing resulting in extra high 10kg stalling torque in a tiny package. The MG996R is essentially an upgraded version of the famous MG995 servo, and features upgraded shock-proofing and a redesigned PCB and IC control system that make it much more accurate than its predecessor. The gearing and motor have also been upgraded to improve dead bandwith and centering. The unit comes complete with 30cm wire and 3 pin 'S' type female header connector that fits most receivers, including Futaba, JR, GWS, Cirrus, Blue Bird, Blue Arrow, Corona, Berg, Spektrum and Hitec.
This high-torque standard servo can rotate approximately 120 degrees (60 in each direction). You can use any servo code, hardware or library to control these servos, so it's great for beginners who want to make stuff move without building a motor controller with feedback & gear box, especially since it will fit in small places. The MG996R Metal Gear Servo also comes with a selection of arms and hardware to get you set up nice and fast!
Specifications
Weight: 55 g
Dimension: 40.7 x 19.7 x 42.9 mm approx. Stall torque: 9.4 kgf·cm (4.8 V ), 11 kgf·cm (6 V) Operating speed: 0.17 s/60º (4.8 V), 0.14 s/60º (6 V)
Operating voltage: 4.8 V a 7.2 V Running Current 500 mA – 900 mA (6V) Stall Current 2.5 A (6V) Dead band width: 5 µs Stable and shock proof double ball bearing design Temperature range: 0 ºC – 55 ºC
DS1307
64 x 8, Serial, I2C Real-Time Clock
GENERAL DESCRIPTION
The DS1307 serial real-time clock (RTC) is a low-power, full binary-coded decimal (BCD)
clock/calendar plus 56 bytes of NV SRAM. Address and data are transferred serially through
an I2C, bidirectional bus. The clock/calendar
provides seconds, minutes, hours, day, date, month, and year information. The end of the
month date 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 AM/PM indicator. The DS1307 has a built-in power-sense circuit
that detects power failures and automatically switches to the backup supply. Timekeeping
operation continues while the part operates from the backup supply.
ORDERING INFORMATION
FEATURES
Real-Time Clock (RTC) Counts Seconds,
Minutes, Hours, Date of the Month, Month,
Day of the week, and Year with Leap-Year
Compensation Valid Up to 2100 56-Byte,
Battery-Backed, Nonvolatile (NV)
RAM for Data Storage
I2C Serial Interface
Programmable Square -Wave Output
Signal Automatic Power-Fail Detect and
Switch Circuitry
Consumes Less than 500nA in Battery-
Backup Mode with Oscillator Running
Optional Industrial Temperature Range:
-40°C to +85°C
Available in 8-Pin Plastic DIP or SO
Underwriters Laboratory (UL) Recognized
Typical Operating Circuit and Pin Configurations appear
at end of data sheet.
PART TEMP RANGE
VOLTAGE
PIN-PACKAGE TOP MARK*
(V)
DS1307 0°C to +70°C 5.0 8 PDIP (300 mils) DS1307
DS1307+ 0°C to +70°C 5.0 8 PDIP (300 mils) DS1307
DS1307N -40°C to +85°C 5.0 8 PDIP (300 mils) DS1307N
DS1307N+ -40°C to +85°C 5.0 8 PDIP (300 mils) DS1307N
DS1307Z 0°C to +70°C 5.0 8 SO (150 mils) DS1307
DS1307Z+ 0°C to +70°C 5.0 8 SO (150 mils) DS1307
DS1307ZN -40°C to +85°C 5.0 8 SO (150 mils) DS1307N
DS1307ZN+ -40°C to +85°C 5.0 8 SO (150 mils) DS1307N
DS1307Z/T&R 0°C to +70°C 5.0 8 SO (150 mils) Tape and Reel DS1307
DS1307Z+T&R 0°C to +70°C 5.0 8 SO (150 mils) Tape and Reel DS1307
DS1307ZN/T&R -40°C to +85°C 5.0 8 SO (150 mils) Tape and Reel DS1307N
DS1307ZN+T&R -40°C to +85°C 5.0 8 SO (150 mils) Tape and Reel DS1307N
Denotes a lead-free/RoHS-compliant device.
A “+” anywhere on the top mark indicates a lead-free device.
Note: Some revisions of this device may incorporate deviations from published specifications known as errata. Multiple revisions of any device
may be simultaneously available through various sales channels. For information about dev ice errata, click here: www.maxim-ic.com/errata.
DS1307 64 x 8, Serial, I2C Real-Time Clock
ABSOLUTE MAXIMUM RATINGS
Voltage Range on Any Pin Relative to Ground……….……………………….…………....-0.5V to +7.0V
Operating Temperature Range (Noncondensing)
Commercial…………………….……………………………….………………………..0°C to +70°C
Industrial………………………………………………………………………………-40°C to +85°C
Storage Temperature Range………………………………………...…………..…………-55°C to +125°C
Soldering Temperature (DIP, leads)..…………………………………………….....+260°C for 10 seconds
Soldering Temperature (surface mount)…..…………………………See JPC/JEDEC Standard J-STD-020
Stresses beyond those listed under “Absolute Maximum Ratings” may cause permanent damage to the device. These are stress rat ings only,
and functional operation of the device at these or any other conditions beyond those indicated in the operational sections of the specifications is
not implied. Exposure to the absolute maximum rating conditions for extended periods may affect device reliability.
outputs one of four square-wave frequencies (1Hz, 4kHz, 8kHz, 32kHz). The SQW/OUT
pin is open drain and requires an external pullup resistor. SQW/OUT operates with either
VCC or VBAT applied.
Primary Power Supply. When voltage is applied within normal limits, the device is fully
8 VCC
accessible and data can be written and read. When a backup supply is connected to the
device and VCC is below VTP, read and writes are inhibited. However, the timekeeping
function continues unaffected by the lower input voltage.
DETAILED DESCRIPTION
The DS1307 is a low-power clock/calendar with 56 bytes of battery-backed SRAM. The clock/calendar provides seconds, minutes, hours, day, date, month, and year information. The date at the end of the month is automatically adjusted for months with fewer than 31 days, including corrections for leap year.
The DS1307 operates as a slave device on the I2C bus. Access is obtained by implementing a START
condition and providing a device identification code followed by a register address. Subsequent registers
can be accessed sequentially until a STOP condition is executed. When VCC falls below 1.25 x V BAT, the device terminates an access in progress and resets the device address counter. Inputs to the device will not be recognized at this time to prevent erroneous data from being written to the device from an out-of-
tolerance system. When VCC falls below VBAT, the device switches into a low-current battery-backup
mode. Upon power-up, the device switches from battery to VCC when VCC is greater than VBAT +0.2V
and recognizes inputs when VCC is greater than 1.25 x VBAT. The block diagram in Figure 1 shows the main elements of the serial RTC.
DS1307 64 x 8, Serial, I2C Real-Time Clock
OSCILLATOR CIRCUIT
The DS1307 uses an external 32.768kHz crystal. The oscillator circuit does not require any external resistors
or capacitors to operate. Table 1 specifies several crystal parameters for the external crystal. Figure 1. shows
a functional schematic of the oscillator circuit. If using a crystal with the specified characteristics, the startup
time is usually less than one second.
CLOCK ACCURACY
The accuracy of the clock is dependent upon the accuracy of the crystal and the accuracy of the match
between the capacitive load of the oscillator circuit and the capacitive load for which the crystal was
trimmed. Additional error will be added by crystal frequency drift caused by temperature shifts. External
circuit noise coupled into the oscillator circuit may result in the clock running fast. Refer to Application
Note 58: Crystal Considerations with Dallas Real-Time Clocks for detailed information.
Table 1. Crystal Specifications*
PARAMETER SYMBOL MIN TYP MAX UNITS
Nominal Frequency fO 32.768 kHz
Series Resistance ESR 45 kΩ
Load Capacitance CL 12.5 pF
*The crystal, traces, and crystal input pins should be isolated from RF generating signals. Refer to
Application Note 58: Crystal Considerations for Dallas Real-Time Clocks for additional specifications.
Figure 2. Recommended Layout for Crystal
LOCAL GROUND PLANE (LAYER 2)
X1
CRYSTAL
NOTE: AVOID ROUTING SIGNAL LINES IN THE CROSSHATCHED
AREA (UPPER LEFT QUADRANT) OF THE PACKAGE UNLESS
THERE IS A GROUND PLANE BETWEEN THE SIGNAL LINE AND THE
DEVICE PACKAGE.
RTC AND RAM ADDRESS MAP
Table 2 shows the address map for the DS1307 RTC and RAM registers. The RTC registers are located in
address locations 00h to 07h. The RAM registers are located in address locations 08h to 3Fh. During a
multibyte access, when the address pointer reaches 3Fh, the end of RAM space, it wraps around to location
00h, the beginning of the clock space
DS1307 64 x 8, Serial, I2C Real-Time Clock
CLOCK AND CALENDAR
The time and calendar information is obtained by reading the appropriate register bytes. Table 2 shows
the RTC registers. The time and calendar are set or initialized by writing the appropriate register bytes.
The contents of the time and calendar registers are in the BCD format. The day-of-week register
increments at midnight. Values that correspond to the day of week are user-defined but must be
sequential (i.e., if 1 equals Sunday, then 2 equals Monday, and so on.) Illogical time and date entries
result in undefined operation. Bit 7 of Register 0 is the clock halt (CH) bit. When this bit is set to 1, the
oscillator is disabled. When cleared to 0, the oscillator is enabled.
Note that the initial power- on state of all registers is not defined. Therefore, it is important to
enable the oscillator (CH bit = 0) during initial configuration.
The DS1307 can be run in either 12-hour or 24-hour mode. Bit 6 of the hours register is defined as the 12-
hour or 24-hour mode-select bit. When high, the 12-hour mode is selected. In the 12-hour mode, bit 5 is
the AM/PM bit with logic high being PM. In the 24-hour mode, bit 5 is the second 10-hour bit (20 to 23
hours). The hours value must be re-entered whenever the 12/24-hour mode bit is changed.
When reading or writing the time and date registers, secondary (user) buffers are used to prevent errors when the internal registers update. When reading the time and date registers, the user buffers are
synchronized to the internal registers on any I2C START. The time information is read from these
secondary registers while the clock continues to run. This eliminates the need to re-read the registers in case the internal registers update during a read. The divider chain is reset whenever the seconds register is
written. Write transfers occur on the I 2C acknowledge from the DS1307. Once the divider chain is reset,
to avoid rollover issues, the remaining time and date registers must be written within one second.
Table 2. Timekeeper Registers
ADDRESS BIT 7 BIT 6 BIT 5 BIT 4 BIT 3 BIT 2 BIT 1 BIT 0 FUNCTION RANGE
00H CH 10 Seconds Seconds Seconds 00–59
01H 0 10 Minutes Minutes Minutes 00–59
12
10
10
1–12
Hour
02H 0
Hours
Hours +AM/PM
PM/
Hour
24
00–23
AM
03H 0 0 0 0 0 DAY Day 01–07
04H 0 0 10 Date Date Date 01–31
05H 0 0
0
10
Month
Month 01–12
Month
06H 10 Year Year Year 00–99
07H OUT 0 0 SQWE 0 0 RS1 RS0 Control —
08H-3FH
RAM
00H–FFH
56 x 8
0 = Always reads back as 0.
DS1307 64 x 8, Serial, I2C Real-Time Clock
CONTROL REGISTER
The DS1307 control register is used to control the operation of the SQW/OUT pin.
BIT 7 BIT 6 BIT 5 BIT 4 BIT 3 BIT 2 BIT 1 BIT 0
OUT 0 0 SQWE 0 0 RS1 RS0
Bit 7: Output Control (OUT). This bit controls the output level of the SQW/OUT pin when the square-
wave output is disabled. If SQWE = 0, the logic level on the SQW/OUT pin is 1 if OUT = 1 and is 0 if
OUT = 0.
Bit 4: Square-Wave Enable (SQWE). This bit, when set to logic 1, enables the oscillator output. The
frequency of the square-wave output depends upon the value of the RS0 and RS1 bits. With the square-
wave output set to 1Hz, the clock registers update on the falling edge of the square wave.
Bits 1, 0: Rate Select (RS1, RS0). These bits control the frequency of the square-wave output when the
square-wave output has been enabled. The following table lists the square-wave frequencies that can be
selected with the RS bits.
RS1 RS0 SQW/OUT OUTPUT SQWE OUT
0 0 1Hz 1 X
0 1 4.096kHz 1 X
1 0 8.192kHz 1 X
1 1 32.768kHz 1 X
X X 0 0 0
X X 1 0 1
DS1307 64 x 8, Serial, I2C Real-Time Clock
I2C DATA BUS
The DS1307 supports the I2 C protocol. A device that sends data onto the bus is defined as a transmitter
and a device receiving data as a receiver. The device that controls the message is called a master. The devices that are controlled by the master are referred to as slaves. The bus must be controlled by a master device that generates the serial clock (SCL), controls the bus access, and generates the START and STOP
conditions. The DS1307 operates as a slave on the I2C bus.
Figures 3, 4, and 5 detail how data is transferred on the I2C bus.
Data transfer may be initiated only when the bus is not busy.
During data transfer, the data line must remain stable whenever the clock line is HIGH. Changes in
the data line while the clock line is high will be interpreted as control signals.
Accordingly, the following bus conditions have been defined:
Bus not busy: Both data and clock lines remain HIGH.
Start data transfer: A change in the state of the data line, from HIGH to LOW, while the clock is
HIGH, defines a START condition.
Stop data transfer: A change in the state of the data line, from LOW to HIGH, while the clock line
is HIGH, defines the STOP condition.
Data valid: The state of the data line represents valid data when, after a START condition, the data
line is stable for the duration of the HIGH period of the clock signal. The data on the line must be
changed during the LOW period of the clock signal. There is one clock pulse per bit of data.
Each data transfer is initiated with a START condition and terminated with a STOP condition. The number of data bytes transferred between START and STOP conditions is not limited, and is determined by the master device. The information is transferred byte-wise and each receiver
acknowledges with a ninth bit. Within the I2C bus specifications a standard mode (100kHz clock
rate) and a fast mode (400kHz clock rate) are defined. The DS1307 operates in the standard mode (100kHz) only.
Acknowledge: Each receiving device, when addressed, is obliged to generate an acknowledge after
the reception of each byte. The master device must generate an extra clock pulse which is associated
with this acknowledge bit.
A device that acknowledges must pull down the SDA line during the acknowledge clock pulse in
such a way that the SDA line is stable LOW during the HIGH period of the acknowledge related
clock pulse. Of course, setup and hold times must be taken into account. A master must signal an end
of data to the slave by not generating an acknowledge bit on the last byte that has been clocked out
of the slave. In this case, the slave must leave the data line HIGH to enable the master to generate the
STOP condition.
DS1307 64 x 8, Serial, I2C Real-Time Clock
Figure 3. Data Transfer on I2C Serial Bus
SDA
MSB
R/W
ACKNOWLEDGEMENT
DIRECTION
BIT SIGNAL FROM RECEIVER
ACKNOWLEDGEMENT
SIGNAL FROM RECEIVER
SCL
1 2 6 7 8 9 1 2 3-7 8 9
START
ACK
ACK
STOP
CONDITION
REPEATED IF MORE BYTES
CONDITION
OR
ARE TRANSFERED REPEATED
START
CONDITION
Depending upon the state of the R/W bit, two types of data transfer are possible:
Data transfer from a master transmitter to a slave receiver. The first byte transmitted by the
master is the slave address. Next follows a number of data bytes. The slave returns an acknowledge
bit after each received byte. Data is transferred with the most significant bit (MSB) first.
Data transfer from a slave transmitter to a master receiver. The first byte (the slave address) is
transmitted by the master. The slave then returns an acknowledge bit. This is followed by the slave
transmitting a number of data bytes. The master returns an acknowledge bit after all received bytes
other than the last byte. At the end of the last received byte, a “not acknowledge” is returned.
The master device generates all the serial clock pulses and the START and STOP conditions. A
transfer is ended with a STOP condition or with a repeated START condition. Since a repeated
START condition is also the beginning of the next serial transfer, the bus will not be released. Data is
transferred with the most significant bit (MSB) first.
DS1307 64 x 8, Serial, I2C Real-Time Clock
The DS1307 may operate in the following two modes:
Slave Receiver Mode (Write Mode): Serial data and clock are received through SDA and
SCL. After each byte is received an acknowledge bit is transmitted. START and STOP
conditions are recognized as the beginning and end of a serial transfer. Hardware performs
address recognition after reception of the slave address and direction bit (see Figure 4). The
slave address byte is the first byte received after the master generates the START condition.
The slave address byte contains the 7-bit DS1307 address, which is 1101000, followed by the
direction bit (R/W), which for a write is 0. After receiving and decoding the slave address
byte, the DS1307 outputs an acknowledge on SDA. After the DS1307 acknowledges the slave
address + write bit, the master transmits a word address to the DS1307. This sets the register
pointer on the DS1307, with the DS1307 acknowledging the transfer. The master can then
transmit zero or more bytes of data with the DS1307 acknowledging each byte received. The
register pointer automatically increments after each data byte are written. The master will
generate a STOP condition to terminate the data write.
Slave Transmitter Mode (Read Mode): The first byte is received and handled as in the slave
receiver mode. However, in this mode, the direction bit will indicate that the transfer direction
is reversed. The DS1307 transmits serial data on SDA while the serial clock is input on SCL.
START and STOP conditions are recognized as the beginning and end of a serial transfer (see
Figure 5). The slave address byte is the first byte received after the START condition is
generated by the master. The slave address byte contains the 7-bit DS1307 address, which is
1101000, followed by the direction bit (R/W), which is 1 for a read. After receiving and
decoding the slave address the DS1307 outputs an acknowledge on SDA. The DS1307 then
begins to transmit data starting with the register address pointed to by the register pointer. If
the register pointer is not written to before the initiation of a read mode the first address that is
read is the last one stored in the register pointer. The register pointer automatically increments
after each byte are read. The DS1307 must receive a Not Acknowledge to end a read.
Figure 4. Data Write—Slave Receiver Mode
W<
R>
<Word Address (n)>
<Data(n)>
<Data(n+1)>
<Data(n+X)>
<Slave Address>
S 1101000 0 A XXXXXXXX A XXXXXXXX A XXXXXXXX A ... XXXXXXXX A P
S - Start
Master to slave
A - Acknowledge (ACK)
Slave to master
DATA TRANSFERRED
P - Stop
(X+1 BYTES + ACKNOWLEDGE)
Figure 5. Data Read—Slave Transmitter Mode
W<
R>
<Data(n)>
<Data(n+1)>
<Data(n+2)>
<Data(n+X)>
<Slave Address>
S 1101000 1 A XXXXXXXX A XXXXXXXX A XXXXXXXX A ... XXXXXXXX A P
S - Start
Master to slave
DATA TRANSFERRED
A - Acknowledge (ACK)
P - Stop (X+1 BYTES + ACKNOWLEDGE); NOTE: LAST DATA BYTE IS
A - Not Acknowledge (NACK) Slave to master FOLLOWED BY A NOT ACKNOWLEDGE (A) SIGNAL)
DS1307 64 x 8, Serial, I2C Real-Time Clock
Figure 6. Data Read (Write Pointer, Then Read)—Slave Receive and Transmit
<Slave Address> <R
<Word Address (n)>
<Slave Address>
S 1101000
0
A XXXXXXXX
A Sr 1101000
1 A
<Data(n)> <Data(n+1)> <Data(n+2)> <Data(n+X)>
XXXXXXXX
A XXXXXXXX A XXXXXXXX A ... XXXXXXXX A P
S - Start
Sr - Repeated Start Master to slave
DATA TRANSFERRED
A - Acknowledge (ACK)
(X+1 BYTES + ACKNOWLEDGE); NOTE: LAST DATA BYTE IS
P - Stop
Slave to master
FOLLOWED BY A NOT ACKNOWLEDGE (A) SIGNAL)
A - Not Acknowledge (NACK)
TYPICAL OPERATING CIRCUIT
V
CC
VCC
V CC
RPU
CRYSTAL
R PU
X1 X2 V
CC
SCL SQW/OUT
CPU DS1307
SDA V BAT
GND
RPU = tr/C b
PIN CONFIGURATIONS
TOP VIEW
VCC
X1
1
DS1
307
8
X1
1
8
VCC
2 7
DS
130
7
X2
SQW/OUT
X2
2 7
SQW/OUT
VBAT
3
6
SCL
VBAT
3
6
SCL
GND
4
5
SDA
GND
4
5
SDA
PDIP (300 mils)
SO (150 mils)
1307 64 x 8, Serial, I2C Real-Time Clock
PACKAGE INFORMATION
(The package drawing(s) in this data sheet may not reflect the most current specifications. For the
latest package outline information, go to www.maxim-ic.com/DallasPackInfo.)
This DFRobot DHT11 Temperature & Humidity Sensor features a temperature & humidity sensor
complex with a calibrated digital signal output. By using the exclusive digital-signal-acquisition
technique and temperature & humidity sensing technology, it ensures high reliability and
excellent long-term stability. This sensor includes a resistive-type humidity measurement
component and an NTC temperature measurement component, and connects to a high-
performance 8-bit microcontroller, offering excellent quality, fast response, anti-interference
ability and cost-effectiveness.
Each DHT11 element is strictly calibrated in the laboratory that is extremely accurate on
humidity calibration. The calibration coefficients are stored as programmes in the OTP memory,
hi h a e used the se so ’s i te al sig al dete ti g p o ess. The si gle-wire serial interface
makes system integration quick and easy. Its small size, low power consumption and up-to-20
meter signal transmission making it the best choice for various applications, including those
most demanding ones. The component is 4-pin single row pin package. It is convenient to
o e t a d spe ial pa kages a e p o ided a o di g to use s’ e uest.
2. Technical Specifications:
Overview:
Item Measurement Humidity Temperature Resolution Package
Range Accuracy Accuracy
DHT11 20-90%RH ±5%RH ±2 1 4 Pin Single
0-50 Row
Detailed Specifications:
Parameters Conditions Minimum Typical Maximum
Humidity
Resolution 1%RH 1%RH 1%RH
8 Bit
Repeatability ±1%RH
Accuracy 25 ±4%RH
0-50 ±5%RH
Interchangeability Fully Interchangeable
Measurement 0 30%RH 90%RH
Range
25 20%RH 90%RH
50 20%RH 80%RH
Response Time 1/e(63%)25, 6 S 10 S 15 S
(Seconds) 1m/s Air
Hysteresis ±1%RH
Long-Term Typical ±1%RH/year
Stability
Temperature
Resolution 1 1 1
8 Bit 8 Bit 8 Bit
Repeatability ±1
Accuracy ±1 ±2
Measurement 0 50
Range
Response Time 1/e(63%) 6 S 30 S
(Seconds)
3. Typical Application (Figure 1)
Figure 1 Typical Application
Note: 3Pin – Null; MCU = Micro-computer Unite or single chip Computer
When the connecting cable is shorter than 20 metres, a 5K pull-up resistor is recommended;
when the connecting cable is longer than 20 metres, choose a appropriate pull-up resistor as
needed.
4. Power and Pin
DHT ’s po e suppl is -5.5V DC. When power is supplied to the sensor, do not send
any instruction to the sensor in within one second in order to pass the unstable status.
One capacitor valued 100nF can be added between VDD and GND for power filtering.
5. Communication Process: Serial Interface (Single-Wire Two-Way)
Single-bus data format is used for communication and synchronization between MCU and
DHT11 sensor. One communication process is about 4ms.
Data consists of decimal and integral parts. A complete data transmission is 40bit, and the sensor sends higher data bit first.
Data format: 8bit integral RH data + 8bit decimal RH data + 8bit integral T data + 8bit decimal T
data + 8bit check sum. If the data transmission is right, the check-sum should be the last 8bit of
"8bit integral RH data + 8bit decimal RH data + 8bit integral T data + 8bit decimal T data".
5.1 Overall Communication Process (Figure 2, below)
When MCU sends a start signal, DHT11 changes from the low-power-consumption mode to the
running-mode, waiting for MCU completing the start signal. Once it is completed, DHT11 sends a
response signal of 40-bit data that include the relative humidity and temperature information to
MCU. Users can choose to collect (read) some data. Without the start signal from MCU, DHT11
will not give the response signal to MCU. Once data is collected, DHT11 will change to the low-
power-consumption mode until it receives a start signal from MCU again.
Figure 2 Overall Communication Process
5.2 MCU Sends out Start Signal to DHT (Figure 3, below)
Data Single-bus free status is at high voltage level. When the communication between MCU and
DHT11 begins, the programme of MCU will set Data Single-bus voltage level from high to low
a d this p o ess ust take at least 8 s to e su e DHT’s dete tio of MCU's sig al, the MCU will pull up voltage and wait 20- us fo DHT’s espo se.
Figure 3 MCU Sends out Start Signal & DHT Responses
5.3 DHT Responses to MCU (Figure 3, above)
Once DHT detects the start signal, it will send out a low-voltage-level response signal, which
lasts 80us. Then the programme of DHT sets Data Single-bus voltage level from low to high
and keeps it fo 8 us fo DHT’s p epa atio fo se di g data.
When DATA Single-Bus is at the low voltage level, this means that DHT is sending the
response signal. Once DHT sent out the response signal, it pulls up voltage and keeps it for
80us and prepares for data transmission.
When DHT is sending data to MCU, every bit of data begins with the 50us low-voltage-level and
the length of the following high-voltage-level signal determines whether data bit is "0" or "1"
(see Figures 4 and 5 below).
Figure 4 Data "0" Indication
Figure 5 Data "1" Indication
If the response signal from DHT is always at high-voltage-level, it suggests that DHT is not
responding properly and please check the connection. When the last bit data is transmitted,
DHT11 pulls down the voltage level and keeps it for 50us. Then the Single-Bus voltage will be
pulled up by the resistor to set it back to the free status.
6. Electrical Characteristics
VDD=5V, T = 25 (unless otherwise stated)
Conditions Minimum Typical Maximum
Power Supply DC 3V 5V 5.5V
Current Measuring 0.5mA 2.5mA
Supply
Average 0.2mA 1mA
Standby 100uA 150uA
Sampling Second 1
period
Note: Sampling period at intervals should be no less than 1 second.
7. Attentions of application
(1) Operating conditions
Applying the DHT11 sensor beyond its working range stated in this datasheet can result in 3%RH
signal shift/discrepancy. The DHT11 sensor can recover to the calibrated status gradually when
it gets back to the normal operating condition and works within its range. Please refer to (3) of
this section to accelerate its recovery. Please be aware that operating the DHT11 sensor in the non- o al o ki g o ditio s ill a ele ate se so ’s agi g p o ess.
(2) Attention to chemical materials
Vapo f o he i al ate ials a i te fe e ith DHT’s se siti e-elements and debase its
sensitivity. A high degree of chemical contamination can permanently damage the sensor.
(3) Restoration process when (1) & (2) happen
Step one: Keep the DHT sensor at the condition of Temperature 50~60Celsius, humidity <10%RH for 2 hours;
Step two:K keep the DHT sensor at the condition of Temperature 20~30Celsius, humidity >70%RH for 5 hours.
(4) Temperature Affect
Relative humidity largely depends on temperature. Although temperature compensation
technology is used to ensure accurate measurement of RH, it is still strongly advised to keep the
humidity and temperature sensors working under the same temperature. DHT11 should be
mounted at the place as far as possible from parts that may generate heat.
(5) Light Affect
Lo g ti e e posu e to st o g su light a d ult a iolet a de ase DHT’s pe fo a e.
(6) Connection wires
The quality of connection wires will affect the quality and distance of communication and high quality shielding-wire is recommended.
(7) Other attentions
Welding temperature should be bellow 260Celsius and contact should take less than 10 seconds.
Avoid using the sensor under dew condition.
Do not use this product in safety or emergency stop devices or any other occasion that failure of DHT11 may cause personal injury.
Storage: Keep the sensor at temperature 10-40, humidity <60%RH.
Declaim:
This datasheet is a t a slated e sio of the a ufa tu e ’s datasheet. Although the due
care has been taken during the translation, D-Robotics is not responsible for the accuracy of
Note: Some revisions of this device may incorporate deviations from published specifications known as errata. Multiple revisions of any device may be simultaneously available through various sales channels. For information about device errata, click here: www.maxim-ic.com/errata.
GENERAL DESCRIPTION The DS1307 serial real-time clock (RTC) is a
low-power, full binary-coded decimal (BCD)
clock/calendar plus 56 bytes of NV SRAM.
Address and data are transferred serially through
an I2C, bidirectional bus. The clock/calendar
provides seconds, minutes, hours, day, date,
month, and year information. The end of the
month date 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 AM/PM indicator.
The DS1307 has a built-in power-sense circuit
that detects power failures and automatically
switches to the backup supply. Timekeeping
operation continues while the part operates from
the backup supply.
FEATURES Real-Time Clock (RTC) Counts Seconds,
Minutes, Hours, Date of the Month, Month,
Day of the week, and Year with Leap-Year
Compensation Valid Up to 2100
56-Byte, Battery-Backed, Nonvolatile (NV)
RAM for Data Storage
I2C Serial Interface
Programmable Square-Wave Output Signal
Automatic Power-Fail Detect and Switch
Circuitry
Consumes Less than 500nA in Battery-
Backup Mode with Oscillator Running
Optional Industrial Temperature Range:
-40°C to +85°C
Available in 8-Pin Plastic DIP or SO
Underwriters Laboratory (UL) Recognized
Typical Operating Circuit and Pin Configurations appear at end of data sheet.
ORDERING INFORMATION
PART TEMP RANGE VOLTAGE
(V) PIN-PACKAGE TOP MARK*
DS1307 0°C to +70°C 5.0 8 PDIP (300 mils) DS1307
DS1307+ 0°C to +70°C 5.0 8 PDIP (300 mils) DS1307
DS1307N -40°C to +85°C 5.0 8 PDIP (300 mils) DS1307N
DS1307N+ -40°C to +85°C 5.0 8 PDIP (300 mils) DS1307N
DS1307Z 0°C to +70°C 5.0 8 SO (150 mils) DS1307
DS1307Z+ 0°C to +70°C 5.0 8 SO (150 mils) DS1307
DS1307ZN -40°C to +85°C 5.0 8 SO (150 mils) DS1307N
DS1307ZN+ -40°C to +85°C 5.0 8 SO (150 mils) DS1307N
DS1307Z/T&R 0°C to +70°C 5.0 8 SO (150 mils) Tape and Reel DS1307
DS1307Z+T&R 0°C to +70°C 5.0 8 SO (150 mils) Tape and Reel DS1307
DS1307ZN/T&R -40°C to +85°C 5.0 8 SO (150 mils) Tape and Reel DS1307N
DS1307ZN+T&R -40°C to +85°C 5.0 8 SO (150 mils) Tape and Reel DS1307N
+ Denotes a lead-free/RoHS-compliant device.
* A “+” anywhere on the top mark indicates a lead-free device.
ABSOLUTE MAXIMUM RATINGS Voltage Range on Any Pin Relative to Ground……….……………………….…………....-0.5V to +7.0V
Operating Temperature Range (Noncondensing)
Commercial…………………….……………………………….………………………..0°C to +70°C
Industrial………………………………………………………………………………-40°C to +85°C
Storage Temperature Range………………………………………...…………..…………-55°C to +125°C
Soldering Temperature (DIP, leads)..…………………………………………….....+260°C for 10 seconds
Soldering Temperature (surface mount)…..…………………………See JPC/JEDEC Standard J-STD-020
Stresses beyond those listed under “Absolute Maximum Ratings” may cause permanent damage to the device. These are stress ratings only, and functional operation of the device at these or any other conditions beyond those indicated in the operational sections of the specifications is not implied. Exposure to the absolute maximum rating conditions for extended periods may affect device reliability.
RECOMMENDED DC OPERATING CONDITIONS (TA = 0°C to +70°C, TA = -40°C to +85°C.) (Notes 1, 2)
PARAMETER SYMBOL CONDITIONS MIN TYP MAX UNITS
Supply Voltage VCC 4.5 5.0 5.5 V
Logic 1 Input VIH 2.2 VCC + 0.3 V
Logic 0 Input VIL -0.3 +0.8 V
VBAT Battery Voltage VBAT 2.0 3 3.5 V
DC ELECTRICAL CHARACTERISTICS (VCC = 4.5V to 5.5V; TA = 0°C to +70°C, TA = -40°C to +85°C.) (Notes 1, 2)
PARAMETER SYMBOL CONDITIONS MIN TYP MAX UNITS
Input Leakage (SCL) ILI -1 1 µA
I/O Leakage (SDA, SQW/OUT) ILO -1 1 µA
Logic 0 Output (IOL = 5mA) VOL 0.4 V
Active Supply Current
(fSCL = 100kHz) ICCA 1.5 mA
Standby Current ICCS (Note 3) 200 µA
VBAT Leakage Current IBATLKG 5 50 nA
Power-Fail Voltage (VBAT = 3.0V) VPF 1.216 x
VBAT
1.25 x
VBAT
1.284 x
VBAT V
DC ELECTRICAL CHARACTERISTICS (VCC = 0V, VBAT = 3.0V; TA = 0°C to +70°C, TA = -40°C to +85°C.) (Notes 1, 2)
PARAMETER SYMBOL CONDITIONS MIN TYP MAX UNITS
VBAT Current (OSC ON);
SQW/OUT OFF IBAT1 300 500 nA
VBAT Current (OSC ON);
SQW/OUT ON (32kHz) IBAT2 480 800 nA
VBAT Data-Retention Current
(Oscillator Off) IBATDR 10 100 nA
WARNING: Negative undershoots below -0.3V while the part is in battery-backed mode may cause loss of data.
DS1307 64 x 8, Serial, I2C Real-Time Clock
3 of 15
AC ELECTRICAL CHARACTERISTICS (VCC = 4.5V to 5.5V; TA = 0°C to +70°C, TA = -40°C to +85°C.)
PARAMETER SYMBOL CONDITIONS MIN TYP MAX UNITS
SCL Clock Frequency fSCL 0 100 kHz
Bus Free Time Between a STOP and
START Condition tBUF 4.7 µs
Hold Time (Repeated) START
Condition tHD:STA (Note 4) 4.0 µs
LOW Period of SCL Clock tLOW 4.7 µs
HIGH Period of SCL Clock tHIGH 4.0 µs
Setup Time for a Repeated START
Condition tSU:STA 4.7 µs
Data Hold Time tHD:DAT 0 µs
Data Setup Time tSU:DAT (Notes 5, 6) 250 ns
Rise Time of Both SDA and SCL
Signals tR 1000 ns
Fall Time of Both SDA and SCL
Signals tF 300 ns
Setup Time for STOP Condition tSU:STO 4.7 µs
CAPACITANCE (TA = +25°C)
PARAMETER SYMBOL CONDITIONS MIN TYP MAX UNITS
Pin Capacitance (SDA, SCL) CI/O 10 pF
Capacitance Load for Each Bus
Line CB (Note 7) 400 pF
Note 1: All voltages are referenced to ground.
Note 2: Limits at -40°C are guaranteed by design and are not production tested.
Note 3: ICCS specified with VCC = 5.0V and SDA, SCL = 5.0V.
Note 4: After this period, the first clock pulse is generated.
Note 5: A device must internally provide a hold time of at least 300ns for the SDA signal (referred to the VIH(MIN) of the
SCL signal) to bridge the undefined region of the falling edge of SCL.
Note 6: The maximum tHD:DAT only has to be met if the device does not stretch the LOW period (tLOW) of the SCL signal.
Note 7: CB—total capacitance of one bus line in pF.
OSCILLATOR CIRCUIT The DS1307 uses an external 32.768kHz crystal. The oscillator circuit does not require any external
resistors or capacitors to operate. Table 1 specifies several crystal parameters for the external crystal.
Figure 1. shows a functional schematic of the oscillator circuit. If using a crystal with the specified
characteristics, the startup time is usually less than one second.
CLOCK ACCURACY The accuracy of the clock is dependent upon the accuracy of the crystal and the accuracy of the match
between the capacitive load of the oscillator circuit and the capacitive load for which the crystal was
trimmed. Additional error will be added by crystal frequency drift caused by temperature shifts. External
circuit noise coupled into the oscillator circuit may result in the clock running fast. Refer to Application
Note 58: Crystal Considerations with Dallas Real-Time Clocks for detailed information.
Table 1. Crystal Specifications*
PARAMETER SYMBOL MIN TYP MAX UNITS
Nominal Frequency fO 32.768 kHz
Series Resistance ESR 45 kΩ
Load Capacitance CL 12.5 pF
*The crystal, traces, and crystal input pins should be isolated from RF generating signals. Refer to Application Note 58: Crystal Considerations for Dallas Real-Time Clocks for additional specifications.
Figure 2. Recommended Layout for Crystal
RTC AND RAM ADDRESS MAP Table 2 shows the address map for the DS1307 RTC and RAM registers. The RTC registers are located in
address locations 00h to 07h. The RAM registers are located in address locations 08h to 3Fh. During a
multibyte access, when the address pointer reaches 3Fh, the end of RAM space, it wraps around to
location 00h, the beginning of the clock space.
NOTE: AVOID ROUTING SIGNAL LINES IN THE CROSSHATCHEDAREA (UPPER LEFT QUADRANT) OF THE PACKAGE UNLESSTHERE IS A GROUND PLANE BETWEEN THE SIGNAL LINE AND THEDEVICE PACKAGE.
LOCAL GROUND PLANE (LAYER 2)
CRYSTAL
X1
X2
GND
DS1307 64 x 8, Serial, I2C Real-Time Clock
8 of 15
CLOCK AND CALENDAR The time and calendar information is obtained by reading the appropriate register bytes. Table 2 shows
the RTC registers. The time and calendar are set or initialized by writing the appropriate register bytes.
The contents of the time and calendar registers are in the BCD format. The day-of-week register
increments at midnight. Values that correspond to the day of week are user-defined but must be
sequential (i.e., if 1 equals Sunday, then 2 equals Monday, and so on.) Illogical time and date entries
result in undefined operation. Bit 7 of Register 0 is the clock halt (CH) bit. When this bit is set to 1, the
oscillator is disabled. When cleared to 0, the oscillator is enabled.
Note that the initial power-on state of all registers is not defined. Therefore, it is important to
enable the oscillator (CH bit = 0) during initial configuration.
The DS1307 can be run in either 12-hour or 24-hour mode. Bit 6 of the hours register is defined as the
12-hour or 24-hour mode-select bit. When high, the 12-hour mode is selected. In the 12-hour mode, bit 5
is the AM/PM bit with logic high being PM. In the 24-hour mode, bit 5 is the second 10-hour bit (20 to
23 hours). The hours value must be re-entered whenever the 12/24-hour mode bit is changed.
When reading or writing the time and date registers, secondary (user) buffers are used to prevent errors
when the internal registers update. When reading the time and date registers, the user buffers are
synchronized to the internal registers on any I2C START. The time information is read from these
secondary registers while the clock continues to run. This eliminates the need to re-read the registers in
case the internal registers update during a read. The divider chain is reset whenever the seconds register is
written. Write transfers occur on the I2C acknowledge from the DS1307. Once the divider chain is reset,
to avoid rollover issues, the remaining time and date registers must be written within one second.
Table 2. Timekeeper Registers
ADDRESS BIT 7 BIT 6 BIT 5 BIT 4 BIT 3 BIT 2 BIT 1 BIT 0 FUNCTION RANGE
00H CH 10 Seconds Seconds Seconds 00–59
01H 0 10 Minutes Minutes Minutes 00–59
12 10
Hour 02H 0
24 PM/
AM
10
Hour Hours Hours
1–12
+AM/PM
00–23
03H 0 0 0 0 0 DAY Day 01–07
04H 0 0 10 Date Date Date 01–31
05H 0 0 0 10
Month Month Month 01–12
06H 10 Year Year Year 00–99
07H OUT 0 0 SQWE 0 0 RS1 RS0 Control —
08H-3FH RAM
56 x 8 00H–FFH
0 = Always reads back as 0.
DS1307 64 x 8, Serial, I2C Real-Time Clock
9 of 15
CONTROL REGISTER The DS1307 control register is used to control the operation of the SQW/OUT pin.
BIT 7 BIT 6 BIT 5 BIT 4 BIT 3 BIT 2 BIT 1 BIT 0
OUT 0 0 SQWE 0 0 RS1 RS0
Bit 7: Output Control (OUT). This bit controls the output level of the SQW/OUT pin when the square-
wave output is disabled. If SQWE = 0, the logic level on the SQW/OUT pin is 1 if OUT = 1 and is 0 if
OUT = 0.
Bit 4: Square-Wave Enable (SQWE). This bit, when set to logic 1, enables the oscillator output. The
frequency of the square-wave output depends upon the value of the RS0 and RS1 bits. With the square-
wave output set to 1Hz, the clock registers update on the falling edge of the square wave.
Bits 1, 0: Rate Select (RS1, RS0). These bits control the frequency of the square-wave output when the
square-wave output has been enabled. The following table lists the square-wave frequencies that can be
selected with the RS bits.
RS1 RS0 SQW/OUT OUTPUT SQWE OUT
0 0 1Hz 1 X
0 1 4.096kHz 1 X
1 0 8.192kHz 1 X
1 1 32.768kHz 1 X
X X 0 0 0
X X 1 0 1
DS1307 64 x 8, Serial, I2C Real-Time Clock
10 of 15
I2C DATA BUS The DS1307 supports the I
2C protocol. A device that sends data onto the bus is defined as a transmitter
and a device receiving data as a receiver. The device that controls the message is called a master. The
devices that are controlled by the master are referred to as slaves. The bus must be controlled by a master
device that generates the serial clock (SCL), controls the bus access, and generates the START and STOP
conditions. The DS1307 operates as a slave on the I2C bus.
Figures 3, 4, and 5 detail how data is transferred on the I2C bus.
Data transfer may be initiated only when the bus is not busy.
During data transfer, the data line must remain stable whenever the clock line is HIGH. Changes in
the data line while the clock line is high will be interpreted as control signals.
Accordingly, the following bus conditions have been defined:
Bus not busy: Both data and clock lines remain HIGH.
Start data transfer: A change in the state of the data line, from HIGH to LOW, while the clock is
HIGH, defines a START condition.
Stop data transfer: A change in the state of the data line, from LOW to HIGH, while the clock line
is HIGH, defines the STOP condition.
Data valid: The state of the data line represents valid data when, after a START condition, the data
line is stable for the duration of the HIGH period of the clock signal. The data on the line must be
changed during the LOW period of the clock signal. There is one clock pulse per bit of data.
Each data transfer is initiated with a START condition and terminated with a STOP condition. The
number of data bytes transferred between START and STOP conditions is not limited, and is
determined by the master device. The information is transferred byte-wise and each receiver
acknowledges with a ninth bit. Within the I2C bus specifications a standard mode (100kHz clock
rate) and a fast mode (400kHz clock rate) are defined. The DS1307 operates in the standard mode
(100kHz) only.
Acknowledge: Each receiving device, when addressed, is obliged to generate an acknowledge after
the reception of each byte. The master device must generate an extra clock pulse which is associated
with this acknowledge bit.
A device that acknowledges must pull down the SDA line during the acknowledge clock pulse in
such a way that the SDA line is stable LOW during the HIGH period of the acknowledge related
clock pulse. Of course, setup and hold times must be taken into account. A master must signal an
end of data to the slave by not generating an acknowledge bit on the last byte that has been clocked
out of the slave. In this case, the slave must leave the data line HIGH to enable the master to generate
the STOP condition.
DS1307 64 x 8, Serial, I2C Real-Time Clock
11 of 15
Figure 3. Data Transfer on I2C Serial Bus
Depending upon the state of the R/W bit, two types of data transfer are possible:
1. Data transfer from a master transmitter to a slave receiver. The first byte transmitted by the
master is the slave address. Next follows a number of data bytes. The slave returns an acknowledge
bit after each received byte. Data is transferred with the most significant bit (MSB) first.
2. Data transfer from a slave transmitter to a master receiver. The first byte (the slave address) is
transmitted by the master. The slave then returns an acknowledge bit. This is followed by the slave
transmitting a number of data bytes. The master returns an acknowledge bit after all received bytes
other than the last byte. At the end of the last received byte, a “not acknowledge” is returned.
The master device generates all the serial clock pulses and the START and STOP conditions. A
transfer is ended with a STOP condition or with a repeated START condition. Since a repeated
START condition is also the beginning of the next serial transfer, the bus will not be released. Data is
transferred with the most significant bit (MSB) first.
ACKNOWLEDGEMENT SIGNAL FROM RECEIVER
ACKNOWLEDGEMENT
SIGNAL FROM RECEIVER
R/WDIRECTION
BIT
REPEATED IF MORE BYTES
ARE TRANSFERED
START CONDITION
STOP
CONDITION
OR REPEATED
START
CONDITION
MSB
1 2 6 7 8 9 1 2 3-7 8 9
ACK ACK
SDA
SCL
DS1307 64 x 8, Serial, I2C Real-Time Clock
12 of 15
...AXXXXXXXXA1101000S 0 XXXXXXXX A XXXXXXXX A XXXXXXXX A P
(X+1 BYTES + ACKNOWLEDGE); NOTE: LAST DATA BYTE IS
FOLLOWED BY A NOT ACKNOWLEDGE (A) SIGNAL)
Master to slave
Slave to master
...
AXXXXXXXXA0 1101000Sr A1
<Data(n)> <Data(n+1)> <Data(n+2)> <Data(n+X)>
<RW
>
A
Figure 6. Data Read (Write Pointer, Then Read)—Slave Receive and Transmit
TYPICAL OPERATING CIRCUIT
PIN CONFIGURATIONS
TOP VIEW
PDIP (300 mils)
X1
X2
VBAT
GND
VCC
SQW/OUT
SCL
1
2
3
4
8
7
6
5 SDA
SO (150 mils)
1
2
3
4
8
7
6
5
X1
X2
VBAT
GND
VCC
SQW/OUT
SCL
SDA
DS
13
07
DS
13
07
DS1307 CPU
V CC
V CC
V CC
SDA
SCL
GND
X2 X1
V CC
R PU R
PU
CRYSTAL
SQW/OUT
V BAT
R PU = t
r /C b
DS1307 64 x 8, Serial, I2C Real-Time Clock
14 of 15
PACKAGE INFORMATION (The package drawing(s) in this data sheet may not reflect the most current specifications. For the latest package outline information, go to www.maxim-ic.com/DallasPackInfo.)
15 of 15 Maxim/Dallas Semiconductor cannot assume responsibility for use of any circuitry other than circuitry entirely embodied in a Maxim/Dallas Semiconductor product. No circuit patent licenses are implied. Maxim/Dallas Semiconductor reserves the right to change the circuitry and specifications without notice at any time.
The Maxim logo is a registered trademark of Maxim Integrated Products, Inc. The Dallas logo is a registered trademark of Dallas Semiconductor Corporation.
PACKAGE INFORMATION (continued) (The package drawing(s) in this data sheet may not reflect the most current specifications. For the latest package outline information, go to www.maxim-ic.com/DallasPackInfo.)