Community project

Дисплей С Русским Интерфейсом

Photo of Дисплей С Русским Интерфейсом
Generated with AI

larthe1

Last updated December 3, 2026

This project builds a spirit level display with a Russian-language interface using an ESP32, G-Tag 6 display, and MPU-6050 accelerometer. The guide provides a wiring diagram, parts list, and complete firmware to read motion sensor data and visualize level orientation on the display in real time.

Assembly involves connecting the display and sensor module to the ESP32 with power disconnected, mounting the accelerometer securely, and verifying both level modes work correctly. Makers will learn how to interface I2C sensors with the ESP32, render graphics on a custom display, and implement sensor filtering for stable readings.

Wiring diagram

Wiring diagram for Дисплей С Русским Интерфейсом
Loading diagram…

Gather all the parts

QtyComponent
1

G-Tag 6 Display

Дисплей с питанием 3,3 В и 9-битным последовательным интерфейсом.

1

MPU-6050 Accelerometer & Gyroscope Module (GY-521)

GY-521 breakout board for the InvenSense MPU-6050 6-axis motion sensor, combining a 3-axis accelerometer and a 3-axis gyroscope. It talks I2C at address 0x68 (0x69 with AD0 high) and has an auxiliary I2C bus and an interrupt output. It runs from 3-5 V through an onboard 3.3 V regulator.

Assemble it in 4 steps

1. Подключите дисплей при отключённом USB

Соедините S10 (данные) с GPIO7, S11 (такт SPI) с GPIO3, pad 7 (выбор дисплея) с GPIO5, pad 8 (сброс) с GPIO1, S1 (такт дисплея) с GPIO4. Соедините VDD с 3V3 и GND с GND.

  • Не подавайте 5 В на дисплей. Контакт pad 4 — выход 1 Гц, оставьте его свободным.

2. Подключите GY-521 при отключённом USB

SDA → GPIO0 (данные), SCL → GPIO10 (такт), VCC → 3V3 (питание), GND → GND (земля), AD0 → GND (адрес датчика). Остальные контакты оставьте свободными.

3. Закрепите датчик на корпусе

Плата датчика должна быть параллельна экрану. По стрелкам на модуле направьте X вправо и Y вверх, если смотреть с лицевой стороны экрана. Для проверки положите прибор экраном вверх на ровную поверхность, затем поставьте его вертикально.

4. Проверьте оба режима уровня

Положите прибор экраном вверх на ровную поверхность — поплавок должен быть около центра. Затем поставьте прибор вертикально — появятся шкала и угол. Слегка наклоните его в обе стороны и проверьте движение указателя.

  • Если на ровной поверхности указатель смещён, проверьте, что датчик закреплён параллельно экрану. Калибровки нуля в этой версии нет.
  • Если на экране написано «НЕТ ДАТЧИКА», отключите USB и проверьте питание и провода GY-521.

Review all connections

1. Connections between "lcd" and "ESP32"

FunctionlcdESP32
dataS10GPIO 7
digitalS11GPIO 3
digitalpad 7GPIO 5
digitalpad 8GPIO 1
pwmS1GPIO 4
powerVDD3V3
groundGNDGND

2. Connections between "imu" and "ESP32"

FunctionimuESP32
i2cSDAGPIO 0
i2cSCLGPIO 10
powerVCC3V3
groundGNDGND
groundAD0GND

Deploy the firmware

#include <Arduino.h>
#include <Wire.h>
#include "GTag6GFX.h"

GTag6Display lcd(7, 3, 5, 1, 4);
GTag6GFX gfx(lcd);
constexpr uint8_t imu = 0x68;
constexpr uint32_t samplePeriodUs = 8333;
constexpr float deg = 180.0f / PI;
bool ready = false, flat = false, filtered = false;
float x, y, z;
struct View { int mode, a, b, angle; } last{-1,0,0,0};

