Saturday, 6 January 2018

How to use a TTGO ESP32 module with OLED display and 18650 battery holder

TTGO ESP32 dev module

I got this very complete dev module from Banggood for review.


TTGO ESP32 Development Module

  Features:

  • ESP-WROOM-32 Module
    (=Wifi, Bluetooth, two cores)
  • USB to serial bridge with Silicon Labs CP210X Chip
    (supported by Windows and Linux)
  • Charge Circuit for an 18650 battery (backside of board)
  • OLED display (SSD1306 or compatible) I2C version
  • LED on GPIO16
  • power switch

Notes from my experiments:

IDE

It was no problem getting the module to work with both the Arduino IDE and a generic ESP-32 developmnent environment (as provided by Espressif).
I set up a dedicated virtual machine running Ununtu with VirtualBox under Windows 10.
For the setup I simply followed the instructions provided by Espressif.

OLED

Unlike on other ESP32 boards with OLEDs, the OLED's I2C SDA and SCL pins are connected as follows:

SCL - Pin 4
SDA - Pin 5

It does not require an "enable" signal on GPIO16 as suggested in some programs I found. So comment these out if you see them.


Power requirements

When I didn't have a battery inserted, my powered USB hub apparently could not provide enough power when I activated WiFi and the ESP32's brownout detection triggered.
I haven't investigated that further. Either my USB hub dies not provide enough power, or the board's regulator is too weak to handle the current.

Example Project: Web Radio

As my first project, I ran a very simple web radio firmware on the module. The code was easy to find here on Github. A six minute video of my 5-minute project is available on my Youtube channel here.



11 comments:

  1. Very nice project, good job!

    I wonder if you can redirect the audit to bluetooth, and turn a dumb bluetooth speaker to a full webradio?

    ReplyDelete
    Replies
    1. There is some very basic code for a BT audio source in Espressif's repostory:
      https://github.com/espressif/esp-idf/tree/master/examples/bluetooth/a2dp_source
      I haven't looked at the options to pipe web audio to the a2dp source. (And on to a connected BT-Speaker)

      Delete
  2. This comment has been removed by the author.

    ReplyDelete
  3. hello,

    can the battery voltage be monitored by the esp32?

    ReplyDelete
    Replies
    1. The ESP32 by itself can't. A solution is to weld a cable from the positive 4.2 V battery terminal, put it to a voltage divider that outputs 3.3 v and put that voltage to an analog input of ESP32. Be aware that the analog reading of esp32 is not so linear, so try to put a 10uF capacitor in the input.

      Delete
  4. Hi andreas!
    My ESP32 OLED BATTERY TTGO card, loosened the connector (the USB port, broke the weld, very fragile).
    I can not record the programs anymore.
    How do I use the ESP32 RX and TX pins?
    What are the RX / TX pins for using a TTL converter?
    Thank you.

    ReplyDelete
    Replies
    1. My way of fixing connectors that broke loose from the PCB (usually ripping off the copper traces) is this:
      a) I superglue the connector to the board
      b) I trace the broken copper traces to a point where I can either scratch off the soldermask or find a clean contact spot.
      c) I use a piece of thin, insulated wire and connect the connector's leg to that copper trace.

      Delete
  5. By itself, the ESP32 can'nt. It can be monitored by welding a cable from the 4.2 v battery terminal to a voltage divider that gives you a 3.3 voltage, and put it to an Analog input of the ESP32. Just be aware that the analog read of the ESP32 is not so linear, try to place a 10uF capacitor in the input, to make it the most precise possible

    ReplyDelete
  6. Hi there! :)
    First of all, thanks for your instructions.
    I've been trying to use a MPU6050 with my ESP32, but the I2C connection isn't working. Could you please help me?

    ReplyDelete
  7. No matter what I do I cannot get the ESP8266Wifi library working with the board. It simply will not compile there are always "files missing" even though I have tried several ways to install the library. Can you show me some code that will utilize the board as a wifi device?

    ReplyDelete
    Replies
    1. This board has the newer, and much more powerful ESP32 chip, so not all ESP8266 related libraries will work with that board.
      There are many tutorials on the web on how to set up your IDE for an ESP32.

      Delete