Skip to content

Board W1219

Thomas edited this page Apr 6, 2020 · 22 revisions

W1219 Thermostat module

The XH-W1219 is a thermostat module with basic I/O (sensor input, keys, dual display, relay) and an STM8S003F3P6 controller that can be re-programmed. Besides temperature control, possible applications are automation tasks, e.g. timing, closed loop control, counting, or recording. At a price of about $3.00 it's a bit more expensive than the popular W1209 but the circuit is well designed, and it's easy to work with.

Please Note:

  • when shopping for the W1219 check if the size of the board is 60mm x 43mm. Some rogue vendors show a picture of the W1219 but will then deliver a different board, the Pseudo-W1219!
  • Some W1219 boards purchased in August 2018 came with a Nuvoton chip (see issue #247). The warning here applies. The Nuvoton chip can be replaced easily with SMD rework tools (or a soldering iron, some solder wick, and flux).

If you receive a board that is otherwise different to the description below, please let us know it by writing an issue.

The board has the following features:

  • STM8S003F3P6 (16MHz, 8K Flash, 1K RAM 128-640 bytes EEPROM)
  • 3 digit red and 3 digit green 7S-LED display with a 74HC164 segment driver
  • 3 keys (set, +, -)
  • 1 independent LED
  • 1 relay rated 20A/125VAC
  • sensor header for a "W1209 type" 10k NTC temperature sensor (included)
  • ICP pads for a programming header (refer to serial console)

XH-W1219-front

W1219 Board Support

A HEX file for the XH-W1219, optimized for embedded control tasks, is part of the binary release. The default configuration provides a complete interactive Forth system with sufficient free Flash memory for typical control applications.

With minor modifications, most STM8 eForth programs written for the W1209 should work on the XH-W1219 (e.g. 5 ADC! instead of 6 ADC!, adaptions to dual display). The page Board W1209 provides more examples on programming W12xx thermostat boards in STM8 eForth.

Analog Header

The analog header is designed for the "Wxxxx standard 10k NTC sensor", and it has a 20k pull-up resistor to +5.0V. The input can be used with many sensors that change resistance (LDR, PTC, certain types of pressure sensors etc), and with minor modifications (e.g. removal of the 20k pull-up) it can be used for other purposes.

Note that there is no voltage reference, and that any analog input signal should be formed with the internal 5V power supply as the reference ("ratiometric input").

The following code snippet reads and displays the sensor header's analog input on the upper (red) 7S-LED display, and the timer ticker on the lower (green) 7S-LED display:

: read_Ain ( -- n ) 
   5 ADC! ADC@ ;

: show_Ain ( -- )
   read_Ain . TIM 65 / U. CR ;

' show_Ain BG !

Board Digital Outputs

The relay and the blue LED are mapped to bits B0 and B1 of the OUT! word and OUT register. The following code shows how to set relay and LED.

1 OUT! \ relay on, LED off
2 OUT! \ relay off, LED on
3 OUT! \ relay on, LED on

Board UI Character IO

The W1219 board provides 3 keys and two 3-digit 7S-LED displays (red and green).

The usage of keys is very similar to that explained in the W1209 UI section. STM8 eForth code that runs on an W1209 can be easily ported to the W1219 (the UI can use one or both of the two 3 digit 7S-LED displays).

The LED display is organized in right-aligned 3-digit groups that each work similar to the display of a pocket calculator. SPACE switching between the groups works, and CR moves to the upper group.

The following code demonstrates the group output feature:

: show 11 . 22 . CR ;
' show BG !

Running show from the command line results in 11 22<new line>. Running it in the background displays 11 in the upper 3-digit group, and 22 on the lower group (both right aligned).

Please refer to the Wiki page STM8 eForth Board Character IO for details.

Serial Console

The board support provides half-duplex console access through PD1/SWIM on the ICP header. An example picocom configuration for half-duplex communication is described here.

The following sketch shows how to connect a serial interface adapter using the SWIMCOM method:


XH-W1219       .      
               .      e.g. "CH340 USB serial converter"
               .      .----o serial TxD "TTL"
               .      |      
ICP header     .     ---
               .     / \  1N4148 
VCC ----------[1]    ---  
               .      |
PD1/SWIM------<2>-----*----o serial RxD "TTL"
               .
NRST----------<3>
               .
GND-----------<4>----------o serial GND
               .     
................      

W1219 Hardware Description

STM8S003F3P6 Signals

Pin	STM	Connected to
1	PD4	blue LED cathode (PD4-LED-10k-5V)
2	PD5	AIN5 with pull-up (20k, 5.0V), sensor header pin 2
3	PD6	key "-"
4	NRST	(ICP header pin 3)
5	PA1	key "+"
6	PA2	key "set"
7	VSS	GND
8	Vcap	cap for core supply
9	VDD	
10	PA3	relay R10-(R14-GND)-Q1
11	PB5	(not connected)
12	PB4	Dig6g grn.8  470R
13	PC3	Dig5g grn.9  470R
14	PC4	Dig4g grn.12 470R
15	PC5	Dig3r red.8  47R
16	PC6	Dig2r red.9  47R
17	PC7	Dig1r red.12 47R
18	PD1/SWIM (ICP header pin2)
19	PD2     data 74HC164 (DSA, DSB)
20	PD3	clock 74HC164 (CP)

Red and Green 3 Digit 7S-LED Displays

Common Anode type green display marked "YBSP820281 G".

Dig1r red.12 STM8S.17 PC7 47R
Dig2r red.9  STM8S.16 PC6 47R
Dig3r red.8  STM8S.15 PC5 47R
Dig1g grn.12 STM8S.14 PC4 470R
Dig2g grn.9  STM8S.13 PC3 470R
Dig3g grn.8  STM8S.12 PB4 470R

74HC164 and LED segments

1  DSA STM8.19 PD2
2  DSB-DSA
3  Q0 SegA
4  Q1 SegDP
5  Q2 SegD
6  Q3 SegE
7  GND
8  CP STM8.20 PD3
9  /MR (+VCC)
10 Q4 SegB
11 Q5 SegG
12 Q6 SegC
13 Q7 SegF
14 VCC

The Pseudo-W1219

The Pseudo-W1219 is a different board with the dimension 47mm x 40mm (instead of the W1219's 60mm * 43mm). Buying it for hacking is not recommended!

image

Many vendors show pictures of the W1219 but will then deliver a Pseudo-W1219. A sure sign is costumer review pictures showing a Pseudo-W1219 board.

Some vendor even show a single picture of the Pseudo-W1219 board among pictures of the W1219, or just specify the dimensions "47mm x 40mm", much smaller than the W1219 board. These vendors are giving away that they know what they're doing and it's likely that you'll get at least some of your money back if you file a complaint.

It wouldn't be so bad if the design of the Pseudo-W1219 were not sub-par:

  • PB4 and PB5 remain non-connected while PD1/SWIM is used as the 74HC164 clock
  • the stock firmware, if your board has a STM8S003F3P6 controller, immediately switches PD1/SWIM it output mode which makes it all but impossible to program, and hence
  • for initial programming the LED displays need to be de-soldered in any case

Of course, if your board has a MCS51-type Nuvoton chip the LED display has to be de-soldered, anyway.

With some tricks it's certainly possible to use the board for STM8 eForth (e.g. the W1401 also uses PD1/SWIM to clock a shift register for the LEDs).

Please write an issue if you want to try it.

Clone this wiki locally