W1209 Temperature control Switch (HCTHER0006)

Modules for various types of sensors including accelerometers. gyro's, IR motion, etc
Alfredo
Posts: 23
Joined: Sat May 13, 2017 12:43 pm

Re: W1209 Temperature control Switch (HCTHER0006)

Post by Alfredo » Sun Jul 23, 2017 7:31 am

There is a development release of STM8EF for the W1209 with full duplex serial communication through the key pins. I find it much easier to use. The keys still work (!)

How-To:
* get a W1209, erase the chip if necessary
* flash the W1209-FD.ihx binary
* connect the serial interface (+key pin near LED display -> TxD, -key -> RxD)
* use terminal program "9600/N/8/1"

The binary is here: https://github.com/TG9541/stm8ef/files/ ... apshot.zip

An issue on github mentions this thread, and @barewires!
https://github.com/TG9541/stm8ef/issues/42

barewires
Posts: 49
Joined: Wed Aug 21, 2013 7:38 am

Re: W1209 Temperature control Switch (HCTHER0006)

Post by barewires » Mon Jul 24, 2017 2:21 pm

Sorry for the duplicated information in this thread, but it is current.

It is typical that the 4 wire SWIM programmer interface is rarely 1:1, always verify the positions of the signals. Equally important is Vdd which is determined by looking at the voltage regulator part number on the top side. The W1209 has an AMS1117-5.0 which is normally powered from 12 volt (15 volt max on datasheet but HC specs rule) external screw terminals.

It is usually safe to program by back-feeding at the rated voltage, but be warned. The STLINK-V2 power should be on the 5 volt pin for this board. Only one power source at a time can be used. The voltage regulator requires a minimum of 6.5 volts plus the 0.7 volt diode drop so external power at the screw terminals should be a minimum of 7.2 volts.

I have traced the 4 pin header from top to bottom, located to the left of the LED.

Pin 4 is the GND at the board edge.
Pin 3 goes to pin 4 , ic STM8S003F TSSOP20 = NRST Reset
Pin 2 goes to pin 18, ic STM8S003F TSSOP20 = PD1/SWIM Interface to Debug or Programming
Pin 1 goes to +5.0 Vdc. Designated as square pad.

Checkout the HCDVBD0034 forum for details on installing the stm8flash burning utility.

On a Pi 3 or Pi Zero W: note the W1209 blaster part designation stm8s003?3 and the question mark and the dash small letter L for list below.

Code: Select all

cd ~/stm8flash
./stm8flash -l | grep stm8s003
... stm8s003?3 ...

\ If you get programming errors then the next two lines must be run once.
 
echo "00 00 ff 00 ff 00 ff 00 ff 00 ff" | xxd -r -p > factory_defaults.bin
sudo ./stm8flash -c stlinkv2 -p stm8s003?3 -s opt -w factory_defaults.bin

sudo ./stm8flash -c stlinkv2 -p stm8s003?3 -s flash -w /home/pi/Downloads/out/W1209-FD/W1209-FD.ihx
In a few seconds the LED should display 4th meaning eForth is running - celebrate now! A convenient ground for the PL2303 UART dongle is by the top edge of the programming header. RxD is either pin at the top of the + button and TxD is the same on the - button. The bottoms of the switches are all common ground. I have it working using picocom at 9600/N81

Thanks Thomas, great work!
https://github.com/TG9541/stm8ef/wiki/B ... e-key-pins

hi
stm8eForth v2.2
ok

NVM
: sq DUP * . ;
: w WORDS ;
RAM
4 sq 16 ok

words
w sq IRET SAVEC RESET RAM NVM LOCKF ULOCKF LOCK ULOCK ADC@ ADC! ?KEYB P7S E7S WORDS .S DUMP ALLOT VARIABLE CREATE DOES> ] IMMEDIATE : ; OVERT ." $" ABORT" AFT REPEAT WHILE AHEAD ELSE THEN IF AGAIN UNTIL BEGIN +LOOP LOOP DO NEXT FOR $," COMPILE [COMPILE] LITERAL CALL, C, , ' [ NAME> \ ( .( ? . U. TYPE U.R .R CR SPACES SPACE NUF? KEY DECIMAL HEX str #> SIGN #S # HOLD <# DIGIT PACK$ ERASE FILL CMOVE @EXECUTE PAD HERE COUNT +! DEPTH PICK 0= ABS NEGATE NOT 1+ 1- 2+ 2- 2* 2/ EXG */ */MOD M* * UM* / MOD /MOD M/MOD UM/MOD WITHIN MIN MAX < U< = DNEGATE 2DUP ROT ?DUP FILE HAND BG TIM BL OUT last '?KEY 'EMIT hld BASE - 0< OR AND XOR + UM+ OVER SWAP DUP 2DROP DROP NIP >R R@ R> I C! C@ ! @ B! 2C@ 2C! 2@ 2! EXIT EXECUTE LEAVE EMIT ?KEY TX! ?RX hi 'BOOT BKEY OUT! COLD ok

