GPIO's for SonOff THR320D

Moderators: grovkillen, Stuntteam, TD-er

Message
Author
obod0002c
Normal user
Posts: 119
Joined: 10 Aug 2019, 20:31

GPIO's for SonOff THR320D

#1 Post by obod0002c » 30 Oct 2022, 14:57

Hello again,
I'm trying to control my new toy: a SonOff THR320D for checking if the hot water pump needs to run (controlled by changes in the temperature read)..

I managed to backup the original firmware and was to able to load a new one .. however I haven't manage to find the GPIO's for the three LED's available, nor the one for the temperature sensor and, even more important, also not the one for the relay ..

Can one help?

User avatar
Ath
Normal user
Posts: 3417
Joined: 10 Jun 2018, 12:06
Location: NL

Re: GPIO's for SonOff THR320D

#2 Post by Ath » 30 Oct 2022, 15:12

I usually consult Blakadder for device GPIO's: THR320D and the sister-device POWR316D
/Ton (PayPal.me)

obod0002c
Normal user
Posts: 119
Joined: 10 Aug 2019, 20:31

Re: GPIO's for SonOff THR320D

#3 Post by obod0002c » 31 Oct 2022, 09:41

Thanks a lot for your post and link, very informative.

From what I understand TM1621 should be the display - which, for the time being, I won't use. Maybe later after the basics are working ;)
But can you tell what the GPIO for the one relay might be and where to find the temperature sensor?

As far as I can see, there's only one relay in the device, but here I somehow suggest two to three?
GPIO04 Relay 3
GPIO19 Relay_b 1
GPIO22 Relay_b 2

I'm assuming the three LED's visible will somehow be attached to the GPIO's listed:
GPIO13 Led_i 2
GPIO15 LedLinki
GPIO16 Led_i 1

There are also two lines, that I can't match so far:
GPIO25 User <- this then might be the input for the temperature sensor, right?
GPIO27 Output Hi

Do you have any more idea?

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: GPIO's for SonOff THR320D

#4 Post by TD-er » 31 Oct 2022, 10:13

Not 100% sure about the notation of those labels, but relay_b does look like the button associated with it?
led_i looks like LED inverted?
led_linki looks like LED linkstatus inverted?

output HI looks like output which is pulled up?
Or -this is important- it might be this pin is maybe not isolated from mains voltage?
You need to always (!!!) keep in mind that mains connected devices like those sold by Sonoff may not always be isolated from mains voltage.
Especially the ones which perform enery/voltage measurements on mains voltage are almost never isolated from mains.

This means that if you add some sensors to it, you either have to place them inside the enclosure to be safe, or add components between the board and the sensor to isolate it from mains.
One way to check is by measuring the resistance between either mains voltage pin and ground of the board inside.
If either one (phase or null) of the mains pins are connected, you MUST(!!) take special care when adding external sensors to it.

obod0002c
Normal user
Posts: 119
Joined: 10 Aug 2019, 20:31

Re: GPIO's for SonOff THR320D

#5 Post by obod0002c » 31 Oct 2022, 10:27

THANKS for the warnings, you can't be cautious enough!
I'll stick to the temperature sensor delivered with the device .. especially as this sensor is super close to house water installation and hence almost all metal around everywhere.

I'm also struggling a bit on which mega release to take, most of the ESP32's I've tried report an uploading failure approx. 20seconds after I started flashing.

From ESPEasy_ESP32_mega-20220616.zip I've tried
ESP_Easy_mega_20220616_display_ESP32_4M316k.bin
ESP_Easy_mega_20220616_display_ESP32s2_4M316k.bin
ESP_Easy_mega_20220616_custom_ESP32_4M316k_LittleFS.bin

Arduino.cc did allow me to upload, so usually the device should work.

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: GPIO's for SonOff THR320D

#6 Post by TD-er » 31 Oct 2022, 10:45

Do you upload the "factory" image file to the unit when flashing via serial?
I saw the Tasmota thread for adding support for this unit and apparently it was quite a lot of work (perhaps also to find out where which sensor was connected)

