Close
0%
0%

ESP8266 + OLED Display

An exercise of connecting the ESP-12 DevKit board running nodemcu to a 4 pin I2C OLED Display

Similar projects worth following
This is a very simple project to test a display connected to an ESP8266

Read further to see how you can make a clock out of this project.

clock1.lua

This program grabs the time from the Internet and displays it on the OLED.

lua - 2.64 kB - 03/09/2016 at 12:11

Download

oled1.lua

nodemcu code to drive connected OLED display

lua - 980.00 bytes - 03/06/2016 at 20:15

Download

View all 2 project logs

  • 1
    Step 1

    Get nodemcu running on your ESP8266, and confirm access via ESPlorer. There's a nice how-to at http://www.esp8266.com/wiki/doku.php?id=loading_firmware

  • 2
    Step 2

    Wire up the display to the ESP-12e:

    Connect the following ESP pins to the OLED pins.

    ESPOLED
    GNDGND
    3V3VCC
    D1SDA
    D2SCL

  • 3
    Step 3

    Load the following code to the ESP and run:

    -- OLED Display demo
    -- March, 2016 
    -- @kayakpete | pete@hoffswell.com
    -- Hardware: 
    --   ESP-12E Devkit
    --   4 pin I2C OLED 128x64 Display Module
    -- Connections:
    --   ESP  --  OLED
    --   3v3  --  VCC
    --   GND  --  GND
    --   D1   --  SDA
    --   D2   --  SCL
    
    -- Variables 
    sda = 1 -- SDA Pin
    scl = 2 -- SCL Pin
    
    function init_OLED(sda,scl) --Set up the u8glib lib
         sla = 0x3C
         i2c.setup(0, sda, scl, i2c.SLOW)
         disp = u8g.ssd1306_128x64_i2c(sla)
         disp:setFont(u8g.font_6x10)
         disp:setFontRefHeightExtendedText()
         disp:setDefaultForegroundColor()
         disp:setFontPosTop()
         --disp:setRot180()           -- Rotate Display if needed
    end
    
    function print_OLED()
       disp:firstPage()
       repeat
         disp:drawFrame(2,2,126,62)
         disp:drawStr(5, 10, str1)
         disp:drawStr(5, 20, str2)
         disp:drawCircle(18, 47, 14)
       until disp:nextPage() == false
       
    end
    
    -- Main Program 
    str1="    Hello World!!"
    str2="     @kayakpete"
    init_OLED(sda,scl)
    print_OLED() 
    

View all 4 instructions

Enjoy this project?

Share

Discussions

f.hillhouse.jr wrote 01/06/2017 at 19:18 point

I am working on the project right now as my first. I had a couple of issues so far. First, I wired my 3V3 and GND in reversed. My bad! My module is reversed from yours. I knew better! The second issue is the lack of U8G in my build. So now I wait for my new custom build. Out of curiosity, what font did you use?

Thanks!

  Are you sure? yes | no

geekstips wrote 12/16/2016 at 06:43 point

Nicely done, thank you!

  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