ESP8266 LCD Quote of the Day?


I’m basing this experimental project off the example “BasicHTTPClient” sketch used in the ESP8266 library:

 * BasicHTTPClient.ino
 *  Created on: 24.05.2015

#include <Arduino.h>

#include <ESP8266WiFi.h>
#include <ESP8266WiFiMulti.h>

#include <ESP8266HTTPClient.h>

#define USE_SERIAL Serial

ESP8266WiFiMulti WiFiMulti;

void setup() {

   // USE_SERIAL.setDebugOutput(true);


    for(uint8_t t = 4; t > 0; t--) {
        USE_SERIAL.printf("[SETUP] WAIT %d...\n", t);

    WiFiMulti.addAP("SSID", "PASSWORD");


void loop() {
    // wait for WiFi connection
    if(( == WL_CONNECTED)) {

        HTTPClient http;

        USE_SERIAL.print("[HTTP] begin...\n");
        // configure traged server and url
        //http.begin("", 443, "/test.html", true, "7a 9c f4 db 40 d3 62 5a 6e 21 bc 5c cc 66 c8 3e a1 45 59 38"); //HTTPS
        http.begin("", 80, "/test.html"); //HTTP

        USE_SERIAL.print("[HTTP] GET...\n");
        // start connection and send HTTP header
        int httpCode = http.GET();
        if(httpCode) {
            // HTTP header has been send and Server response header has been handled
            USE_SERIAL.printf("[HTTP] GET... code: %d\n", httpCode);

            // file found at server
            if(httpCode == 200) {
                String payload = http.getString();
        } else {
            USE_SERIAL.print("[HTTP] GET... failed, no connection or no HTTP server\n");


However, when I try to replace the “”, 80, “/test.html” used in the http.begin function with a daily quote website (e.g., the serial port returns with an error:

[HTTP] begin...
[HTTP] GET... code: 200

[HTTP] begin...
[HTTP] GET... code: 200

How could I go about reading only the first quote of the day and then displaying this on a 1602 LCD (Using the LiquidCrystal Library)? :confused:

HTTP code 200 means OK (that is, successful).

You now need to parse the HTML being sent to you and extract the first quote (if that is what this web page is giving you).

First step is to actually identify what that web site is sending to you apart from the OK response.


It doesnt look like there is an API.. or a webservice or something that specifically gives you the quote of the day.

It looks as if you would have to parse the site content and 'pick' your quote out.

(not sure how much processing power can be used for parsing a page like that?)

If there isn't an api it may be better to use one of the quote sites that does have an api such as

Google quote api, there are many results.


So I found a daily quote API which returns in JSON from (thanks MartynC!). I replaced the same line, and now I get the following message in the Serial Monitor:

[HTTP] begin...
[HTTP] GET... code: 200
    "success": {
        "total": 1
    "contents": {
        "quotes": [
                "quote": "You must be the change you want to see in the world....",
                "length": "55",
                "author": "M.K. Gandhi",
                "tags": [
                "category": "inspire",
                "date": "2016-06-23",
                "title": "Inspiring Quote of the day",
                "background": "",
                "id": "dj0Sq7ipgSdBr1tMOO_WSAeF"

How can I now search for "quote" in the feed and return just the quote of the day (I don't need the other data)?

Also, does this need to be done in string format to be easily transferred to an LCD using the LiquidCrystal library?

I never tried parsing a json in Arduino, but give a try with this library or do some more search and you might get some other libs.