站内搜索
发作品签到
专业版

ESP32C3 墨水屏开发板 模块化设计 0门槛

工程标签

488
0
0
0

简介

非常容易上手的ESP32C3开发板 墨水屏项目, 全部采用模块化设计, 0门槛上手, 不用采用各种零件和焊接各种复杂的原件, 各种模块淘宝都能买到.

简介:非常容易上手的ESP32C3开发板 墨水屏项目, 全部采用模块化设计, 0门槛上手, 不用采用各种零件和焊接各种复杂的原件, 各种模块淘宝都能买到.
复刻成本:60

开源协议

GPL 3.0

创建时间:2025-12-02 12:10:55更新时间:2025-12-07 20:31:04

描述

这是一个ESP32C3开发板 墨水屏项目

全部采用模块化设计, 0门槛上手, 不用采用各种零件和焊接各种复杂的原件, 各种模块淘宝都能买到.

完整的案例是 锂电池供电的版本, 如果想要更简单,可以采用USB供电 , 只需要焊接开发板 和驱动板 更加简单.

文档匆忙完成, 如有不对请指正.

如有更好的想法或者建议, 请留言讨论.

 

1. DIY 所需硬件

开发板合宙ESP32-C3

 

墨水屏驱动板

 

墨水屏幕2.9寸029A01

 

锂电池充放电模块

5V2A/2.4A冲放电锂电充电模块 type-c口可输入输出 输出常开

 

PCB电路板

 

微动开关轻触式按键小开关按钮卧式带支架侧按4脚小型微形微型6*6*10mm

 

直键开关 小型A05/PS-12E01/05

自锁

 

ph2.54 插头

 

电阻10k 数量3个 封装0603

 

3D打印外壳

https://makerworld.com.cn/zh/models/1698643-esp32-2-9cun-mo-shui-ping-gu-piao-xing-qing-xian-s#profileId-1868773

除此之外,你可能还需要用到万用表,电烙铁套件,钳子三件套,Type-C数据线,用于烧录固件的PC。

2. 硬件组装

如图:

3. 烧录固件

访问网站:打开 https://espressif.github.io/esptool-js/

连接设备:USB线连接ESP32开发板到电脑

选择端口:点击"Connect"选COM口(Windows)或/dev/口(Mac/Linux)

Flash Address 填 0

选固件:点击"Choose a firmware..."选你的.bin文件

开刷:点"Program"开始上传,等进度条完成

刷机完成后, 按下开发板Rest按钮程序才会开始运行

4. 源代码

VSCDOE PIO 开发环境

platformio.ini

Plain Text
; PlatformIO Project Configuration File
;
; Build options: build flags, source filter
; Upload options: custom upload port, speed and extra flags
; Library options: dependencies, extra library storages
; Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html

[env:airm2m_core_esp32c3]
platform = espressif32@^6.0.0
board = airm2m_core_esp32c3
framework = arduino
monitor_speed = 115200
lib_deps =
zinggjm/GxEPD2 @ ^1.6.4

src/main.cpp

C++
// GxEPD2版本的微雪电子E029A01 2.9寸墨水屏代码
// 适用于AirM2M CORE ESP32C3
#include <GxEPD2_BW.h>
#include <GxEPD2_3C.h>
#include <Fonts/FreeMonoBold9pt7b.h>
#include <Fonts/FreeMonoBold12pt7b.h>
#include <Fonts/FreeMonoBold18pt7b.h>

#define EPD_DC 6 // DC数据/命令引脚
#define EPD_RST 10 // RST复位引脚
#define EPD_BUSY 0 // BUSY忙碌状态引脚
#define EPD_CS 7 // CS片选引脚

#define EPD_SCK 2 // SPI时钟
#define EPD_MOSI 3 // SPI数据

// 选择对应的显示器类型
// 对于微雪2.9寸黑白屏(296x128) - E029A01
GxEPD2_BW<GxEPD2_290, GxEPD2_290::HEIGHT> display(GxEPD2_290(EPD_CS, EPD_DC, EPD_RST, EPD_BUSY));

// 辅助函数:绘制虚线
void drawDottedLine(int16_t x0, int16_t y0, int16_t x1, int16_t y1) {
int16_t dx = abs(x1 - x0);
int16_t dy = abs(y1 - y0);
int16_t sx = x0 < x1 ? 1 : -1;
int16_t sy = y0 < y1 ? 1 : -1;
int16_t err = dx - dy;

bool draw = true;
int dotCount = 0;

while (true) {
if (draw && dotCount < 2) {
display.drawPixel(x0, y0, GxEPD_BLACK);
}

dotCount++;
if (dotCount >= 4) {
dotCount = 0;
draw = !draw;
}

if (x0 == x1 && y0 == y1) break;

int16_t e2 = 2 * err;
if (e2 > -dy) {
err -= dy;
x0 += sx;
}
if (e2 < dx) {
err += dx;
y0 += sy;
}
}
}

void showImageArray() {
Serial.println("Show image for array");
display.fillScreen(GxEPD_WHITE);

// 注意: 需要将原来的gImage_2in9位图数据转换为适合GxEPD2的格式
// 这里是示例,你需要根据实际的图像数据调整
// display.drawBitmap(0, 0, gImage_2in9, 296, 128, GxEPD_BLACK);

// 临时显示文字代替图像
display.setFont(&FreeMonoBold12pt7b);
display.setTextColor(GxEPD_BLACK);
display.setCursor(10, 50);
display.print("Image Array");
display.setCursor(10, 80);
display.print("(Bitmap Here)");

display.display();
}

