An Arduino code that displays on a small 0.98" OLED SSD1306 Date/Time and also calculates and displays Salat Time for a given town
The animation at the end will give the different time as following:
1. Building the circuit
1 Arduino Nano but any Arduino can be used.
1 RTC DS1307 or DS3231 (more precise)
1 I2C OLED display
I used a small 0.98" OLED with I2C interface SSD1106 that is supported by the excellent library U8g2
Here is the schematic2. The program
The code is shared on github:
This code has math routines to compute sun position and muslims salat (prayer) time for a given town (latitude / longitude), DST and convention. The hardware part is composed of an Arduino Nano, a RTC DS1307 and the SSD1306 OLED display to display the time, the date and prayer times.
- check the conventions on http://salat-mosque.com/salattime.php (in expert mode)
Here is the part of code you have to adapt to change for your town:
/** change your town */ const char CountryName PROGMEM = "Algeria"; const char TownName PROGMEM = "Tlemcen"; const double latitude = 34.88*deg2rd; const double longitude = -1.31*deg2rd; const int TimeZoneTown = 1; const int Convention = 1; const int DST = 0;
uncomment to force the RTC to take the compilation date and time