三色电子纸开发全攻略:从原理到ESP32实战The Complete Guide to Tricolor E-Paper Development: From Principles to ESP32 Practice


AI free token/AI免费积分

三色电子纸开发全攻略:从原理到ESP32实战

本文来源:http://www.hqwc.cn/news/1367976.html
若有版权问题,请来信告知:13951431913#139.com 或在右方提交评论。

做电子纸相关项目有些年头了,从最早的单色黑白屏一路玩到现在的三色屏,说实话,三色电子纸这几年的成熟速度比我想象中快很多。不管你是准备做电子价签、会议门牌、桌面信息牌,还是只是想给家里的智能家居加一块低功耗显示屏,"New Tricolor E-Paper Displays"这个方向都值得花点时间研究一下。这篇文章我打算完整梳理一遍三色电子纸从原理到选型再到实际开发的整个链路,里面大部分内容都是我自己踩坑踩出来的经验,希望能帮你少走弯路。

1. 三色电子纸的核心原理与技术背景

要搞懂三色电子纸,先得明白电子墨水屏这块面板到底是怎么工作的。它和LCD、OLED这种需要背光或者主动发光的屏幕完全是两套逻辑。电子纸的核心是微胶囊电泳技术——你可以把屏幕表面想象成密密麻麻铺了一层微型胶囊,每个胶囊里面悬浮着带正电荷的白色粒子和带负电荷的黑色粒子,这些粒子悬浮在透明液体中。

当我们在胶囊上下两侧施加电场时,带正电的白色粒子会被吸引到一侧,带负电的黑色粒子会被推到另一侧。如果白色粒子被推到可视面,这个像素就显示为白色,反过来就是黑色。电场撤掉之后,由于粒子本身带有电荷且周围的液体有粘度,粒子位置会稳定保持住,这就是电子纸最著名的"双稳态"特性。

这个特性带来的直接好处就是 零功耗静态显示 。只有在画面切换的那一刻才需要消耗电能,画面静止时即使完全断电,内容也依然清晰地留在屏幕上。这和"墨水印在纸上"的体验几乎一样,也是电子纸能在功耗敏感场景里脱颖而出的根本原因。

黑白屏的原理好理解,那三色屏是怎么在同一个像素上表现出红、黑、白三种颜色的?这个问题我第一次接触的时候也琢磨了很久。

目前市面上的三色电子纸,主流方案是在微胶囊里增加第三种粒子——红色粒子。也就是说,一个胶囊里同时存在白色、黑色、红色三种粒子,它们对电场和电荷的响应特性不同。驱动芯片通过施加一系列特定时序的电压波形,在不同阶段分别驱动不同粒子运动,从而实现三色显示。

但这里有个很关键的技术痛点:红色粒子的迁移速度和驱动电压与黑白粒子不一样,而且红色粒子和黑白粒子在同一个胶囊里容易互相干扰。所以三色屏的刷新过程普遍要比黑白屏慢得多。一块4.2英寸的黑白屏全刷大概2到3秒,同样尺寸的三色屏全刷可能要12到15秒。刷新过程中你会看到屏幕像波浪一样来回翻动好几次,那其实是驱动波形在依次把粒子推到对应位置。

好消息是,经过几年的迭代,现在的三色屏在色彩饱和度、刷新速度和残影控制上已经比早期产品进步了一大截。目前市场上最常见的两种三色方案是 黑白红 和 黑白黄 。红色方案适合做警示信息、促销标签、低价提醒这类需要吸引眼球的内容;黄色方案对比度更高、底色更清晰,适合做菜单、公告、仪表盘等需要长时间阅读的场景。

说完了原理,也得聊聊三色屏的局限性,免得你上手之后产生不切实际的期望。

三色屏在色彩表现上其实很"朴素"。它只有三个确定的颜色状态,没有中间过渡色,无法像彩色LCD那样显示照片级画面。刷新速度慢也决定了它不适合播放视频或做高频动画。还有一个容易被忽略的问题是,三色屏在每次刷新时几乎都需要做全屏初始化——也就是把整块屏幕先刷成全黑再刷成全白再刷出内容,这个过程中屏幕闪烁非常明显,用在展厅、门店等人员密集的场景时要提前评估会不会造成视觉干扰。

所以我个人觉得,三色电子纸最适合的场景是那些**"内容变化频率低、但需要比黑白屏多一些信息层次"**的应用。典型的有:

电子货架标签:显示商品名、价格、促销标识,红色数字突出折扣力度

会议门牌:显示会议室名称、使用状态、预约时间段,红色标明"使用中"

智慧办公信息屏:团队KPI看板、出勤状态、设备状态指示灯

工业数据面板:温度超限报警、设备离线告警、库存临界提醒

个人桌面摆件:天气信息、日历提醒、待办事项

核心逻辑就是:一台设备长期静止显示同一画面,偶尔需要更新,更新时用红色强化关键信息。这个定位恰好把三色屏的所有优点发挥出来,同时避开它的短板。

很多新手上来就买屏幕、抄代码,做完发现和预期差很远。我的建议是动手之前先把下面几个问题想清楚,这会直接决定你后面选什么硬件、写什么逻辑。

第一, 刷新频率有多高 。如果你的应用是每天更新两三次,那三色屏完全没压力;但如果你的业务要求每隔几分钟就刷新一次,我劝你趁早换黑白屏或者干脆上LCD。三色屏频繁刷新不仅耗时,还会加速屏幕的老化,残影也会越积越重。

第二, 颜色怎么用 。三色屏的红色不是用来大面积铺底的,它更适合做点状强调。比如价格数字、状态标记、警示边框。如果你打算把整个背景都刷成红色,你会发现实际观感偏暗、饱和度不够,反而影响信息的可读性。

