02
Jun
2019

DS3231 Do it at…

Summer is coming… My plants require more often watering. But how watering is connected to the time measuring. It is one of use case in smart installation. One of the ideas is create watering system with proper schedule. We should water plants only in certain hours – in the morning or late afternoon when sun is not so high.

DS3231 module

After reading multiple articles I decided tu use DS3231 module. There is a battery slot which keep tracking time in case of power not connected. There is also hidden feature. Module has integrated temperature sensor that might be used in the future. DS3231module board looks like below.

WP_20160524_16_57_40_Pro
WP_20160524_16_57_06_Pro

Pinouts Wiring

In order to use clock you have to properly connects it to your Arduino board. I use Arduino Uno. Wiring should be as below:

GND –> Arduino GND

VCC –> Arduino 5V

SCL –> SCL or A5

SDA –> SDA or A4

Software library

DS3231 module can be programmed by using Henning Karlsen’s library that you might download from:

http://www.rinkydinkelectronics.com/library.php?id=73

You will find also full documentation with other functions available.

Software

Code below I get from the examples included in library. kod poniżej pochodzi z przykładów dołączonych do biblioteki. Listing is very well commented so you should not get any headache when using.

Please remember that in first step you should program correct date and hour. In order to achieve it please uncomment lines 57 to 59 :

After modification we may use time as condition in our code and execute tasks at specific time. Please define Time structure that you re-use in loop().

As the result we get every 30s the following output:

For more examples please familiar with documentation mentioned above first.

Share

You may also like...

Leave a Reply