TTGO T5 2.9inch e-Ink display with ESP32 MCU

posted in: Uncategorized | 14

e-Ink, also known as e-Paper displays have become a lot more affordable in the last year, with several Chinese companies selling modules with or without a built in mircocontroller, so I finally decided to buy a few to test.

 

One of the more interesting display + micro-controller modules is the “TTGO T5” module, which features a ESP32 WiFi processor, and a 2.9 inch e-Ink display, 3 buttons (4 if you include the “reset” button), a micro SD card socket, and a small speaker / buzzer, and CP2104 USB to Serial IC to allow the ESP32 to be programmed, as well as debug messages to be displayed

 

 

From the start, I found there is a distinct lack of information about this unit, specifically how the display is connected to the ESP32 and also which pin the speaker is connected to.

My impression is that these modules are not specifically design for the maker / hobbyist market, but are probably designed to be used in some sort of domestic electronics, like a heating controller.

 

I found this information, in a listing on Amazon

 

But this still leaves a lot of unknowns.

 

I still don’t know, the meaning of the header pins, “P” and “5”. Both of these appear to have 1.7V on them, but knowing the voltage doesn’t help much

Edit. The P and 5 are actually “SP” for speaker. The Pin labelled S (or 5) connects to the PCB pad closest to the pin header, and the pin labelled P connects to the pad nearest the end of the board (i.e the furthest  from the pin header)

There are 4 blue SMD LEDs on the back of the module, as well as a red LED.

The red LED is probably an indication of power, because it lights up as soon as power is applied.

The blue LED’s seem to be connected to an IC marked as a IP5306, which appears to be a 2.1A multi-function power management device with integrated boost converter, and  lithium battery charge management and other features.

I found this Chinese datasheet

https://cdn.datasheetspdf.com/pdf-down/I/P/5/IP5306-Injoinic.pdf

 

Next to the IP5306 is a small connector, labelled + and -, and the + pin is connected to the header pin labelled as VBAT, so I’m fairly certain, that’s how the battery would normally be connected when the module is used commercially

So the module has definitely been designed to run from a lithium ion battery, as well as being charged via the USB connector, however I’ve yet to connect a LiPo battery to the board.

 

In addition to the IP5306, there is another power controller IC, the EA3036

http://www.everanalog.com/Product/ProductEA3036DetailInfo.aspx

My guess is that potentially this IC is being used to generate the voltages needed for the eInk display, but I have not confirmed this yet.

 

Another interesting IC on the board is a NS4148, http://www.chipsourcetek.com/Uploads/file/20151207193630_0605.pdf which is a “3W mono – Class D audio amplifier”, which explains why the small speaker that comes attached, via a flying lead, to the module, can be made to beep surprisingly loudly.

I suspect that the module could drive a larger speaker and potentially could be used to play either music or possibly voice prompts, if software could be found for the ESP32 to support this.

By trial and error, I found that the speaker could be made to beep, if I enabled PWM onto pin GPIO 25 of the ESP32.

In my testing I found that applying PWM to pin GPIO 26 caused a small amount of audio to be produced on the speaker, which made more sense when I found that the NS4148 is an audio amplifier.

I suspect that the tracks of the PCB for ESP32 pins 25 and 26 are routed on the PCB next to each other, for around 5 cm, which causes enough capacitive coupling for the modulation on pin 26 to bleed through to pin 25.

 

I supposed I should not have been surprised that the speaker is connected to GPIO 25, because this pin is also DAC 0, as this allows low quality audio to be played through the speaker.

To test this, I found an Arduino sound library (XT_DAC_Audio) for ESP32 on this website http://www.xtronical.com/the-dacaudio-library-download-and-installation/ which worked straight out of the box.

The WAV playback example included in the library was a low quality audio sample, so I made my own loop using Audacity from Curtis Mayfield’s “Move on up” (youtube will probably have a clip of that), and this sounded a bit better than the example audio, even though I down sampled to 22kHz and the file has to be 8 bit wav.

However the sound was still very “tinny” and it sounded like the speaker was being over-driven.

Reducing the wav file volume to 50% gave a small improvement. I also tried connecting the speaker pins to a small good quality home HiFi speaker, (“Mini monitor”), which is a 6 Ohm speaker with both woofer and tweeter. This produced a very loud sound, probably the full 3W that the amplifier chip is capable of delivering, and was an improvement in audio quality. But there were still a lot of high frequency noise components.

I don’t know whether the noise components are caused by the DAC or the audio playback library, or the amplifier chip being over-driven. Needless to say, I don’t think this module was every intended to play anything other than perhaps basic tones or simple tunes, and it works well for what its designed to do.

