ESP8266 Built-in OLED – Heltec WiFi Kit 8

P1010154-e1514573732678.jpg

A  set-up guide for the Heltec WiFi Kit 8 development board (an ESP8266 with built-in OLED display).

Follow the easy steps below to get up and running with this board using standard Arduino libraries.

This board is based on the ESP8266 chip and has onboard WiFi,  a 0.96inch 128*32 OLED display, lithium battery connector charging and a CP2014 USB to serial interface. It also works with the Arduino IDE! I bought mine from here: https://aliexpress.com/item/ESP8266-WIFI-Chip-0-91-inch-OLED-CP2014-32Mb-Flash-ESP-8266-Module-Internet-of-things/32822165059.html but it’s also available on eBay and Amazon.

Setting Up the Arduino IDE for the ESP8266 Range

The ESP8266 boards are much easier to set up in the Arduino IDE than the ESP32 range. If you don’t already have it installed, download and install the IDE from here: https://www.arduino.cc/en/main/software (don’t use the Web version).

In the IDE, open the File Menu and choose Preferences and enter http://arduino.esp8266.com/stable/package_esp8266com_index.json into the Additional Board Manager URLs field.

Add ESP 8266 Library

Open the Boards Manager from Tools > Board:xxxxx menu

Board Manager

Find esp8266 by ESP8266 Community in the list and click Install

Hardware Library

The ESP8266 Hardware Libraries are now installed and you can test your new board with a simple Sketch.

Testing the WiFi is Functioning

In the Arduino IDE, in the Tools > Board menu choose NodeMCU 1.0 (ESP-12E Module)

Select Nodemcu

Select the port (It might not be COM4)

Select Port

You can now upload Sketches to the board. A good test is use the example WiFiScan sketch.

Open File> Examples > ESP8266WiFi > WifiScan and upload the sketch.

If you open the Serial Monitor (Tools > Serial Monitor) you will be able to see any WiFi access points in range. Check the baud rate is the same as in the sketch – probably 115200.

WiFi Scan Example

 

Displaying data on the WiFi Kit 8 OLED

