GitHub 开源 ESP32 墨水屏天气站:14μA 待机,一块电池用一年GitHub Open-Source ESP32 E-Paper Weather Station: 14μA Standby, One Battery Lasts a Year


AI free token/AI免费积分
GitHub 开源 ESP32 墨水屏天气站:14μA 待机,一块电池用一年

本文来源:https://mp.weixin.qq.com/s/Bypf3g2qsviub67x79xe6g
若有版权问题,请来信告知:13951431913#139.com 或在右方提交评论。

有一类设备,买了就该忘了它的存在。天气站就是。

可市面上的电子天气站,要么难看,要么半年换一次电池,要么天天让你看它连不联网。

esp32-weather-epd (lmarzen/esp32-weather-epd[1], 6252 Star , GPL-3.0 )把这三件事一起应对: 7.5 寸墨水屏表明天气,平时功耗 14μA,一块 5000mAh 电池跑 6-12 个月。

constint SLEEP_DURATION =30;   // 每 30 分钟醒一次,刷完就睡

就这一行,是它「不吃电」的全部秘密。记住一句:装完放那,一年不用管它。

14μA 是怎么做到的

墨水屏的原理是「刷一次,永久表明」。它不像液晶屏那样需要持续供电刷新,画面写上去就停在那,断电也不消失。

所以这颗 ESP32 绝大部分时间在深度睡眠:

状态
功耗
说明
休眠
~14μA
默认每 30 分钟醒一次
刷新时
~83mA
一次刷新约 15 秒
静态功耗
可再降 500μA
剪掉 FireBeetle 的低功耗焊盘

换算一下: 5000mAh 电池,平时 14μA 深度睡眠,每天刷 48 次,每次 15 秒,官方给的是 6-12 个月。这个数字不夸张——刷新才是唯一的耗电大户,其余时间几乎不耗。

物料清单:四样东西,五十块钱

门槛低在物料少,而且兼容免焊接(用杜邦线):

物料
型号
说明
主控
FireBeetle 2 ESP32-E
低功耗外观, USB-C 充电,带电池管理
墨水屏
Waveshare 7.5 寸 e-Paper v2
800×480 黑白,官方建议
驱动板
DESPI-C02
屏和 ESP32 之间的桥
传感器
BME280
室内温湿度气压, 3.3V/5V 兼容

其他:一块 3.7V LiPo 电池( JST-PH2.0 接口)、几根杜邦线。要不要焊枪,取决于你买不带针脚的版本——带针脚的直接插线。

显示屏型号要留意: v2 是 800×480 黑白,还有 3 色(红黑白)和 7 色版本,刷新时间会变长、更耗电。分辨率相同,但项目对老 v1 ( 640×384 )只给出有限兼容,买 v2 最省心。

接线:三根线加一个拨码开关

连接逻辑很简单:墨水屏驱动板接 ESP32 的 SPI 口, BME280 接 I2C 。

三个最容易踩的坑全在这步:

1.DESPI-C02 上有个物理拨码开关,必须拨到 0.47 位置,显示屏才会亮。不拨就白屏,这是 Issue 区第一高频难题。
2.Waveshare 的驱动 HAT ( rev 2.2/2.3 )有两个开关: Display Config 拨到 B, Interface Config 拨到 0。 README 明确说 2.3 版加了个 PWR 引脚,要接 3.3V 。
3.JST-PH2.0 的极性不统一。电池插上先量一下,反了会烧——README 用加粗警告写这条,不是开玩笑。

规格:一个文件改完,点一下上传

项目用 PlatformIO 管理,装个 VSCode + PlatformIO 插件就行。所有规格集中在 platformio/src/config.cpp:

// WiFiconstchar*WIFI_SSID     ="ssid";constchar*WIFI_PASSWORD ="password";// OpenWeatherMap API key(免费申请)const String OWM_APIKEY   ="abcdefghijklmnopqrstuvwxyz012345";const String OWM_ENDPOINT ="api.openweathermap.org";// 你的坐标const String LAT  ="40.7128";const String LON  ="-74.0060";const String CITY_STRING ="New York";// 刷新间隔(分钟)constint SLEEP_DURATION =30;

改完这几行,连接 ESP32 ,点 VSCode 底部的上传箭头, PlatformIO 自动下载依赖、编译、烧录。

表明内容很全:当前温度、体感、湿度、气压、风速、 AQI 空气质量,右下角一张 12 小时温度曲线 + 降水概率图,再往边上一块能看云图的小地图。整屏天气图标来自 Weather Icons 开源字体,视觉很统一。