第三, 屏幕尺寸和分辨率怎么平衡 。市面常见的三色屏有1.54寸、2.13寸、2.9寸、4.2寸、5.83寸、7.5寸等几种规格。尺寸越大,分辨率越高,但刷新时间也越长、驱动电流也越大。做产品原型的话,2.13寸和4.2寸是上手成本最低的两个规格,资料多、库支持好、价格也相对便宜。

第四, 交互需求是否有 。如果只是显示信息,单向推送就行;如果需要按键切换页面,那就得考虑按钮输入和页面管理逻辑。这些都会影响主控选型和代码架构。

选三色屏的时候,不要只看尺寸和分辨率,更要关注它用了哪颗驱动芯片。不同芯片的指令集、LUT配置、驱动波形都有差异,代码不能完全通用。

我做过的项目和帮粉丝排查过的问题里,出现频率最高的是下面这几种驱动芯片:

这里面我要单独说一下SSD1681和SSD1680这两颗芯片。SSD1681支持黑白红三色和黑白双色两种模式,数据手册里明确写着三色模式下支持1bpp黑白加1bpp红色,一共2bpp数据;SSD1680是比较老的芯片,也支持三色,但驱动寄存器和波形配置和SSD1681不完全一样。用Arduino或者ESP32做开发的话,建议优先选SSD1681或者更新的芯片,因为主流的GxEPD2库对这两颗芯片的适配最完善,网上能搜到的示例代码也最多。

选屏幕的时候还有个小技巧:尽量选带FPC排线接口的模块,而不是裸屏。裸屏的引脚间距很密,手工焊接非常痛苦,而且电子纸对静电比较敏感,焊接过程中损伤屏幕的风险很高。模块化的屏幕一般都把电压转换电路和电平转换电路做到板载了,直接用杜邦线就能接主控,对新手友好得多。

屏幕选好了,接下来就是主控芯片。三色电子纸本身对主控的计算能力要求不高,毕竟图像处理主要靠上位机或者离线脚本完成,主控顶多负责SPI通信和简单的位图数据搬运。但这不意味着可以随便选,因为你的应用场景会决定主控需要具备哪些外围能力。

我做三色屏项目,最常见的三种主控方案:

Arduino Uno/Nano :适合纯学习、验证屏幕能不能点亮、跑通基础驱动。AVR芯片主频低,内存小,大尺寸屏幕的整幅位图(比如7.5寸800x480的2bpp数据有80KB)塞不进2KB RAM,只能从Flash里一段一段读出来发,操作起来比较痛苦。所以我建议Arduino只用来玩小尺寸屏幕。

ESP32 :这是我个人最推荐的方案。双核240MHz,520KB SRAM,自带WiFi和蓝牙,可以直接从服务器拉取数据再刷新屏幕。4MB甚至16MB的Flash可以存储多套图片资源。2.13寸到4.2寸的三色屏整幅图像数据都能在内存里操作,开发体验好很多。

STM32 :如果做产品量产,追求稳定性和工业级可靠性,STM32L0/L4系列是很好的选择。低功耗表现优秀,有专门的LPTIM和RTC可以在睡眠模式下定时唤醒。不过开发门槛稍高,调试工具和库的生态不如ESP32方便。

通信方案上,三色电子纸屏幕本身几乎都走SPI接口,数据线就四根——SCLK、DIN、CS、DC,加上一根BUSY忙信号线和一根RST复位线。主控之间的数据获取则看你的应用场景:室内场景用WiFi最方便;室外或者距离远的场景可以选LoRa或者4G Cat.1;纯本地离线应用完全不需要无线通信,用SD卡或者键盘输入都行。

三色电子纸的功耗大头不在屏幕显示,而在刷新过程。屏幕静止时整机电流可以做到几十微安甚至更低,但一旦进入刷新流程,驱动芯片需要内部升压到正负15V到25V来驱动电子墨水粒子运动,瞬间电流可能达到几十毫安。

如果你用电池供电,这里有几个需要注意的点:

屏幕模块的VCC不能直接接在锂电池上。一定要经过稳压,把电压稳定在3.3V。很多模块板载了稳压和电平转换,但最好确认一下模块的供电范围。

刷新瞬间电流需求比较大,建议在电源线上并联一个100uF左右的电解电容和0.1uF陶瓷电容,避免大电流导致电压跌落,引起刷新失败。

主控进入深度睡眠之前,一定要确保屏幕刷新流程已经完成,也就是BUSY信号已经拉低。如果屏幕还在忙就断电,轻则刷新中断,重则屏幕出现残影甚至花屏。

如果需要在户外阳光直射环境下使用,还要注意工作温度范围,多数电子纸的工作温度是0到50摄氏度,超出范围粒子迁移速度会变慢,刷新效果受影响。

3. 核心细节:三色屏驱动流程与图像处理

三色屏驱动和黑白屏驱动最大的区别在于刷新流程多了一个阶段。以SSD1681为例,黑白屏的刷新流程大致是:初始化 -> 写入LUT -> 发送黑白位图 -> 发送刷新命令 -> 等待BUSY解除。三色屏在此基础上多了一步,需要分别写入黑白位图和红色位图,而且驱动波形分两个阶段执行。

第一阶段驱动黑白粒子,把黑白内容和灰阶色块推到位;第二阶段驱动红色粒子,把红色内容推到显示面。由于红色粒子的响应速度慢,整个驱动波形被拉得很长,所以三色屏刷新时间比黑白屏翻倍甚至翻三倍。

初始化屏幕,配置分辨率、扫描方向、边框宽度

发送DRF(Display Refresh)命令,触发驱动波形

