Tag Archives: GPS module

Calculating day of the week

While adding software to perform an automatic adjustment of Daylight Savings Time to my clocks, I came across a problem. My GPS-powered gpSKY CLOCK does not contain a real-time clock. So? Well, the algorithm I used for determining whether or not a date is within Daylight Savings Time (from 2am on the 2nd Sunday in March to 2am on the 1st Sunday in November) relies on knowing the day of the week (0-Sunday, 1-Monday etc.) – data that is automatically calculated by the RTC.

So, I had to determine the day of the week in the gpsSKY CLOCK by other means. Trawling the Internet I came across many different calculations, most of which were complex and almost impossible to follow. However, I found an algorithm that is elegant, small and relatively simple. According to Wikipedia, this algorithm is based on work in 1990 by Michael Keith and Tom Craver and revised into its current form Tomohiko Sakamoto in 1993. Apparently it is accurate for any Gregorian date.

// dow() returns byte containing numeric day of the week [0-Sunday, 1-Monday etc.]
byte dow(int y, int m, int d) {
       static int t[] = {0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4};
       y -= m < 3;
       return (y + y/4 - y/100 + y/400 + t[m-1] + d) % 7;

Elegantly simple; simply elegant!

Large numbers on small displays…

Widely available and cheap, small 2 and 4-line LCD panels are convenient displays to add capability to  Arduino projects that require the display of information or data. With the “LiquidCrystal.h” library built into the Arduino IDE, the availability of both parallel and I2C interfaces, and a wide variety of bright and subtle backlight colours, they are simple to add to your Arduino projects and look great.

4 x 20 Character Liquid Crystal Display Module

4×20 Character Liquid Crystal Display Module

However, the popular 2 (line) x16 (column) and 4×20 LCDs appear to use the same HD44780 or equivalent LCD controller that has an inbuilt character set based on the 5×8 pixel ‘cell’ to display all alphanumeric text. This means that there is just one single-size font to produce characters of up to 4.5mm high. While this suits many applications, it is a limitation for projects such as clocks designed to be viewed from a distance.

So, for my latest “gpSKY CLOCK“, a GPS-based clock equipped with a 4×20 display, I have created a simple way to display numbers at 3x scale…  Yep, whopping great big 13mm high numbers!

gpSkyClock in clock mode

gpSkyClock in large time display mode

Continue reading

MTK3339 chipset GPS module

I have recently been intrigued by some really innovative geo-caching and GPS-enabled Arduino projects, and it got the creative juices flowing. I read up on various GPS modules on the market and settled on a GPS module called the “Ultimate GPS Breakout v.3″ that sported the highest receiver sensitivity (-165 dBm), and the fastest read data rate (10 Hz), all packaged in an Arduino-friendly (5V interface) module. Adafruit has a GPS library for this chipset and a whole suite of example code to get you going quickly.

GPS module

“Ultimate GPS Breakout”

The module just arrived and it’s up and running… Way to go!

Read more…