Skip to content

Commit 322bcea

Browse files
authored
Merge pull request #56 from vroland/v5
V5
2 parents ddb2732 + 8914285 commit 322bcea

37 files changed

+54693
-36623
lines changed

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
[submodule "hardware/epaper-breakout/esp32-wrover-kicad"]
22
path = hardware/epaper-breakout/esp32-wrover-kicad
33
url = https://github.com/aliafshar/esp32-wrover-kicad
4+
[submodule "hardware/epaper-breakout/tp4056"]
5+
path = hardware/epaper-breakout/tp4056
6+
url = https://github.com/alltheworld/tp4056/

README.md

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,29 @@ Ready-made DIY modules for this size and with 4bpp (16 Grayscale) color support
1313

1414
The EPDiy driver board targets multiple E-Paper displays. As the driving method for all matrix-based E-ink displays seems to be more or less the same, only the right connector and timings are needed. The EPDiy PCB v4 features a 33pin and a 39pin connector, which allow to drive the following display types: ED097OC4, ED060SC4, ED097TC2. With the upcoming revision v5, even more display types will be supported! For details, refer to the table below.
1515

16+
Revision 5 of the board is optimized for the use with LiPo batteries, featuring a LiPo charger and ultra-low deep sleep current.
1617

1718
Building It
1819
-----------
1920