这里面有一个很容易踩的坑:三色屏的RAM区域划分和黑白屏不一样。SSD1681内部有黑白和红色两块独立的RAM区,地址空间不同,写入数据时对应关系必须准确。如果偏移搞错,屏幕显示的颜色就会错乱。

理解三色屏的数据格式,对后面的图像处理至关重要。

黑白屏一像素只需要1bit,0表示白,1表示黑。三色屏需要表示三种状态,如果用纯二进制编码,2bit可以表示4个状态,也就是0-3。但市面上三色屏的硬件设计通常并不是把一个像素的2bit连续放在一起,而是采用 两个独立位平面 的方式:一个黑白位平面,一个红色位平面。

所以你在写驱动代码的时候,实际要做的是准备两个独立的bitmap数组:一个是黑白数据,一个是红色数据。发送图像时先发黑白数组再发红色数组(具体顺序以驱动芯片手册为准)。有些老库的API只接受一张完整的三色位图,内部会帮你拆分成两个平面,但理解底层逻辑能帮你排查很多疑难杂症。

实际项目里,你手上的图片素材基本都是全彩的JPG或PNG,需要转成三色屏能显示的格式。转换的核心逻辑就一句话: 把接近红色的像素归类为红色,其余像素按灰度阈值分成黑和白 。

听起来简单,做起来有讲究。三色屏的红色粒子呈现出来的红色其实偏暗、偏砖红,和电脑屏幕上那种鲜艳的纯正红色差别很大。如果你直接按RGB中R值最高就判定为红色,一屏图转出来往往是一团糊。

先把图片缩放到屏幕分辨率,比如4.2寸屏就是400x300

判断红色时,设置两个阈值:RGB中R通道要明显高于G和B,比如R > 140且R - G > 60且R - B > 60,同时R通道本身的绝对值要够高

不满足红色条件的像素,转成灰度后用阈值切分黑白,常用阈值在128到160之间

对于灰度渐变的区域,建议使用Floyd-Steinberg抖动或者有序抖动,避免出现明显的色块断层

这里有个容易被忽略的点: 红色阈值判定最好在颜色空间里做 。纯RGB阈值对光照和色偏很敏感,如果有条件可以先把图片转成HSV或Lab颜色空间,在色相维度上圈定红色范围,再结合饱和度判断。用Python的PIL库或者OpenCV做这个转换非常方便,下文我会给出可直接用的脚本。

三色屏的刷新时序是很多新手容易忽略但后果很严重的环节。三色屏驱动芯片要求在每次完整刷新前,先进行整屏的清除操作——具体表现就是屏幕先全部变黑、再全部变白、最后才逐渐显示内容。这不仅是为了让粒子回到初始位置,也是为了让红色粒子和黑白粒子彻底分离,否则上一帧的内容残留会非常明显。

所以在写代码时,不要在两次刷新之间省略清屏流程。有些驱动库默认每次调全刷都会自动带清屏,但如果你为了缩短刷新时间,手动改了LUT或者跳过某些步骤,残影问题就会找上门。

另外,三色屏的驱动波形对电源稳定性要求比较高。刷新过程中如果供电电压波动,粒子可能停在半空中,画面看起来就是灰蒙蒙的"半残影"状态。这也是为什么我前面强调供电设计要并联去耦电容的原因。

4. 实操过程:从接线到显示一张完整画面

我这边以ESP32 + 4.2寸三色屏(SSD1683或者IL0398)为例,演示最基础的接线方式。不同模块的引脚定义可能有细微差别,接线前一定先看你自己那块屏幕的原理图,下面表格是我最常用的一套接法:

这块4.2寸屏模块自带稳压和电平转换,所以可以直接接3.3V。如果是裸屏,升压和转换电路都得自己做,不建议新手从裸屏开始玩。

代码部分我用的是GxEPD2库,这是目前社区里维护最活跃、兼容性最好的电子纸驱动库,支持市面上绝大多数三色屏。在Arduino IDE中安装库之后,一个最基础的显示流程只需要十几行代码:

这个示例干了三件事:初始化屏幕、调用 firstPage() 和 nextPage() 做分页绘图、用 setTextColor 分别设置黑字和红字。GxEPD2库内部自动处理了黑白位图和红色位图的分拆,你只需要关注绘图API即可。

如果你用的是2.13寸或者1.54寸的小屏,记得把 GxEPD2_420 改成对应的型号类名,库文件里每个型号都有对应定义,照着改就行。

显示文字只是第一步,实际项目里更多是需要把品牌Logo、产品图片、表格数据放上屏幕。我这边推荐一套我自己用了很久的图片处理工具链,命令行加批量处理非常方便。

如果你只要简单转换一张图,用ImageMagick的命令行最省事:

第一条命令生成黑白层:先把图片强制缩放到400x300,转灰度后按50%阈值切成黑白。第二条命令生成红色层:先把图片里所有非红色区域填充为白色,再把红色区域填充为黑色,得到一张只有红色区域的掩膜。两张bmp再配合GxEPD2库的 drawBitmap 函数就能直接上屏。

如果图片内容比较复杂,或者你想用脚本批量处理,推荐用Python的PIL库:

这段脚本把红色判定逻辑封装成了一个函数,方便你调阈值。注意PIL的"1"模式位图里,0是黑色、1是白色,和GxEPD2库里 drawBitmap 的取值逻辑正好对应。如果你发现颜色反了,把0和1对调就行。

做三色屏应用,如果不把低功耗做好,那就浪费了电子纸最核心的价值。下面我用ESP32的深度睡眠加定时唤醒来演示一个典型的低功耗显示循环。

这段代码的精髓在于: 先完成屏幕刷新,再进入深度睡眠,并且把睡眠时间设为下一次需要刷新数据的时刻 。刷新过程中ESP32全速运行,电流大概100mA左右,持续十几秒;刷新完进入深度睡眠,电流降到10uA左右。如果每天只刷新4次,平均功耗非常低,两节AA电池撑半年以上是完全可以实现的。