The tiny speaker that came with the module has a self adhesive coating on one side, protected by a removable strip, and seems to be intended to be stuck to the inside of the case of whatever device it was intended to be used for.

I think the design of the case will also play a big part in the sound of the audio, because simply pressing the speaker down onto my desk, seemed to improve the audio quality.

 

On thing I would like to try out is possibly a “Mod” file player. (I found this on GitHub which may work)

https://github.com/earlephilhower/ESP8266Audio

But I’ve not had time to try this yet.

 

BTW.

I didn’t notice any bleed from pin 24, which is probably because pin 24 does not appear to be connected to any of the headers or unpopulated through holes on the PCB

 

Apart from the ESP32, the only other IC on the back of the PCB is a Winbond 25Q32 (32Meg Bit flash memory – 4M byte), which is connected directly to the ESP32. I think the ESP32 supports 8Mb of external flash, but 4M bytes seems to be an average size on ESP32 modules at the moment.

 

The connections to the eInk display do not seem to be listed anywhere, but I found that using an Arduino eInk library from https://github.com/ZinggJM/GxEPD , that the eInk worked without me having to change any of the pin designations in the example code.

Hence the pins used for the eInk display appear to be

CS/SS GPIO 5

DC GPIO17

RST GPIO16

BUSY GPIO 4

plus the default ESP32 SPI data and clock pins

 

 

There are 5 through holes which are not populated, and these are labelled as being connected to GND, 3.3V, IO21, IO22 and 5V

I’m not sure what this would be used for.

I first guess was that its a programming port but I don’t know enough about IO21 and IO21 to determine whether these can be used to functions other than GPIO.

 

On the front side of the PCB is the 2.9inch display. Its resolution is a bit strange as its 296 pixels in one dimension and 128 in the other.

The display is monochrome only. Just black and white, and not a third colour, (some eInk displays are Black, White and Red, or Black White and Yellow, but this one is only Back and White)

It is pure monochrome, not grey scale, so you’ll notice I had to pre-process my photo into a 1 bit deep diffusion pattern image to simulate grey scales, but you don’t need to look that closely to see the individual dots.

 

The 2.9 inch display supports partial updates, so that a rectangle of the display can be cleared to white, rather than needing to clear the whole display before changes can be made, however I found that partial updates can leave undesired traces of the previous values of the pixels, so its generally better to clear the whole screen before each update.

 

Also on the front of the board, are 4 buttons, 3 of these are “user” buttons, in that they don’t have a predefined function, but the forth button is connected to reset, and can’t be used for anything else.

The buttons are all pulled high and go low when pressed.

 

The module also has a SD card, but according to the available information, the SD card appears to be connected as an SDIO device rather than a SPI device.

The pinout shows only 4 pins being connected to the SD card. CMD (IO 15), CLK (IO 14), DAT0 (IO 2) and DAT1 (IO 4)

I’m not entirely sure what this SD card configuration is.

The Arduino STM32 core has a SD MMC library which defaults to 4 bit, but I don’t think that’s what this is.

So I’ll need to do some more research.

 

 

Overall, at around $30 for the whole module, including the display, and the speaker etc, I think its a reasonable price, and the module looks like it could be useful for a wide variety of projects, both power from USB and also battery operated.

 

Update

 

I connected a 2000mAh LiPo battery to the board’s battery terminals and the battery powers the board, and it does appear to charge the battery if I connect the USB.

However, the board draws around 125mA even with a simple program doing nothing. I think it would take more if the program was using WiFi.

 

I tried using some of the Arduino deep sleep examples, and there seems to be a problem using them using a battery connected to the battery terminals.

What seems to happen is that after around 35 seconds after the ESP32 entered deep sleep, the battery charge / monitor chip, senses that the ESP32 is not taking much current, and seems to completely turn off the voltage to the ESP32.

All LED’s on the board go out.

I’ve tried using the deep sleep examples that wake from external interrupt and also from a timer, but neither of them work,  and the ESP32 does not appear to wake up once the battery controller has timed out.

I’m a bit surprised that this is happening.

 

I find if I press the Reset button (the button on the right), that power is restored, but the reset button doesn’t seem to work very well, even when power is applied to via USB, so I’m not sure if the problem with waking up via the reset button is the button its self or not.

Its difficult to read the data sheet for the battery controller, as its in Chinese, but I can’t see anything obvious which would allow the ESP32 to control the battery controller, perhaps to allow just the ESP32 to be powered and not the rest of the board

 

Update 6th Oct 2018

 