void showDrawingDemo() {
Serial.println("Drawing Demo");
display.fillScreen(GxEPD_WHITE);

// 绘制点
display.drawPixel(10, 80, GxEPD_BLACK);
display.fillRect(10, 90, 2, 2, GxEPD_BLACK); // 2x2点
display.fillRect(10, 100, 3, 3, GxEPD_BLACK); // 3x3点

// 绘制线条
display.drawLine(20, 70, 70, 120, GxEPD_BLACK);
display.drawLine(70, 70, 20, 120, GxEPD_BLACK);

// 绘制矩形
display.drawRect(20, 70, 50, 50, GxEPD_BLACK); // 空心矩形
display.fillRect(80, 70, 50, 50, GxEPD_BLACK); // 实心矩形

// 绘制圆形
display.drawCircle(45, 95, 20, GxEPD_BLACK); // 空心圆
display.fillCircle(105, 95, 20, GxEPD_BLACK); // 实心圆
display.fillCircle(105, 95, 18, GxEPD_WHITE); // 内部白色,形成空心效果

// 绘制虚线 (GxEPD2没有直接的虚线函数,需要自己实现)
drawDottedLine(85, 95, 125, 95);
drawDottedLine(105, 75, 105, 115);

// 绘制英文文字
display.setFont(&FreeMonoBold9pt7b);
display.setTextColor(GxEPD_BLACK);
display.setCursor(10, 15);
display.print("waveshare");

display.setTextColor(GxEPD_WHITE);
display.fillRect(10, 20, 120, 15, GxEPD_BLACK);
display.setCursor(12, 32);
display.print("hello world");

// 绘制数字
display.setTextColor(GxEPD_BLACK);
display.setCursor(10, 48);
display.print("123456789");

display.setTextColor(GxEPD_WHITE);
display.fillRect(10, 50, 120, 20, GxEPD_BLACK);
display.setCursor(12, 68);
display.print("987654321");

// 中文显示 (GxEPD2对中文支持有限,需要特殊字体)
display.setTextColor(GxEPD_BLACK);
display.setCursor(150, 15);
display.print("Chinese Text");
display.setCursor(150, 35);
display.print("Need Special");
display.setCursor(150, 55);
display.print("Font Support");

display.display();
}

void showPartialRefreshDemo() {
Serial.println("Partial refresh demo");

display.fillScreen(GxEPD_WHITE);
display.setFont(&FreeMonoBold18pt7b);
display.setTextColor(GxEPD_BLACK);
display.setCursor(10, 40);
display.print("Time:");
display.display();

// 部分刷新区域 - 调整为适应18pt字体
int16_t x = 120;
int16_t y = 10;
int16_t w = 170;
int16_t h = 35;

int hour = 12, minute = 34, second = 56;

for (int i = 0; i < 20; i++) {
// 更新时间
second++;
if (second >= 60) {
minute++;
second = 0;
if (minute >= 60) {
hour++;
minute = 0;
if (hour >= 24) {
hour = 0;
}
}
}

// 部分刷新时间显示
display.setPartialWindow(x, y, w, h);
display.fillScreen(GxEPD_WHITE);
display.setTextColor(GxEPD_BLACK);
display.setCursor(x, y + 20);

// 格式化时间字符串
char timeStr[10];
sprintf(timeStr, "%02d:%02d:%02d", hour, minute, second);
display.print(timeStr);

display.display(true); // true表示部分刷新
delay(500); // 模拟1秒钟
}
}

void setup() {
Serial.begin(115200);
Serial.println("GxEPD2 EPD_2IN9 Demo");

// 初始化显示器
display.init(115200); // 串口波特率,用于调试

// 设置旋转方向 (0, 1, 2, 3 对应 0°, 90°, 180°, 270°)
display.setRotation(3); // 对应原代码的270度旋转

Serial.println("E-Paper Init and Clear...");
display.fillScreen(GxEPD_WHITE);
display.display();
delay(500);

Serial.println("1. 显示图像 (需要先准备位图数据)");
showImageArray();
delay(5000);

Serial.println("2. 绘图演示");
showDrawingDemo();
delay(5000);

Serial.println("部分刷新演示");
showPartialRefreshDemo();

// 最后清屏并进入睡眠
Serial.println("Clear...");
display.fillScreen(GxEPD_WHITE);
display.display();

Serial.println("Goto Sleep...");
display.hibernate();
}

void loop() {
// 空循环
}

5. 更多固件下载

在这里 ==> https://scn3of9e1oiy.feishu.cn/wiki/HjfFwfFLAit25KkcsjlchWT6nZc?from=from_copylink

设计图

未生成预览图,请在编辑器重新保存一次

BOM

暂无BOM

3D模型

序号文件名称下载次数
暂无数据

附件

序号文件名称下载次数
暂无数据
克隆工程
添加到专辑
0
0
分享
侵权投诉
知识产权声明&复刻说明

本项目为开源硬件项目,其相关的知识产权归创作者所有。创作者在本平台上传该硬件项目仅供平台用户用于学习交流及研究,不包括任何商业性使用,请勿用于商业售卖或其他盈利性的用途;如您认为本项目涉嫌侵犯了您的相关权益,请点击上方“侵权投诉”按钮,我们将按照嘉立创《侵权投诉与申诉规则》进行处理。

请在进行项目复刻时自行验证电路的可行性,并自行辨别该项目是否对您适用。您对复刻项目的任何后果负责,无论何种情况,本平台将不对您在复刻项目时,遇到的任何因开源项目电路设计问题所导致的直接、间接等损害负责。

评论

全部评论(1
按时间排序|按热度排序
粉丝0|获赞0
相关工程
暂无相关工程

底部导航