那个能免费用的 API

数据源是 OpenWeatherMap ,免费注册就能拿 key 。有个细节很多人第一次卡住:项目用两个 API ( One Call 3.0 和 Air Pollution ),而 One Call 3.0 在免费账号里要走一次「订阅」流程——即使免费也要点订阅按钮激活。

README 给了防扣费操作:订阅后把每日调用上限设成 1,000 次,这样永远不会超限。按 30 分钟刷一次、一天 48 次调用算, 1,000 次绰绰有余。

踩坑清单

翻 Issues 和官方文档,高频难题集中在:

1.显示屏完全黑屏。九成是拨码开关位置不对,或 Waveshare HAT 的 PWR 引脚没接 3.3V ( rev 2.3 新增)。对照接线图逐根查。
2.低电量提示 "Low Battery"。电池低于 3.2V 会表明这个错误页并停刷。别慌,充电即可;低于 3.0V 会进 hibernate ,要按 RST 手动唤醒。
3.WiFi 表明 "SSID Not Available"。多半是 SSID 拼写错或距离太远,固件每 30 分钟重试一次。
4.API 表明 401 Unauthorized。 key 不对,或 One Call 3.0 没完成免费订阅激活。
5.高降雨概率日子整屏比较度变差。 Issue #62 是个真 Bug :降雨概率图的绘制方式在某些日子让整个显示屏比较度下降,作者定位后把图的像素间距改了。

它是天气站,不是信息屏

把边界说清楚:它表明固定布局的天气数据,不能像乐高那样随便摆组件。刷新最快也是分钟级——想拿它当秒表、滚动新闻,是用错方向了。

它也不需要一直联网。刷完数据就睡, WiFi 只在每次唤醒时连一下。家里 WiFi 偶尔抽风,它自己重试,不影响表明已有的数据。

另一个现实难题是,国内访问 OpenWeatherMap 偶尔不稳定。 README 里的错误页( WiFi/API/Time Server )就是为这种环境外观的:它把难题直接画在显示屏上告诉你,不用猜。

装完那一刻,显示屏上自己城市的天气刷出来,然后它就安静地睡过去。这种「做完了就忘了它」的感觉,是低功耗设备最大的浪漫。放三年,它只在你需要看天气的时候醒一次。

#ESP32 #墨水屏 #天气站 #低功耗 #DIY


参考链接

[1] lmarzen/esp32-weather-epd: https://github.com/lmarzen/esp32-weather-epd

Source: https://mp.weixin.qq.com/s/Bypf3g2qsviub67x79xe6g If there are copyright issues, please email: 13951431913#139.com or submit a comment on the right.

There's a type of device that you buy and then forget it exists. Weather stations are like that.

But electronic weather stations on the market are either ugly, require battery changes every six months, or constantly make you check if they're connected to the internet.

esp32-weather-epd (lmarzen/esp32-weather-epd [1], 6252 stars, GPL-3.0) tackles all three: a 7.5-inch e-paper screen shows the weather, with a power consumption of 14 µA in idle mode, allowing a 5000 mAh battery to last 6-12 months.

This line holds the secret to its energy efficiency. Remember this: Install it and leave it alone for a year.

How is 14 µA achieved?

E-paper works on the principle of "write once, display forever." Unlike LCD screens that require continuous power to refresh, e-paper retains the image even after the power is cut off.

Therefore, this ESP32 spends most of its time in deep sleep:

State

Power Consumption

Explanation

Sleep

~14 µA

Wakes up every 30 minutes by default

Refreshing

~83 mA

A single refresh takes about 15 seconds

Static power consumption

Can be reduced to 500 µA

By cutting the low-power pads on the FireBeetle

To put it in perspective: with a 5000 mAh battery, spending 14 µA in deep sleep and refreshing 48 times a day (each time for 15 seconds), the official estimate is 6-12 months. This number is realistic because the only significant power drain is during the refresh; the rest of the time, very little energy is consumed.

Parts List: Four Items, Fifty Dollars

The barrier to entry is low because the component count is small, and it supports solderless assembly (using Dupont lines):

Component

Model

Description

Controller

FireBeetle 2 ESP32-E

Low-power board, USB-C charging, battery management

E-paper screen

Waveshare 7.5" e-Paper v2

800x480 black and white, recommended by the manufacturer

Driver board

DESPI-C02

Bridge between the screen and the ESP32

Sensor

BME280

Indoor temperature, humidity, and pressure, compatible with 3.3V/5V

