Monochrome OLED Breakouts Created by lady ada Last updated on 2018-01-02 08:35:47 PM UTC
Guide Contents Guide Contents Overview Power Requirements 2 3 5 OLED Power Requirements 5V- ready 128x64 and 128x32 OLEDs 0.96" 128x64 OLED 5 5 5 Arduino Library & Examples Install Adafruit SSD1306 Library Install Adafruit GFX Run Demo! 7 7 7 7 Create Bitmaps 9 Wiring 128x64 OLEDs 12 Solder Header 12 I2C or SPI 13 Using with I2C Using with SPI 13 14 Wiring 128x32 SPI OLED display 128x32 SPI OLED 16 Wiring 128x32 I2C Display 18 128x32 I2C OLED 18 Wiring OLD 0.
Overview This is a quick tutorial for our 128x64 and 128x32 pixel monochrome OLED displays. These displays are small, only about 1" diagonal, but very readable due to the high contrast of an OLED display. Each OLED display is made of 128x64 or 128x32 individual white OLEDs, each one is turned on or off by the controller chip. Because the display makes its © Adafruit Industries https://learn.adafruit.
own light, no backlight is required. This reduces the power required to run the OLED and is why the display has such high contrast; we really like this miniature display for its crispness! The driver chip, SSD1306 can communicate in multiple ways including I2C, SPI and 8-bit parallel. However, only the 128x64 display has all these interfaces available. For the 128x32 OLED, only SPI is available.
Power Requirements OLED Power Requirements The OLED and driver require a 3.3V power supply and 3.3V logic levels for communication. The power requirements depend a little on how much of the display is lit but on average the display uses about 20mA from the 3.3V supply. Built into the OLED driver is a simple switch-cap charge pump that turns 3.3v-5v into a high voltage drive for the OLEDs. You can run the entire display off of one 3.3V supply or use 3.3V for the chip power and up to 4.
VDD is the 3.3V logic power. This must be 3 or 3.3V VBAT is the input to the charge pump. If you use the charge pump, this must be 3.3V to 4.2V VCC is the high voltage OLED pin. If you're using the internal charge pump, this must be left unconnected. If you're not using the charge pump, connect this to a 7-9V DC power supply. For most users, we suggest connecting VDD and VBAT together to 3.3V and then leaving VCC unconnected. © Adafruit Industries https://learn.adafruit.
Arduino Library & Examples For all of the different kinds of small OLED monochrome displays, you'll need to install the Arduino libraries. The code we have is for any kind of Arduino, if you're using a different microcontroller, the code is pretty simple to adapt, the interface we use is basic bit-twiddling SPI or I2C Install Adafruit SSD1306 Library Start by installing the support library for the OLED display, you'll need it to talk to the OLED controller chip.
After you've finished wiring the display as indicated on the following pages, load the example sketch to demonstrate the capabilities of the library and display. The OLED SSD1306 driver is based on the Adafruit GFX library which provides all the underlying graphics functions such as drawing pixels, lines, circles, etc. For more details about what you can do with the OLED check out the GFX library tutorial The library cannot determine the screen size via software. You have to specify it in the header file.
Create Bitmaps You can create bitmaps to display easily with the LCD assistant software. First make your image using any kind of graphics software such as photoshop or Paint and save as a Monochrome Bitmap (bmp) © Adafruit Industries https://learn.adafruit.
Select the following options (You might also want to try Horizontal if Vertical is not coming out right) and import your monochrome bitmap image. Save the output to a cpp file © Adafruit Industries https://learn.adafruit.
You can use the output directly with our example code © Adafruit Industries https://learn.adafruit.
Wiring 128x64 OLEDs Solder Header Before you start wiring, a strip of header must be soldered onto the OLED. It is not possible to "press-fit" the header, it must be attached! Start by placing an 8-pin piece of header with the long ends down into a breadboard for stability Place the OLED on top so all the short ends of the header stick thru the header pads © Adafruit Industries https://learn.adafruit.
Finish by soldering each of the 8 pins to the 8 pads! I2C or SPI The nice thing about the 128x64 OLEDs is that they can be used with I2C (+ a reset line) or SPI. SPI is generally faster than I2C but uses more pins. It's also easier for some microcontrollers to use SPI. Anyways, you can use either one with this display Using with I2C The display can be used with any I2C microcontroller.
Finally, connect the pins to your Arduino GND goes to ground Vin goes to 5V Data to I2C SDA (on the Uno, this is A4 on the Mega it is 20 and on the Leonardo digital 2) Clk to I2C SCL (on the Uno, this is A5 on the Mega it is 21 and on the Leonardo digital 3) RST to digital 4 (you can change this pin in the code, later) This matches the example code we have written. Once you get this working, you can try a different Reset pin (you can't change the SDA and SCL pins).
Finally, connect the pins to your Arduino GND goes to ground Vin goes to 5V DATA to digital 9 CLK to digital 10 D/C to digital 11 RST to digital 13 CS to digital 12 (Note: If using the display with other SPI devices, D/C, CLK and DAT may be shared, but CS must be unique for each device.) This matches the example code we have written. Once you get this working, you can try another set of pins.
Wiring 128x32 SPI OLED display 128x32 SPI OLED The 128x32 SPI OLED is very easy to get up and running because it has built in level shifting. First up, take a piece of 0.1" header 8 pins long. Plug the header long end down into a breadboard and place the OLED on top. Solder the short pins into the OLED PCB. © Adafruit Industries https://learn.adafruit.
Finally, connect the pins to your Arduino - GND goes to ground, Vin goes to 5V, DATA to digital 9, CLK to digital 10, D/C to digital 11, RST to digital 13 and finally CS to digital 12. (Note: If using the display with other SPI devices, D/C, CLK and DAT may be shared, but CS must be unique for each device.) This matches the example code we have written. Once you get this working, you can try another set of pins.
Wiring 128x32 I2C Display 128x32 I2C OLED The 128x32 I2C OLED is very easy to get up and running because it has built in level shifting and regulator. First up, take a piece of 0.1" header 6 pins long. Plug the header long end down into a breadboard Place the OLED on top Solder the short pins into the OLED PCB. © Adafruit Industries https://learn.adafruit.
Finally, connect the pins to your Arduino GND goes to ground Vin goes to 5V SDA to I2C Data (on the Uno, this is A4 on the Mega it is 20 and on the Leonardo digital 2) SCL to I2C Clock(on the Uno, this is A5 on the Mega it is 21 and on the Leonardo digital 3) RST to digital 4 (you can change this pin in the code, later) This matches the example code we have written. Once you get this working, you can change the RST pin.
Wiring OLD 0.96" 128x64 OLED This wiring diagram is only for the older 0.96" OLED that comes with a level shifter chip. If you did not get a level shifter chip, you have a V2.0 so please check out the other wiring tutorial! 128x64 Version 1.0 OLED The version 1 128x64 OLED runs at 3.3V and does not have a built in level shifter so you'll need to use a level shifting chip to use with a 5V microcontroller. The following will assume that is the case. If you're running a 3.
And solder the pins We'll be using the internal charge pump so connect VDD and VBAT together (they will connect to 3.3V). GND goes to ground. © Adafruit Industries https://learn.adafruit.
Place a CD4050 level shifter chip so pin one is at the top. Connect pin 10 to D/C pin 12 to CLK (SPI clock) and pin 15 to DAT (SPI data). Connect pin 2 to RES (reset) and pin 4 to CS (chip select). Pin 1 goes to 3.3V and pin 8 to ground. (Note: If using the display with other SPI devices, D/C, CLK and DAT may be shared, but CS must be unique for each device.) © Adafruit Industries https://learn.adafruit.
You can connect the inputs of the level shifter to any pins you want but in this case we connected digital I/O 13 to pin 3 of the level shifter, 12 to pin 5, 11 to pin 9, 10 to pin 11 and 9 to pin 14. This matches the example code we have written. Once you get this working, you can try another set of pins. © Adafruit Industries https://learn.adafruit.
Downloads Software You can download our SSD1306 OLED display Arduino library from github which comes with example code. The library can print text, bitmaps, pixels, rectangles, circles and lines. It uses 1K of RAM since it needs to buffer the entire display but its very fast! The code is simple to adapt to any other microcontroller. You'll also have to install the Adafruit GFX graphics core library at this github repo and install it after you've gotten the OLED driver library.
Schematic & Fabrication Print for 1.3" OLED © Adafruit Industries https://learn.adafruit.
Schematic & Fabrication Print for 0.91" 128x32 I2C © Adafruit Industries https://learn.adafruit.
Schematic & Fabrication Print for 0.91" 128x32 SPI © Adafruit Industries https://learn.adafruit.
© Adafruit Industries Last Updated: 2018-01-02 08:35:46 PM UTC Page 28 of 28