I found a youtube video by G6EJD called “Tech Note 099 “…. and he had some useful information about the SD card connections.

 

The card is connected via SPI but not on the pins that the official Espressive Arduino core uses for its SPI SD connections

He linked to a library on github ( https://github.com/LilyGO/esp32-micro-sdcard ), which works for this board, because you can set the pins

 

SS GPIO 13

MISO GPIO 2

MOSI GPIO 15

SCLK GPIO14

 

however since this is a standard SPI connected SD card, I looked at the official SD library and also the official SPI library, and found that the SD library begin function can be passed an instance of SPIClass and the SS pin.

 

So the simple fix for this is to replace the Sd.begin() call with

 

SPIClass sdSpi;// make our own special instance of the SPI class
sdSpi.begin(14,2,15,13);// Set the pins we need
SD.begin(13,sdSpi);// setup the official SD class using our SS pin (13) and also our instance of the SPI class

 

Changing these lines in the official Arduino core, immediately resulted in the SD card being recognised and the demo was able to read and write files etc.

 

I have noticed one problem, with the demo, in that (1) it seems to have a bug where it attempts to delete the file “hello.txt” just after it renames hello.txt to foo.txt

 

Also, it seems to give an error saying its unable to “open a file for reading” but I’m not sure what file its trying to read, as the demo already successfully opened and read in both hello.txt and foo.txt

 

I did try changing the SPI speed from the default to 10,000,000 but this didn’t seem to make any difference, so I suspect the problem may be in the demo code rather than some specific problem on this board.

 

 

The other useful thing that G6EJD said was that there is a green “user” LED on pin GPIO 22

 

And… In the comments, a lot of people had also found that its impossible to use this board in low power (deep sleep) mode, because the battery manager chip turns off the power to the ESP32 after about 45 seconds (I found this was nearer 35 seconds)

 

I’m still trying to find a solution for this, because turning off the power to the other peripherals is a good idea, but not to the ESP32. So ideally there would be an alternative route for power to be supplied to the ESP32 when its in deep sleep mode.

One thought I had was to bypass the battery manager chip using several diodes and a resistor in series.

This may be able to provide just enough current to keep the ESP32 running, however there are a couple of problems with this…

1) Other devices e.g. the audio amplifier and the buck converter etc, are probably powered from the same 3.3V rail, and would take power from this bypass route

I’d need to check what is connected to the 3.3V rail that feeds the ESP32, and possibly put a low voltage drop diode in series with its supply track to prevent back feeding.

2) When the ESP32 wakes from deep sleep, it would suddenly require a load of current, and it will take some time for the battery manager chip to respond to the demand, and turn the power back on.
This may cause the ESP32 to brown out and potentially just reboot.

Assuming that I’ve fitted a diode to prevent back feeding of the deep sleep power , just to the ESP32, then a capacitor could possibly be added next to the ESP32 with enough capacity to sustain it for the time it takes for the power management chip to wake up.

 

 

Update 7th Oct 2018

 

I had another look at the datasheet for the IP5306 battery manager chip, and even though the datasheet is written in Chinese, its clear that this chip is designed for those mobile phone “power bank” devices, as the example schematics all have the output connected to USB sockets (2 sockets).

It looks like the chip produces 5V from the 3.7V Lipo cell, so I suspect that the EA3036 produces 3.3V from the 5V generated by the IP5306

I measured the voltage on the audio amplifier IC, and it seems to be supplied with 3.3V. So as far as I can tell the 5V output from the IP5306 is not directly used by anything,

 

The EA3036 has some low power modes, which seem to be controlled by some “enable” pins, but as far as I can tell, the enable(s) seem to be connected to the Vin pins, as it looks very much like EN3 and IN3 are connected .  EN1 and EN2 seem to be connected together, but don’t seem to be directly connected to IN1 or IN2.

 

Buck converter 3 pins are on the side of the chip closest to the ESP32, so my guess would be that perhaps that buck converter 3 powers the ESP32.

Possibly buck converters 1 and 2 power the audio amplifier, because it can draw over 1A (as its a 3W amplifier)

 

I’ve yet to try adding a bypass power route to give the ESP32 enough power when in sleep mode, but I have a feeling that it may be better to disconnect the existing battery management system, and use a separate module; though I’m not sure which module.

The problem with most battery changer modules is that they have an almost direct output from the battery voltage, which is nominally 3.7V and can be as high as 4.2V, so some kind of step down regulator is required to supply the power to the ESP32.

If the audio amplifier was required, it would be best to power this directly from the battery module as it can operate from up to 6V.

