Testing touch on small SPI epaper displays

Our now IDF ver. 5 compatible touch component FT6X36 is ready to be tested.

There are two affordable models that I would like to cover in this post. First one is the 400×300 FT6336 from Good Display, we can see this one in action (2nd video, 1st had still wrong Waveform)

I2C touch interface Focal Tech. Pin-out follows:
1 GND
2 VDD -> 3.3V only, not 5V!
3 RST (Not used in this component)
4 INT
5 SDA
6 SCL

It’s important to know that each different model uses a different pinup in the 6 pin FPC cable, so if you had the great idea to make an universal adapter, you will fail doing it (Guess who tried?)
Please note also that I do not use GoodDisplay touch adapter for this since I do not like the fact that you can use it only for touch or for SPI but not both, so I choose to use a simple 6 pin FPC adapter that you can find cheap in Aliexpress.

Note there is a small gotcha with this ones! Sometimes the FPC is bottom-contact only so make sure to plug it with the contacts facing down (Disregard this if it has double sided contacts)
Also we are using a very raw touch interface to MCU connection there are some technical things to keep in mind:

1. I2C is a bidirectional connection and needs pull-up resistors to 3.3V in both SDA and SCL lines (4.7K or even 6K Ω will work)
2. INT pin goes low when there is an event to read via I2C. Same as last case, you should not leave this pin floating and add also a pullup to 3.3V.

The 2.7″ smaller brother

The smaller 2.7″ has also an optional touch screen. This model called Gdey027T91T with 264*176 pixels resolution seems to be at the moment out of stock, but you can get the touch separately, and just stick it with care in the top of the epaper display.

In the video you can see how fast partial update works in this model, compared with my 4.2″ version
1 GND
2 INT
3 RST (Not used in this component)
4 VDD
5 SCL
6 SDA

Also if you want to use Espressif IDF framework to handle touch events plus epaper component with GFX, we highly recommend to try Cale-idf
Cale is a component that is already 2 years in development and has the most common epapers from Goodisplay / Waveshare, including this two touch models. It also has the interesting fact, and sometimes important, if you design something that is able to rotate screen of adapting touch to this rotation. Only on certain classes like the 2.7″ since we are no-one requested yet to add this feature to the 4.2″ display class.
On our example demo-keyboard.cpp on cale component you can clearly see how this is implemented:

// Include touch plus the right class for your display
#include "FT6X36.h"
#include "goodisplay/touch/gdey027T91T.h"

// INTGPIO is touch interrupt, goes low when it detects a touch, which coordinates are read by I2C
// Use an RTC IO if you need to wake-up with touch!
FT6X36 ts(CONFIG_TOUCH_INT);
EpdSpi io;
// At this moment we insert touch into the display class!
Gdey027T91T display(io, ts);

uint8_t display_rotation = 3; // 1 or 3: Landscape mode
int t_counter = 0;

// This callback function will be fired on each touch event
void touchEvent(TPoint p, TEvent e)
{
    ++t_counter;
    printf("X: %d Y: %d count:%d Ev:%d\n", p.x, p.y, t_counter, int(e));
}

// Entry point of our Firmware
void app_main()
{
   // Initialize display and SPI
   display.init(false);
   // When using the ClassT integrated with touch then rotating this
   // rotates touch X,Y coordinates too.
   display.setRotation(display_rotation);
   display.registerTouchHandler(touchEvent);
  
   // You could launch this also in a FreeRTOS task
   for (;;) {
     display.touchLoop();
   }
}

Dust sensor data representation

The idea of using a HM3301 Laser dust sensor was to make a data representation that instead of boring numbers show a more visual appealing image representing particles and their size.
For that we though about making a read each 2 minutes and use a bi-stable display with 4 grays.
Components used:

The build work!
First you should measure the ESP32 board that you are going to use. Same we did with the HM3301 sensor 3D Model and we also uploaded it to Thingiverse.

That way it’s easier to place in the 3D design and move the small holders with 2mm holes (for the screws) to secure your board. You know, when you start using hot glue everywhere, is when it starts lookin’ bad :)
For that reason we provided the Blender file so you can use a free 3D modeling program to move things around as you like. Then you can simply switch to Wireframe view with key Z select with B (Bounding box) all what you want to export and export to STL.

