Close
0%
0%

world clock thing

8x 1602 LCDs - 8x I2C controller - ESP8266

Similar projects worth following
maybe pwming the LEDs equals sunlight and sending text to it via mqtt, do funky stuff with special characters.

I wanted even more displays at first, like 24 or more for all the timezones, would have been ridiculously cool. But now I just want something mildly complex looking with timezones from friends and family and stuff. I'll throw some mqtt stuff in, too.

  • Arduino code for the ESP

    davedarko06/28/2017 at 10:08 0 comments

    (OTA doesn't work with current chip)

    #include <ESP8266WiFi.h>
    #include <ESP8266mDNS.h>
    #include <WiFiUdp.h>
    #include <ArduinoOTA.h>
    #include <Wire.h> 
    #include <LiquidCrystal_I2C.h>
    LiquidCrystal_I2C lcd[8] = {
      LiquidCrystal_I2C(0x27, 16, 2),
      LiquidCrystal_I2C(0x26, 16, 2),
      LiquidCrystal_I2C(0x25, 16, 2),
      LiquidCrystal_I2C(0x24, 16, 2),
      LiquidCrystal_I2C(0x23, 16, 2),
      LiquidCrystal_I2C(0x22, 16, 2),
      LiquidCrystal_I2C(0x21, 16, 2),
      LiquidCrystal_I2C(0x20, 16, 2)
    };
    int LED = 0;
    int sda = 4; 
    int scl = 5;
    int current_lcd = 0;
    int current_lcd_line = 0;
    const char* ssid = "XXX";
    const char* password = "XXX";
    const char* clientID = "octoLCD";
    const char* host = "your.hostname.com";
    void setup() {
      Serial.begin(115200);
      Serial.println("Booting");
      Wire.begin(sda, scl);
      for (int i=0; i<8; i++)
      {
        lcd[i].init();
      }
      for (int i=0; i<8; i++)
      {
        lcd[i].backlight();
      }
      setup_wifi();
      // Hostname defaults to esp8266-[ChipID]
      ArduinoOTA.setHostname(clientID);
      // No authentication by default
      ArduinoOTA.setPassword((const char *)"PASSWORD");
      ArduinoOTA.onStart([]() {
        Serial.println("Start");
      });
      ArduinoOTA.onEnd([]() {
        Serial.println("\nEnd");
      });
      ArduinoOTA.onProgress([](unsigned int progress, unsigned int total) {
        Serial.printf("Progress: %u%%\r", (progress / (total / 100)));
      });
      ArduinoOTA.onError([](ota_error_t error) {
        Serial.printf("Error[%u]: ", error);
        if (error == OTA_AUTH_ERROR) Serial.println("Auth Failed");
        else if (error == OTA_BEGIN_ERROR) Serial.println("Begin Failed");
        else if (error == OTA_CONNECT_ERROR) Serial.println("Connect Failed");
        else if (error == OTA_RECEIVE_ERROR) Serial.println("Receive Failed");
        else if (error == OTA_END_ERROR) Serial.println("End Failed");
      });
      ArduinoOTA.begin();
    }
    void setup_wifi() {
      delay(10);
      // We start by connecting to a WiFi network
      Serial.println();
      Serial.print("Connecting to ");
      Serial.println(ssid);
      WiFi.mode(WIFI_STA);
      WiFi.begin(ssid, password);
      while (WiFi.status() != WL_CONNECTED) {
        delay(500);
        Serial.print(".");
      }
      Serial.println("");
      Serial.println("WiFi connected");
      Serial.println("IP address: ");
      Serial.println(WiFi.localIP());
    }
    void loop() 
    {
      ArduinoOTA.handle();
      WiFiClient client;
      const int httpPort = 80;
      if (!client.connect(host, httpPort)) {
        Serial.println("connection failed");
        return;
      }
      delay(10);
      String url = "/81602/index.php";
      client.print(String("GET ") + url + " HTTP/1.1\r\n" +
                   "Host: " + host + "\r\n" +
                   "Connection: close\r\n\r\n");
      delay(10);
      boolean ignore = true;
      reset_lcds();
      while (client.connected()) 
      {
        char a,b,c,d;
        if (!ignore)
        {
          String line = client.readStringUntil('\n');
          // char f = (char) client.read();
          Serial.println(line);
          draw(line);
          // lcd[0].print(a);
          // lcd[0].setCursor(0,0);
        }
        else
        {
          a = client.read();
          if (a == 13)
          {
            b = client.read();
            if (b == 10)
            {
              c = client.read();
              if (c == 13)
              {
                d = client.read();
                if (d == 10)
                {
                  ignore = false;  
                }
              }
            }
          }
        }
      }
      delay(15000);
    }
    void draw (String line)
    {
      lcd[current_lcd].print(line);
      if (current_lcd_line==1) 
      {
        current_lcd_line = 0;
        if (current_lcd<7) current_lcd++;
      }
      else 
      {
        lcd[current_lcd].setCursor(0,1);
        current_lcd_line = 1;
      }
    }
    void reset_lcds()
    {
      current_lcd = 0;
      current_lcd_line = 0;
      for (int i=0; i<8; i++)
      {
        lcd[i].clear();
      }
    }
    

  • soooon

    davedarko06/27/2017 at 21:40 0 comments

    So the data is served by a webpage, but it's still a mockup. But yay!

  • I'm a fire-ing my laser

    davedarko06/24/2017 at 21:12 3 comments

    noooo.

  • So much for not soldering...

    davedarko11/05/2016 at 17:05 0 comments

    damn, I might have killed one LCD in the process, but it looks nice, especially with the red power lights on the backside. I've hooked up one of my #Ignore this ESP8266 board s via I2C and used an LCD I2C library for arduinos. Almost too easy.

  • All boards soldered

    davedarko10/13/2016 at 19:23 0 comments

    Next up arduino and ic2 stuff. Muahaha.

    [UPDATE]

    Nopes, I'm just tooo lazy to solder a cable with pinheaders today, so I ordered these.

  • almost all parts are in

    davedarko10/10/2016 at 07:21 2 comments

    8 LCDs and 5 I2C boards are in - muahahaha. Sooo.

    Sorry for this short log.

  • mini rant

    davedarko09/26/2016 at 08:46 0 comments

    I really don't like the look of those 1602 LCDs.

    They are ugly. So ugly.

    Heavy and Bulky.

    32 characters, not much at all.

    5 displays for 1 tweet, even though I don't use twitter - this sucks.

    The coolest I've seen done with it where special character animations and the eyes of Chappy.

  • I'm going for eight displays now

    davedarko09/24/2016 at 16:13 3 comments

    There are 3 external address bits on the I2C controller boards and the displays are cheap, so why not have at least eight displays, instead of 5 or 24.

View all 8 project logs

Enjoy this project?

Share

Discussions

Craig Hissett wrote 06/27/2017 at 23:50 point

This looks awesome mate.

Are you programming the ESP8266 with the Arduino IDE?

  Are you sure? yes | no

davedarko wrote 06/28/2017 at 08:34 point

yes, I do :) but the web content is parsed on a raspberry pi for the displays first.

  Are you sure? yes | no

Craig Hissett wrote 06/28/2017 at 09:57 point

Ah, very interesting!

For my Aquariumatic project I'm having my ESP8266s running webservers; one page for users to view updates from their unit, and one page in json format for a Pi Hub to scrape and complie data from multiple units. I flipping love these boards.

I'm trying to get a Wemos D1 to play nicely with an i2c screen and having no luck. I may have to try my ESP8266 board you sent me to rule out a dodgy D1 :-)

Is it the Adafruit l2c lcd library you're using mate?

  Are you sure? yes | no

davedarko wrote 06/28/2017 at 10:05 point

I'm using the LiquidCrystal_I2C library from https://github.com/mrkaleArduinoLib/LiquidCrystal_I2C - at least that comes up when I'm searching the comments in the header files on google :D it also might be a bit outdated, at least my locale version. The page I generate is text + "\n" and the ESP does a client.readStringUntil('\n'); after I found the \r\n\r\n that separates the http header from the content. 

What I2C screen are you using, the oled one or a 1602 with expander?

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates