Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for SONOFF Smart Power Meter Switch | POW Elite #15856

Closed
5 of 11 tasks
nobodyman1 opened this issue Jun 23, 2022 · 476 comments
Closed
5 of 11 tasks

Support for SONOFF Smart Power Meter Switch | POW Elite #15856

nobodyman1 opened this issue Jun 23, 2022 · 476 comments
Assignees
Labels
enhancement Type - Enhancement that will be worked on fixed Result - The work on the issue has ended

Comments

@nobodyman1
Copy link

nobodyman1 commented Jun 23, 2022

PROBLEM DESCRIPTION

Is it possible to use Tasmota on the new SONOFF POW Elite?
I found some Pictures here.
It´s based on an ESP32 and the power measuring is done with a CSE7759B (same as used in SONOFF POW R2).
But what´s about the LCD driver?

REQUESTED INFORMATION

Make sure your have performed every step and checked the applicable boxes before submitting your issue. Thank you!

  • Read the Contributing Guide and Policy and the Code of Conduct
  • Searched the problem in issues
  • Searched the problem in discussions
  • Searched the problem in the docs
  • Searched the problem in the chat
  • Device used (e.g., Sonoff Basic): _____
  • Tasmota binary firmware version number used: _____
    • Pre-compiled
    • Self-compiled
  • Flashing tools used: _____
  • Provide the output of command: Backlog Template; Module; GPIO 255:

TO REPRODUCE

Steps to reproduce the behavior:

EXPECTED BEHAVIOUR

A clear and concise description of what you expected to happen.

SCREENSHOTS

If applicable, add screenshots to help explain your problem.

ADDITIONAL CONTEXT

Add any other context about the problem here.

(Please, remember to close the issue when the problem has been addressed)

@arendst arendst self-assigned this Jun 23, 2022
@arendst
Copy link
Owner

arendst commented Jun 23, 2022

I have one on order. Will see what's possible.

@arendst arendst added the enhancement Type - Enhancement that will be worked on label Jun 23, 2022
Repository owner deleted a comment from Erling55 Jun 29, 2022
Repository owner deleted a comment from sfromis Jun 29, 2022
Repository owner deleted a comment from Erling55 Jun 29, 2022
@dervomsee
Copy link

I received my POW elite yesterday and tried to run my own Platformio code on it.

The used hardware is the following:

  • SOC: ESP32-D0WD-V3
  • Flash: BL2111 (Unknown, esptool flash_id identifies it as a 4MB chip)
  • Power Measurement: CSE7759B
  • LCD Controller: TM1621
  • Relay: FANHAR W15l-1A2T-L2, single coil latching

As usually the button is connected to GPIO00 to enable the flash mode. It is possible to flash a basic program but it is not starting correctly. I based the first test program on the OTA example (https://github.com/espressif/arduino-esp32/blob/master/libraries/ArduinoOTA/examples/BasicOTA/BasicOTA.ino).
It connects to the WIFI, but does not start properly and it is not possible to run a OTA update.

In Platformio i used board = esp32dev as the base.
Does anyone has a idea, what stops the program running on the ESP?

@sfromis
Copy link
Contributor

sfromis commented Jul 1, 2022

Did you try just flashing the standard Tasmota build? If that works......

@dervomsee
Copy link

dervomsee commented Jul 1, 2022

Hmm, good Idea. I started with my own firmware to play with the IOs and the LCD.
I will try the default image later..

Update: Great, this works. Maybe my build environment is broken.
Now Tasmota runs on my POWR320D
ESP Chip Id 1124244 (ESP32-D0WD-V3 rev.3)
Flash Chip Id 0x16405E
Flash Size 4096 KB
Program Flash Size 4096 KB
Program Size 1397 KB
Free Program Space 1482 KB
Free Memory 159.0 KB (frag. 28%)

@arendst
Copy link
Owner

arendst commented Jul 2, 2022

GPIO00 = Button1
GPIO02 = Relay1 (320D - bi-stable - Off)
GPIO05 = LedLink_i
GPIO13 = Relay1 (316D)
GPIO14 = TM1621 DA
GPIO15 = Relay1 (320D - bi-stable - On)
GPIO16 = CSE7766 Rx
GPIO18 = Led_i1
GPIO25 = TM1621 CS
GPIO26 = TM1621 RD
GPIO27 = TM1621 WR

Also DO NOT CONNECT SERIAL WHILE AC IS CONNECTED. Just blew my Earth Leakage Circuit Breaker. No visible damage. Pfew. How could I forget...

image

Current template for POWR316D is:

{"NAME":"Sonoff POWR316D","GPIO":[32,0,0,0,0,576,0,0,0,224,0,0,3104,0,320,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"FLAG":0,"BASE":1}

@barbudor
Copy link
Contributor

barbudor commented Jul 2, 2022

Lcd driver datasheet
Titan Micro TM1621 Lcd driver.pdf
Chinese but seems understandable. Otherwise Google translate is our friend 😊

@sfromis
Copy link
Contributor

sfromis commented Jul 2, 2022

Some driver code found here: https://github.com/emsyscode/TM1621

/*
This code is not clean and also is not perfect, this is only 
a reference to extract ideas and adapte to your solution.
*/

@nobodyman1
Copy link
Author

Lcd driver datasheet Titan Micro TM1621 Lcd driver.pdf Chinese but seems understandable. Otherwise Google translate is our friend 😊

I found the HT1621 which looks very similar to me.

@Nuffic
Copy link

Nuffic commented Jul 3, 2022

TH Elite seems to have the same base as POW Elite (by the looks at least). Would be nice to get support for it as well. I have few of them here + DS18B20, THS01 sensors. I can share info if needed, willing to help any way I can.

@sfromis
Copy link
Contributor

sfromis commented Jul 3, 2022

Looks like support for both is in the works.

@dervomsee
Copy link

@arendst Are you sure with the 320D pins?
My bistable relay uses the following pins: on=GPIO2, off=GPIO4.
The LEDs and the CSE pins are the same.

My config is currently the following:
{"NAME":"Sonoff POWR320D","GPIO": 32,0,224,0,225,576,0,0,0,0,0,0,3104,0,320,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"FLAG":0,"BASE":1}

Does the 316D not have a bistable relay?

@arendst
Copy link
Owner

arendst commented Jul 4, 2022

Not sure about gpio15. As you noticed it's gpio4 it might well be ok.

My 316D has no bistable relay and is controlled by gpio13.

In the meantime I managed to logic analyse the sonoff lcd init sequence and 5 second display update sequence (on the thr316d to stay away from AC voltage). Currently need to find out which bit controls which part of the lcd. Init sequence is clear.

The ht1621 docs are indeed equal to my google translated tm1621 docs.

IMG_20220704_100542417_HDR

@arendst
Copy link
Owner

arendst commented Jul 4, 2022

I have the TM1621 init code working resulting in displaying default state on the POW ;-)

- - - - C
- - - - %RH

Now I have to find out which bit is which element on the LCD screen. Then I have to make a reference between these bits and numbers 0-9. Takes some time.

UPDATE1: Which is bit is which element solved:
IMG_20220704_163039721

Now come up with some nice small tables referencing digit to element.

@Philippe12
Copy link

Hello,
I use for few time a THR316D

The IO that I configured are :

  • Button GPIO 0
  • Relay 1 GPIO 21
  • Relay 2 GPIO 4
  • Alim ON/OFF captor GPIO 27
  • Captor GPIO 25
  • LED power GPIO 16
  • LED connected GPIO15
  • LED auto GPIO13
  • TX GPIO 1
  • RX GPIO 3

@Nuffic
Copy link

Nuffic commented Jul 4, 2022

@Philippe12 big thanks, I've managed to get everything working with this config, but the temperature sensor. Have you managed to use the temperature sensor there?

arendst added a commit that referenced this issue Jul 4, 2022
Add initial Sonoff POWR3xxD display support (#15856)
@arendst
Copy link
Owner

arendst commented Jul 4, 2022

By adding define USE_DISPLAY_TM1621_SONOFF you should be able to see Sonoff POWR3xxD alternating Voltage/Current and TotalEnergy/Power on the LCD display.

Using these templates:

 * {"NAME":"Sonoff POWR316D","GPIO":[32,0,0,0,0,576,0,0,0,224,9280,0,3104,0,320,0,0,0,0,0,0,9184,9248,9216,0,0,0,0,0,0,0,0,0,0,0,0],"FLAG":0,"BASE":1}
 * {"NAME":"Sonoff POWR320D","GPIO":[32,0,224,0,225,576,0,0,0,0,9280,0,3104,0,320,0,0,0,0,0,0,9184,9248,9216,0,0,0,0,0,0,0,0,0,0,0,0],"FLAG":0,"BASE":1}

That's it for today (00:11)

@Philippe12
Copy link

@Nuffic THR sensor (Sonoff Si7021) is a dificulty, it use the same protocole one wire than DHT11 but not with the same timming.

You can find mi first modification at : Philippe12@0d9f674

I know all this modifications are dirty that it for test, but if can help you.

@BangerTech
Copy link

hey @Philippe12 thanks for your modification i´m testing it right now ;-) could you please post your template?
Thanks

@Philippe12
Copy link

@BangerTech

{"NAME":"THR316D","GPIO":[32,3200,0,3232,225,9280,0,0,0,8224,0,544,3872,9184,9216,0,0,224,0,9248,0,1248,0,3840,0,0,0,0,0,0,0,0,0,0,0,0],"FLAG":0,"BASE":1}

I add TM1621 pin

@Nuffic
Copy link

Nuffic commented Jul 5, 2022

@Philippe12 thanks for all the info. We even got the DS18b20 working with it.

@BangerTech
Copy link

so for now the THR320D shows no Temp/Hum on the Display (Tasmota Interface is correct) instead it shows Watt, kWH like the POW try to figure out what to change...

@arendst
Copy link
Owner

arendst commented Jul 6, 2022

Try latest dev.

@BangerTech
Copy link

BangerTech commented Jul 6, 2022

@arendst it does show some temps but some weird ones ;-) and the Tasmota Interface shows no Temp/Hum at all. See Pic.
so i think one of the temps on the display is correct it is the esp32 temp.
@Philippe12 build worked well with the status infos in the tasmota interface but nothing on the display
Screenshot 2022-07-06 094134
Screenshot 2022-07-06 094216

