Which pins work for HX8357 breakout (adafruit) with ESP32 Sparkfun Thing Plus C

Hello All,

I am trying to get the touchscreen on my HX8357 breakout from adafruit, but I’m really not having much luck.

I’ve seen a number of posts regarding the resolution, so I updated the code to reduce the resolution to 10 bits. I’ve check my wiring a number of times as well, and I’m fairly confident this is wired correctly. Here’s the code I am using to test:

#include <Adafruit_GFX.h>    // Core graphics library
#include <SPI.h>
#include "Adafruit_HX8357.h"
#include "TouchScreen.h"

// ESP32 Thing Plus USBC TS Pins
#define YP A1  // must be an analog pin, use "An" notation!
#define XM A0  // must be an analog pin, use "An" notation!
#define YM 13  // can be a digital pin
#define XP 12  // can be a digital pin

// For better pressure precision, we need to know the resistance
// between X+ and X- Use any multimeter to read it
// For the one we're using, its 300 ohms across the X plate
TouchScreen ts = TouchScreen(XP, YP, XM, YM, 300);

void setup(void) {
  Serial.begin(115200);
}

void loop()
{
  // Retrieve a point  
  analogReadResolution(10);
  
  TSPoint p = ts.getPoint();

  Serial.print("X = "); Serial.print(p.x);
  Serial.print("\tY = "); Serial.print(p.y);
  Serial.print("\tPressure = "); Serial.println(p.z);  

  delay(200);
}

This code returns this (X= 1023 when touching the display, X=800ish when not touching):

X = 1023 Y = 751 Pressure = 0

X = 1023 Y = 751 Pressure = 0

X = 1023 Y = 751 Pressure = 0

X = 867 Y = 763 Pressure = 0

X = 800 Y = 770 Pressure = 0

X = 806 Y = 769 Pressure = 0

I suspect this is a pin selection related issue, or that I may need a pull-up/down somewhere, but I’m kind of at a stand still. Has anyone resolved this issue?

Nate

What is your connection? Is there any diagram or chart that you’re following?

Thanks for the response!

I’m using pins A0 and A1 for the analog pins, and pins 12 & 13 for the digital pins.

I am using this guide as a reference: https://learn.adafruit.com/adafruit-3-5 … /downloads

And this hookup guide diagram for the pins:

https://cdn.sparkfun.com/assets/3/9/5/f … sheet2.pdf

I think you’d be a lot better off using an Arduino Uno wirh that display than a ESP32 based board.

For one, the Uno is a known good configuration and for another the display is a 5 volt device and the ESP32 is a 3.3 volt device.

Get it working first, then progress to dealing with the voltage differences and any needed code and pin changes necessary.