Project showcase
Minimal Parts OLED Word Clock

Minimal Parts OLED Word Clock © GPL3+

A minimal parts, cheap to-the-minute word clock using a .91 inch 128 X 32 OLED display.

  • 1,596 views
  • 0 comments
  • 5 respects

Components and supplies

About this project

I wanted to build a word clock using minimal components and a cheap OLED display that would show time to the minute without using RTC.

Code

simple word clockArduino
#include <Wire.h>
#include <Time.h>
#include <SPI.h>
#include <TimeLib.h>

#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define OLED_RESET 4
Adafruit_SSD1306 display(OLED_RESET);
#if (SSD1306_LCDHEIGHT != 32)
#error("Height incorrect, please fix Adafruit_SSD1306.h!");
#endif
byte mm1, mm5, h, m, s;
byte ultM = 10, ultH = 10;
byte hPin = 3, mPin = 2;
boolean ajustaH = true, ajustaM = true;


void setup() {

  Serial.begin(9600);
  pinMode(hPin, INPUT_PULLUP);
  pinMode(mPin, INPUT_PULLUP);
  display.begin(SSD1306_SWITCHCAPVCC, 0x3C);  // initialize with the I2C addr 0x3C (for the 128x32)
  // init done
  //Clear the buffer.
  display.clearDisplay();
  text();

}



void text(void) {
  display.setTextSize(1);
  display.setTextColor(WHITE);




}

void Display() {

  // Setup of Hours & Minutes
  ajustaH = digitalRead(hPin);
  ajustaM = digitalRead(mPin);

  if (!ajustaH) {
    adjustTime(3600);
  }

  if (!ajustaM) {
    adjustTime(60);
  }

  h = hour();
  m = minute();
  Serial.print (hour());
  Serial.print(":");
  Serial.print (minute());
  Serial.print(":");
  Serial.print (second());
  Serial.println();

  delay(000);

  if ( h > 12)
  {
    h = (h - 12);
  }





  // now set hour
  if (h == 1)
  {
    display.print("One ");
  }



  if (h == 2)
  {
    display.print("Two ");
  }

  if (h == 3)
  {
    display.print("Three ");
  }



  if (h == 4)
  {
    display.print("Four ");
  }


  if (h == 5)
  {
    display.print("Five ");
  }



  if (h == 6)
  {
    display.print("Six ");
  }



  if (h == 7)
  {
    display.print("Seven ");
  }



  if (h == 8)
  {
    display.print("Eight ");
  }


  if (h == 9)
  {
    display.print("Nine ");
  }



  if (h == 10)
  {
    display.print("Ten ");
  }



  if (h == 11)
  {
    display.print("Eleven ");
  }



  if (h == 12)
  {
    display.print("Twelve ");
  }

  if (h == 0)
  {
    display.print("Twelve ");
  }


  // now set minute
  if (m == 0)
  {
    display.print("O'Clock ");
  }



  if (m == 1)
  {
    display.print(" o-One ");
  }



  if (m == 2)
  {
    display.print(" o-Two ");
  }



  if (m == 3)
  {
    display.print(" o-Three ");
  }



  if (m == 4)
  {
    display.print(" o-Four ");
  }



  if (m == 5)
  {
    display.print(" o-Five ");
  }



  if (m == 6)
  {
    display.print(" o-Six ");
  }



  if (m == 7)
  {
    display.print(" o-Seven ");
  }



  if (m == 8)
  {
    display.print(" o-Eight ");
  }


  if (m == 9)
  {
    display.print(" o-Nine ");
  }



  if (m == 10)
  {
    display.print("Ten ");
  }



  if (m == 11)
  {
    display.print("Eleven ");
  }



  if (m == 12)
  {
    display.print("Twelve ");
  }



  if (m == 13)
  {
    display.print("Thirteen ");;
  }



  if (m == 14)
  {
    display.print("Fourteen ");
  }


  if (m == 15)
  {
    display.print("Fifteen ");
  }


  if (m == 16)
  {
    display.print("Sixteen ");
  }



  if (m == 17)
  {
    display.print("Seventeen ");
  }



  if (m == 18)
  {
    display.print("Eighteen ");
  }



  if (m == 19)
  {
    display.print("Ninteen ");
  }



  if (m == 20)
  {
    display.print("Twenty ");
  }



  if (m == 21)
  {
    display.print("Twenty-One ");
  }



  if (m == 22)
  {
    display.print("Twenty-Two ");
  }



  if (m == 23)
  {
    display.print("Twenty-Three ");
  }



  if (m == 24)
  {
    display.print("Twenty-Four ");
  }



  if (m == 25)
  {
    display.print("Twenty-Five ");
  }


  if (m == 26)
  {
    display.print("Twenty-Six ");
  }



  if (m == 27)
  {
    display.print("Twenty-Seven ");
  }



  if (m == 28)
  {
    display.print("Twenty-Eight ");;
  }



  if (m == 29)
  {
    display.print("Twenty-Nine ");
  }



  if (m == 30)
  {
    display.print("Thirty ");
  }



  if (m == 31)
  {
    display.print("Thirty-One ");
  }



  if (m == 32)
  {
    display.print("Thirty-Two ");
  }



  if (m == 33)
  {
    display.print("Thirty-Three ");
  }



  if (m == 34)
  {
    display.print("Thirty-Four ");
  }


  if (m == 35)
  {
    display.print("Thirty-Five ");;
  }



  if (m == 36)
  {
    display.print("Thirty-Six ");
  }



  if (m == 37)
  {
    display.print("Thirty-Seven ");
  }



  if (m == 38)
  {
    display.print("Thirty-Eight ");
  }



  if (m == 39)
  {
    display.print("Thirty-Nine ");
  }



  if (m == 40)
  {
    display.print("Forty ");
  }



  if (m == 41)
  {
    display.print("Forty-One ");
  }



  if (m == 42)
  {
    display.print("Forty-Two ");
  }



  if (m == 43)
  {
    display.print("Forty-Three ");
  }



  if (m == 44)
  {
    display.print("Forty-Four ");
  }



  if (m == 45)
  {
    display.print("Forty-Five ");
  }



  if (m == 46)
  {
    display.print("Forty-Six ");
  }



  if (m == 47)
  {
    display.print("Forty-Seven ");
  }



  if (m == 48)
  {
    display.print("Forty-Eight ");
  }



  if (m == 49)
  {
    display.print("Forty-Nine ");
  }



  if (m == 50)
  {
    display.print("Fifty ");
  }



  if (m == 51)
  {
    display.print("Fifty-One ");
  }


  if (m == 52)
  {
    display.print("Fifty-Two ");
  }



  if (m == 53)
  {
    display.print("Fifty-Three ");
  }


  if (m == 54)
  {
    display.print("Fifty-Four ");;
  }



  if (m == 55)
  {
    display.print("Fifty-Five ");
  }



  if (m == 56)
  {
    display.print("Fifty-Six ");
  }



  if (m == 57)
  {
    display.print("Fifty-Seven ");
  }


  if (m == 58)
  {
    display.print("Fifty-Eight ");
  }



  if (m == 59)
  {
    display.print("Fifty-Nine ");
  }
  if (hour() < 12)
  {
    display.setCursor(38, 24);
    display.print("AM");
  }
  if (hour() == 12)
  {
    display.setCursor(38, 24);
    display.print("PM");
  }
  if (hour() == 24)
  {
    display.setCursor(38, 24);
    display.print("AM");
  }

  if (hour() > 12)
  {
    display.setCursor(38, 24);

    display.print("PM");

  }
}

void loop() {

  Display();
  display.setCursor(30, 0);
  display.print("It is");
  display.setCursor(0, 12);

  display.display();
  delay(1000);
  display.clearDisplay();
}

Schematics

photo diagram for hookup
OLED SDA to nano pin 4, SCL to nano pin 5. Push button 1 to ground and to nano pin 2 sets hour. Push button 2 to ground and to nano pin 3 sets minute.
Wiring diagram mmwpjlrg2f

Comments

Similar projects you might like

Arduino Cheap Minimal Parts Digital Clock

Project showcase by garysat

  • 9,645 views
  • 34 comments
  • 26 respects

Arduino OLED Word Clock

Project showcase by garysat

  • 4,313 views
  • 0 comments
  • 12 respects

Arduino to-the-minute word clock OLED Display

Project showcase by garysat

  • 1,308 views
  • 0 comments
  • 3 respects

Italian Word Clock

Project tutorial by Tittiamo

  • 5,064 views
  • 2 comments
  • 15 respects

Weather Clock

Project showcase by Tittiamo

  • 7,665 views
  • 7 comments
  • 22 respects

Adjusting Dual Clock using DS3231 on 1.8" ST7735 Display

Project showcase by FLORICA Tudor-Nicusor

  • 3,968 views
  • 2 comments
  • 11 respects
Add projectSign up / Login