obod0002c
Normal user
Posts: 119
Joined: 10 Aug 2019, 20:31

Re: GPIO's for SonOff THR320D

#7 Post by obod0002c » 31 Oct 2022, 10:55

I'll try the factory ones tonight.

Regarding the temperature sensor GPIO: I thought I just browse through all the GPIO's but that gave my '-127.00' for all of them ..

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: GPIO's for SonOff THR320D

#8 Post by TD-er » 31 Oct 2022, 11:06

You _have_ to use the "factory" ones when flashing via serial as those include the bootloader files.
Later, when updating via WiFi, you can use the bin files without "factory" in the name.

User avatar
Ath
Normal user
Posts: 3417
Joined: 10 Jun 2018, 12:06
Location: NL

Re: GPIO's for SonOff THR320D

#9 Post by Ath » 31 Oct 2022, 11:15

obod0002c wrote: 31 Oct 2022, 10:27 From ESPEasy_ESP32_mega-20220616.zip I've tried
That's a rather old release.
obod0002c wrote: 31 Oct 2022, 10:27 ESP_Easy_mega_20220616_display_ESP32s2_4M316k.bin
That'll surely not work on the ESP32 that's in these units, the ESP32s2 is a different CPU.
/Ton (PayPal.me)

obod0002c
Normal user
Posts: 119
Joined: 10 Aug 2019, 20:31

Re: GPIO's for SonOff THR320D

#10 Post by obod0002c » 31 Oct 2022, 11:26

That's a rather old release.
Yep, but 'cause of the lengthy warning for Release mega-20220809 that was the most up to date with no such text :D

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: GPIO's for SonOff THR320D

#11 Post by TD-er » 31 Oct 2022, 11:28

You can pick the latest (completed) builds from the GitHub Actions builds: https://github.com/letscontrolit/ESPEasy/actions
For example this one: https://github.com/letscontrolit/ESPEas ... 3356992715

obod0002c
Normal user
Posts: 119
Joined: 10 Aug 2019, 20:31

Re: GPIO's for SonOff THR320D

#12 Post by obod0002c » 31 Oct 2022, 13:25

not sure if with no access to the project I can see/download those

User avatar
Ath
Normal user
Posts: 3417
Joined: 10 Jun 2018, 12:06
Location: NL

Re: GPIO's for SonOff THR320D

#13 Post by Ath » 31 Oct 2022, 13:57

obod0002c wrote: 31 Oct 2022, 13:25 not sure if with no access to the project I can see/download those
You only need a valid Github account (free) to be able to download there.
/Ton (PayPal.me)

obod0002c
Normal user
Posts: 119
Joined: 10 Aug 2019, 20:31

Re: GPIO's for SonOff THR320D

#14 Post by obod0002c » 01 Nov 2022, 18:28

