Tag Archives: clock

Arduino GPS clock using NMEA protocol

GPS for accurate synchronization and  position measurement must use precise clock, so GPS satellites are equipped with atomic clocks. Clock accuracy is amazing ± 1 second in 1 million years. Using GPS module is available not only acquire position, speed, bet also time and date, so in this post I’ll explain how to do it.

GPS clock consist of old Sirf II GPS module, MAX 232, Arduino Mega and LCD display (Hitachi HD44780).

Sirf II module has RS-232 interface for communication and it can be  connected to PC Com port. Atmega in Arduino board has  UART interface. RS-232 basically is the same UART, only zeros and ones voltage levels are different. To match levels MAX232 driver is used. Today’s GPS modules have UART port, so there isn’t any need for MAX232.

Arduino in this project doesn’t have clock function it just pass time and date from GPS module to display. It works that way because GPS module has internal RTC(Real time clock) it’s not accurate, but it is synchronized to GPS system.

As you can see from video GPS module RTC is sychronised before GPS fix happens, but GPS fix is only one indicator that shows that clock is synchronised.
Continue reading

Examples of using Arduino/Atmega 16 bit hardware timer for digital clock

Arduino Mega with Atmega 1280 has four 16 bit timers, that could be used for various purposes, like time/frequency measurement, control with precise timing, PWM generation. Today I hope to explain how to use timer for clocks, timers (countdown) and other things, where You need µCPU to perform some tasks after precise period of time. I’ll give You two examples:

  • Pseudo 1 second timer
  • Real 1 second timer

How counter works? It is simple independent  16 bit accumulator, which value increases by 1 at clock cycle. 16 bit means that maximum counter’s value is 65536. When this value is reached counter starts counting from 0 again and gives hardware interrupt. Counter value could be changed any time. This is normal counter mode, Atmega 1280 offers total 14 operating modes.

Pseudo 1 second timer (1.048576 s)

Continue reading