Other: A 3.7 V LiPo battery (JST-PH2.0 connector) and several Dupont lines. Whether you need a soldering iron depends on if you bought the version without headers; if you have headers, you can plug them in directly.

Note the screen model: v2 is 800x480 black and white. There are also 3-color (red, black, white) and 7-color versions, which have longer refresh times and higher power consumption. While the resolution is the same, the project only offers limited compatibility with the older v1 (640x384), so buying v2 is the safest option.

Wiring: Three Wires Plus a DIP Switch

The connection logic is simple: the e-paper driver board connects to the ESP32's SPI port, and the BME280 connects to the I2C port.

Here are three common pitfalls:

1. The DESPI-C02 has a physical DIP switch that must be set to the 0.47 position for the display to light up. If the switch is in the wrong position, the screen will be blank—this is the most frequently reported issue.

2. On the Waveshare driver HAT (rev 2.2/2.3), there are two switches: the Display Config must be switched to B, and the Interface Config must be switched to 0. The README specifically mentions that rev 2.3 has a PWR pin that needs to be connected to 3.3V.

3. The polarity of the JST-PH2.0 connector is inconsistent. You should measure the battery voltage before plugging it in; if the polarity is reversed, it will burn out the device. The README highlights this danger with bold text.

Configuration: Change a File, Click Upload

The project uses PlatformIO, so installing VSCode with the PlatformIO extension is sufficient. All configurations are concentrated in platformio/src/config.cpp:

Once these lines are modified, connect the ESP32 and click the upload arrow at the bottom of VSCode. PlatformIO will automatically download dependencies, compile, and flash the device.

The display content is comprehensive: current temperature, perceived temperature, humidity, pressure, wind speed, AQI air quality, a 12-hour temperature curve, precipitation probability, and a small map for cloud images. The weather icons are sourced from the Weather Icons open-source font, ensuring visual consistency.

The Free API

The data source is OpenWeatherMap, which requires a free registration to obtain a key. A common stumbling block is that the project uses two APIs (One Call 3.0 and Air Pollution), and One Call 3.0 requires a "subscription" to be activated in the free account—even if it's free, you must click the subscribe button.

The README provides an operation to prevent overcharging: after subscribing, set the daily call limit to 1,000. With a refresh rate of every 30 minutes (48 calls per day), 1,000 calls is more than enough.

Troubleshooting Checklist

Looking at the Issues section and the official documentation, these are the high-frequency problems:

1. The screen is completely blank. This is usually caused by the DIP switch being in the wrong position or the PWR pin on the Waveshare HAT not being connected to 3.3V (for rev 2.3). Check the wiring diagram line by line.

2. The "Low Battery" message is displayed. This appears when the battery voltage drops below 3.2 V, and the device stops refreshing. It is resolved by charging; falling below 3.0 V triggers hibernate mode, requiring a manual reset.

3. The WiFi indicator says "SSID Not Available." This typically implies that the SSID is misspelled or the device is too far from the router; the firmware retries every 30 minutes.

4. The API returns a 401 Unauthorized error. This means the key is incorrect or the One Call 3.0 subscription was not activated.

5. The display quality degrades on days with high rainfall probability. Issue #62 identifies a bug where the rendering of the precipitation probability graph reduces the overall contrast of the screen on busy days; the author has since adjusted the pixel spacing of the graph.

It's a Weather Station, Not an Information Screen

It's important to clearly define the boundaries of this device: it displays a fixed layout of weather data and cannot be customized like LEGO blocks to show arbitrary information. The refresh rate is only on the order of minutes, meaning it is not suitable for tasks that require real-time updates, such as timing or scrolling news.

It does not need to be constantly online either. After updating the data, it sleeps. The WiFi connection is only used during the initialization phase of each wake-up cycle. If the home WiFi fails temporarily, the device handles the errors gracefully, displaying the last known good data while attempting to reconnect.

Another practical consideration is that access to OpenWeatherMap from China can be unreliable. The error pages listed in the README (for WiFi, API, and Time Server failures) are specifically designed for these scenarios, allowing the device to clearly communicate the problem to the user without guesswork.

The moment you install it and see the weather for your city appear on the screen, followed by the device quietly sleeping, is the true allure of low-power devices. It doesn't demand attention; it waits patiently, waking up only when you need it.

#ESP32 #E-paper #WeatherStation #LowPower #DIY

Reference Links

[1] lmarzen/esp32-weather-epd: https://github.com/lmarzen/esp32-weather-epd

GitHub Open-Source ESP32 E-Paper Weather Station: 14μA Standby, One Battery Lasts a Year

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

📮 需求咨询📮 Inquiry