@arendst
Copy link
Owner

arendst commented Jul 6, 2022

This is expected. The SI7021 driver is not available on the ESP32 (yet). The @Philippe12 patched version is not stable either considering the DHT: Invalid reading logging messages.

The display driver selects the current global-temp for being displayed. As the SI7021 is invalid it displays the ESP32 temp. To remove the ESP32 from being fed to global-temp you can either remove the ESP32 temp with command SetSensor127 0 or use the recently released command GlobalTemp2 1 to select the first JSON temperature being the SI7021 one which in turn is invalid and therefor does not show as a temp on the LCD display.

Also when no valid humidity is read it won't show anything on the LCD. Using command GlobalHum2 1 would select the SI7021 humidity.

@pissten
Copy link

pissten commented Feb 18, 2024

Is WTS01 working now or do I need to cut out the "Bulge"? Found some link that worked, but I don't understand what they did... https://www.letscontrolit.com/forum/viewtopic.php?t=9846 I guess it did work with a DS18x20 sensor not a WTS01.

I also asked in Discord and #19373

Also interessted in the WTS01 solution. Is it a work in progress, or is the solution to cut the "bulge"?

@arendst
Copy link
Owner

arendst commented Feb 19, 2024

From #19373 one could conclude it doesn't work
From letscontrolit one could conclude it should work.

I ordered some WTS01 and have a look myself and let you know.

@Elekronixx
Copy link

Elekronixx commented Mar 21, 2024

Hi, on my POWR320D I checked the PCB - FYI the Pin of GPIO15 looks 'not connected' monostabile relay.

IMG_pinout
IMG_20240321_095949