so I tried with the
ESP_Easy_mega_20221030_normal_ESP32_4M316k.factory.bin
->
######2022-11-01######
#######0.04.007#######
######FLASH INFO######
BIN file: ESP_Easy_mega_20221030_normal_ESP32_4M316k.factory.bin
COM port: (COM3) USB-SERIAL CH340 (Port_#0001.Hub_#0006)
Baud rate: 115200
######POST FLASH######
No post flash information entered...
######FLASH LOG######
[esptool.exe -vv -cd nodemcu -cb 115200 -cp COM3 -ca 0x00000 -cf "O:\Computer Elektronik\ESPEasy\20221030_ESP32\bin\ESP_Easy_mega_20221030_normal_ESP32_4M316k.factory.bin"]
[01.11.2022 17:13:45] esptool v0.4.12 - (c) 2014 Ch. Klippel <ck@atelier-klippel.de>
...
[01.11.2022 17:13:45] erasing flash
[01.11.2022 17:13:45] size: 153670 address: 000000
[01.11.2022 17:13:45] first_sector_index: 0
[01.11.2022 17:13:45] total_sector_count: 340
[01.11.2022 17:13:45] head_sector_count: 16
[01.11.2022 17:13:45] adjusted_sector_count: 324
[01.11.2022 17:13:45] erase_size: 144000
[01.11.2022 17:13:45] espcomm_send_command: sending command header
[01.11.2022 17:13:45] espcomm_send_command: sending command payload
[01.11.2022 17:13:45] setting serial port timeouts to 15000 ms
[01.11.2022 17:13:45] read 0, requested 1
[01.11.2022 17:13:45] setting serial port timeouts to 1000 ms
[01.11.2022 17:13:45] warning: espcomm_send_command: didn't receive command response
[01.11.2022 17:13:45] warning: espcomm_send_command(FLASH_DOWNLOAD_BEGIN) failed
[01.11.2022 17:13:45] closing bootloader
[01.11.2022 17:13:45] flush start
[01.11.2022 17:13:45] setting serial port timeouts to 1 ms
[01.11.2022 17:13:45] setting serial port timeouts to 1000 ms
[01.11.2022 17:13:45] flush complete
[01.11.2022 17:13:45] error: espcomm_upload_mem failed
[2022-11-01 17:13:45] DONE! BUT WITH (1) ERRORS!
############################
[2022-11-01 17:13:45] The COM port was already in use... the post-flash did not complete.
[2022-11-01 17:13:45] JOB COMPLETED, over and out!

ESP_Easy_mega_20221030_normal_ESP32_4M316k_ETH.factory.bin -> ditto
ESP_Easy_mega_20221030_normal_ESP32_4M316k_LittleFS.factory.bin > ditto

Flashing stops after less than 20sec.

User avatar
ThomasB
Normal user
Posts: 1064
Joined: 17 Jun 2018, 20:41
Location: USA

Re: GPIO's for SonOff THR320D

#15 Post by ThomasB » 01 Nov 2022, 20:53

From the error log I see that it failed because the SonOff device did not respond and later it states chosen COM port was already in-use. If you are sure the SonOff device was set to FLASH mode, and you have chosen the correct port (and no other serial service is using it), then reboot your PC and try again.

- Thomas

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: GPIO's for SonOff THR320D

#16 Post by TD-er » 01 Nov 2022, 21:01

Also what flash tool do you use?
This one seems to date from way before there even existed ESP32 units.

In the ZIP file containing the releases, there is also a copy of the Espressif download tool.

See the documentation on how to use this tool: https://espeasy.readthedocs.io/en/lates ... nload-tool

obod0002c
Normal user
Posts: 119
Joined: 10 Aug 2019, 20:31

Re: GPIO's for SonOff THR320D

#17 Post by obod0002c » 02 Nov 2022, 18:02

This one seems to date from way before there even existed ESP32 units
ESP Easy Flasher 0.04.007, not that antique or maybe ..

esptool v0.4.12 - (c) 2014 Ch. Klippel <ck@atelier-klippel.de>
ESP8266/ESP32 build and upload helper tool

If I download
ESPEasy_ESP82xx_mega-20220809.zip
and extract ESP_Easy_Falsher as well as esptool I'm receiving the same version .. where's my mistake?

obod0002c
Normal user
Posts: 119
Joined: 10 Aug 2019, 20:31

Re: GPIO's for SonOff THR320D

#18 Post by obod0002c » 02 Nov 2022, 18:23

then reboot your PC and try again
no change unfortunately:
######2022-11-02######
#######0.04.007#######
######FLASH INFO######
BIN file: ESP_Easy_mega_20221030_normal_ESP32_4M316k.factory.bin
COM port: (COM3) USB-SERIAL CH340 (Port_#0001.Hub_#0006)
Baud rate: 115200
######POST FLASH######
No post flash information entered...
######FLASH LOG######
[esptool.exe -vv -cd nodemcu -cb 115200 -cp COM3 -ca 0x00000 -cf "O:\Computer Elektronik\ESPEasy\20221030_ESP32\bin\ESP_Easy_mega_20221030_normal_ESP32_4M316k.factory.bin"]
[02.11.2022 18:21:21] esptool v0.4.12 - (c) 2014 Ch. Klippel <ck@atelier-klippel.de>
[02.11.2022 18:21:21] setting board to nodemcu
[02.11.2022 18:21:21] setting baudrate from 115200 to 115200
[02.11.2022 18:21:21] setting port from to COM3
[02.11.2022 18:21:21] setting address from 0x00000000 to 0x00000000
[02.11.2022 18:21:21] espcomm_upload_file
[02.11.2022 18:21:21] espcomm_upload_mem
[02.11.2022 18:21:21] setting serial port timeouts to 1000 ms
[02.11.2022 18:21:21] opening bootloader
[02.11.2022 18:21:21] resetting board
[02.11.2022 18:21:21] trying to connect
[02.11.2022 18:21:21] flush start
[02.11.2022 18:21:21] setting serial port timeouts to 1 ms
[02.11.2022 18:21:21] setting serial port timeouts to 1000 ms
[02.11.2022 18:21:21] flush complete
[02.11.2022 18:21:21] espcomm_send_command: sending command header
[02.11.2022 18:21:21] espcomm_send_command: sending command payload
[02.11.2022 18:21:21] read 0, requested 1
[02.11.2022 18:21:21] trying to connect
[02.11.2022 18:21:21] flush start
[02.11.2022 18:21:21] setting serial port timeouts to 1 ms
[02.11.2022 18:21:21] setting serial port timeouts to 1000 ms
[02.11.2022 18:21:21] flush complete
[02.11.2022 18:21:21] espcomm_send_command: sending command header
[02.11.2022 18:21:21] espcomm_send_command: sending command payload
[02.11.2022 18:21:21] espcomm_send_command: receiving 4 bytes of data
[02.11.2022 18:21:21] trying to connect
[02.11.2022 18:21:21] flush start
[02.11.2022 18:21:21] setting serial port timeouts to 1 ms
[02.11.2022 18:21:21] setting serial port timeouts to 1000 ms
[02.11.2022 18:21:21] flush complete
[02.11.2022 18:21:21] espcomm_send_command: sending command header
[02.11.2022 18:21:21] espcomm_send_command: sending command payload
[02.11.2022 18:21:21] espcomm_send_command: receiving 4 bytes of data
[02.11.2022 18:21:21] espcomm_send_command: receiving 4 bytes of data
[02.11.2022 18:21:21] espcomm_send_command: receiving 4 bytes of data
[02.11.2022 18:21:21] espcomm_send_command: receiving 4 bytes of data
[02.11.2022 18:21:21] espcomm_send_command: receiving 4 bytes of data
[02.11.2022 18:21:21] espcomm_send_command: receiving 4 bytes of data
[02.11.2022 18:21:21] espcomm_send_command: receiving 4 bytes of data
[02.11.2022 18:21:21] espcomm_send_command: receiving 4 bytes of data
[02.11.2022 18:21:21] Uploading 1390192 bytes from O:\Computer Elektronik\ESPEasy\20221030_ESP32\bin\ESP_Easy_mega_20221030_normal_ESP32_4M316k.factory.bin to flash at 0x00000000
[02.11.2022 18:21:21] erasing flash
[02.11.2022 18:21:21] size: 153670 address: 000000
[02.11.2022 18:21:21] first_sector_index: 0
[02.11.2022 18:21:21] total_sector_count: 340
[02.11.2022 18:21:21] head_sector_count: 16
[02.11.2022 18:21:21] adjusted_sector_count: 324
[02.11.2022 18:21:21] erase_size: 144000
[02.11.2022 18:21:21] espcomm_send_command: sending command header
[02.11.2022 18:21:21] espcomm_send_command: sending command payload
[02.11.2022 18:21:21] setting serial port timeouts to 15000 ms
[02.11.2022 18:21:21] read 0, requested 1
[02.11.2022 18:21:21] setting serial port timeouts to 1000 ms
[02.11.2022 18:21:21] warning: espcomm_send_command: didn't receive command response
[02.11.2022 18:21:21] warning: espcomm_send_command(FLASH_DOWNLOAD_BEGIN) failed
[02.11.2022 18:21:21] closing bootloader
[02.11.2022 18:21:21] flush start
[02.11.2022 18:21:21] setting serial port timeouts to 1 ms
[02.11.2022 18:21:21] setting serial port timeouts to 1000 ms
[02.11.2022 18:21:21] flush complete
[02.11.2022 18:21:21] error: espcomm_upload_mem failed
[2022-11-02 18:21:21] DONE! BUT WITH (1) ERRORS!
############################
[2022-11-02 18:21:21] The COM port was already in use... the post-flash did not complete.
[2022-11-02 18:21:21] JOB COMPLETED, over and out!

User avatar
Ath
Normal user
Posts: 3417
Joined: 10 Jun 2018, 12:06
Location: NL

Re: GPIO's for SonOff THR320D

#19 Post by Ath » 02 Nov 2022, 18:57

obod0002c wrote: 02 Nov 2022, 18:02 ESP Easy Flasher 0.04.007, not that antique or maybe ..
That tool has some known flaws, by not recognizing all types of COM ports, and also not flashing all types of ESP32 units...

As said before, please use the Espressif flash download tool, also available in that release you downloaded, as that does flash ESP32 units as intended.
/Ton (PayPal.me)

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: GPIO's for SonOff THR320D

#20 Post by TD-er » 02 Nov 2022, 19:04

Ath wrote: 02 Nov 2022, 18:57 [...]
That tool has some known flaws, by not recognizing all types of COM ports, and also not flashing all types of ESP32 units...
[...]
Let me correct that: The ESPEasy flasher tool does not support flashing ANY ESP32 chip.

obod0002c
Normal user
Posts: 119
Joined: 10 Aug 2019, 20:31

Re: GPIO's for SonOff THR320D

#21 Post by obod0002c » 04 Nov 2022, 19:40

I now flashed all the three factory-bin's, and everytime the tablet can connect to the device's WiFi (looks like Android has had changes here, too), however, I dont' manage to get the device out of 'ap mode':
Warning: Connected via AP

Can't connect to the device with the IP shown, obviously

User avatar
Ath
Normal user
Posts: 3417
Joined: 10 Jun 2018, 12:06
Location: NL

Re: GPIO's for SonOff THR320D

#22 Post by Ath » 04 Nov 2022, 20:02

You did reconnect the tablet to the regular WiFi Access Point (AP), I assume? (I always have to do that manually)
The AP doesn't get auto-disconnected after the WiFi of the ESP is configured, only after the last connected client of the AP is disconnected, the AP will be stopped.
And the newly assigned IP is only available on the WiFi AP the ESP is now connected to as a client, there is no internal routing between the AP and STA (client) networks.
/Ton (PayPal.me)

obod0002c
Normal user
Posts: 119
Joined: 10 Aug 2019, 20:31

Re: GPIO's for SonOff THR320D

#23 Post by obod0002c » 04 Nov 2022, 21:26

Yes, tablet manually connected to 'standard' WIFi again.

Router is showing same IP address for new ESP device as the device itself.

User avatar
Ath
Normal user
Posts: 3417
Joined: 10 Jun 2018, 12:06
Location: NL

Re: GPIO's for SonOff THR320D

#24 Post by Ath » 04 Nov 2022, 22:08

What is the exact build you installed (.bin filename)?
/Ton (PayPal.me)

obod0002c
Normal user
Posts: 119
Joined: 10 Aug 2019, 20:31

Re: GPIO's for SonOff THR320D

#25 Post by obod0002c » 04 Nov 2022, 22:42

those three:
ESP_Easy_mega_20221030_normal_ESP32_4M316k.factory.bin
ESP_Easy_mega_20221030_normal_ESP32_4M316k_ETH.factory.bin
ESP_Easy_mega_20221030_normal_ESP32_4M316k_LittleFS.factory.bin

Flash Tool:
flash_download_tool_3.9.3

E.g.
EspressifFlashDownloadTool_001.jpg
EspressifFlashDownloadTool_001.jpg (95.32 KiB) Viewed 15099 times

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: GPIO's for SonOff THR320D

#26 Post by TD-er » 04 Nov 2022, 22:51

I have been working on those wifi connect/disconnect issues today (especially on ESP32)
You can try this test build: https://github.com/letscontrolit/ESPEas ... 3395425378

Or you can connect via serial (115200 baud rate) to the ESP and enter the WiFi credentials manually:

Code: Select all

wifissid,YourWiFiSSID
wifikey,YourSecretWiFiPassword
save
Then reboot the unit and it should connect to your WiFi.

The things fixed in this build:
- WiFi events were not processed well, especially the ones when the ESP is running in AP mode to configure it
- On the Setup page, the CSS would not load
- When changing/entering the WiFi credentials during initial setup, it would take over 10 minutes before the ESP would try to connect. (that's why I suggest to reboot after entering the credentials via serial using the build on your node)

obod0002c
Normal user
Posts: 119
Joined: 10 Aug 2019, 20:31

Re: GPIO's for SonOff THR320D

#27 Post by obod0002c » 05 Nov 2022, 18:48

It works, thx!

Tried to access the DS18B20 temperature sensor on GPIO25 quickly, but received 0.00 readings.
Have to take a closer look I guess.

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: GPIO's for SonOff THR320D

#28 Post by TD-er » 05 Nov 2022, 19:15

Is GPIO-25 on this unit I/O or only output?

obod0002c
Normal user
Posts: 119
Joined: 10 Aug 2019, 20:31

Re: GPIO's for SonOff THR320D

#29 Post by obod0002c » 05 Nov 2022, 20:17

Good question but how could I know ;)

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: GPIO's for SonOff THR320D

#30 Post by TD-er » 05 Nov 2022, 22:44

Add a switch task and see if its state switches when you connect the pin to GND or 3V3.

obod0002c
Normal user
Posts: 119
Joined: 10 Aug 2019, 20:31

Re: GPIO's for SonOff THR320D

#31 Post by obod0002c » 13 Nov 2022, 15:09

If I connected the PIN's properly (no RJ45 jack available at the moment) non of the GPIO's 1 .. 25 change it's state when data is connected to GND or 3V3.

But honestly I can't even get a reading of 3V3 when attaching the multimeter.

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: GPIO's for SonOff THR320D

#32 Post by TD-er » 13 Nov 2022, 15:15

I have ordered these (and received them a few days ago)
But have not yet found the time to look into these. So right now I have no idea whether you need to toggle something to enable something on these pins.

I also ordered the Dallas sensor for these, so I should be able to see some activity then.... I hope.

obod0002c
Normal user
Posts: 119
Joined: 10 Aug 2019, 20:31

Re: GPIO's for SonOff THR320D

#33 Post by obod0002c » 13 Nov 2022, 15:31

might be GPIO27 as due to https://templates.blakadder.com/sonoff_THR320D.html
GPIO27 Output Hi

obod0002c
Normal user
Posts: 119
Joined: 10 Aug 2019, 20:31

Re: GPIO's for SonOff THR320D

#34 Post by obod0002c » 13 Nov 2022, 15:40

confirmed: /control?cmd=gpio,27,1 gives a temperature reading
Your soft is awesome 8-)

obod0002c
Normal user
Posts: 119
Joined: 10 Aug 2019, 20:31

Re: GPIO's for SonOff THR320D

#35 Post by obod0002c » 13 Nov 2022, 16:08

Now comes the software part:
if I, e.g., would like to check the sensor's temperature every 5seconds, would you say I leave the 3V3 ON all time or should I switch it ON/off for every reading?

How would you implement detecting a rising temperature ..

User avatar
Ath
Normal user
Posts: 3417
Joined: 10 Jun 2018, 12:06
Location: NL

Re: GPIO's for SonOff THR320D

#36 Post by Ath » 13 Nov 2022, 16:26

obod0002c wrote: 13 Nov 2022, 16:08 Now comes the software part:
if I, e.g., would like to check the sensor's temperature every 5seconds, would you say I leave the 3V3 ON all time or should I switch it ON/off for every reading?

How would you implement detecting a rising temperature ..
I can't see a reason to turn off the power for the sensor with that small interval, as the low power consumption of the sensor isn't going to burn your budget. Burning CPU cycles for turning it on and off could be more expensive... :lol:
/Ton (PayPal.me)

obod0002c
Normal user
Posts: 119
Joined: 10 Aug 2019, 20:31

Re: GPIO's for SonOff THR320D

#37 Post by obod0002c » 13 Nov 2022, 17:34

there seems to be something more .. as the temperature sensor has gone again.

GPIO's so far:
GPIO,19,1 + GPIO,22,0 -> 'big' relay OFF (seems to be inverted) 19,0+22,1 gives the noisy 'clack' + AC on L Out)