当然,实际项目里你会需要从网络获取数据,那就不能在setup里直接refresh,而是先连接WiFi拉数据、处理图片、再刷新、最后睡眠。整个流程要保证在唤醒周期内完成,超时要做兜底逻辑,防止屏幕刷新到一半就进睡眠。

表现 :代码运行了,屏幕白茫茫一片,没有任何刷新动作。

排查方向 :首先看供电。用万用表量屏幕VCC对GND电压是否稳定在3.3V,如果电压偏低或者有跳动,多半是电源问题。其次检查接线,尤其是CS、DC、BUSY这三根线,接错或者松动会导致主控发命令但屏幕收不到。第三,看初始化有没有成功,GxEPD2库的 init() 失败一般会在串口打印错误信息,注意看串口输出。

另外有个很容易被忽略的点: ESP32和屏幕模块的共地 。如果你用USB给ESP32供电,屏幕又用另一个电源,两个电源的GND没有连在一起,SPI信号会因为参考地不同而乱掉。解决办法就是所有设备共用一个GND。

表现 :明明代码里指定了红色文字,屏幕却显示成黑色,或者红色区域出现黑色杂点。

排查方向 :大概率是红色位图数据没有正确写入,或者写入顺序反了。SSD1681要求先写黑白RAM区域,再写红色RAM区域,有些驱动库的封装顺序不同,你可能需要调整发送顺序。另一个原因是红色阈值判定不严格,图片上原本应该是白色的区域被误判成红色,和黑色叠在一起看起来就是浑浊的颜色。用我上文的Python脚本打印一下red_layer.bmp,看看掩膜是否干净。

表现 :刷新过程中屏幕来回翻动,看起来像是海浪一样,但比正常情况剧烈很多,甚至出现花屏。

排查方向 :这是三色屏刷新过程中的正常现象,但如果特别剧烈,可能是LUT配置异常。很多库允许自定义波形LUT,如果你从网上拷贝了自定义LUT代码,先注释掉,用库默认的LUT跑一遍。另外,刷新过程中如果附近有大功率电机或者开关电源,电磁干扰也可能让波形异常,适当缩短SPI线长度会有改善。

表现 :屏幕某个区域更新过内容后,旧内容的轮廓一直留在屏幕上,怎么刷新都消不掉。

排查方向 :三色屏本质上就不适合做局部刷新。它不像黑白屏那样有一套成熟的局部刷新波形,强行局部刷新会因为粒子没有被完整驱动到端点位置而产生永久性残影。我的建议是 放弃局部刷新 ,每次更新都做全屏刷新。如果实在需要局部更新,可以考虑在画面设计上让更新区域永远保持同一块,比如把可变化的内容集中在一个固定矩形框里,其他区域不变化,这样即使每次全刷,视觉冲击也会小很多。

表现 :显示到一半,程序卡在等待BUSY的循环里,屏幕纹丝不动。

排查方向 :这种情况最常见的是刷新过程中电源电压跌落。检查电池电压是否充足,升压电路是否正常。还有一个可能:刷新过程中你对屏幕执行了复位操作,导致驱动芯片进入了异常状态。确保复位引脚只在初始化阶段拉低,刷新过程中不要碰它。

另外,如果你用的是ESP32,检查一下SPI时钟频率。三色屏驱动芯片的SPI时钟最高一般支持到20MHz左右,但有些模块板上走线过长,拉太高容易出通信错误,我一般设置在4MHz到8MHz之间,稳定性和速度都能兼顾。

三色电子纸这几年发展最明显的变化,就是驱动库和工具链的成熟度上来了。我在2019年第一次做2.13寸三色屏时,光是调驱动波形就折腾了两三天,现在就几行代码的事。如果你是新接触这个方向,建议直接选GxEPD2库加ESP32,这套组合是目前试错成本最低的路径。

真的要动手做产品的话,我会额外提醒一句: 拿到屏幕先做老化测试 。把屏幕连续刷新50到100次,观察每次刷新后画面是否稳定、有没有渐变式残影。三色屏对驱动芯片品控和墨水批次比较敏感,同一型号不同批次的屏幕,显示效果可能有细微差别。量产前把这个问题摸清楚,能帮你避免后期大批量返工的麻烦。

后续想扩展的话,这个方向比较有意思的玩法有几个:一是做多屏同步显示系统,用ESP-NOW或者MQTT做数据同步,几十块屏组成一个信息矩阵,非常适合门店或者展厅的导引场景;二是把传感器数据接进来,温度、湿度、空气质量实时显示在桌面上,配上红色告警阈值,就是一个很实用的低功耗环境监测台;三是利用电子纸柔性封装做曲面显示,不过柔性屏价格偏高,刷新波形也要重新调,适合做进阶挑战。

我自己目前正在折腾的一个项目,是用一块5.83寸的三色屏做主控板的状态监控面板,把家里几台NAS和工控机的运行状态实时汇总显示,红色高亮异常项。整个系统已经稳定跑了一个多月,屏幕每天只刷新两次,一次在早上八点,一次在晚上六点,目前还没充过电。等这个项目再打磨一段时间,我打算把完整的硬件接线图和代码整理出来,到时候再单独写一篇分享。

The Complete Guide to Tricolor E-Paper Development: From Principles to ESP32 Practice

本文来源:http://www.hqwc.cn/news/1367976.html
若有版权问题,请来信告知:13951431913#139.com 或在右方提交评论。