Why I spend time to look for NC pins ? I want to connect an additional DS18B20 sensor (not forseen in the POW Elite).
My question is, for the SW side - it is possible to use with this modification the tasmota SW and do the configuration with this magic Templates like: {"NAME":"Sonoff POWR320D","GPIO":[32,0,9313,0,9312,576,0,0,0,0,928..........}.

Can you support me i.e if I connect one (or two) DS18B20 to GPIO19 (or GPIO22) ?

Br

@sfromis
Copy link
Contributor

sfromis commented Mar 21, 2024

Tasmota supports multiple DS18B20 on the same wires, no need for additional gpios. But yes, if you use the web UI instead of looking at the numbers in the template, you can see that the gpio config for DS18x20 has an extra dropdown to the right, allowing up to 4 such pins.

@Elekronixx
Copy link

Hi, clear - it's onewire. But the original POWR320D has not only one onewire device and so also not a given GPIO. But I will flash tasmota and check what I can do in the web interface. thank you

@pmknowles
Copy link

pmknowles commented Mar 21, 2024 via email

@sfromis
Copy link
Contributor

sfromis commented Mar 21, 2024

No reason to put in the gpios manually, just start from the existing template, you can change pins and name in the web interface, and save it. "Configure Template" instead of "Configure Module".

@pmknowles
Copy link

pmknowles commented Mar 21, 2024 via email

@Elekronixx
Copy link

Elekronixx commented Mar 21, 2024

OK, I got it running via AutoConf and Sonoff POWR316D (LEDs, Display, Relay on/OFF). Then I configure on base of the AutoConf before the pin GPIO19 as DS18x20 1 and rename the config to 'Sonoff POWR316D+DS18B20'. Then I remove the AutoConf and reboot (230V Power Cycle) - i still have the display and the GPIO configured. But I estimate to get also a temperature on the Webpage ?!
Is this the mistace you @pmknowles talk from ?

gpio all gives me "GPIO19":{"1312":"DS18x201"}

12:29:46.377 CMD: gpio all
12:29:46.393 RSL: RESULT = {"GPIO0":{"32":"Button1"},"GPIO1":{"0":"None"},"GPIO2":{"0":"None"},"GPIO3":{"0":"None"},"GPIO4":{"0":"None"},"GPIO5":{"576":"LedLink_i"},"GPIO6":{"0":"None"},"GPIO7":{"0":"None"},"GPIO8":{"0":"None"},"GPIO9":{"0":"None"},"GPIO10":{"0":"None"},"GPIO11":{"0":"None"},"GPIO12":{"0":"None"},"GPIO13":{"224":"Relay1"},"GPIO14":{"9280":"TM1621 DAT"},"GPIO15":{"0":"None"},"GPIO16":{"3104":"CSE7766 Rx"},"GPIO17":{"0":"None"},"GPIO18":{"320":"Led_i1"},"GPIO19":{"1312":"DS18x201"},"GPIO20":{"0":"None"},"GPIO21":{"0":"None"},"GPIO22":{"0":"None"},"GPIO23":{"0":"None"},"GPIO24":{"0":"None"},"GPIO25":{"9184":"TM1621 CS"},"GPIO26":{"9248":"TM1621 RD"},"GPIO27":{"9216":"TM1621 WR"},"GPIO32":{"0":"None"},"GPIO33":{"0":"None"},"GPIO34":{"0":"None"},"GPIO35":{"0":"None"},"GPIO36":{"0":"None"},"GPIO37":{"0":"None"},"GPIO38":{"0":"None"},"GPIO39":{"0":"None"}}

Clear, that I at first have soldered the 4,7k to3.3V and connect the DS18B20 ! :-)

2024-03-21 12_31_28
2024-03-21 12_31_13

@minichma
Copy link

From #19373 one could conclude it doesn't work From letscontrolit one could conclude it should work.

I ordered some WTS01 and have a look myself and let you know.

@arendst Any findings regarding the WTS01?

@arendst
Copy link
Owner

arendst commented Mar 21, 2024

