Adding an OLED display to a TTGO T-Beam

The Board

The TTGO T-Beam is a nice board that has an ESP32 microcontroller, GPS, LoRa transceiver, 18650 battery holder, and more. It can be ordered with or without an OLED display. Here's one place where you can get one with the display:




If you bought a T-Beam without the display, you'll probably want to buy one. And, if you buy the right one, it will be very easy to hook it up.

The Display

If you bought a T-Beam with a display, it most likely came with an 128x64 display based on the SSD1306 chip, and has an I2C interface. However, there are two popular models of this kind of display, and one difference is the positions of the power and ground pins. Both will work, but if you get the one that has the pins in the order of VCC-GND-SCL-SDA, you'll be making it easier on yourself. The reason is that the OLED pins will magically line up with the 3.3V-GND-GPIO22-GPIO21 pins on the T-Beam board.


What You Get With The T-Beam Kit

When you order the T-Beam with the display, here's what you get: the T-Beam board, the OLED display, a 4-pin header, and two 13-pin headers. You also get an antenna, which isn't shown here.


I thought of several different ways to hook up the display.

Just The 4-Pin Header

The simplest way to hook up the display is to use just the 4-pin header to attach the display to the T-Beam, in this position. I used some double-sided foam tape between the display and the T-Beam.



Using The 4-Pin and 13-Pin Headers

If you want to solder the 4-pin header to the display and the two 13-pin headers to the T-Beam, you can do that, but you'll need to get yourself four jumper wires. If you do it this way, it really doesn't matter which of the two display types you use.


Using Female 13-Pin Headers

If you don't want to use jumper wires but also don't want to solder the display to the T-Beam, you can get yourself some 13-pin female headers, which of course are not very easy to find. But you can make your own if you get a 40-pin female header and cut it.




Using A Female 4-Pin Header

Female 4-pin headers are easier to find, so you can put one of those on the display and use the male 13-pin headers that came with the kit.



Arduino Sketch For Testing The Display

After installing the "Adafruit GFX Library" and "Adafruit SSD1306" libraries, I used the example sketch from File --> Examples --> Adafruit SSD1306 --> ssd1306_128x64_12c. The board was set to T-Beam under ESP32. I had to make one small change to the sketch in order to get it to work.
void setup() {
  Serial.begin(9600);
  // SSD1306_SWITCHCAPVCC = generate display voltage from 3.3V internally
  if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) { // Change this from 0x3D to 0x3C
    Serial.println(F("SSD1306 allocation failed"));
    for(;;); // Don't proceed, loop forever
  }



No comments:

Post a Comment