Friday, May 15, 2015

Arduino Analog clock with DS1307

arduino_my_name_analogclock.png Another experiment with Arduino based on experiment with TFT 240×320 display using driver chip ILI9341 and DS1307 real time clock module.

Turn out this can be a nice analog-clock on my desk to replace the widget analog-clock of windows 7.

Update 13/Oct/2016

Analog Clock v2.4

ds1307analogclock2.4.jpg

Changes:
- Use DS3231 - extreme precise does not effect by temperature like DS1307
- Clockface with date/time inside

Version 2.3

ds1307analogclockfinish.jpg ds1307analogclockfinish2.jpg ds1307analogclockfinishinside.jpg

Behind the scene

ds1307clockface.jpg ds1307clockface-backpack.jpg

The circuit
ds1307schema.png

This Analog clock uses precision RTC DS1307 for time keeping and uses arduino-pro-mini clone to read the time from DS1307 and displays it on the TFT screen as Analog clock.

When using arduino Uno, you can power DS1307 RTC module directly with IO pins using A2 sink to GND, and A3 pull up to Vcc and connect the TFT display through a 5v to 3v3 level shifter module.

ds1307ontherun.jpg

Time update on PC code:
ds1307timeupdateconsole.png

If you use ArduinoPro mini (clone) like mine, you have to use a USB / Serial adaptor like this. [S]You should not connect DTR pin because PL2303 acts weird sometime, and send DTR signal before everytime data is sent from PC. And thus it makes ArduinoPro mini restart when PC app scan the com port[/S]. Actually I got mix up between output pin and input pin of AMS1117, but somehow LCD works even it was almost 4v. After fixing, arduinoPro mini no longer restart when scanning com port.

The code consists of two part:
- Code for Arduino: Read time and draw a clock, receive time from serial connection (Com port)
- Code from PC: Auto scan from COM1 to COM16 and send time to Arduino if Analog Clock is found

[INDENT][attach=download/Arduino-AnalogClock2.5.zip]AnalogClock version 2.5[/attach]
[attach=download/Arduino-AnalogClock2.4.zip]AnalogClock version 2.4[/attach]
[attach=download/Arduino-AnalogClock2.31.zip]AnalogClock version 2.3.1[/attach]
[attach=download/Arduino-AnalogClock1.0.zip]AnalogClock version 1.0[/attach]
[/INDENT]

Libraries and tool:

[INDENT]- Adafruit_ILI9341 and Adafruit_GFX
[attach=download/java-Image2Code.rar]java-Image2Code.rar[/attach] or here
[attach=download/arduino-lib-DS1307RTC.rar]arduino-lib-DS1307RTC.rar[/attach]
[attach=download/arduino-lib-Time.rar]arduino-lib-Time.rar[/attach][/INDENT]
[tag]DS1307, Arduino[/tag]