bool readRegs(uint8_t reg, uint8_t* buf, uint8_t count) {
    Wire.beginTransmission(imu);
    Wire.write(reg);
    if (Wire.endTransmission(false) != 0) return false;
    if (Wire.requestFrom(imu, count) != count) return false;
    while (count--) *buf++ = Wire.read();
    return true;
}
bool wake() {
    uint8_t id;
    if (!readRegs(0x75, &id, 1) || id != 0x68) return false;
    Wire.beginTransmission(imu);
    Wire.write(0x6B);
    Wire.write(0x01);
    return Wire.endTransmission() == 0;
}
void text(int cy, const char* label, int size = 2) {
    auto s = gfx.lcdText(label);
    gfx.setTextSize(size);
    gfx.setCursor((256 - int(s.length()) * 6 * size) / 2, cy);
    gfx.print(s);
}
void draw(View v) {
    if (v.mode == last.mode && v.a == last.a && v.b == last.b && v.angle == last.angle) return;
    last = v;
    lcd.clear();
    if (!v.mode) {
        text(43, "НЕТ ДАТЧИКА");
        text(69, "ПРОВЕРЬТЕ ПРОВОДА", 1);
    } else if (v.mode == 1) {
        text(3, "ГОРИЗОНТ");
        gfx.drawCircle(128, 71, 42, 1);
        gfx.drawCircle(128, 71, 10, 1);
        for (int side : {-1, 1}) {
            gfx.drawFastHLine(128 + side * 34 - 3, 71, 7, 1);
            gfx.drawFastVLine(128, 71 + side * 34 - 3, 7, 1);
        }
        gfx.fillCircle(128 + v.a, 71 + v.b, 8, 0);
        gfx.fillCircle(128 + v.a, 71 + v.b, 6, 1);
    } else {
        text(3, "ВЕРТИКАЛЬ");
        gfx.drawFastVLine(128, 26, 73, 1);
        for (int i = -4; i <= 4; ++i) {
            int w = i % 2 ? 5 : 10;
            gfx.drawFastHLine(128 - w, 62 - i * 9, 2*w+1, 1);
        }
        gfx.setTextSize(1);
        gfx.setCursor(150, 22); gfx.print("+20");
        gfx.setCursor(150, 58); gfx.print("0");
        gfx.setCursor(150, 94); gfx.print("-20");
        const int marker = 62 - v.a;
        gfx.fillTriangle(118, marker, 106, marker - 5, 106, marker + 5, 1);
        char s[32];
        snprintf(s, sizeof(s), "%+.1f ГРАД", v.angle / 10.0);
        text(104, s);
    }
    lcd.show();
}
void setup() {
    Serial.begin(115200);
    if (!lcd.begin()) {
        Serial.println("Не удалось запустить экран");
        while (true) delay(1000);
    }
    gfx.setTextColor(1);
    gfx.setTextWrap(false);
    text(54, "ЗАПУСК УРОВНЯ");
    lcd.show();
    Wire.begin(0, 10, 100000);
    Wire.setTimeOut(30);
}
void loop() {
    if (!ready) {
        ready = wake();
        if (!ready) { draw({0,0,0,0}); delay(500); return; }
        delay(100);
    }
    static uint32_t lastSampleUs = 0;
    const uint32_t now = micros();
    if (now - lastSampleUs < samplePeriodUs) { delay(1); return; }
    const uint32_t elapsedUs = now - lastSampleUs;
    lastSampleUs = now;
    uint8_t d[6];
    if (!readRegs(0x3B, d, 6)) {
        ready = filtered = false;
        draw({0,0,0,0});
        delay(250);
        return;
    }
    auto axis = [&](int i) { return float(int16_t((uint16_t(d[i]) << 8) | d[i+1])); };
    // Ignore small resting noise while following intentional movement faster.
    const float dx = axis(0) - x, dy = axis(2) - y, dz = axis(4) - z;
    const float tau = dx*dx + dy*dy + dz*dz > 600.0f*600.0f ? 20.0f : 65.0f;
    const float dt = elapsedUs * 0.001f;
    const float k = filtered ? dt / (tau + dt) : 1.0f;
    x += k * (axis(0) - x); y += k * (axis(2) - y); z += k * (axis(4) - z);
    filtered = true;
    float length = sqrtf(x*x+y*y+z*z);
    if (length < 1000) return;
    float face = fabsf(z) / length;
    flat = face > (flat ? 0.64f : 0.77f);
    if (flat) {
        float scale = 33.0f / max(length * sinf(12.0f / deg), hypotf(x,y));
        draw({1, int(roundf(x * scale)), int(roundf(-y * scale)), 0});
    } else {
        // Roll relative to the nearest upright or inverted vertical.
        float angle = atan2f(x, fabsf(y)) * deg;
        draw({2, int(roundf(constrain(angle, -20.0f, 20.0f) * 1.8f)), 0, int(roundf(angle * 10))});
    }
}

Download project files

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