2021
If you want to build a board right now, there are two possible routes:
21-
- Use the new v2 PCB (`hardware/epaper-breakout/gerbers_v4.zip`). This is a bit more fresh, but should work.
22+
23+
- Use the new v5 PCB (`hardware/epaper-breakout/gerbers_v5.zip`).
24+
**So far, I only tested a prototype of it. The newest gerbers should work, but are untested!**
25+
**If you have tested them, please let me know!**
26+
The BOM is available at (`hardware/epaper-breakout/BOM.csv`).
27+
Positioning files for SMT assembly are available at (`hardware/epaper-breakout/gerbers/epaper-breakout-top-pos.csv`).
28+
Please double check the part positioning and Rotation with your assembly service!
29+
More information on the order process and where to find parts is in the [documentation](https://epdiy.readthedocs.io/en/latest/getting_started.html#getting-your-board).
30+
31+
Make sure to select the `V5` board revision in `idf.py menuconfig` when building the examples.
32+
33+
- Use the old v4 PCB (`hardware/epaper-breakout/gerbers_v4.zip`). This is a bit more fresh, but should work.
2234
The BOM is available at (`hardware/epaper-breakout/BOM.csv`).
2335
Positioning files for SMT assembly are available at (`hardware/epaper-breakout/gerbers/epaper-breakout-top-pos.csv`).
2436
Please double check the part positioning and Rotation with your assembly service!
2537

2638
Make sure to select the `V4` board revision in `idf.py menuconfig` when building the examples.
27-
- Use the original v2 PCB (`hardware/epaper-breakout/gerbers_v2_rev0.zip`).
28-
However, you might run into issue #3 with some selections of parts.
29-
30-
Make sure to select the `v2/v3` board revision in `idf.py menuconfig` when building the examples.
3139

3240
Gettings Started
3341
----------------

components/epd_driver/Kconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,8 @@ menu "E-Paper Driver"
3939

4040
config EPD_BOARD_REVISION_V4
4141
bool "epdiy v4"
42+
43+
config EPD_BOARD_REVISION_V5
44+
bool "epdiy v5"
4245
endchoice
4346
endmenu

components/epd_driver/config_reg_v4.h

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
#include "ed097oc4.h"
22

33
typedef struct {
4+
#if defined(CONFIG_EPD_BOARD_REVISION_V5)
5+
bool power_enable : 1;
6+
#else
47
bool power_disable : 1;
8+
#endif
59
bool power_enable_vpos : 1;
610
bool power_enable_vneg : 1;
711
bool power_enable_gl : 1;
@@ -12,7 +16,11 @@ typedef struct {
1216
} epd_config_register_t;
1317

1418
static void config_reg_init(epd_config_register_t *cfg) {
19+
#if defined(CONFIG_EPD_BOARD_REVISION_V5)
20+
cfg->power_enable = false;
21+
#else
1522
cfg->power_disable = true;
23+
#endif
1624
cfg->power_enable_vpos = false;
1725
cfg->power_enable_vneg = false;
1826
cfg->power_enable_gl = false;
@@ -39,14 +47,23 @@ static void IRAM_ATTR push_cfg(const epd_config_register_t *cfg) {
3947
push_cfg_bit(cfg->power_enable_gl);
4048
push_cfg_bit(cfg->power_enable_vneg);
4149
push_cfg_bit(cfg->power_enable_vpos);
50+
#if defined(CONFIG_EPD_BOARD_REVISION_V5)
51+
push_cfg_bit(cfg->power_enable);
52+
#else
4253
push_cfg_bit(cfg->power_disable);
54+
#endif
4355

4456
fast_gpio_set_hi(CFG_STR);
57+
fast_gpio_set_lo(CFG_STR);
4558
}
4659

4760
static void cfg_poweron(epd_config_register_t *cfg) {
4861
// POWERON
62+
#if defined(CONFIG_EPD_BOARD_REVISION_V5)
63+
cfg->power_enable = true;
64+
#else
4965
cfg->power_disable = false;
66+
#endif
5067
push_cfg(cfg);
5168
busy_delay(100 * 240);
5269
cfg->power_enable_gl = true;
@@ -77,7 +94,15 @@ static void cfg_poweroff(epd_config_register_t *cfg) {
7794
cfg->power_enable_vneg = false;
7895
push_cfg(cfg);
7996
busy_delay(100 * 240);
97+
98+
cfg->ep_stv = false;
99+
cfg->ep_output_enable = false;
100+
cfg->ep_mode = false;
101+
#if defined(CONFIG_EPD_BOARD_REVISION_V5)
102+
cfg->power_enable = false;
103+
#else
80104
cfg->power_disable = true;
105+
#endif
81106
push_cfg(cfg);
82107
// END POWEROFF
83108
}

components/epd_driver/ed097oc4.c

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#if defined(CONFIG_EPD_BOARD_REVISION_V2_V3) || defined(CONFIG_EPD_BOARD_REVISION_LILYGO_T5_47)
99
#include "config_reg_v2.h"
1010
#else
11-
#if defined(CONFIG_EPD_BOARD_REVISION_V4)
11+
#if defined(CONFIG_EPD_BOARD_REVISION_V4) || defined(CONFIG_EPD_BOARD_REVISION_V5)
1212
#include "config_reg_v4.h"
1313
#else
1414
#error "unknown revision"
@@ -36,25 +36,28 @@ void IRAM_ATTR busy_delay(uint32_t cycles) {
3636
}
3737

3838
inline static void IRAM_ATTR push_cfg_bit(bool bit) {
39-
fast_gpio_set_lo(CFG_CLK);
39+
gpio_set_level(CFG_CLK, 0);
4040
if (bit) {
41-
fast_gpio_set_hi(CFG_DATA);
41+
gpio_set_level(CFG_DATA, 1);
4242
} else {
43-
fast_gpio_set_lo(CFG_DATA);
43+
gpio_set_level(CFG_DATA, 0);
4444
}
45-
fast_gpio_set_hi(CFG_CLK);
45+
gpio_set_level(CFG_CLK, 1);
4646
}
4747

4848
void epd_base_init(uint32_t epd_row_width) {
4949

5050
config_reg_init(&config_reg);
5151

5252
/* Power Control Output/Off */
53+
PIN_FUNC_SELECT(GPIO_PIN_MUX_REG[CFG_DATA], PIN_FUNC_GPIO);
54+
PIN_FUNC_SELECT(GPIO_PIN_MUX_REG[CFG_CLK], PIN_FUNC_GPIO);
55+
PIN_FUNC_SELECT(GPIO_PIN_MUX_REG[CFG_STR], PIN_FUNC_GPIO);
5356
gpio_set_direction(CFG_DATA, GPIO_MODE_OUTPUT);
5457
gpio_set_direction(CFG_CLK, GPIO_MODE_OUTPUT);
5558
gpio_set_direction(CFG_STR, GPIO_MODE_OUTPUT);
5659

57-
#if defined(CONFIG_EPD_BOARD_REVISION_V4)
60+
#if defined(CONFIG_EPD_BOARD_REVISION_V4) || defined(CONFIG_EPD_BOARD_REVISION_V5)
5861
// use latch pin as GPIO
5962
PIN_FUNC_SELECT(GPIO_PIN_MUX_REG[V4_LATCH_ENABLE], PIN_FUNC_GPIO);
6063
ESP_ERROR_CHECK(gpio_set_direction(V4_LATCH_ENABLE, GPIO_MODE_OUTPUT));
@@ -124,7 +127,7 @@ static inline void latch_row() {
124127
config_reg.ep_latch_enable = false;
125128
push_cfg(&config_reg);
126129
#else
127-
#if defined(CONFIG_EPD_BOARD_REVISION_V4)
130+
#if defined(CONFIG_EPD_BOARD_REVISION_V4) || defined(CONFIG_EPD_BOARD_REVISION_V5)
128131
fast_gpio_set_hi(V4_LATCH_ENABLE);
129132
fast_gpio_set_lo(V4_LATCH_ENABLE);
130133
#else

components/epd_driver/ed097oc4.h

Lines changed: 38 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,33 @@
22

33
#include "driver/gpio.h"
44

5+
#if defined(CONFIG_EPD_BOARD_REVISION_V5)
6+
#define D7 GPIO_NUM_23
7+
#define D6 GPIO_NUM_22
8+
#define D5 GPIO_NUM_21
9+
#define D4 GPIO_NUM_19
10+
#define D3 GPIO_NUM_18
11+
#define D2 GPIO_NUM_5
12+
#define D1 GPIO_NUM_4
13+
#define D0 GPIO_NUM_25
14+
15+
516
/* Config Reggister Control */
6-
#define CFG_DATA GPIO_NUM_23
7-
#define CFG_CLK GPIO_NUM_18
8-
#if defined(CONFIG_EPD_BOARD_REVISION_LILYGO_T5_47)
17+
#define CFG_DATA GPIO_NUM_33
18+
#define CFG_CLK GPIO_NUM_32
919
#define CFG_STR GPIO_NUM_0
10-
#else
11-
#define CFG_STR GPIO_NUM_19
12-
#endif
1320

1421
/* Control Lines */
15-
#define CKV GPIO_NUM_25
16-
#define STH GPIO_NUM_26
22+
#define CKV GPIO_NUM_26
23+
#define STH GPIO_NUM_27
1724

18-
#define V4_LATCH_ENABLE GPIO_NUM_15
25+
26+
#define V4_LATCH_ENABLE GPIO_NUM_2
1927

2028
/* Edges */
21-
#define CKH GPIO_NUM_5
29+
#define CKH GPIO_NUM_15
2230

23-
/* Data Lines */
31+
#else
2432
#define D7 GPIO_NUM_22
2533
#define D6 GPIO_NUM_21
2634
#define D5 GPIO_NUM_27
@@ -34,6 +42,25 @@
3442
#define D1 GPIO_NUM_32
3543
#define D0 GPIO_NUM_33
3644

45+
#define CFG_DATA GPIO_NUM_23
46+
#define CFG_CLK GPIO_NUM_18
47+
#if defined(CONFIG_EPD_BOARD_REVISION_LILYGO_T5_47)
48+
#define CFG_STR GPIO_NUM_0
49+
#else
50+
#define CFG_STR GPIO_NUM_19
51+
#endif
52+
53+
/* Control Lines */
54+
#define CKV GPIO_NUM_25
55+
#define STH GPIO_NUM_26
56+
57+
#define V4_LATCH_ENABLE GPIO_NUM_15
58+
59+
/* Edges */
60+
#define CKH GPIO_NUM_5
61+
62+
#endif
63+
3764
void epd_base_init(uint32_t epd_row_width);
3865
void epd_base_deinit();
3966
void epd_poweron();

components/epd_driver/epd_driver.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include "freertos/semphr.h"
1212
#include "freertos/task.h"
1313
#include "xtensa/core-macros.h"
14+
#include "driver/rtc_io.h"
1415
#include <string.h>
1516

1617
#define RTOS_ERROR_CHECK(x) \
@@ -943,5 +944,9 @@ void epd_init() {
943944
}
944945

945946
void epd_deinit(){
947+
#if defined(CONFIG_EPD_BOARD_REVISION_V5)
948+
gpio_reset_pin(CKH);
949+
rtc_gpio_isolate(CKH);
950+
#endif
946951
epd_base_deinit();
947952
}

components/epd_driver/i2s_data_bus.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ void i2s_deinit() {
250250
free(i2s_state.buf_b);
251251
free((void *)i2s_state.dma_desc_a);
252252
free((void *)i2s_state.dma_desc_b);
253-
253+
254254
rtc_clk_apll_enable(0, 0, 0, 8, 0);
255255
periph_module_disable(PERIPH_I2S1_MODULE);
256256
}

hardware/epaper-breakout/BOM.csv

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,44 @@
11
Comment,Designator,Footprint,LCSC Part #
2-
"SW2 Push button switch, generic, two pins",BOOT1,SW_TS-1187A,C318884
32
4.7uF Polarized capacitor,"C1,C6",C_0603_1608Metric,C19666
4-
10uF Unpolarized capacitor,"C2,C3,C17",C_0603_1608Metric,C19702
5-
0.1uF Unpolarized capacitor,"C4,C7,C13,C14",C_0603_1608Metric,C14663
3+
10uF Unpolarized capacitor,"C2,C3,C21",C_0603_1608Metric,C19702
4+
0.1uF Unpolarized capacitor,"C4,C7,C15,C16,C22,C23",C_0603_1608Metric,C14663
65
4.7pF Unpolarized capacitor,"C5,C10",C_0603_1608Metric,C1669
76
100pF Unpolarized capacitor,"C8,C11",C_0603_1608Metric,C14858
8-
1uF Unpolarized capacitor,"C9,C12,C18,C19,C20",C_0603_1608Metric,C15849
9-
1nF Unpolarized capacitor,"C15,C16",C_0603_1608Metric, C1588
7+
1uF Unpolarized capacitor,"C9,C12,C13,C14,C18,C19,C20",C_0603_1608Metric,C15849
8+
100uF Unpolarized capacitor,C17,CP_EIA-3528-15_AVX-H, C16133
109
"MBR0540 40V 0.5A Schottky Power Rectifier Diode, SOD-123","D1,D2,D3,D4,D5,D6",D_SOD-123,C21353
11-
MountingHole Mounting Hole without connection,"H1,H2,H3",MountingHole_2.2mm_M2,
12-
"XF2M-3315-1A ED097OC4 9.7"" epaper display",J1,CONN_ED097OC4,C231420
10+
"1N5817 20V 1A Schottky Barrier Rectifier Diode, DO-41","D7,D10",D_SOD-123, C8598
11+
LED GREEN Light emitting diode,D8,LED_0805_2012Metric,C2297
12+
LED RED Light emitting diode,D9,LED_0805_2012Metric, C84256
13+
"XF2M-3315-1A",J1,CONN_ED097OC4,C231420
1314
C10418 USB Micro Type B connector,J2,USB_Micro-B_A01SB141B1-067,C10418
14-
"Conn_02x06_Counter_Clockwise Generic connector, double row, 02x06, counter clockwise pin numbering scheme (similar to DIP packge numbering), script generated (kicad-library-utils/schlib/autogen/connector/)",J3,PinHeader_2x06_P2.54mm_Vertical,
15-
ED060SC4 ,J4,HRS_FH26W-39S-0.3SHW(60),C92280
16-
22uH Inductor,"L1,L2,L3,L4",L_6.3x6.3_H3,C326331
17-
"IRLML6402 -3.7A Id, -20V Vds, 65mOhm Rds, P-Channel HEXFET Power MOSFET, SOT-23",Q1,SOT-23,C2593
18-
10k Resistor,"R2,R3,R8,R9,R10,R13,R15,R19",R_0805_2012Metric,C17414
15+
HRS_FH26W-39S-0.3SHW(60) ,J4,HRS_FH26W-39S-0.3SHW(60),C92280
16+
22uH Inductor,"L1,L2,L3,L4",L_6.3x6.3_H3, C206321
17+
"AO3401A -4.0A Id, -30V Vds, P-Channel MOSFET, SOT-23","Q1,Q2,Q5",SOT-23, C15127
18+
"MMBT3904 0.2A Ic, 40V Vce, Small Signal NPN Transistor, SOT-23","Q3,Q4,Q6",SOT-23,C20526
19+
10k Resistor,"R1,R10,R11,R13,R15,R19,R20",R_0805_2012Metric,C17414
20+
100k Resistor,R2,R_0805_2012Metric,C17407
21+
1k Resistor,"R3,R8,R12",R_0805_2012Metric,C17513
1922
2M Resistor,R4,R_0805_2012Metric,C26112
2023
120k Resistor,R5,R_0805_2012Metric, C17436
2124
560k Resistor,R6,R_0805_2012Metric,C15785
2225
39k Resistor,R7,R_0805_2012Metric,C25826
23-
470 Resistor,"R11,R12",R_0805_2012Metric,C17710
26+
6.8k Resistor,R9,R_0805_2012Metric, C17772
2427
390k Resistor,R14,R_0805_2012Metric,C17656
2528
300k Resistor,R16,R_0805_2012Metric, C17616
2629
27k Resistor,R17,R_0805_2012Metric,C17593
2730
110k Resistor,R18,R_0805_2012Metric,C17422
28-
"SW1 Push button switch, generic, two pins",RESET1,SW_TS-1187A,C318884
31+
680k Resistor,R21,R_0805_2012Metric, C17797
32+
150k Resistor,R22,R_0805_2012Metric, C17470
2933
200k Potentiometer,RV1,EVM3ESX50B25,C11958
30-
TestPoint_Probe test point (alternative probe-style design),TP1,TestPoint_Pad_D1.0mm,
3134
"MCP1700-3302E_SOT23 250mA Low Quiscent Current LDO, 3.3V output, SOT-23",U1,SOT-23,C39051
3235
"LT1945 Dual Micropower DC/DC Converter with Positive and Negative Outputs, MSOP-10","U2,U3",MSOP-10_3x3mm_P0.5mm,
33-
ESP32-WROVER ,U5,ESP32-WROVER,C503591
34-
"CH330N USB serial converter, UART, SOIC-8",U6,SOIC-8_3.9x4.9mm_P1.27mm,C108996
36+
"XC6206PxxxMR Positive 60-250mA Low Dropout Regulator, Fixed Output, SOT-23",U4,SOT-23, C5446
37+
ESP32-WROVER-B ,U5,ESP32-WROVER-B, C503591
38+
X05A20H34G,U6,X05A20H34G,
3539
"LM358 Low-Power, Dual Operational Amplifiers, DIP-8/SOIC-8/TO-99-8",U7,SOP-8_3.76x4.96mm_P1.27mm,C7950
36-
74HC4094-normal ,U8,SOIC-16_3.9x9.9mm_P1.27mm,C5651
40+
74HC4094 ,U8,SOIC-16_3.9x9.9mm_P1.27mm,C5651
3741
"MCP9700AT-ETT Low power, analog thermistor temperature sensor, ±2C accuracy, -40C to +125C, in SOT-23-3",U9,SOT-23,C127949
42+
ED060SC7 ,U10,AXT334124,
43+
TP4056 ,U11,TP4056_SOP-8-PP, C16581
44+
"CH340C USB serial converter, UART, SOIC-16",U12,SOIC-16_3.9x9.9mm_P1.27mm, C84681

0 commit comments

Comments
 (0)