I've been working on e-paper projects for quite a few years now, starting with the earliest monochrome black-and-white displays and working my way up to today's tricolor panels. Truth be told, tricolor e-paper has matured much faster over the past few years than I expected. Whether you're planning to build electronic shelf labels, meeting-room nameplates, desktop information displays, or simply want to add a low-power screen to your smart home, the "New Tricolor E-Paper Displays" direction is well worth spending some time exploring. In this article I intend to walk through the entire chain of tricolor e-paper—from underlying principles to component selection and then to hands-on development. Most of the content comes from my own hard-won experience and the mistakes I've made along the way, and I hope it helps you avoid a few detours.

1. Core Principles and Technical Background of Tricolor E-Paper

To understand tricolor e-paper, you first need to grasp how an electronic-ink panel actually works. It operates on completely different principles from LCD or OLED screens, which require a backlight or actively emit light. The core of e-paper is microcapsule electrophoretic technology—you can imagine the screen surface as being densely covered with a layer of tiny capsules, each containing positively charged white particles and negatively charged black particles suspended in a transparent fluid.

When an electric field is applied across the top and bottom of a capsule, the positively charged white particles are attracted to one side while the negatively charged black particles are pushed to the other. If the white particles are pushed to the visible surface, the pixel appears white; conversely it appears black. After the field is removed, the particles remain stably in place because they carry a charge and the surrounding fluid has viscosity—this is the famous "bistable" characteristic of e-paper.

The direct benefit of this characteristic is zero-power static display. Power is only consumed at the moment the image changes; when the image is static, the content remains clearly on the screen even with power completely cut off. This is almost identical to the experience of "ink printed on paper," and it is the fundamental reason e-paper stands out in power-sensitive applications.

The principle of black-and-white screens is easy to understand, so how does a tricolor screen produce three colors—red, black, and white—in the same pixel? I puzzled over this question for quite a while when I first encountered it.

The mainstream approach for tricolor e-paper on the market today is to add a third type of particle to the microcapsules—red particles. In other words, a single capsule contains white, black, and red particles simultaneously, each responding differently to electric fields and charges. The driver chip applies a series of voltage waveforms with specific timing, driving different particles to move at different stages, thereby achieving tricolor display.

But there's a critical technical pain point here: the migration speed and drive voltage of the red particles differ from those of the black and white particles, and the red and black/white particles in the same capsule tend to interfere with each other. As a result, the refresh process of tricolor screens is generally much slower than that of black-and-white screens. A 4.2-inch black-and-white screen takes about 2 to 3 seconds for a full refresh, while a tricolor screen of the same size may take 12 to 15 seconds. During refresh you'll see the screen flip back and forth several times like a wave—that's actually the drive waveform sequentially pushing the particles into their respective positions.

The good news is that after several years of iteration, today's tricolor screens have improved significantly over early products in color saturation, refresh speed, and ghosting control. The two most common tricolor schemes on the market are black/white/red and black/white/yellow. The red scheme is suited to eye-catching content such as warning messages, promotional labels, and low-price alerts; the yellow scheme offers higher contrast and a cleaner background, making it suitable for menus, announcements, dashboards, and other scenarios that require long periods of reading.

Having covered the principles, we should also talk about the limitations of tricolor screens, so you don't end up with unrealistic expectations once you start working with them.

In terms of color expression, tricolor screens are actually quite "plain." They have only three definite color states, no intermediate transition colors, and cannot display photo-quality images like a color LCD. The slow refresh speed also means they're unsuitable for playing video or high-frequency animation. Another easily overlooked issue is that tricolor screens almost always require a full-screen initialization with each refresh—that is, the entire screen is first refreshed to all black, then all white, and only then is the content drawn. The flickering during this process is very noticeable, so if you're using the display in crowded settings such as exhibition halls or storefronts, evaluate in advance whether it might cause visual disturbance.

So personally I think the scenarios best suited to tricolor e-paper are those applications where "content changes infrequently, but more information layers are needed than a black-and-white screen can provide." Typical examples include:

Electronic shelf labels: showing product names, prices, and promotional markers, with red numbers highlighting the size of the discount

Meeting-room nameplates: showing the room name, usage status, and booking time slots, with red used to indicate "in use" status

Smart office information displays: team KPI dashboards, attendance status, and equipment status indicators

Industrial data panels: over-temperature alarms, device-offline alerts, and low-stock warnings

Personal desktop ornaments: weather information, calendar reminders, and to-do items

The core logic is this: a device displays the same image statically for long periods, only occasionally needs updating, and uses red to emphasize key information when it does. This positioning happens to bring out all the advantages of tricolor screens while avoiding their weaknesses.

Many beginners immediately buy a screen and copy code, only to find when they're done that the result is far from what they expected. My advice is to think through the following questions before you start—they will directly determine what hardware you choose and what logic you write later.

First, how high is the refresh frequency? If your application updates two or three times a day, a tricolor screen is no problem at all; but if your use case requires refreshing every few minutes, I'd urge you to switch to a black-and-white screen or even go with LCD sooner rather than later. Frequent refreshing of a tricolor screen not only takes time, it also accelerates screen aging and causes ghosting to accumulate.

Second, how to use color. The red on a tricolor screen isn't meant to be used as a large-area background; it's better suited to point-like emphasis—for example price digits, status markers, and warning borders. If you plan to refresh the entire background to red, you'll find the actual result looks rather dark and lacks saturation, which actually hurts the readability of the information.

Third, how to balance screen size and resolution. Common tricolor screens on the market come in sizes such as 1.54-inch, 2.13-inch, 2.9-inch, 4.2-inch, 5.83-inch, and 7.5-inch. The larger the size, the higher the resolution—but the longer the refresh time and the greater the drive current. For prototyping, 2.13-inch and 4.2-inch are the two specs with the lowest entry cost: plenty of documentation, good library support, and relatively low prices.