You should be able to use any SSD1306 library for the OLED. I prefer the U8g2 (https://github.com/olikraus/u8g2) library. It can be installed using the Arduino IDE library manager. Open Sketch > Include Library > Manage Libraries and search for and then install U8g2.

U8g2 has three different display methods. To test the board we are using the Full Buffer method. Open the example Sketch:  File> Examples > U8g2 > full_buffer > GraphicsTest

In the code for this Sketch, paste:
U8G2_SSD1306_128X32_UNIVISION_F_HW_I2C u8g2(U8G2_R0, /* reset=*/ 16, /* clock=*/ 5, /* data=*/ 4);
or the slower software driver version: U8G2_SSD1306_128X32_UNIVISION_F_SW_I2C u8g2(U8G2_R0, /* clock=*/ 5, /* data=*/ 4, /* reset=*/ 16);
Above this line: // Please UNCOMMENT one of the contructor lines below
Upload the sketch. You should see some different graphics appearing on the screen. Don’t worry that they are cut off, this example sketch is designed for different size screens.

If this doesn’t work you might have a different version of the board. Try pasting the following:
U8G2_SSD1306_128X32_UNIVISION_F_HW_I2C u8g2(U8G2_R0, /* reset=*/ 4, /* clock=*/ 14, /* data=*/ 2);
or the slower software driver version: U8G2_SSD1306_128X32_UNIVISION_F_SW_I2C u8g2(U8G2_R0, /* clock=*/ 14, /* data=*/ 2, /* reset=*/ 4);

Displaying a Scrolling Message on the OLED

Displaying a scrolling message can be a little tricky due to hardware and font limitations. The following sketch (based on the U8g2 ScrollingText example) will horizontally scroll a short piece of text.

#include <U8g2lib.h>

//U8g2 Contructor
U8G2_SSD1306_128X32_UNIVISION_F_HW_I2C u8g2(U8G2_R0, /* reset=*/ 16, /* clock=*/ 5, /* data=*/ 4);
// Alternative board version. Uncomment if above doesn't work.
// U8G2_SSD1306_128X32_UNIVISION_F_HW_I2C u8g2(U8G2_R0, /* reset=*/ 4, /* clock=*/ 14, /* data=*/ 2);

u8g2_uint_t offset;     // current offset for the scrolling text
u8g2_uint_t width;      // pixel width of the scrolling text (must be lesser than 128 unless U8G2_16BIT is defined
const char *text = "ROB01 "; // scroll this text from right to left


void setup(void) {
  u8g2.begin();

  u8g2.setFont(u8g2_font_logisoso32_tf); // set the target font to calculate the pixel width
  width = u8g2.getUTF8Width(text);    // calculate the pixel width of the text

  u8g2.setFontMode(0);    // enable transparent mode, which is faster
}


void loop(void) {
  u8g2_uint_t x;

  u8g2.firstPage();
  do {

    // draw the scrolling text at current offset
    x = offset;
    u8g2.setFont(u8g2_font_logisoso32_tf);   // set the target font
    do {                // repeated drawing of the scrolling text...
      u8g2.drawUTF8(x, 32, text);     // draw the scolling text
      x += width;           // add the pixel width of the scrolling text
    } while ( x < u8g2.getDisplayWidth() );   // draw again until the complete display is filled

    u8g2.setFont(u8g2_font_logisoso32_tf);   // draw the current pixel width
    u8g2.setCursor(0, 64);
    u8g2.print(width);          // this value must be lesser than 128 unless U8G2_16BIT is set

  } while ( u8g2.nextPage() );

  offset -= 1;            // scroll by one pixel
  if ( (u8g2_uint_t)offset < (u8g2_uint_t) - width )
    offset = 0;             // start over again
}


If you want to scroll a longer piece of text you have to edit one of the display library files to allow 16bit mode.

Open the file /libraries/U8g2_Arduino/src/clib/u8g2.h and uncomment this line:
// #define U8G2_16BIT

Save the file and you can now use longer text by replacing this line:
const char *text = “ROB01 “; // scroll this text from right to left
with (for example):
const char *text = “ROBOTZERO.ONE “; // scroll this text from right to left

You’ll then see something like the animation below:

Bonus tip! You can make the animation smoother by boosting the CPU speed to 160Mhz for the uploaded Sketch:

CPU Frequency

Further Information

More detailed information about pins and the two board versions: http://stefanfrings.de/esp8266/#wifikit8
Reference for the display library, including custom fonts etc: https://github.com/olikraus/u8g2/wiki/u8g2reference
ESP32 version setup: https://robotzero.one/heltec-wifi-kit-32/
Heltec on Github: https://github.com/Heltec-Aaron-Lee/WiFi_Kit_series

------------

52 Replies to “ESP8266 Built-in OLED – Heltec WiFi Kit 8”

  1. William MOORE says:

    Love this guide thanks! but I’m stuck at no port selectable. I’ve picked out the exact board stated, and port remains dimmed sadly! No reaction from windows 10 when plugged in yet the board happily displays a hello world sketch from factory.. I notice in the manual for this which is in Chinese lol.. the board is selected as wifi_kit_32 ?? With a dead link to I presume a zip file of drivers :/ (installed cp210 and rebooted before all this btw – doesn’t show in DM at all)

    1. WordBot says:

      Is it the Kit 8 or the 32 you have?

      Kit 8 looks like this in my Device Manager…

      https://robotzero.one/wp-content/uploads/2018/01/heltec-port.jpg

      Can you see anything with question marks in Device Manager?

      1. William MOORE says:

        Kit 8 printed on board.
        Problem was my side. I got so fed up I backed all my stuff up to the NAS and reset the entire PC! lol
        -Installed the CP210 drivers again from another page – that I didn’t know I needed in win10 reading this guide,
        and hey presto. Though I might add I get a menu of examples just for this Node. (you suggest using examples/wifi/wifi scan -not there for me.)

        Got it going through the examples/examples for nodeMCU 1 etc/esp8266wifi/wifiscan
        and your graphics example. This was no plain sail but thanks for some pointers.
        The simplest of sketches takes up to 2-3 mins to compile and upload, that surprised me I thought it would be quicker.

        1. WordBot says:

          Where did you get the CP210 drivers? I had to install this https://www.silabs.com/products/development-tools/software/usb-to-uart-bridge-vcp-drivers for the ESP32 version of this board to work. I might need to add that to the instructions. I thought I’d created this on a fresh Win10 install but maybe not.

          I’ve corrected the WiFi Scan menu path in the article to the correct path as you’ve written.

          I think they take a long time as the ESP8266 is much more complicated that the original Arduino boards so the libraries etc are much larger so take a while to compile and upload.

          1. krishnan says:

            For a Macbook I had to install the vintage VCP driver to get the board recognised and the serial to show up.
            When you double click the dmg, one also sees a “Vintage” folder. Inside there is another dmg. I installed that dmg that to get my serial port recognised on the Macbook . This works for the heltec and also for the AMICA NodeMCU (12E ), since both have the CP210x UART. Hope this helps

            1. WordBot says:

              Cool. Thanks for the tip.

  2. Redbeard says:

    Hi, Thanks for the write up. Do you know what kind of JST cable fits this particular unit? I’m looking to get a Lithium battery for it, but I don’t know what kind to get.

    1. WordBot says:

      Maybe JST 1.25 mm 2 pin? The LiPo connector I have doesn’t fit. Make sure you use batteries with the built in protection circuit as I don’t know how well the charging circuit on this device manages over charging or discharging. Something I need to investigate.

  3. Pavel says:

    I believe, the right mating connector is Hirose DF13-2S-1.25C. yes, it is 1.25mm. Didn’t find them available wired. Molex Micro JST 1.25 mm picoblade also fits in, although the fit is a bit loose.

  4. J3QQ4 says:

    HELP PLEASE! 🙂
    What pins should i connect MAX6675 to work simultaneously with the screen? I’ve tried smth like this with a huge number of variants on delays, pins order, connecting to the D1-D8-D6 or D5 (14) – D8-D6 or even D1 – D7-D6, lots of libraries, but nothing worked correct.

    #include
    #include
    #include
    #ifdef U8X8_HAVE_HW_SPI
    #include
    #endif
    #ifdef U8X8_HAVE_HW_I2C
    #include
    #endif

    MAX6675_Thermocouple thermocouple(D1, D8, D6);
    U8G2_SSD1306_128X32_UNIVISION_F_SW_I2C u8g2(U8G2_R0, /* clock=*/ 5, /* data=*/ 4, /* reset=*/ 16);

    void u8g2_prepare(void) {
    u8g2.setFont(u8g2_font_6x10_tf);
    u8g2.setFontRefHeightExtendedText();
    u8g2.setDrawColor(1);
    u8g2.setFontPosTop();
    u8g2.setFontDirection(0);
    }

    void setup(void) {
    u8g2.begin();
    Serial.begin(9600);
    }

    void loop(void) {
    u8g2.clearBuffer();
    u8g2_prepare();
    u8g2.drawStr( 0, 0, “TEST PE4”);

    String stringVar = String(thermocouple.readCelsius());
    char temp[20];
    stringVar.toCharArray(temp, 20);
    u8g2.drawStr( 0, 10, temp);
    u8g2.sendBuffer();
    delay(2000);
    }

    I have either random values or just zero 🙁 Maybe the problem is about SPI , but i don’t have much experience to solve this . Can someone help?

    1. WordBot says:

      If your device is plugged into D0 to D7 then this script should find it. Run it first with nothing plugged into the 8266..
      https://github.com/jainrk/i2c_port_address_scanner/blob/master/i2c_port_address_scanner/i2c_port_address_scanner.ino

      EDIT: Sorry – you have an SPI based device so I’m not sure how to test it.

  5. Miguel Salinas says:

    Great tutorial, you have I’m trying to use the SSD1306 from https://github.com/ThingPulse/esp8266-oled-ssd1306 Do you ghow to use it?, because the demo examples and they not show anything.
    Regards

    1. WordBot says:

      Hi. That library is for the 128×64 version so it might not work with this display as it’s 128×32, Looking briefly at the instructions one of the following might work…
      SSD1306Wire display(0x3c, 4, 5);
      SSD1306Wire display(0x3c, 2, 14);

  6. AllTheKingsMen says:

    Does anyone know if the battery LED can be disabled? With no battery connected it just keeps blinking and driving me insane.

  7. Bill Knight says:

    As an FYI, if you have version A of the board (SDA on 4 & SCL 0n 5) the following HW driver will update the display faster that the SW driver.

    U8G2_SSD1306_128X32_UNIVISION_F_HW_I2C display(U8G2_R0, DSP_RST, DSP_SCL, DSP_SDA);

    Note: The order of the pins is different from the SW driver.

    1. WordBot says:

      Ah, thanks for the information…

      U8G2_SSD1306_128X32_UNIVISION_F_HW_I2C u8g2(U8G2_R0, /* reset=*/ 16, /* clock=*/ 5, /* data=*/ 4);

      is much faster. I’ve updated the tutorial.

  8. zack says:

    I’m a noob to esp8266. Can anyone tell me how I could get a message to appear on the OLED when the wifi has connected?

  9. Pasi says:

    If reset is in pin16, does this mean that you can not use I2C, because I2C SDA is in pin16 ?

    1. WordBot says:

      I have version 1 of the board with SDA on GPIO4 and SCL on GPIO5. I tested it with a Si7021 using the sketch below and it works fine.

      #include <Adafruit_Si7021.h>
      #include <U8g2lib.h>
      U8G2_SSD1306_128X32_UNIVISION_F_HW_I2C u8g2(U8G2_R0, /* reset=*/ 16, /* clock=*/ 5, /* data=*/ 4);

      Adafruit_Si7021 sensor = Adafruit_Si7021();

      void setup(void) {
      sensor.begin();
      u8g2.begin();
      }

      void loop(void) {

      float temp = sensor.readTemperature();
      float humid = sensor.readHumidity();

      do {
      u8g2.setFont(u8g2_font_logisoso32_tf);

      u8g2.drawStr(0, 32, “T: “);

      u8g2.setCursor(18, 32);
      u8g2.print(temp, 0);

      u8g2.drawStr(64, 32, “H: “);

      u8g2.setCursor(84, 32);
      u8g2.print(humid, 0);

      } while ( u8g2.nextPage() );
      delay(1000);
      }

      Pin info: http://stefanfrings.de/esp8266/#wifikit8

      The screen uses the same i2c connections so you might see a conflict depending on the device you use.

      Si7021 library info: https://learn.adafruit.com/adafruit-si7021-temperature-plus-humidity-sensor/arduino-code

  10. Jeff says:

    I have the TTGO (version A) board that I got on AliExpress. Works great except for one thing: If I upload from my laptop, it works. If I unplug & replug the USB, it does not run until I hit the reset button. While not running, the serial monitor shows an endless stream of
    Fatal exception (0):
    epc1=0x40100000, epc2=0x00000000, epc3=0x00000000, excvaddr=0x00000000, depc=0x00000000
    at the bootloader speed of 74880bd.
    Very strange. Works after reset but not without a reset.
    Anyone ever seen this?

    1. Jason Lewis says:

      Hi Jeff,
      Yes! I had exactly the same issue with that board from AliExpress. Fix was found here:
      http://simplestuffmatters.com/wemos-ttgo-esp8266-with-0-91-inch-oled/#comment-3574

      Basically you have to remove the resister above the 2 caps above d6 when looking at the underside of the board, and then bridge the pads where the resistor was with solder.

  11. Jason says:

    Thanks for this tutorial. I tried lots of other libraries with the Heltec NodeMCU with OLED built in. None worked and I was ready to give up – your guide and the U8g2 library worked perfectly for me. Great work!

  12. Joseph Chrzempiec says:

    Hello i got this device and so i love it. Not use to the pin out and how everything is mapped. I was trying to get a i2c device the bme280 with no luck. so i found the i2c scanner that was from Wordbot posted https://github.com/jainrk/i2c_port_address_scanner/blob/master/i2c_port_address_scanner/i2c_port_address_scanner.ino and i put SDA on D6and SCL on D7 that found it with the address of Scanning (SDA : SCL) – GPIO12 : GPIO13 – I2C device found at address 0x76 ! But the problem is i don’t know how to map the bme280 to them addresses. Can someone please help me. My sketch is below.

    #include
    #include “cactus_io_BME280_I2C.h”

    // Create BME280 object
    BME280_I2C bme; // I2C using address 0x77
    // or BME280_I2C bme(0x76); // I2C using address 0x76

    void setup() {

    Serial.begin(9600);
    Serial.println(“Bosch BME280 Pressure – Humidity – Temp Sensor | cactus.io”);

    if (!bme.begin()) {
    Serial.println(“Could not find a valid BME280 sensor, check wiring!”);
    while (1);
    }

    bme.setTempCal(-1);// Temp was reading high so subtract 1 degree

    Serial.println(“Pressure\tHumdity\t\tTemp\ttTemp”);
    }

    void loop() {

    bme.readSensor();

    Serial.print(bme.getPressure_MB()); Serial.print(” mb\t”); // Pressure in millibars
    Serial.print(bme.getHumidity()); Serial.print(” %\t\t”);
    Serial.print(bme.getTemperature_C()); Serial.print(” *C\t”);
    Serial.print(bme.getTemperature_F()); Serial.println(” *F”);

    // Add a 2 second delay.
    delay(2000); //just here to slow down the output.
    }

    Can someone please help me?

    1. WordBot says:

      Hi,
      Does it work if you change:
      BME280_I2C bme; // I2C using address 0x77
      // or BME280_I2C bme(0x76); // I2C using address 0x76
      to
      //BME280_I2C bme; // I2C using address 0x77
      BME280_I2C bme(0x76); // I2C using address 0x76

      1. Joseph Chrzempiec says:

        Hello wordbot i did that and still got nothing from it.

          1. Joseph Chrzempiec says:

            When i tried this i2c scanner from your post https://github.com/jainrk/i2c_port_address_scanner/blob/master/i2c_port_address_scanner/i2c_port_address_scanner.ino i get this from it.

            I2C Scanner to scan for devices on each port pair D0 to D7
            Scanning (SDA : SCL) – GPIO4 : GPIO5 – I2C device found at address 0x3C !
            **********************************
            Scanning (SDA : SCL) – GPIO2 : GPIO14 – I2C device found at address 0x76 !
            **********************************
            to save space i edit out i took out the ones that said not found.

            i have tried this sketch
            #include
            #include “cactus_io_BME280_I2C.h”

            // Create BME280 object
            //BME280_I2C bme; // I2C using address 0x77
            BME280_I2C bme(0x76 ); // I2C using address 0x76

            void setup() {

            Serial.begin(115200);
            Serial.println(“Bosch BME280 Pressure – Humidity – Temp Sensor | cactus.io”);

            if (!bme.begin()) {
            Serial.println(“Could not find a valid BME280 sensor, check wiring!”);
            while (1);
            }

            bme.setTempCal(-1);// Temp was reading high so subtract 1 degree

            Serial.println(“Pressure\tHumdity\t\tTemp\ttTemp”);
            }

            void loop() {

            bme.readSensor();

            Serial.print(bme.getPressure_MB()); Serial.print(” mb\t”); // Pressure in millibars
            Serial.print(bme.getHumidity()); Serial.print(” %\t\t”);
            Serial.print(bme.getTemperature_C()); Serial.print(” *C\t”);
            Serial.print(bme.getTemperature_F()); Serial.println(” *F”);

            // Add a 2 second delay.
            delay(2000); //just here to slow down the output.
            }

            and this is what i got from it in serial monitor.

            ctx: cont
            sp: 3ffffdf0 end: 3fffffc0 offset: 01b0
            3fffffa0: feefeffe 00000000 3ffee66c 40204040
            3fffffb0: feefeffe feefeffe 3ffe850c 40100d09
            <<<stack<<<

            ets Jan 8 2013,rst cause:2, boot mode:(3,6)

            load 0x4010f000, len 1384, room 16
            tail 8
            chksum 0x2d
            csum 0x2d
            v951aeffa
            ~ld
            Bosch BME280 Pressure – Humidity – Temp Sensor | cactus.io
            Could not find a valid BME280 sensor, check wiring!

          2. Joseph Chrzempiec says:

            Something in the library is doing this. Is there a way to map to them pins in the sketch or the library?

  13. WordBot says:

    Ah.. ok.. you have to set the i2c pins. https://learn.sparkfun.com/tutorials/esp8266-thing-hookup-guide/using-the-arduino-addon under ‘Libraries Available/Not Available and the Differences’. In the library you are using, in cactus_io_BME280_I2C.cpp there’s the line:
    Wire.begin();
    you could try changing it to:
    Wire.begin(2,14);
    if those are the pins you are using for SDA and SCL

    1. Joseph Chrzempiec says:

      Updated the sketch

      #include

      #include “cactus_io_BME280_I2C.h”

      // Create BME280 object
      BME280_I2C bme; // I2C using address 0x77
      //BME280_I2C bme(0x76); // I2C using address 0x76

      void setup() {
      Wire.begin(2,14);
      Serial.begin(115200);
      Serial.println(“Bosch BME280 Pressure – Humidity – Temp Sensor | cactus.io”);

      if (!bme.begin()) {
      Serial.println(“Could not find a valid BME280 sensor, check wiring!”);
      while (1);
      }

      bme.setTempCal(-1);// Temp was reading high so subtract 1 degree

      Serial.println(“Pressure\tHumdity\t\tTemp\ttTemp”);
      }

      void loop() {

      bme.readSensor();

      Serial.print(bme.getPressure_MB()); Serial.print(” mb\t”); // Pressure in millibars
      Serial.print(bme.getHumidity()); Serial.print(” %\t\t”);
      Serial.print(bme.getTemperature_C()); Serial.print(” *C\t”);
      Serial.print(bme.getTemperature_F()); Serial.println(” *F”);

      // Add a 2 second delay.
      delay(2000); //just here to slow down the output.
      }

      and i get this from the serial monitor

      ets Jan 8 2013,rst cause:2, boot mode:(3,7)

      load 0x4010f000, len 1384, room 16
      tail 8
      chksum 0x2d
      csum 0x2d
      v951aeffa
      ~ld
      Bosch BME280 Pressure – Humidity – Temp Sensor | cactus.io
      Could not find a valid BME280 sensor, check wiring!

      1. WordBot says:

        Is the sensor not x76?

        BME280_I2C bme; // I2C using address 0x77
        //BME280_I2C bme(0x76); // I2C using address 0x76

        1. Joseph Chrzempiec says:

          I have tried 76 and tried 77 nothing.

        2. Joseph Chrzempiec says:

          Just a update i changed temperature sensors to a si7021 and used the same wire.begin addresses. Guess what? it works. So something wrong or something is up with that library and sketch with the bme280.

          But now new problem. Once i did that and i added the oled to it But not working because of the new address. SO not sure what to do now.

            1. Joseph Chrzempiec says:

              Problem is i need to use the bme280 not the si7012 temperature sensor.

  14. Joseph Chrzempiec says:

    Here is a updated sketch. if i put the wire.begin(02,14); in there the bme280 works now but the oled doesn’t work. i change the bme280 with a different library from sparkfun. And if i comment out the Wire.begin(02,14); the oled works and the bme280 doesn’t. here is the sketch.

    #include
    #include “SparkFunBME280.h”
    //Library allows either I2C or SPI, so include both.
    #include “Wire.h”
    #include “SPI.h”
    #include
    #include
    //Global sensor object
    BME280 mySensor;
    U8G2_SSD1306_128X32_UNIVISION_F_HW_I2C u8g2(U8G2_R0); // Adafruit ESP8266/32u4/ARM Boards + FeatherWing OLED
    void setup()
    {
    Wire.begin(02,14);
    u8g2.begin();
    mySensor.settings.commInterface = I2C_MODE;
    mySensor.settings.I2CAddress = 0x76;
    mySensor.settings.runMode = 3; //Normal mode
    mySensor.settings.tStandby = 0;
    mySensor.settings.filter = 0;
    mySensor.settings.tempOverSample = 1;
    mySensor.settings.pressOverSample = 1;
    mySensor.settings.humidOverSample = 1;
    Serial.begin(115200);

    uint8_t memCounter = 0x80;
    uint8_t tempReadData;
    for(int rowi = 8; rowi < 16; rowi++ )
    {
    Serial.print("0x");
    Serial.print(rowi, HEX);
    Serial.print("0:");
    for(int coli = 0; coli > 4) & 0x0F, HEX);//Print first hex nibble
    Serial.print(tempReadData & 0x0F, HEX);//Print second hex nibble
    Serial.print(” “);
    memCounter++;
    }
    Serial.print(“\n”);
    }
    }
    void loop(){
    u8g2.clearBuffer(); // clear the internal memory
    u8g2.setFont(u8g2_font_logisoso32_tr); // choose a suitable font
    //u8g2.drawStr(0,32, mySensor.readTempC(), 2); // write something to the internal memory
    u8g2.setCursor (0, 32);
    // u8g2.print(mySensor.readTempC(), 2);
    u8g2.sendBuffer(); // transfer internal memory to the display
    delay(1000);
    }

    1. WordBot says:

      Hi,
      This is working for me: https://pastebin.com/Z0wKxAC2
      I’m using the TwoWire methods from the Wire.h library. I also had to change to the software version of the display library.
      I used pins 12 and 13 (D6 and D7) but you can probably use others. I have a slightly different BME but it’s basically the same.

      An alternative might work with your sketch if you put the sensor on the same pins as the OLED. You’ll need to change the address if it’s the same as the OLED.

  15. Joseph Chrzempiec says:

    Getting a new error when i try to upload a sketch.

    Sketch uses 272,832 bytes (26%) of program storage space. Maximum is 1,044,464 bytes.
    Global variables use 28,140 bytes (34%) of dynamic memory, leaving 53,780 bytes for local variables. Maximum is 81,920 bytes.
    error: Failed to open COM6
    error: espcomm_open failed
    error: espcomm_upload_mem failed
    error: espcomm_upload_mem failed

    1. WordBot says:

      Does the error go if you disconnect the sensor?

    2. WordBot says:

      Hi, did you get this working in the end?

  16. Kiwi says:

    Just got this device and have only used an Arduino Uno before. I cant upload any of the example sketches.
    i get this error:
    warning: espcomm_sync failed
    error: espcomm_open failed
    error: espcomm_upload_mem failed
    error: espcomm_upload_mem failed

    What am i doing wrong? what can i do to fix it?

    1. WordBot says:

      Was it just that you were using a USB cable without the data lines?

  17. Taa says:

    What is anyone using for a compact enclosure for just the board (no extra circuits or sensors) and USB power?

    I found this one but it looks over bulky for just the board: https://www.thingiverse.com/thing:3255436

  18. robi says:

    Hallo, You say:
    If you want to scroll a longer piece of text you have to edit one of the display library files to allow 16bit mode.
    Open the file /libraries/U8g2_Arduino/src/clib/u8g2.h and uncomment this line:
    // #define U8G2_16BIT

    But there is no #define U8G2_16BIT
    I am missing something?
    Thanks

    1. WordBot says:

      It should be there. From the FAQ –
      Q: How to activate 16 Bit mode?
      A: Search for the line
      //#define U8G2_16BIT
      in “u8g2.h”. Uncomment this line:
      #define U8G2_16BIT
      The file “u8g2.h” is located in “/libraries/U8g2_Arduino/src/clib” inside your default sketch folder.

      It’s in a section that starts – The following macro enables 16 Bit mode.

  19. robi says:

    You are right!
    Thank you.

  20. Robi says:

    One more question!
    How to manage the speed of the scrolling text, I want it a little bit faster.
    Thanks

    1. WordBot says:

      I think the speed is the maximum it will go if you’ve already set the CPU frequency to 80. You could try over-clocking the 8266 but I don’t have experience of that.

      If you change:
      offset -= 1; // scroll by one pixel
      to:
      offset -= 2;

      So the text moves 2 pixels rather than one it will be faster but might look poor. I’ve not tested this either.

  21. Robi says:

    Thanks WordBot,
    exzellent Support here 🙂
    One more question: Is there a sketch for this Display with only the Time displayed but with WiFi and Ntp.
    I need a simple Clock a la 22:33:12 <- hh:mm:ss
    but the time must be get from a ntp server over the wifi

    Thanks

  22. jay nottelling says:

    ty for the tutorial 😀 – helped me get my cheep from china “DIY MORE” wifi kit 8 working nice: ) –

    i am having difficulties getting mine to come back from deepsleep, i think it might be the shared pin16? as it happily copes with ESP.restart, yet fails with wake from timer
    any ideas??

    1. WordBot says:

      I don’t know the answer to this one. Can you not use a different pin to wake it?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

scroll to top