ESP8266 (ESP-201) Working perfectly direct to OLED (hardware SPI)

128x128 pixel 1.5" full colour OLED display with MicroSD card slot. [Product page]
Post Reply
mikehains
Posts: 5
Joined: Fri Jul 26, 2013 2:17 pm

ESP8266 (ESP-201) Working perfectly direct to OLED (hardware SPI)

Post by mikehains » Sat Dec 12, 2015 1:53 am

Hi All,

After a lot of fooling around, I have managed to get OLED 128x128 running perfectly directly on an ESP-201 (ESP8266) using hardware SPI. It runs very very fast - successfully at 20MhZ. Faster may be possible (I haven't bothered trying).

Video of this working: https://www.youtube.com/watch?v=8t2uMHc_WLs

Here are the keys to this adventure:

Wiring

MOSI -> Pin 13
SCK -> Pin 14
OLED CS -> Pin 5
DNC -> Pin 2
RST -> Pin 4

Modify progmem_compat.h

This file is found in C:\Users\...\Documents\Arduino\libraries\FTOLED-master and needs to refer to the ESP8266 pgmspace

#if defined(ESP8266)
#include <pgmspace.h>
#else // #include <avr/pgmspace.h>

... Note: this is a bit of a hack (I know). It works on ESP8266 but breaks others
... All you good programmers out there, please let me know how to fix this !

Modify FTOLED.cpp

In the function for begin() change the "setClockDivider" speed lines like this:

#ifdef ESP8266
SPI.setFrequency(20000000); // 20MHz works very reliably
#else
SPI.setClockDivider(SPI_CLOCK_DIV2); // 8MHz on standard Arduino models
#endif

... Note: once again, I know this is a hack and makes ESP8266 work and breaks others.
... All you good programmers out there, please let me know how to fix this !

Other notes

These notes on the ESP-201 come from bitter experience working with very cheap direct Chinese imports:
-> ESP-201 can be very flakey unless wired correctly. Make sure you have the correct pullup and pulldown resistors:
=> my experience is GPIO15 must be pulled to Gnd with 10K resistor (not direct !!)
=> my experience is CH_PD must be pulled up to 3.3V with 10K resistor (not direct !!)
=> my experience is RST must be pulled up to 3.3V with 10K resistor (not direct !!)
=> for flashing the ESP-201, use a 10K resistor to pull GPIO0 to Gnd (not direct !!)
-> ESP-201 can also be flakey when driven through a regulator from computer USB. Use strong power supply instead !


Summing up

I am utterly thrilled by this. Instead of an Arduino (slow refresh, no wifi, small memory) ... I get an extremely, blinding fast display, and a large memory, and a direct-to-internet connection.

What's not to like ?

Regards,
Mike H


PS ... I've also worked out how to create a really large font with just numbers and a colon (very small kb size). I'll post a separate note.

andrew
Freetronics Staff
Freetronics Staff
Posts: 978
Joined: Sun Jul 14, 2013 7:06 am
Location: Melbourne, Australia
Contact:

Re: ESP8266 (ESP-201) Working perfectly direct to OLED (hardware SPI)

Post by andrew » Sat Dec 12, 2015 2:01 am

Awesome - thank you for sharing that with everyone :)

Post Reply