Yes. I cannot get the WTS01 to work reliably. So final fix is remove the bulge and configure as DS18x20

@tof92130
Copy link

Hello,

I have installed tasmota32-fatory.bin from the GitHub tasiota install page.

Flash was successful but it doesn't work on the POW Elite device, no Wifi network and I have this message that continuously repeat.

Any idea ?

rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:184
load:0x40078000,len:12732
ho 0 tail 12 room 4
load:0x40080400,len:2908
entry 0x400805c4

00:00:00.002-215/50 HDW: ESP32-D0WD-V3 v3.0 
00:00:00.013-213/50 UFS: FlashFS mounted with 312 kB free
00:00:00.016-213/50 TFS: File '.settings' not found
00:00:00.019-213/50 TFS: File '.settings.lkg' not found
00:00:00.019-213/50 CFG: Utiliser par défaut
00:00:00.134 QPC: Reset
00:00:00.552 BRY: Berry initialized, RAM used 5180 bytes
00:00:00.573 Projet tasmota - Tasmota Version 13.4.0(tasmota32)-2_0_14(2024-02-14T16:22:51)
00:00:00.963 WIF: WifiManager actif pour 3 minutes
ets Jul 29 2019 12:21:46

@arendst
Copy link
Owner

arendst commented Mar 29, 2024

Yes. Start reading this threat from the beginning and find a solution to your problem.

@tof92130
Copy link

this one was also needed : #19979 (comment)

@PhillyGilly
Copy link

I have two THR316D devices and one SI7021 sensor and one DS18x20 sensor.
I flashed both with v13.4 tasmota.factory32.bin. I can configure both to work with the SI7021 sensor and after applying the DhtDelay 500,40 they work reliably.
image
However I cannot get either to work with the DS sensor. I select the correct device to GPIO25:
image
But the display does not come on and nothing is showing in tasmota:
image
Any ideas?

@pmknowles
Copy link

pmknowles commented Apr 4, 2024 via email

@Tasmodo
Copy link

Tasmodo commented Apr 4, 2024

@PhillyGilly how did you connect the sensor to the device?

@PhillyGilly
Copy link

If you're getting nothing at all it's generally a wiring issue


