DS1307 on the breadboard

Zápisník experimentátora

Hierarchy: DS1307 Hodiny reálneho času

The DS1307 is an integrated circuit with real-time clocks. It features a simple construction and a relatively high accuracy. It can also be purchased as a module, but in this article we will use a directly integrated circuit, crystal and breadboard.

The circuit

We will need these parts:

  • Arduino Uno
  • Breadboard
  • DS1307
  • Crystal 32,768 kHz - The integrated circuit requires a 12.5 pF crystal. For example, this one.
  • 2x resistor 4k7
  • CR2032 Battery Holder with Battery - The battery is needed if the circuit is to store the time even after shutdown. If you just want to have fun with the circuit, you can skip this part. Then every time the switch is turned on, the integrated circuit will show the same time. For example,​ this one.

Connect the components according to the following scheme.

Programming

The DS1307 communicates via the​ I2C bus, so two​ pull-up resistory on the SCL and SDA pins are needed. Communication with Arduino would also work without them thanks to an internal pull-up resistors, but it is better to put it as follows. Their value is not critical. 10k but 4k7 will work the same.

The best way to communicate is to use two libraries:

  • DS1307RTC - Communication with the circuit.
  • Time - Various auxiliary functions to work with time.

Both libraries can be installed directly through Library Manager if you use IDE 1.6.x. Communication with the device it is very straight forward. All your code can be derived from the two examples that are enclosed in a library DS1307RTC.

  • SetTime - Use the example to set the time in the circuit according to the current time on the computer.
  • ReadTest - An example shows a regular time reading from the circuit.

Accuracy

Due to the use on the breadboard, the accuracy of the circuit will not be exactly as it would be on a normal field. Metal paths in the test field show a certain parasitic capacity that slightly detunes the clock in the circuit. But it is enough for the experiments, and you know that the transition to normal circuitry should stabilize the accuracy.



Download

02.10.2017


Menu