PercenTime the New Approach to Timekeeping

by holybaf in Circuits > Microcontrollers

614 Views, 4 Favorites, 0 Comments

PercenTime the New Approach to Timekeeping

cover.jpg
esp8.gif

Introducing a new approach to timekeeping: a method that transcends traditional hours, minutes, and seconds. By representing time as a percentage of the day, this system simplifies time perception to its essence.


Supplies

esp11.gif

ESP12

0.91 Inch 128x32 OLED LCD Module SSD1306 

The Story

clock.jpg

If you check my profile you can see I like clocks and my motto: Think outside the box.

I think it's time to change the time. There is an article about analog clocks, the new generation prefers the digital world.

https://www.cbsnews.com/news/u-k-schools-getting-rid-of-analog-clocks-because-teens-cannot-tell-time/

There are other articles about the confusion of the 12 or 24 hours system.

My simple clock shows the time as a percentage of the day. No hours, no minutes, no seconds.

The Technical Part

esp6.gif

The circuit includes an ESP12 and an OLED display. ESP12 receives the time from the NTP server, calculates the time in seconds, and divides it by 86400

The last digit changes every 9 seconds, which is a better resolution than the 1 minute resolution of a normal clock

The Code

esp9.gif

#include <SPI.h>

#include <Wire.h>

#include <Adafruit_GFX.h>

#include <Adafruit_SSD1306.h>

#define SCREEN_WIDTH 128 // OLED display width, in pixels

#define SCREEN_HEIGHT 32 // OLED display height, in pixels

#define OLED_RESET  -1 // Reset pin # (or -1 if sharing Arduino reset pin)

#define SCREEN_ADDRESS 0x3C ///< See datasheet for Address; 0x3D for 128x64, 0x3C for 128x32

Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);

#include <NTPClient.h>

#include <ESP8266WiFi.h>

#include <WiFiUdp.h>

int second, hour,minute ;

float perc, eltime ;

const char* ssid   = "your ssid";

const char* password = "your password";

const long utcOffsetInSeconds = 3600;

// Define NTP Client to get time

WiFiUDP ntpUDP;

NTPClient timeClient(ntpUDP, "pool.ntp.org", utcOffsetInSeconds);

void setup(){

 Serial.begin(115200);

 display.begin(SSD1306_SWITCHCAPVCC, 0x3C);

 WiFi.begin(ssid, password);

 while ( WiFi.status() != WL_CONNECTED ) {

  delay ( 500 );

  Serial.print ( "." );

 }

 timeClient.begin();

 display.setTextSize(3);      // Draw 2X-scale text

 display.setTextColor(SSD1306_WHITE);

 display.dim(0);

}

void loop() {

 timeClient.update();

 hour = timeClient.getHours() ;

 second = timeClient.getSeconds() ;

 minute = timeClient.getMinutes() ;

 eltime=(hour*3600)+(minute*60)+second ;

 perc=eltime/864 ;

display.setCursor(2,6);

display.print(perc ,2);

display.print(" %");

//Display retrieved seconds

    display.display();

    display.clearDisplay();

 

 delay(1000);

}