DS3234 Example Software

This is an update of similar content originally published in 2013. The software previously referenced by the original author became unavailable. This update references three software packages, two of which are available from Github.

The software examples and accompanying libraries enable setting the date and time as well as reading the temperature from the sensor built in the DS3234 that controls the oven. Alarm functionality is not present in the demos. If you delve into the various .h and .cpp libraries, the notes will tell you what features have been implemented.

I have tested all three software packages using the Deadon DS3234 breakout board, available from SparkFun and others, on my Arduino Mega 2560. There is every reason to believe that the software packages will function correctly on all AVR devices; however, redevelopment would likely be needed for Arduino 101 support. I was not successful getting basic functionality to work on my Arduino 101 board, but after the initial failure, I focused on the Mega 2560. The landing page for reference 3 below lists the AVR boards that should function with the DS3234 and all of the software referenced herein.

The basic hookup for the DS3234 device will vary based on the type of Arduino board you are using. A good reference for SPI operation and connection of the DS3234 can be found at the SPI reference page at the Arduino.cc site: https://www.arduino.cc/en/Reference/SPI.

The first interesting software package you might want to try is this one from SparkFun: https://github.com/sparkfun/DeadOn_RTC/blob/v1.1/Libraries/DeadOn_RTC/examples/set_and_read_time/set_and_read_time.ino. The output, which displays on the Arduino IDE’s serial monitor, is intended only to test your connections and to determine if your DS3234 is live. In other words, the date and time are not intended to be meaningful. However, you can change the parameters on line 8 to reflect the current time and date, and the output will be meaningful. The clock will be initially set with this value and update the time based on its internal crystal. (Note, I added 10 seconds to the “real time” and then compiled and uploaded. It is a good approximation of accurate time.)

The next two software packages are likely not to be compatible with one another. In other words, it is not a good idea to have both installed in the Arduino IDE’s library at the same time, although I did not try it. Some of the libraries share overlapping file names, but the content is different. I kept an “archived” copy in some convenient folder and moved the libraries in and out.

The second of the example libraries is from an active Arduino forum participant. Although the software is old, it is mature and has interesting examples: https://github.com/maniacbug/RTClib. All examples worked perfectly with one exception. The operation of example ds3234.pde (change the “pde” to “ino” particularly if you are also running Processing on your computer) is explained by Mac Lane here: http://www.l8ter.com/?p=375. But I was never successful in getting the date and time to set automatically. The output always came up starting at the value to which the clock was initialized by the accompanying software library. I think that was because my clock always started running, and the intent of the test on line 23 is to update the time and date if the clock is not running. I tested the update routine (line 23) by removing the “not” (!), and the clock updated based on the time and date of sketch compilation. This shows that the update routine works well, but there needs to be a different trigger for updating the clock with the sketch’s compilation time and date. Maybe your hardware will function differently.

The third of the example libraries is from Rinky Dinky Electronics and can be downloaded from the landing page: http://www.rinkydinkelectronics.com/library.php?id=71. All of the examples referenced in the library work just fine. There is a lot of very good program documentation in the author’s reference manual.

There are a number of DS3234 software libraries on Github, but I have tried only the two noted above. There is also software on Marc Lane’s page, but I was not able to get that to work correctly, possibly because of the change in Arduino IDE standards.

Share