Community project

BASCULA PANTALLA ROJA ESP32

Photo of BASCULA PANTALLA ROJA ESP32
Generated with AI

EJEZ3D

Published November 28, 2026

This project builds a digital weighing scale with a large red touchscreen display controlled by an ESP32 microcontroller. The system combines a 1 kg load cell with HX711 amplifier for precise weight measurement, a 3.5-inch ILI9488 color display for real-time readout, and a 4x4 matrix keypad for user input and calibration controls.

Builders will receive a complete wiring diagram showing all connections between the ESP32, display, keypad, and load cell sensor, along with a full parts list and Arduino firmware with calibration routines. The assembly guide walks through step-by-step setup including display initialization, keypad matrix configuration, load cell amplifier connection, and taring and calibration procedures to ensure accurate weight readings.

Wiring diagram

Wiring diagram for BASCULA PANTALLA ROJA ESP32
Loading diagram…

Gather all the parts

QtyComponent
1

KMRTM35018-SPI V1.0 (ILI9488)

TFT SPI 480x320; configuración ILI9488. Táctil y microSD no utilizados.

1

Resistor

220 Ω

Through-hole resistor (current-limiting in series with an LED)

1

4x4 Matrix Keypad

A 16-button (4 rows × 4 columns) membrane matrix keypad that uses 8 digital I/O lines (4 row + 4 column) to scan all keys. No dedicated power rail is required — rows and columns are driven directly by GPIO. Compatible with the Arduino Keypad library.

1

HX711 Load Cell Amplifier

24-bit ADC front-end for strain-gauge load cells and weigh scales. DT/DOUT and SCK are MCU-facing pins; E+/E-/A+/A- connect to the load cell bridge.

1

1 kg Four-Wire Load Cell Platform

Plataforma ensamblada de 1 kg con puente de cuatro hilos.

Assemble it in 8 steps

1. Conectar con todo desconectado

Desconecta el USB. Usa las etiquetas de la pantalla, no la posición de los pines. VCC va a 3V3 y GND a GND.

  • No conectes señales a 5 V; el ESP32 usa señales de 3.3 V.

2. Conectar las señales de imagen

Conecta CS a GPIO10, RESET a GPIO14, DC (o DC/RS) a GPIO9, SDI (MOSI) a GPIO11 y SCK a GPIO12. Deja SDO (MISO) sin conectar.

3. Conectar la luz

Conecta LED a un extremo de la resistencia de 220 Ω y el otro extremo a 3V3. La resistencia no tiene polaridad. Conecta T_CS a 3V3 para desactivar el táctil. Deja los demás pines táctiles y los de microSD sin conectar y no insertes tarjeta.

  • La resistencia protege la iluminación pero puede reducir su brillo.

4. Revisar el montaje

Revisa alimentación y cables antes de conectar el USB-UART de la Freenove.

  • Se usa ILI9488. Si tu lote lleva ST7796S hará falta cambiar el controlador; una pantalla blanca no confirma una avería.

5. Conectar el teclado de membrana

Con el USB desconectado, conecta las filas R1 a R4 a GPIO4, GPIO5, GPIO6 y GPIO7. Conecta las columnas C1 a C4 a GPIO15, GPIO16, GPIO17 y GPIO18. El teclado no lleva cables de alimentación.

  • Si el conector no está marcado, consulta el orden del fabricante o usa un multímetro en continuidad con el teclado desconectado. Al pulsar 1 se unen R1 y C1; al pulsar 2 se unen R1 y C2. El contacto común es R1. Con 3 y A identificas C3 y C4. Con 4, 7 y asterisco identificas R2, R3 y R4 usando C1.

6. Conectar el HX711

Con USB desconectado, une VCC a 3V3, GND a GND, DT (DOUT) a GPIO1 y SCK (CLK) a GPIO2.

  • No alimentes el HX711 con 5 V en este montaje.

7. Conectar la plataforma de 1 kg

Une excitacion positiva y negativa de la celda a E+ y E-, y salida positiva y negativa a A+ y A-. Sigue las etiquetas del kit; B+ y B- quedan libres.

  • No identifiques los hilos solo por color si no tienes confirmado el codigo del kit.

8. Hacer la tara y calibrar