cold \erases words except those added during NVM / RAM non-volatile memory (flash) mode.
stm8eForth v2.2
ok

reset \erases all
stm8eForth v2.2
ok

Note the relay coil is 12 volt and will not activate at 5 volt but the LED will light.

\ activate the relay 63 mA @ 12 volt external power in through the screw terminals
1 OUT!

\ deactivate the relay 11 mA @ 12 volt
0 OUT!

Alfredo
Posts: 23
Joined: Sat May 13, 2017 12:43 pm

Re: W1209 Temperature control Switch (HCTHER0006)

Post by Alfredo » Sat Aug 05, 2017 5:31 pm

STM8EF v2.2.13 was released today - the "full duplex serial interface" through the key pins is now "officially" supported! The old "half-duplex" interface through the sensor header is still available.

On hackaday someone asked for a thermostat with serial interface for data logging. This sounds interesting!

Edit: there is now a W1209 thermostat code repository on GitHub, and a Hackaday project.

barewires
Posts: 49
Joined: Wed Aug 21, 2013 7:38 am

Re: W1209 Temperature control Switch (HCTHER0006)

Post by barewires » Sat Sep 16, 2017 5:39 pm

The 470nF capacitor "C1" (the one next to the sensor connector) now needs to be replaced on the W1209 PCB if it was removed when the sensor input was made dual-purpose as serial communications.
https://github.com/TG9541/stm8ef/wiki/Board-W1209

barewires
Posts: 49
Joined: Wed Aug 21, 2013 7:38 am

Re: W1209 Temperature control Switch (HCTHER0006)

Post by barewires » Sun Oct 01, 2017 11:01 am

Check out the parallel forum on the STM8S103F3 Development Board (HCDVBD0034)
http://forum.hobbycomponents.com/viewto ... =87&t=2180

barewires
Posts: 49
Joined: Wed Aug 21, 2013 7:38 am

Re: W1209 Temperature control Switch (HCTHER0006)

Post by barewires » Sun Oct 01, 2017 4:41 pm

Just updated W1209 to ver 2.2.17 and dumped flash and saw all remnants of previous words in the dictionary. How about padding the remaining 3K flash with 00 for readability?

https://github.com/TG9541/stm8ef/issues/84

I thought about writing another memory to intel hex file converter (how many times I've done that since the mid 70s, but time is running out for me). So I read -r a new blank chip with
./stm8flash -c stlinkv2 -p stm8s003?3 -s flash -r newblankchip.ihx
and had my empty flash template within seconds.

Alfredo
Posts: 23
Joined: Sat May 13, 2017 12:43 pm

Re: W1209 Temperature control Switch (HCTHER0006)

Post by Alfredo » Sun Nov 26, 2017 6:11 pm

News: the first version of the W1209 Data Logging Thermostat firmware is ready:

https://github.com/TG9541/W1209/releases/tag/0.1.0

This took some time (the project was started in August). However, installing the binary is simple, and it works as advertised. The data logger is still very basic, but there is enough free Flash memory for more features.

The Menu is very usable even if there are some minor quirks (e.g. holding the set key leads to a main/select/edit/set cycle ;-) )

Alfredo
Posts: 23
Joined: Sat May 13, 2017 12:43 pm

Re: W1209 Temperature control Switch (HCTHER0006)

Post by Alfredo » Fri Dec 22, 2017 3:37 pm

There is a new version of the W1209 "data logging thermostat" firmware.

According to the GitHub readme the firmware logs this:
Lowest temperature
Highest temperature
Heating duty cycle DC = 100% * t.on/(t.on + t.off)
Number of relay cycles
Here is a demo chart from the readme:
Image

Janne
Posts: 2
Joined: Mon Nov 11, 2019 2:40 pm

Re: W1209 Temperature control Switch (HCTHER0006)

Post by Janne » Mon Nov 11, 2019 2:58 pm

Hi,

does someone know, what happens with the programmed values after a powerfail or switch off?
Are they permantly stored?

I´m thinking of cascading two of these boards, one switches the second one on if temp collector is >30°C which then swiches on the fan if the concrete temperature is under 23°. This would be a cheap and easy differential temperature regulator.

andrew
Site Admin
Posts: 1374
Joined: Sun Aug 05, 2012 4:15 pm

Re: W1209 Temperature control Switch (HCTHER0006)

Post by andrew » Mon Nov 11, 2019 4:48 pm

Yes settings are saved in EEPROM and so will be retained if power is removed from the module
Comments made by this poster do not necessarily reflect the views of Hobby Components Ltd.

Post Reply

Return to “Sensors”