GPIO,4,1 'small' relay ON

GPIO,13,1 // right LED green OFF
GPIO,15,1 // mid LED blue OFF
GPIO,16,1 // left LED red OFF

obod0002c
Normal user
Posts: 119
Joined: 10 Aug 2019, 20:31

Re: GPIO's for SonOff THR320D

#38 Post by obod0002c » 13 Nov 2022, 19:14

no idea anymore, posting a screen of when it used to work, maybe that'll help later
Image
Attachments
ITworkED.png
ITworkED.png (272.62 KiB) Viewed 14664 times

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: GPIO's for SonOff THR320D

#39 Post by TD-er » 13 Nov 2022, 20:00

Maybe easier to start monitoring the pins using the "monitor" command.
Then you can simply see each pin state on the pin state buffer (link on tools page)
You can also see the events in the log when monitor is enabled for these pins.

See: https://espeasy.readthedocs.io/en/lates ... r#commands

Do you have a resistor between data and 3V3?
Maybe the Dallas task should also be re-init when the GPIO-27 was pulled down?
The sensor my need some re-init if it was powered down.

See for the resistor: https://espeasy.readthedocs.io/en/lates ... e-pictures

obod0002c
Normal user
Posts: 119
Joined: 10 Aug 2019, 20:31

Re: GPIO's for SonOff THR320D

