-
Notifications
You must be signed in to change notification settings - Fork 66
Board W1401
The W1401 (also XH-1401) is a cheap thermostat board with 3x2 digits 7S-LED display.
The XH-W1401 will be supported by this project since it's widely available. There are variants with a front panel, and at a price of about $2.60 it's still very cheap. The schematics still have some mysteries (e.g. what they did at the sensor input, and which STM8s pins are assigned to keys, relay and buzzer) but if you follow this little project ordering a W1401 now isn't a big risk.
The board has the following features:
- STM8S003F3P6
- 3x2 digit 7S-LED display with 74HC164 as segment driver,
- 4 keys,
- 2 LEDs,
- relay (rated 250VAC),
- buzzer
- 10k NTC temperature sensor header
When I examined the XH-W1401 thermostat module it became clear that using the GPIO PD1/SWIM for 3 tasks (SWIM for flashing, half-duplex RX and TX) wouldn't be easy. It's used to clock the 74HC164 shift register. The solution is to make the LED shift register clock pulses short compared with the UART bit time. I tested it with low-pulse of 125ns which a CH340 UART chip filtered out.
The implementation now uses a shorter 64ns pulse, and also possible to use a simple RC filter (e.g. 47R/10nF) to hide it from UARTs without noise filter, like the interrupt driven implementation in this project.
It's further complicated by the fact that the 74HC164 is unlatched which means that any transition on the serial line alters the LED pattern of a currently displayed digit. This can be countered by refreshing the display contents in the serial interface stop bit.
C7, the capacitor connected to NRST is over-sized and ICP (in circuit programming) fails. However, programming through SWIM is possible if NRST is not connected (SWIM only). I recommend either removal, or replacement by a capacitor with max. 100nF.
Common Anode type, compatible LED displays with a different color may be used. One sample has 9mm yellow displays marked ZT21036.Y instead of green, and a red 14mm center display marked ZT210501R7.3.
Only 7 bits of the shift register are used, the decimal point (DP) isn't connected.
1 DSA STM8.15 PC5
2 DSB-DSA
3 Q0 R5 L3621.3, L5621.10 segment A
4 Q1 R6 L3621.9, L5621.9 segment B
5 Q2 R8 L3621.8, L5621.1 segment C
6 Q3 R9 L3621.6, L5621.4 segment D
7 GND
8 CLK STM8.18 PD1/SWIM
9 /MR (+VCC)
10 Q4 R10 L3621.7, L5621.3 segment E
11 Q5 R11 L3621.4, L5621.6 segment F
12 Q6 R12 L3621.1, L5621.5 segment G
13 Q7 NC
14 VCC
L3621.2, L5621.2 segment DP not connected
STM8S003F3P6:
Pin STM Connected to
1 PD4 R3-Q1 (-> BEEP_CSR)
2 PD5 Ain sensor connector
3 PD6 Key "Start v"
4 NRST ICP header pin 3
5 PA1 Key "Stop ^"
6 PA2 R-Q5 (relay, LED red)
7 VSS GND
8 Vcap Cap
9 VDD 5.0V
10 PA3 Key "Stop v"
11 PB5 !LED green
12 PB4 Key "Start ^"
13 PC3 Dig2 L3621.5
14 PC4 Dig3 L5621.8
15 PC5 74HC164 DSA-DSB
16 PC6 Dig6 L3621.5
17 PC7 Dig1 L3621.10
18 PD1 74HC164 CLK, ICP header pin2
19 PD2 Dig5 L3621.10
20 PD3 Dig4 L5621.7
The STM8EF code for W1401 isn't complete, but it's ready for first experiments.
- working serial interface through PD1/SWIM
- working 7S-LED
Not implemented is support for the LEDs marked "Start" & "Stop", relay, and buzzer.