Fourth, whether there's any need for interaction. If you're only displaying information, one-way push is fine; if you need button presses to switch pages, then you'll need to account for button input and page-management logic. All of these affect your choice of main controller and your code architecture.

When choosing a tricolor screen, don't look only at size and resolution—pay closer attention to which driver chip it uses. Different chips differ in instruction sets, LUT configuration, and drive waveforms, so code is not fully interchangeable.

Among the projects I've done and the problems I've helped followers troubleshoot, the following driver chips come up most frequently:

Among these, I want to specifically mention the SSD1681 and SSD1680 chips. The SSD1681 supports both black/white/red tricolor and black/white two-color modes; the datasheet explicitly states that in tricolor mode it supports 1bpp black-and-white plus 1bpp red, for a total of 2bpp of data. The SSD1680 is an older chip that also supports tricolor, but its driver registers and waveform configuration are not exactly the same as the SSD1681's. If you're developing with Arduino or ESP32, I'd recommend choosing the SSD1681 or a newer chip first, because the mainstream GxEPD2 library has the most complete support for these two chips, and you'll find the most example code online.

Here's another tip when choosing a screen: go for a module with an FPC ribbon-cable connector rather than a bare panel. Bare panels have very fine pin pitch, making hand-soldering extremely painful, and e-paper is fairly sensitive to static electricity, so the risk of damaging the screen during soldering is high. Modular screens generally build the voltage-conversion and level-shifting circuits onto the board, so you can connect them to the main controller directly with Dupont wires—much friendlier for beginners.

Once you've chosen the screen, next comes the main controller. Tricolor e-paper itself doesn't place high demands on the controller's computing power—after all, image processing is mostly done by a host computer or an offline script, and the controller is at most responsible for SPI communication and simple moving of bitmap data. But that doesn't mean you can pick just anything, because your application scenario determines which peripheral capabilities the controller needs.

In my tricolor-screen projects, the three most common controller options are:

Arduino Uno/Nano: suitable for pure learning, verifying that the screen can light up, and getting basic drivers working. AVR chips have low clock speeds and little memory; a full bitmap for a large screen (for example a 7.5-inch 800x480 2bpp image is 80KB) won't fit into 2KB of RAM, so you can only read and send it piece by piece from Flash, which is rather painful to work with. So I'd recommend using Arduino only for playing with small-screen displays.

ESP32: this is the option I personally recommend most. Dual-core 240MHz, 520KB SRAM, with built-in WiFi and Bluetooth, it can pull data directly from a server and then refresh the screen. 4MB or even 16MB of Flash can store multiple sets of image assets. The full image data of tricolor screens from 2.13-inch to 4.2-inch can all be manipulated in memory, making for a much better development experience.

STM32: if you're moving into mass production and want stability and industrial-grade reliability, the STM32L0/L4 series is a good choice. It has excellent low-power performance, with dedicated LPTIM and RTC that can wake the chip on a timer from sleep mode. However, the development barrier is a bit higher, and the ecosystem of debugging tools and libraries isn't as convenient as ESP32's.

In terms of communication, tricolor e-paper screens themselves almost all use the SPI interface, with just four data lines—SCLK, DIN, CS, and DC—plus a BUSY signal line and an RST reset line. How the main controller obtains data depends on your application: for indoor scenarios WiFi is the most convenient; for outdoor or long-distance scenarios you can choose LoRa or 4G Cat.1; and purely local offline applications need no wireless communication at all—an SD card or keypad input works fine.

The bulk of a tricolor e-paper device's power consumption lies not in displaying the image but in the refresh process. When the screen is static, the whole device can draw only tens of microamps or even less; but once refresh begins, the driver chip must internally boost voltage to plus/minus 15V–25V to drive the electronic-ink particles, and the instantaneous current can reach tens of milliamps.

If you're powering the device with a battery, here are a few points to keep in mind:

The screen module's VCC must not be connected directly to a lithium battery. It must go through voltage regulation to stabilize the voltage at 3.3V. Many modules have regulation and level shifting built in, but it's best to confirm the module's supply-voltage range.

The instantaneous current demand during refresh is fairly large, so it's advisable to place a roughly 100uF electrolytic capacitor and a 0.1uF ceramic capacitor in parallel on the power line, to prevent voltage droop caused by high current from leading to a failed refresh.

Before the main controller enters deep sleep, make absolutely sure the screen refresh process has finished—that is, the BUSY signal has been pulled low. If you cut power while the screen is still busy, at best the refresh is interrupted; at worst the screen develops ghosting or even displays garbage.

If you need to use it outdoors in direct sunlight, also pay attention to the operating temperature range. Most e-paper operates from 0 to 50 degrees Celsius; outside this range the particle migration speed slows down and the refresh result is affected.

3. Key Details: Tricolor Screen Drive Flow and Image Processing

The biggest difference between driving a tricolor screen and a black-and-white screen is that the refresh flow has one extra stage. Taking the SSD1681 as an example, the refresh flow for a black-and-white screen is roughly: initialize -> write LUT -> send black-and-white bitmap -> send refresh command -> wait for BUSY to clear. A tricolor screen adds a step on top of this: you must write the black-and-white bitmap and the red bitmap separately, and the drive waveform executes in two phases.

The first phase drives the black and white particles, pushing the black-and-white content and grayscale blocks into place; the second phase drives the red particles, pushing the red content to the display surface. Because the red particles respond slowly, the entire drive waveform is stretched out, so a tricolor screen's refresh time is double or even triple that of a black-and-white screen.

Initialize the screen, configuring resolution, scan direction, and border width

Send the DRF (Display Refresh) command to trigger the drive waveform

