venerdì 12 dicembre 2014

Adding a Real Clock Calendar to your Arduino UNO

The Arduino UNO  doesn’t have  a little coin-battery-powered 'Real Time Clock'  (RTC) module, which keeps time even when the power is off, or the battery removed.
So in this project we will show you how to add a RTC Click shield from Mikroelektronika, without the use of iron solder or breadboard.
This is possible using a Click Shield for Arduino UNO ( MIKROE 1581 ) from Mikroelektronika, 


We just need to insert the two Click boards as per below images.

 On top the Arduino UNO 
 On bottom the  Mikroelektronika Click Shield for Arduino ( on the left ) and a RTC Click shield ( on the right )


The RTC Click shield inserted on the Mikroe  Click shield for Arduino
                       

The 3 boards (  
Arduino UNO ( on the bottom ) – Mikroe Click Shield ( on the middle ) – RTC Click shield ( on the top )



The Mikroe Click shield for Arduino let’s permit to interface not one, but two Click shields.
The RTC Click shield uses a very popular Real Time Clock PCF8583 from NXP ( ex Philips ) .
On the web, there are a lot of open source libraries for Arduino, based on the PCF8583 .

I have used the following :




Not sure if it is the best, but it worked well on my test.
You just need to :
  • download the library “PCF8583-master” from github
  • unzip
  • copy the unzip files on the Arduino “library” directory ( take care – depending your Arduino IDE version , you should remove the “-“ character from the library name “PCF8583-master”. The newest versions don’t accept this char on the library’s name.
  • launch the “Arduino” IDE
  • upload the example file “ read_write_time.ino” ( from the library “PCF8583master” )

-    


  •           Compile & upload the sketch
  •           Open the serial monitor on the Arduino IDE

  •        On the first time, you could see a wrong date-time
  •        Write on the top bar the date-time to set on the following form “YYMMddhhmmss;”
  •        Send to Arduino
  •        That's all! – you can now see the correct date-time
  •        Try to switch off the UNO board and then switch on, to see if the date-time has been kept

The system should function also with Arduino Leonardo and Arduino Mega, but I didn’t tested these boards

Nessun commento:

Posta un commento