all | audio | badgelife | breakout | clocks | displays | experiments | feather | handhelds | home automation | howto | LED art | misc | props | robots | sewing | software | tools | no_category

world clock thing

8x 1602 LCDs - 8x I2C controller - ESP8266

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

world clock thing | Arduino code for the ESP

2017-06-28 12:08:14

(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();
  }
}

world clock thing | Arduino code for the ESP

2017-06-28 12:08:14

(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();
  }
}

world clock thing | soooon

2017-06-27 23:40:08

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

world clock thing | soooon

2017-06-27 23:40:08

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

world clock thing | I'm a fire-ing my laser

2017-06-24 23:12:09

noooo.

https://cdn.hackaday.io/images/7366151498338689027.jpeg

world clock thing | I'm a fire-ing my laser

2017-06-24 23:12:09

noooo.

https://cdn.hackaday.io/images/7366151498338689027.jpeg

world clock thing | So much for not soldering...

2016-11-05 18:05:12

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.

world clock thing | So much for not soldering...

2016-11-05 18:05:12

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.

world clock thing | All boards soldered

2016-10-13 21:23:20

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.

https://cdn.hackaday.io/images/8481271476386536522.jpg
https://cdn.hackaday.io/images/8680381476388021949.png

world clock thing | All boards soldered

2016-10-13 21:23:20

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.

https://cdn.hackaday.io/images/8481271476386536522.jpg
https://cdn.hackaday.io/images/8680381476388021949.png

world clock thing | almost all parts are in

2016-10-10 09:21:10

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

Sorry for this short log.

https://cdn.hackaday.io/images/7550371476084020450.png

world clock thing | almost all parts are in

2016-10-10 09:21:10

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

Sorry for this short log.

https://cdn.hackaday.io/images/7550371476084020450.png

world clock thing | mini rant

2016-09-26 10:46:07

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.

world clock thing | mini rant

2016-09-26 10:46:07

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.

world clock thing | I'm going for eight displays now

2016-09-24 18:13:30

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.

world clock thing | I'm going for eight displays now

2016-09-24 18:13:30

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.