From: PhillyGilly @.>
Sent: 04 April 2024 18:48
To: arendst/Tasmota @.
>
Cc: pmknowles @.>; Mention @.>
Subject: Re: [arendst/Tasmota] Support for SONOFF Smart Power Meter Switch | POW Elite (Issue #15856)

I have two THR316D devices and one SI7021 sensor and one DS18x20 sensor.
I flashed both with v13.4 tasmota.factory32.bin. I can configure both to work with the SI7021 sensor and after applying the DhtDelay 500,40 they work reliably.
image.png (view on web)https://github.com/arendst/Tasmota/assets/56273663/0404318e-7e43-4f6a-a068-0ee4fd796687
However I cannot get either to work with the DS sensor. I select the correct device to GPIO25:
image.png (view on web)https://github.com/arendst/Tasmota/assets/56273663/9edc7aa2-0c72-48f9-a4d2-cd0d1fab3e66
But the display does not come on and nothing is showing in tasmota:
image.png (view on web)https://github.com/arendst/Tasmota/assets/56273663/cdd5b7d1-9831-4dd0-b28f-f30ff444b50a
Any ideas?


Reply to this email directly, view it on GitHub#15856 (comment), or unsubscribehttps://github.com/notifications/unsubscribe-auth/AI5KPM3ITVLGKLA36DFZ563Y3WG7BAVCNFSM5ZVP735KU5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TEMBTG44DENRWHE2A.
You are receiving this because you were mentioned.Message ID: @.***>

If I set GPIO25 to SI7021 but don't plug in the sensor it shows with null values. So why doesn't the THR316D show DS18x20 at the top of the page even with a null value? The temperature sensor is plugged in by its original RJ9 plug. On other Tasmota devices you can set it up and then plug in the sensor. So why not here?

@pmknowles
Copy link

pmknowles commented Apr 4, 2024 via email

@PhillyGilly
Copy link

There is nothing plugged in (although it makes no difference) but when I set GPIO25 to DS18x20 like this
image
I get nothing below the Title
image
However if I set GPIO25 to other random inputs I get
image
image
image
image

This makes me think that there may be a problem in using DS18x20 relating to the discussion above comment
#15856 (comment)

@sfromis
Copy link
Contributor

sfromis commented Apr 5, 2024

It is quite normal that the DS18x20 driver will not give anything on the front page, or in JSON, unless the sensor is detected. With Weblog 3 enabled, you should see this during boot:
DSB: Sensors found 1
Obviously, the number 0 means nothing detected, and would be bad if you have it plugged in.

@Littlesloths
Copy link

did you look into this?:
#19373

new DS18x20 "with bulge" will not work as they come. You need to cut the bulge first and connect manually...

@sfromis
Copy link
Contributor

sfromis commented Apr 5, 2024

In that case, the supplied device is WTS01, not DS18B20, even if the device incorporates a DS18B20 plus a MCU to bridge to a different protocol.

@PhillyGilly
Copy link

did you look into this?: #19373

new DS18x20 "with bulge" will not work as they come. You need to cut the bulge first and connect manually...

Remarkably I didn't see the "bulge" inside my neatly coiled sensor. Great thank you.

@sfromis
Copy link
Contributor

sfromis commented Apr 13, 2024

I'd not expect people to make new code for just one random relay device, when there are general projects working for lots of similar device.

@S474N
Copy link
Contributor

S474N commented May 12, 2024

Is it upgradeable THR316D via OTA Tasmota 12.5.0.4 to newest?

And how is final version of template? :D

@HectorDRR
Copy link

Yes. I cannot get the WTS01 to work reliably. So final fix is remove the bulge and configure as DS18x20

Hi @arendst , in the #19373 I've put a driver coded in Berry console that seem to work with the WTS01. It lacks of update web page, as I'm newbie to Berry and driver development. But I suppose that with the information I've published it could be implemented the driver directly in the Tasmota code for a next firmware revision. It save us to cut the cable of the WTS01... ;)

@arendst
Copy link
Owner

arendst commented Jun 11, 2024

Your drivers works perfectly and I'm not sure if I should rewrite it in C and hardcode it.

This is a perfect example of berry extending Tasmota!!!

@dx136
Copy link

dx136 commented Jun 11, 2024

An idea for extra GPIO pins on THR3XXD. @Longlife4ever

Here's a question/idea: THR316 and THR320 appear to be identical except for the main relay; presumably the PCB is common, with all the same traces. On the blakadder template site, I see that the THR316 uses GPIO21 for the (monostable) 16A relay; THR3320 uses GPIO19 & GPIO22 for the (bi-stable) 20A relay.

Wouldn't it be relatively easy to access the unused solder pads near the non-populated relay in each case? e.g. on the THR316, the unused solder pads for GPIO19 + GPIO22 in the exposed space where the 20A relay would go?

I ask because this may represent simpler, easier soldering for those who aren't willing/capable to attempt to access SMD solder pads in the relatively crowded area for GPIO26. If this makes sense, it shouldn't be too hard to reverse-engineer to determine where the GPIO pins terminate near the relay.

Comments, suggestions, feedback are solicited & welcome. Thanks.

@sfromis
Copy link
Contributor

sfromis commented Jun 11, 2024

If you want to suggest an idea, you should not really ask about ease of access to such pads, but have an answer about whether it would be feasible.

I'd not really expect holes for "the other" relay type (significant size difference) to be connected directly to the ESP32, as it looks like 5V relays, where the ESP32 only produces 3.3V signals. However, I've not poked around on the board....
https://sonoff.tech/wp-content/uploads/2023/02/SONOFF_THR3_Photos-1.pdf

If you're fine with SMD level soldering at the 3.3V end of that setup, that may be possible, but I thought that SMD level soldering was what you wanted to avoid 😁

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Type - Enhancement that will be worked on fixed Result - The work on the issue has ended
Projects
None yet
Development

No branches or pull requests