There's a very easy-to-hit pitfall here: the RAM layout of a tricolor screen differs from that of a black-and-white screen. Inside the SSD1681 there are two independent RAM areas—one for black/white and one for red—with different address spaces, so the mapping must be exact when writing data. If you get the offset wrong, the colors shown on the screen will be scrambled.

Understanding the data format of a tricolor screen is crucial for the image processing that follows.

A black-and-white screen needs only 1 bit per pixel—0 for white, 1 for black. A tricolor screen needs to represent three states; with pure binary encoding, 2 bits can represent four states, namely 0–3. But the hardware design of tricolor screens on the market usually doesn't place a pixel's 2 bits consecutively together; instead it uses two independent bit planes: a black/white bit plane and a red bit plane.

So when you write the driver code, what you actually need to do is prepare two separate bitmap arrays: one for black/white data and one for red data. When sending the image, send the black/white array first and the red array second (the exact order depends on the driver chip's datasheet). Some older libraries' APIs accept only a single complete tricolor bitmap and internally split it into two planes for you, but understanding the underlying logic will help you troubleshoot many tricky problems.

In real projects, the image assets you have are basically full-color JPG or PNG files that need to be converted into a format the tricolor screen can display. The core logic of the conversion comes down to one sentence: classify pixels that are close to red as red, and split the rest into black and white using a grayscale threshold.

It sounds simple, but there's a knack to doing it well. The red produced by a tricolor screen's red particles is actually rather dark, a brick red, quite different from the vivid pure red on a computer screen. If you simply judge a pixel as red whenever its R value is the highest among RGB, the converted image often turns into a muddy mess.

First scale the image to the screen resolution—for a 4.2-inch screen, 400x300

When judging red, set two thresholds: in RGB, the R channel must be significantly higher than G and B—for example R > 140 and R - G > 60 and R - B > 60—while the absolute value of the R channel itself must be high enough

For pixels that don't meet the red condition, convert to grayscale and then split into black and white with a threshold—a common threshold is between 128 and 160

For areas with grayscale gradients, it's recommended to use Floyd-Steinberg dithering or ordered dithering to avoid visible color-block banding

Here's an easily overlooked point: it's best to do red-threshold judgment in a color space. Pure RGB thresholds are very sensitive to lighting and color cast; if possible, first convert the image to the HSV or Lab color space, define the red range in the hue dimension, and then combine it with saturation for judgment. Using Python's PIL library or OpenCV to do this conversion is very convenient, and I'll give a ready-to-use script below.

The refresh timing of a tricolor screen is a link that many beginners overlook but that has serious consequences. The tricolor driver chip requires a full-screen clearing operation before every complete refresh—in practice, the screen first turns all black, then all white, and only gradually displays the content at the end. This is not only to return the particles to their initial positions, but also to fully separate the red particles from the black and white ones; otherwise residue from the previous frame would be very obvious.

So when writing code, don't omit the screen-clearing step between two refreshes. Some driver libraries automatically include a clear with every full refresh by default, but if you manually modify the LUT or skip certain steps in order to shorten refresh time, ghosting problems will come knocking.

In addition, the tricolor screen's drive waveform has fairly high requirements for power-supply stability. If the supply voltage fluctuates during refresh, particles may stop mid-way, and the image appears in a gray, "half-ghosted" state. That's also why I emphasized earlier the need to add decoupling capacitors in parallel in the power design.

4. Hands-On: From Wiring to Displaying a Complete Image

Let me use an ESP32 plus a 4.2-inch tricolor screen (SSD1683 or IL0398) as an example to demonstrate the most basic wiring. Pin definitions can differ slightly between modules, so before wiring be sure to check the schematic of your own particular screen. The table below shows the connection scheme I most commonly use:

This 4.2-inch screen module has regulation and level shifting built in, so it can be connected directly to 3.3V. With a bare panel, you'd have to build the boost and level-shifting circuits yourself, so I don't recommend that beginners start with a bare panel.

For the code I use the GxEPD2 library, currently the most actively maintained and best-compatible e-paper driver library in the community, supporting the vast majority of tricolor screens on the market. After installing the library in the Arduino IDE, a most basic display routine takes just a dozen or so lines of code:

This example does three things: initializes the screen, calls firstPage() and nextPage() for paged drawing, and uses setTextColor to set black text and red text respectively. The GxEPD2 library internally handles the split between the black/white bitmap and the red bitmap automatically, so you only need to focus on the drawing API.

If you're using a smaller 2.13-inch or 1.54-inch screen, remember to change GxEPD2_420 to the corresponding model class name; every model has its definition in the library files, so just change it accordingly.

Displaying text is only the first step; in real projects you'll more often need to put brand logos, product images, and tabular data onto the screen. Let me recommend an image-processing toolchain I've used for a long time—command line plus batch processing is very convenient.

If you just need to convert a single image simply, ImageMagick's command line is the easiest:

The first command generates the black-and-white layer: first force-scale the image to 400x300, convert to grayscale, then cut into black and white at a 50% threshold. The second command generates the red layer: first fill all non-red areas of the image with white, then fill the red areas with black, producing a mask containing only the red regions. The two BMP files, combined with the GxEPD2 library's drawBitmap function, can then be sent directly to the screen.

If the image content is fairly complex, or you want to use a script for batch processing, I'd recommend using Python's PIL library:

This script wraps the red-detection logic in a function so you can easily tune the thresholds. Note that in a PIL "1"-mode bitmap, 0 is black and 1 is white, which corresponds exactly to the value logic of drawBitmap in the GxEPD2 library. If you find the colors are inverted, just swap 0 and 1.

When building a tricolor-screen application, if you don't do low power well, you'll be wasting the core value of e-paper. Below I'll use ESP32 deep sleep plus timer wake-up to demonstrate a typical low-power display cycle.

The essence of this code is: finish the screen refresh first, then enter deep sleep, and set the sleep duration to the moment the data next needs refreshing. During refresh the ESP32 runs at full speed, drawing about 100mA for a dozen or so seconds; after refreshing it enters deep sleep, dropping to around 10uA. If you only refresh four times a day, the average power consumption is very low, and running two AA batteries for more than half a year is entirely achievable.

Of course, in a real project you'll need to fetch data from the network, so you can't just refresh directly in setup(). Instead, you connect to WiFi to pull data, process the image, then refresh, and finally sleep. The whole flow must complete within the wake cycle, and you need fallback logic for timeouts to prevent the device from going to sleep halfway through a screen refresh.

Symptom: the code runs, but the screen stays blank white with no refresh activity at all.

Troubleshooting direction: first check the power supply. Use a multimeter to measure whether the voltage from the screen's VCC to GND is stable at 3.3V; if the voltage is low or fluctuating, it's most likely a power problem. Second, check the wiring—especially the three lines CS, DC, and BUSY; a wrong or loose connection means the controller sends commands but the screen doesn't receive them. Third, check whether initialization succeeded: when GxEPD2's init() fails it usually prints an error message over the serial port, so watch the serial output.

Another easily overlooked point: common ground between the ESP32 and the screen module. If you power the ESP32 via USB and the screen from a separate supply, and the GND of the two supplies isn't connected together, the SPI signals will go haywire because the reference grounds differ. The solution is to have all devices share a single GND.

Symptom: the code clearly specifies red text, but the screen shows it as black, or black specks appear in the red areas.

Troubleshooting direction: most likely the red bitmap data wasn't written correctly, or the write order is reversed. The SSD1681 requires writing the black/white RAM area first and the red RAM area second; some driver libraries wrap them in a different order, so you may need to adjust the sending order. Another cause is lax red-threshold judgment—areas that should be white are misclassified as red, and overlapping with black they look like a muddy color. Use the Python script above to print out red_layer.bmp and see whether the mask is clean.

Symptom: during refresh the screen flips back and forth like waves, but much more violently than normal, and may even show garbage.

Troubleshooting direction: this is a normal phenomenon during a tricolor screen refresh, but if it's especially violent, the LUT configuration may be abnormal. Many libraries allow custom waveform LUTs; if you copied custom LUT code from the web, comment it out first and run once with the library's default LUT. Also, if there's a high-power motor or switching power supply nearby during refresh, electromagnetic interference can also make the waveform abnormal—shortening the SPI cable length somewhat will help.

Symptom: after a certain area of the screen has been updated, the outline of the old content remains on the screen and can't be removed no matter how much you refresh.

Troubleshooting direction: tricolor screens are inherently unsuitable for partial refresh. Unlike black-and-white screens, they don't have a mature set of partial-refresh waveforms; forcing a partial refresh creates permanent ghosting because the particles aren't fully driven to their endpoint positions. My advice is to give up on partial refresh and do a full-screen refresh with every update. If you really need partial updates, you can design the layout so the update area is always the same region—for example, concentrate the changing content in a fixed rectangle and leave other areas unchanged. That way, even with a full refresh each time, the visual impact is much smaller.

Symptom: halfway through displaying, the program gets stuck in the loop waiting for BUSY, and the screen doesn't move at all.

Troubleshooting direction: the most common cause of this is a supply-voltage droop during refresh. Check whether the battery voltage is sufficient and whether the boost circuit is working properly. Another possibility: you performed a reset on the screen during refresh, causing the driver chip to enter an abnormal state. Make sure the reset pin is pulled low only during initialization and isn't touched during refresh.

Also, if you're using an ESP32, check the SPI clock frequency. Tricolor driver chips generally support SPI clocks up to around 20MHz, but some modules have long board traces, and setting it too high easily causes communication errors. I usually set it between 4MHz and 8MHz, which balances stability and speed.

The most obvious change in tricolor e-paper over the past few years is the maturity of driver libraries and toolchains. When I first worked with a 2.13-inch tricolor screen in 2019, just tuning the drive waveform took me two or three days; now it's a matter of a few lines of code. If you're new to this area, I'd suggest going straight with the GxEPD2 library plus ESP32—this combination is currently the path with the lowest trial-and-error cost.

If you're really going to make a product, I'd add one extra reminder: run a burn-in test as soon as you get the screen. Refresh the screen continuously 50 to 100 times and observe whether the image is stable after each refresh and whether any gradual ghosting appears. Tricolor screens are fairly sensitive to driver-chip quality control and ink batches; screens of the same model from different batches may differ slightly in display quality. Figuring this out before mass production can save you from a large amount of rework later.

If you want to expand later, there are several interesting directions to play with here: first, build a multi-screen synchronized display system, using ESP-NOW or MQTT for data synchronization, with dozens of screens forming an information matrix—ideal for wayfinding in stores or exhibition halls; second, bring in sensor data, displaying temperature, humidity, and air quality in real time on your desk, with red alert thresholds—a very practical low-power environmental monitoring station; third, take advantage of e-paper's flexible packaging to make curved displays—though flexible screens are relatively expensive and the refresh waveform needs retuning, making this a more advanced challenge.

One project I'm currently tinkering with is a status-monitoring panel for my main control board using a 5.83-inch tricolor screen, aggregating and displaying the real-time running status of several NAS units and industrial PCs at home, with abnormal items highlighted in red. The whole system has been running stably for over a month now, with the screen refreshing only twice a day—once at 8 a.m. and once at 6 p.m.—and it hasn't been charged yet. After I've polished this project a bit longer, I plan to organize the complete hardware wiring diagram and code, and write a separate article to share it then.

暂无评论,快来发表第一条评论吧!No comments yet. Be the first!

📮 需求咨询📮 Inquiry