This small article is focused on the build and Blender itself is a tool that is not for the faint of the heart, but is a nice and powerful 3D program, that in my case made sense to spend days learning how to tinker with it.

After 3D printing the bottom case you can start placing the parts. But it makes a lot of sense to test all this outside the box first, so first we need to connect the sensor that is easy since it’s 2 wire I2C (Plus power and SET pin, that on low makes the sensor sleep)

# Default I2C (No need for pull-ups are already in the sensor)
CONFIG_SCL_GPIO=22
CONFIG_SDA_GPIO=21
# Note we use 14 but could be any output PIN
HM3301_SET_GPIO=GPIO_NUM_14

With those in place we should be able to already flash a program and check the measurements. Please note that SET pin should be on HIGH in order for the sensor to be powered on (Bring the small fan close to your ear, you should hear it!)
For that we created our HM3301 component since there was no ESP32 IDF component, you can find it here:
https://github.com/martinberlin/HM3301-idf

You can already link this as a submodule in the components folder or for an easier test, just download our epaper-weather-station project and their linked components using the develop branch:

git clone –branch develop –recursive https://github.com/martinberlin/epaper-weather-station.git

–recursive will also pull linked submodules making it really easy to have everything available at once.
Updating the main/CMakeLists.txt you can point the build process to the file you want to build as your main entry point. And in the main/tests directory we left an hm3301 test program.

If that goes as expected then doing a: idf.py flash monitor
You should see sensor readings in the Serial output.
Congratulations, your Dust sensor seems to be measuring particles.

Now let’s go ahead and connect the epaper display!
Make sure that you connect the SPI adapter DESPI-CO3 and secure it to the epaper with some nice tape. I’ve used also here 2 small spots of hot glue but is not recommended, you might damage that nice display (Although I didn’t since I wait some seconds until is not super hot and I apply 2 small spots)
The idea is just to avoid making force over the sensible FPC flexible cable.
Once that is done you can start the SPI + power wiring to the ESP32 board:

CONFIG_EINK_SPI_MOSI=23
CONFIG_EINK_SPI_CLK=18
CONFIG_EINK_SPI_CS=12
CONFIG_EINK_DC=19
CONFIG_EINK_RST=27
CONFIG_EINK_BUSY=33

That are IOs we used. For MOSI and CLOCK we usually use the ESP32 defaults. But you could of course use the GPIO matrix to route this signals to any output pins.
If all that is good connected and also the 3.3V and GND pins are perfectly connected, and tested with the multimeter that in fact are powering the epaper…then this should display something!
Just try our next example program:
https://github.com/martinberlin/epaper-weather-station/tree/develop/main/SPI-displays

With particle-draw.cpp you can test a program that reads from HM3301 and displays some random circles showing how many PM1, PM2.5 and PM10 particles are there.

New Cinwrite SPI HAT for IT8951 parallel epaper controllers

At the moment only available in Tindie Fasani Corporation store this PCB mission is to provide:

  • ESP32S3 Espressif MCU with 2MB of external RAM
  • WiFi
  • BLE
  • DS3231 real time clock and small CR1220 coin battery to keep time
  • Fast 40Mhz SPI
  • 3V to 5V step-up (And a way to enable this boost converter)
  • 3.7v LiPo battery charger

This Cinwrite PCB is open source Hardware that you can explore and even adapt to your needs.

The price is 45 USD since I only made 5 and otherwise it will be impossible to cover the costs. But it might go lower if we can make a budget version without Bluetooth, that is, provided there is some interested parties in using it.
This along with DEXA-C097 IT8951 controller sold by GoodDisplay, and fabricated by CINREAD, can be a very powerful option to use very fast 8-bit parallel displays, such as ED097OC4 or ED097TC2. There are many models available and all of them should work, they just have different contrast and VCOM voltage adjustments.
Making this board a very good option to control them and make a digital clock for a store, or add sensors in it’s dedicated I2C connector, such as Humidity, CO2 air quality or anything that can be plugged in this super fast MCU from Espressif.