Apoya la base en una mesa firme. Conecta el USB y pulsa Deploy. Con la plataforma vacia y sin tocarla, pulsa A y espera la confirmacion. Pulsa B, coloca una pesa conocida centrada (por ejemplo 500 g), espera a que se asiente, escribe su masa en gramos y pulsa

  • No superes la capacidad de 1 kg ni presiones la plataforma con la mano.

Review all connections

1. Connections between "pantalla" and "ESP32"

FunctionpantallaESP32
powerVCC3V3
groundGNDGND
spiCSGPIO 10
digitalRESETGPIO 14
digitalDCGPIO 9
spiSDIGPIO 11
spiSCKGPIO 12
powerLED → Resistor P1EXT
powerT_CS3V3

2. Connections between "resistencia" and "ESP32"

FunctionresistenciaESP32
powerP23V3

3. Connections between "teclado" and "ESP32"

FunctiontecladoESP32
digitalR1GPIO 4
digitalR2GPIO 5
digitalR3GPIO 6
digitalR4GPIO 7
digitalC1GPIO 15
digitalC2GPIO 16
digitalC3GPIO 17
digitalC4GPIO 18

4. Connections between "hx711" and "ESP32"

Functionhx711ESP32
powerVCC3V3
groundGNDGND
digitalDTGPIO 1
digitalSCKGPIO 2

5. Connections between "celda" and "ESP32"

FunctionceldaESP32
powerE+ → HX711 Load Cell Amplifier E+EXT
groundE- → HX711 Load Cell Amplifier E-EXT
analogA+ → HX711 Load Cell Amplifier A+EXT
analogA- → HX711 Load Cell Amplifier A-EXT

Deploy the firmware

#include <HX711.h>
#include <Preferences.h>
#include <Arduino.h>
#include <LovyanGFX.hpp>
class Pantalla : public lgfx::LGFX_Device {
  lgfx::Panel_ILI9488 panel;
  lgfx::Bus_SPI bus;
public:
  Pantalla() {
    auto b = bus.config();
    b.spi_host = SPI2_HOST;
    b.spi_mode = 0;
    b.freq_write = 10000000;
    b.pin_sclk = 12;
    b.pin_mosi = 11;
    b.pin_miso = -1;
    b.pin_dc = 9;
    bus.config(b);
    panel.setBus(&bus);
    auto p = panel.config();
    p.pin_cs = 10;
    p.pin_rst = 14;
    p.pin_busy = -1;
    p.panel_width = 320;
    p.panel_height = 480;
    p.memory_width = 320;
    p.memory_height = 480;
    p.readable = false;
    panel.config(p);
    setPanel(&panel);
  }
};
Pantalla pantalla;

constexpr int filas[] = {4, 5, 6, 7};
constexpr int columnas[] = {15, 16, 17, 18};
constexpr char mapa[] = "123A456B789C*0#D";
constexpr uint16_t fondo = 0x001F;
char texto[49]{};
size_t largo = 0;

// Solo una fila activa; las otras quedan como entradas de alta impedancia.
int leerTecla() {
  int tecla = -1;
  for (int f = 0; f < 4; ++f) {
    digitalWrite(filas[f], LOW);
    pinMode(filas[f], OUTPUT);
    delayMicroseconds(10);
    for (int c = 0; c < 4; ++c) {
      if (digitalRead(columnas[c]) == LOW) {
        tecla = tecla == -1 ? f * 4 + c : -2;
      }
    }
    pinMode(filas[f], INPUT);
  }
  return tecla;
}

HX711 sensor;
Preferences memoria;
float factor, cero, promedio, sum;
int muestras, modo = 0; // 1: tara, 2: calibracion con masa conocida
int referencia;
bool conCero, hayDato, guarda;
uint32_t ultimo;
const char* aviso = "A: tara con plataforma vacia";

void teclaPeso(char k) {
  if (k == 'A') { modo = 1; muestras = 0; sum = 0; aviso = "Tomando tara: espera"; }
  else if (k == 'B' && conCero && !modo) { largo = 0; texto[0] = 0; aviso = "Coloca pesa; escribe gramos y pulsa #"; }
  else if (!modo && k >= '0' && k <= '9' && largo < 4) { texto[largo++] = k; texto[largo] = 0; }
  else if (!modo && k == '*' && largo) texto[--largo] = 0;
  else if (!modo && k == '#') {
    referencia = atoi(texto);
    if (!conCero) aviso = "Primero retira todo y pulsa A";
    else if (referencia < 1 || referencia > 1000) aviso = "Introduce entre 1 y 1000 g";
    else { modo = 2; muestras = 0; sum = 0; aviso = "Midiendo referencia: espera"; }
  }
}