#40 Post by obod0002c » 13 Nov 2022, 22:26

Saw the manual for the resistor, thx, but somehow didn't dare to cut the only one I have at the moment - maybe also as I expected the device to have one integrated and me doing something stupid.

How could I re-init the Dallas task? Disabling/enabling resp. rebooting with GPIO27 set to 1 on boot didn't do.

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: GPIO's for SonOff THR320D

#41 Post by TD-er » 13 Nov 2022, 22:37

you can give the commands
taskdisable,N
taskenable,N

With N being the task index as shown on the Devices page.

You can also try to enable the internal pull-up resistor on that pin on the Hardware tab.
Both on GPIO 27 and 25

obod0002c
Normal user
Posts: 119
Joined: 10 Aug 2019, 20:31

Re: GPIO's for SonOff THR320D

#42 Post by obod0002c » 14 Nov 2022, 17:06

internal pull-up resistor activated for GPIO27 .. as the Dallas one seem to not own one on its device's tab.

taskdis/enable:

456730: EVENT: Clock#Time=Mon,17:04
456878: ACT : taskdisable,27
456883: ACT : TaskEnable,27
457318: EVENT: TaskExit#ttt=27,0
457329: EVENT: TaskInit#ttt=27,0
475373: static_file: /esp.css
475456: WD : Uptime 8 ConnectFailures 0 FreeMem 201864 WiFiStatus WL_CONNECTED 3 ESPeasy internal wifi status: Conn. IP Init
475772: static_file: /favicon.ico

