Arnov Sharma
Published © MIT

Quote of the Day

This Device displays Quotes depending on which day it is. Powered by the PICO W and a Custom RGB matrix Board.

BeginnerFull instructions provided1 hour224
Quote of the Day

Things used in this project

Hardware components

Raspberry Pi Pico W
Raspberry Pi Pico W
×1

Software apps and online services

Fusion
Autodesk Fusion
Arduino IDE
Arduino IDE

Hand tools and fabrication machines

3D Printer (generic)
3D Printer (generic)

Story

Read more

Custom parts and enclosures

cad file

Schematics

WIRING

Code

code

C/C++
#include <WiFi.h>
#include <NTPClient.h>
#include <WiFiUdp.h>
#include <Adafruit_NeoPixel.h>
#include <Adafruit_GFX.h>
#include <Adafruit_NeoMatrix.h>

#define MATRIX_PIN 0
#define MATRIX_WIDTH 10
#define MATRIX_HEIGHT 10

const char* ssid = "----";        // Your Wi-Fi SSID
const char* password = "----";  // Your Wi-Fi Password

Adafruit_NeoMatrix matrix = Adafruit_NeoMatrix(
  MATRIX_WIDTH, MATRIX_HEIGHT, MATRIX_PIN,
  NEO_MATRIX_TOP + NEO_MATRIX_LEFT + NEO_MATRIX_ROWS,
  NEO_GRB + NEO_KHZ800
);

WiFiUDP udp;
NTPClient timeClient(udp, "pool.ntp.org", 0, 60000); // NTP server, time offset (UTC), update interval (ms)

const char *quotes[] = {
  "Monday: Don't wait for opportunity. Create it.",
  "Tuesday: The way to get started is to quit talking and begin doing.",
  "Wednesday: You are never too old to set another goal or to dream a new dream.",
  "Thursday: Believe you can and you're halfway there.",
  "Friday: It always seems impossible until it's done.",
  "Saturday: The future belongs to those who believe in the beauty of their dreams.",
  "Sunday: Act as if what you do makes a difference. It does."
};

int currentQuoteIndex = 0;
int x = 0;
int textWidth = 0;
const int textY = 1;
unsigned long lastScrollTime = 0;
const unsigned long scrollInterval = 100;

void setup() {
  Serial.begin(115200);
  matrix.begin();
  matrix.setRotation(3);
  matrix.setTextWrap(false);
  matrix.setBrightness(40);
  matrix.setTextColor(matrix.Color(0, 0, 255));
  matrix.setTextSize(1);

  // Connect to Wi-Fi
  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED) {
    delay(1000);
    Serial.println("Connecting to WiFi...");
  }
  Serial.println("Connected to WiFi");

  // Initialize NTP Client
  timeClient.begin();
  timeClient.update();  // Sync time on start

  // Get the current time in UTC
  unsigned long epochTime = timeClient.getEpochTime();
  
  // Adjust to IST (UTC +5:30)
  epochTime += 5 * 3600 + 30 * 60;  // IST offset (5 hours 30 minutes)
  
  // Get the current day of the week (0=Sunday, 1=Monday, ..., 6=Saturday)
  timeClient.setEpochTime(epochTime);  // Adjust the epoch time for IST
  int dayOfWeek = timeClient.getDay();  // Get day of the week based on IST

  // Map 0-6 (Sunday-Saturday) to quotes array (0 = Sunday, 1 = Monday, ...)
  currentQuoteIndex = dayOfWeek; 

  loadQuote(currentQuoteIndex);
}

void loop() {
  unsigned long now = millis();

  if (now - lastScrollTime > scrollInterval) {
    matrix.fillScreen(0);
    matrix.setCursor(x, textY);
    matrix.print(quotes[currentQuoteIndex]);
    matrix.show();

    x--;
    if (x < -textWidth) {
      x = matrix.width();  // Reset scroll to right side
    }

    lastScrollTime = now;
  }
}

void loadQuote(int index) {
  int16_t x1, y1;
  uint16_t w, h;
  matrix.getTextBounds(quotes[index], 0, textY, &x1, &y1, &w, &h);
  textWidth = w;
  x = matrix.width();  // Start scrolling from the right edge
}

Credits

Arnov Sharma
352 projects • 360 followers
I'm Arnov. I build, design, and experiment with tech—3D printing, PCB design, and retro consoles are my jam.

Comments