void pantallaPeso() {
  char linea[80], peso[48];
  if (millis() - ultimo > 1500) snprintf(peso, sizeof(peso), "Sin datos HX711");
  else if (modo) snprintf(peso, sizeof(peso), "Midiendo...");
  else if (!conCero) snprintf(peso, sizeof(peso), "Pulsa A");
  else if (!factor) snprintf(peso, sizeof(peso), "Sin calibrar");
  else {
    float g = (promedio - cero) / factor;
    if (g > 1000) snprintf(peso, sizeof(peso), "Retira carga");
    else snprintf(peso, sizeof(peso), "%.0f g", fabsf(g) < 0.5f ? 0.f : g);
  }
  snprintf(linea, sizeof(linea), "Referencia: %s g", largo ? texto : "-");
  static String anteriorPeso, anteriorLinea, anteriorAviso;
  if (anteriorPeso != peso) {
    anteriorPeso = peso;
    pantalla.fillRect(16, 76, 448, 65, fondo);
    pantalla.setTextSize(4);
    pantalla.drawString(peso, 18, 84);
  }
  if (anteriorLinea != linea || anteriorAviso != aviso) {
    anteriorLinea = linea; anteriorAviso = aviso;
    pantalla.fillRect(16, 161, 448, 78, fondo);
    pantalla.setTextSize(2);
    pantalla.drawString(linea, 18, 166);
    pantalla.drawString(aviso, 18, 202);
  }
}

void setup() {
  for (int pin : filas) pinMode(pin, INPUT);
  for (int pin : columnas) pinMode(pin, INPUT_PULLUP);
  pantalla.init();
  pantalla.setRotation(1);
  pantalla.fillScreen(fondo);
  pantalla.setTextColor(0xFFFF, fondo);
  pantalla.setTextSize(4);
  pantalla.drawString("Bascula 1 kg", 18, 12);
  pantalla.setTextSize(2);
  pantalla.drawString("A Tara   B Calibrar   # Confirmar", 18, 264);
  pantalla.drawString("* Borra un digito", 18, 292);
  sensor.begin(1, 2);
  guarda = memoria.begin("bascula", false);
  factor = guarda ? memoria.getFloat("factor", 0) : 0;
  ultimo = millis() - 1501;
}

void loop() {
  static int candidato = -1, estable = -1;
  static uint32_t cambiado = 0;
  static bool listo = true;
  int k = leerTecla();
  if (k != candidato) { candidato = k; cambiado = millis(); }
  if (candidato != estable && millis() - cambiado >= 30) {
    estable = candidato;
    if (estable == -1) listo = true;
    else if (estable == -2) listo = false;
    else if (listo) { listo = false; teclaPeso(mapa[estable]); }
  }
  if (sensor.is_ready()) {
    long dato = sensor.read();
    bool reiniciar = !hayDato || millis() - ultimo > 1500;
    ultimo = millis();
    promedio = reiniciar ? dato : promedio + 0.25f * (dato - promedio);
    hayDato = true;
    if (modo) {
      sum += dato;
      if (++muestras == 16) {
        float media = sum / muestras;
        promedio = media;
        if (modo == 1) {
          cero = media; conCero = true;
          aviso = factor ? "Tara lista" : "Tara lista. Pulsa B para calibrar";
        } else if (fabsf(media - cero) < 100) {
          aviso = "Sin cambio: revisa celda y pesa";
        } else {
          factor = (media - cero) / referencia;
          aviso = guarda && memoria.putFloat("factor", factor) == sizeof(float)
                ? "Calibracion guardada" : "Calibrado solo para esta sesion";
        }
        modo = 0;
      }
    }
  } else if (modo && millis() - ultimo > 1500) {
    modo = 0; aviso = "Revisa HX711 y repite el paso";
  }
  pantallaPeso();
  delay(5);
}

Remix this project

Make it yours in one click

Open a full copy of this project in your own Schematik workspace, diagram, code, parts, and assembly steps included. Swap the sensor, add features, or redesign the whole thing with AI. The author's original stays untouched.

Open in Schematik