temperature reading still 0.00 unfortunately .. somehow believing I have to cut my own RJ9 to connect multimeter e.a.

User avatar
Ath
Normal user
Posts: 3417
Joined: 10 Jun 2018, 12:06
Location: NL

Re: GPIO's for SonOff THR320D

#43 Post by Ath » 14 Nov 2022, 17:15

Does your task 27 enable GPIO 27 to a 1 level? In your last screenshot GPIO27 was on task 22 and the DS18b20 on 23.
Maybe you should just send the gpio,27,1 command to turn GPIO 27 on.
/Ton (PayPal.me)

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: GPIO's for SonOff THR320D

#44 Post by TD-er » 14 Nov 2022, 17:36

GPIO 27 is just for powering the sensor.
Data is GPIO-25 as far as I understood.

So you need to enable the pull-up to GPIO-25.
En put GPIO-27 to "output high"
Only the pull-up isn't strong enough to power the Dallas sensor (at least how I think it is connected electrically)

These "boot states" on the Hardware tab are done before the plugins are initialized.

On top of that you can also place this in the rules:

Code: Select all

on System#Boot do
  GPIO,27,1
endon

obod0002c
Normal user
Posts: 119
Joined: 10 Aug 2019, 20:31

Re: GPIO's for SonOff THR320D