Additionally the amplifier has a low power shutdown mode,where it only draws 0.1uA, if its “Control” pin is pulled low.
On the module the Control pin seems to be pulled high through a resistor, so I think the best solution would be to pull this low though a resistor e.g 10, and then use one of the GPIO pins on the ESP32 as the amplifier control, so that the ESP32 could turn on the amplifier when its needed.

 

 

 

14 Responses

  1. Hi Roger

    I am trying to use gxepd with this display module without success. Minigrafx is working fine but has no partial refresh function.

    Which version of gxepd and which example do you use?

    Thx,
    Markus

  2. Roger Clark
    |

    I’m using the example code from

    https://github.com/ZinggJM/GxEPD and it worked OK

    Specifically, the line that needs to be uncommented is

    #include // 2.9" b/w

    I don’t think I had to change the pins that the example uses at all, i.e

    GxIO_Class io(SPI, /*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16); // arbitrary selection of 17, 16
    GxEPD_Class display(io, /*RST=*/ 16, /*BUSY=*/ 4); // arbitrary selection of (16), 4

  3. www.fotofieber.ch
    |

    Thx for the fast reply.

    The code seems to hang somewhere in my setup in void loop(). I had the same settings. I will try to debug it or only use minigrafx. 🙂

  4. Manuel Huitrado
    |

    which board do you select to upload the code? ex ttgo lora32 oled, wemos lolin32, etc

  5. Roger Clark
    |

    I can’t remember, but it was just one of the simple options, not one with LoRa

  6. Manuel Huitrado
    |

    thanks for the reply, greetings

  7. TonyI
    |

    Roger,

    The T5 version 2.2 variant of this board needs a bit of fiddling to get the e-paper module to work as there are a number of pin changes.

    I created a new board variant based on the lolin32 to handle the change of MISO pin…

    pins_arduino.h
    change
    static const uint8_t MISO = 19;
    to
    static const uint8_t MISO = 2;

    Within GxEPD based sketches….

    GxIO_Class io(SPI, /*CS=5*/ SS, /*DC=*/ 19, /*RST=*/ 12);
    GxEPD_Class display(io, /*RST=*/ 12, /*BUSY=*/ 4);

  8. Roger Clark
    |

    OK

    Thanks for sharing

    BTW. Have they now fixed the problem with not being able to put the ESP32 into its sleep / low power mode ?
    (on the boards I have, if you put the ESP32 into its sleep mode, the supply voltage gets cut off to the whole board after about 45 secs.

  9. tonyl
    |

    Roger, the one board that I purchased is now in a production environment. I have more coming because I am really impressed with its capabilities and the crispness of the e-paper display. As soon as they arrive I will test the sleep function and advise.

  10. Roger Clark
    |

    Hi Tony

    I’ve been told that they’ve fixed the sleep function problems on the newer hardware design, but unfortunately I’m stuck with the old ones which effectively can’t be used in sleep mode 🙁

    I have quite a few ePaper / eInk displays of different sizes and shapes, and they are seem very similar. They are all very crisp and work in a wide variety of light conditions.

  11. Andrea Contini
    |

    Hello Roger,

    Try this website: http://www.lilygo.cn/
    And the 2 repo:
    https://github.com/LilyGO
    https://github.com/Xinyuan-LilyGO/T5-Ink-Screen-Series

    Seller website: https://pt.aliexpress.com/store/product/TTGO-T5-V2-2-ESP32-2-9-EPaper-Plus-Module-e-Ink-Speakers/2090076_32850386996.html?spm=a2g03.12010615.8148356.69.1b9f5c41F8ICsc

    There are different models of the T5 v.2.0 has the ESP32, display and battery controller. v.2.2 has also a sd card, the speaker and 2 more buttons.

    Funny enough, I was developing something similar for a UHF/GSM pager with a WaveShare board, but this one it’s spot on for my requirements!

    Andrea

  12. Thanks so much for writing the article and for the comments that helped me get a ttgo t5 v2.2 connected to a gps. Despite searching the net for hours, I was only able to get it working using the tip to create a new variant and change the MISO pin. I then connected the ublox m8 chip to the connector for power and used the io21 and io22 connections.

  13. Peter W
    |

    HI, I found this forum because I just tried to load some code onto a ttg0-t5 board (seemed successful) but having done so I seem unable to power the board up! I tried using the usb port for power as that’s how I loaded the code, also tried direct 3.7v into the power connector and much stabbing of the reset button.The display no longer has the guitar picture, just different sized black squares in the four corners.
    Should be pretty basic stuff getting the board powered up, maybe I’m just stupid!
    cheers. Peter w

Leave a Reply