#45 Post by obod0002c » 14 Nov 2022, 17:59

loosing track, I have to admit ..

Image
Image
GPIO27.png
GPIO27.png (18.22 KiB) Viewed 14588 times
(super silly, I know ..)

Image
onsysboot.png
onsysboot.png (43.97 KiB) Viewed 14588 times
Image
GPIO27b.png
GPIO27b.png (31.95 KiB) Viewed 14586 times
Attachments
GPIO27-OutputHI.png
GPIO27-OutputHI.png (8.02 KiB) Viewed 14588 times

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: GPIO's for SonOff THR320D

#46 Post by TD-er » 14 Nov 2022, 18:01

Can you measure the voltage on the 3V3 pin?
Perhaps it is slightly less than 3V3 and then some Dallas sensors may not like it?

Also to make sure this pin 27 isn't inverted or something like that (e.g. you need to set it to "0" to output 3V3)

obod0002c
Normal user
Posts: 119
Joined: 10 Aug 2019, 20:31

Re: GPIO's for SonOff THR320D

#47 Post by obod0002c » 14 Nov 2022, 18:10

I meanwhile rasped my own RJ9 jack, not super good but should do.

left and right pins are 3V3 and GND or the other way round, depending on how you look at it. The multimeter gives a correct display of 3.341V.
If I connect data and GND or data and 3V3 nothing changes, output in the device's tab remains at 0.00

I just wonder: was it by accident that it worked for let's say half an hour or am I do something wrong now ..

obod0002c
Normal user
Posts: 119
Joined: 10 Aug 2019, 20:31

Re: GPIO's for SonOff THR320D

#48 Post by obod0002c » 14 Nov 2022, 19:47

I erased and flashed the device again with HEAD_1f690ef version (20221104) ..
Warning: Connected via AP ..
Groundhog day?

User avatar
Ath
Normal user
Posts: 3417
Joined: 10 Jun 2018, 12:06
Location: NL

Re: GPIO's for SonOff THR320D

#49 Post by Ath » 14 Nov 2022, 20:24

obod0002c wrote: 14 Nov 2022, 19:47 Warning: Connected via AP ..
Groundhog day?
This?:
Ath wrote: 04 Nov 2022, 20:02 You did reconnect the tablet to the regular WiFi Access Point (AP), I assume? (I always have to do that manually)
The AP doesn't get auto-disconnected after the WiFi of the ESP is configured, only after the last connected client of the AP is disconnected, the AP will be stopped.
And the newly assigned IP is only available on the WiFi AP the ESP is now connected to as a client, there is no internal routing between the AP and STA (client) networks.
/Ton (PayPal.me)

obod0002c
Normal user
Posts: 119
Joined: 10 Aug 2019, 20:31

Re: GPIO's for SonOff THR320D

#50 Post by obod0002c » 14 Nov 2022, 22:27

Yes, ESP Easy Hotspot and setting up credentials for normal WiFi worked fine again.
I put my mobile to flight mode, restarted the Sonoff but no connection possible. Some half hour later I checked with my mobile and the ESP hotspot was still available and the device willing to connect in AP mode

Post Reply

Who is online

Users browsing this forum: No registered users and 32 guests