arendst / Tasmota

Alternative firmware for ESP8266 and ESP32 based devices with easy configuration using webUI, OTA updates, automation using timers or rules, expandability and entirely local control over MQTT, HTTP, Serial or KNX. Full documentation at
https://tasmota.github.io/docs
GNU General Public License v3.0
22.26k stars 4.81k forks source link

new hardware Teckin SP22 v1.4 #3950

Closed Clooney82 closed 6 years ago

Clooney82 commented 6 years ago

Hello together,

just bought a 4pack of Teckin SP22 because, I knew they were identical to Blitzwolf SHP2 / Gosund SP1. I´ll got them yesterday an recognized that there is a new Version of them out now.

  1. The are no more screwed together
  2. New HW Layout. TYWE2S based

Layout of new HW: img_7789 img_7794

TYWE2S: img_7790 img_7792

Details: img_7796 img_7797

img_7795 img_7798

Good new is, that i managed to get them to work. For flashing I used this page: https://github.com/arendst/Sonoff-Tasmota/wiki/CE-Smart-Home---LA-WF3-Wifi-Plug-(TYWE2S)

For basic feature I used a generic board in configuration GPIO1 Button 1 GPIO3 Led2i GPIO13 Led1i GPIO14 Relay1

after this was working I tried to figure out power measuring feature. In sonoff_template.h I added a new entrie of for the Teckin based on the Blitzwolf setup. After a few tried I got a working one.

{ "TECKIN SP22v1.4", // https://www.amazon.de/gp/product/B07D5V139R GPIO_USER, // GPIO00 Red Led (1 = On, 0 = Off) GPIO_KEY1, // GPIO01 Serial TXD and Button GPIO_USER, // GPIO02 Blue Led (1 = On, 0 = Off) GPIO_LED2_INV, // GPIO03 Serial RXD and Red Led (1 = On, 0 = Off) GPIO_HLW_CF, // GPIO04 BL0937 or HJL-01 CF power GPIO_HLW_CF1, // GPIO05 BL0937 or HJL-01 CF1 voltage / current 0, 0, 0, 0, 0, 0, // Flash connection GPIO_HLW_SEL, // GPIO12 BL0937 or HJL-01 Sel output GPIO_LED1_INV, // GPIO13 Blue Led (1 = On, 0 = Off) GPIO_REL1, // GPIO14 Relay (0 = Off, 1 = On) 0, 0, 0 }

Only Voltage was not shown correctly, so I calibrated it via console an VoltageSet

Hope this one will get official support.

BR, Jochen

andrethomas commented 6 years ago

Nice

Also see they have a nice way of installing a fuse inside the device ;) image

arendst commented 6 years ago

Pls give it a try and let me know if the power monitoring works as expected.

Clooney82 commented 6 years ago

Hi, just tested your new Version, but it gives very strange power values. So I compared your new Version and mine. Found out, that I use HJL based Values and you HLW Values. After changings this, it looked good, only Voltage calibration needed to:

07:49:04 CMD: VoltageSet 232.5 07:49:04 MQT: stat/sonoffplug03/RESULT = {"VoltageSetCal":1725}

xnrg_01_hlw8012.ino Line 182

  if (BLITZWOLF_BWSHP2 == Settings.module) {
    hlw_power_ratio = HJL_PREF;
    hlw_voltage_ratio = HJL_UREF;
    hlw_current_ratio = HJL_IREF;
    hlw_ui_flag = HJL_SEL_VOLTAGE;
  } else {
    hlw_power_ratio = HLW_PREF;

changed to

  if (BLITZWOLF_BWSHP2 == Settings.module || TECKIN == Settings.module) {
arendst commented 6 years ago

Thx. Just fixed.

Clooney82 commented 6 years ago

thanks, works great now.

andrethomas commented 6 years ago

@Clooney82 Awesome - if you have time please add some wiki information for this device so that other users can also use it easily. Thanks!

docbobo commented 6 years ago

@Clooney82, did you find a non-destructive way to open them up?

MJP-76 commented 6 years ago

Has anyone worked on the SP23 version?

Clooney82 commented 6 years ago

@docbobo Not completly, but you can use a flat screwdriver to get between both housing parts an lift it up until it „cracks“ the glue an than all around. With this was only one part of the housing is damaged. After opening you can Heat it up and form it back, so you don‘t see much damage. I also put a bit glue in the middle of all 4 sides after flashing worked to keep it closed and secured.

pauledd commented 6 years ago

@Clooney82 Hi, the flash page you mentioned states I have to ground GPIO0 to flash the device... Where exactly is GPIO0? Do they mean "IO0"? I ask because the "official" documentation only contains GPIO_4,GPIO_5,GPIO_13... https://fccid.io/2ANDL-TYWE2S/User-Manual/Users-Manual-3596121

EDIT: and some more questions arose...: how did you erease_flash? Did you use tasmota_minimal tasmota_full binary to flash? How did you flash? With Arduino IDE or with something else?

pauledd commented 6 years ago

So I just connected 3.3V, GND, RX & TX to my USB2TTL adapter... RX to TX and TX to RX... 20181027_165215

Is it possible to verify that the serial connection is successful? If I open a terminal (screen /dev/ttyUSB0) and I connect the 3.3V to the board I get a line of garbled characters printed. If I press the button on the board while connecting the power I dont get any output..

pauledd commented 6 years ago

Ok I made some progress... The problem was I did not disconnect the whole USB-Serial adapter but only the 3,3V cable... As I wired "IO0" to GND, plugged in the USB-Serial adapter and issuing the command to first read the flash memory for backup:

sudo esptool.py --port /dev/ttyUSB0 read_flash 0x00000 0x100000 image1M.bin
esptool.py v2.6-beta1
Serial port /dev/ttyUSB0
Connecting....
Detecting chip type... ESP8266
Chip is ESP8285
Features: WiFi, Embedded Flash
MAC: dc:4f:22:xx:xx:xx
Uploading stub...
Running stub...
Stub running...
^[[C1048576 (100 %)
1048576 (100 %)
Read 1048576 bytes at 0x0 in 94.2 seconds (89.0 kbit/s)...
Hard resetting via RTS pin...

So far... going into flash mode again... Then I erased the flash

sudo esptool.py --port /dev/ttyUSB0 erase_flash
esptool.py v2.6-beta1
Serial port /dev/ttyUSB0
Connecting....
Detecting chip type... ESP8266
Chip is ESP8285
Features: WiFi, Embedded Flash
MAC: dc:4f:22:xx:xx:xx
Uploading stub...
Running stub...
Stub running...
Erasing flash (this may take a while)...
Chip erase completed successfully in 3.6s
Hard resetting via RTS pin...

going into flash mode again... Then I flashed the "sonoff-minimal.bin":

sudo esptool.py --port /dev/ttyUSB0 write_flash -fs 1MB -fm dout 0x0 sonoff-minimal.bin 
esptool.py v2.6-beta1
Serial port /dev/ttyUSB0
Connecting....
Detecting chip type... ESP8266
Chip is ESP8285
Features: WiFi, Embedded Flash
MAC: dc:4f:22:xx:xx:xx
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Compressed 346240 bytes to 246184...
Wrote 346240 bytes (246184 compressed) at 0x00000000 in 22.7 seconds (effective 121.9 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...

going into flash mode again... Then I flashed the "sonoff.bin":

sudo esptool.py --port /dev/ttyUSB0 write_flash -fs 1MB -fm dout 0x0 sonoff.bin 
esptool.py v2.6-beta1
Serial port /dev/ttyUSB0
Connecting....
Detecting chip type... ESP8266
Chip is ESP8285
Features: WiFi, Embedded Flash
MAC: dc:4f:22:xx:xx:xx
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Compressed 482512 bytes to 330006...
Wrote 482512 bytes (330006 compressed) at 0x00000000 in 30.2 seconds (effective 127.7 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...

Then I disconnected power and reconnected power but nothing happens if I press the button... Do I have to reassemble the plug and test it on mains ac? Or should it work with 3.3V too?

pauledd commented 6 years ago

Well I guess I have to compile a customized binary instead of using the pre-compiled ones?

pauledd commented 6 years ago

Sorry for polluting this thread. I made more progress. My device is now running the new firmware. The problem was maybe a power/voltage issue and binary issue. Since I powered the 3.3V from my lab power supply and not from my USB-TTY Adapter the device started to blink blue. Of cause I shared the same ground from my lab power suppl. to the USB-Programmer. It showed as a new wifi device on my android phone but seemed to be in a boot loop because it disappeared ever 4 secs. I then compiled the binary myself with arduino ide.

I made changes as @Clooney82 described in his first post in the file Sonoff_template.h, added the new Teckin section and also added the two new GPIOS GPIO_HLW_CF1, GPIO_HLW_SEL in "ProgramSelectablePins" at the end but before "GPIO_MAX". I also added "TECKIN22P" in "SupportedModules" at the end but before "MAXMODULE".

Then I added my AP details in my_user_config.h, compiled and erased and flashed and then the device was reachable in my LAN. I will now reassemble the plug and see if everything else works.

pauledd commented 6 years ago

The plug works now on AC, I can switch it. But how can I show power consumption? There is no such option in the web interface...

pauledd commented 6 years ago

Problem solved: https://github.com/arendst/Sonoff-Tasmota/issues/4204 mission accomplished. bye

philipp2310 commented 6 years ago

Is there any chance to flash it "over the air"? The two sp22 I got don't even offer a smallest slit to get the housing open :/

with plenty force and hot air, I got it open (quite ugly...) unfortunatelly I get now: A fatal error occurred: Failed to connect to Espressif device: Invalid head of packet (0xDE) with a lots of this inbetween: Connecting...TRACE +0.000 command op=0x08 data len=36 wait_response=1 timeout=0.100 data= 0707122055555555 5555555555555555 | ... UUUUUUUUUUUU 5555555555555555 5555555555555555 | UUUUUUUUUUUUUUUU 55555555 | UUUU TRACE +0.001 Write 46 bytes: c000082400000000 0007071220555555 | ...$........ UUU 5555555555555555 5555555555555555 | UUUUUUUUUUUUUUUU 5555555555555555 5555555555c0 | UUUUUUUUUUUUU. TRACE +0.001 Read 1 bytes: f0 TRACE +0.000 Read invalid data: f0 (using 2 raspi, because one will always reboot when i connect 3.3V to the chip)

philipp2310 commented 6 years ago

I now added an external power supply (old PCs psu 3.3V) but still get exactly the same problem. baud is already extreme low(960) but no real difference.

When I change RX/TX I just get a timeout, so it should be correct. Any Idea? I don't really want to use the same ground for both(raspi is at a powerbank atm ;>), might that be the problem?

Edit: Finally one step further, now I am at a write timeout (port should be left empty if you are not 100% sure, no idea why i got a response anyways!) Edit2: I found one problem: one of the connections to the chip was not connected (i was not soldering there so i guess it was that way ._. Now I got a red led (with one combination of the RX/TX) when I start with the button pressed. When I start without pressing the button it only flashes for a second(red as well)

ocl80 commented 6 years ago

@matthewjporter Here is the ESP module in the SP23 (UK version). Just flashed it successfully. To get at the pins on the module, you need to unsolder the Live & Neutral connections on the main PCB so you can remove the PCB from the base. teckin_sp23_uk

MJP-76 commented 6 years ago

@matthewjporter Here is the ESP module in the SP23 (UK version). Just flashed it successfully. To get at the pins on the module, you need to unsolder the Live & Neutral connections on the main PCB so you can remove the PCB from the base.

@ocl80 Thanks for the update, Will give it a bash

How did you get it open, Hot air gun and sharp edge tool i guess, did it destroy the case?

Does it still do the power monitoring?

Cheers

ocl80 commented 6 years ago

@matthewjporter I don't have a hot air gun so just a sharp edge tool in my case. I might have been lucky, but with a bit of patience it opened nicely and you wouldn't know now it is back together. In Tasmota it is configured as a BlitzWolf SHP2, and the energy & power metrics seem to work, although on mine the voltage is off somewhat.

image

MJP-76 commented 6 years ago

Hi All

Just to update on the "dismantling" of the Teckin SP23. I have taken some pics as I go as it may help so here they are:

This is the Unit I have and is currently on Amazon and at £10 each is not bad for a power monitoring plug https://www.amazon.co.uk/TECKIN-Monitoring-Function-Anywhere-Required/dp/B07D7BH6N8/ref=sr_1_1?ie=UTF8&qid=1541589149&sr=8-1&keywords=teckin
2018-11-07 10 25 07

2018-11-07 10 25 12

This is what I used to get into it (Heat gun helped as it is glued together on the edges) 2018-11-07 11 07 01

Only slight damage to the edging but heat gun will fix when closing up 2018-11-07 10 11 18

This is what I found on the inside. This seems to be a new design! 2018-11-07 10 12 17 2018-11-07 10 12 28 2018-11-07 10 22 37

I noticed that it is not using the TYWE2S chip, but is still esp8266 based

After de-soldering the Live & Neutral the board came right off 2018-11-07 10 43 14 2018-11-07 10 43 18 2018-11-07 10 42 58 2018-11-07 10 43 02 2018-11-07 10 43 09

Next steps are a work in progress:

  1. line up the board and cut a hole in the bottom
  2. Make a template to drill holes for my other units to avoid opening up 2018-11-07 11 18 34
  3. Figure out what is what on this new chip and which is GND, TX, RX & GPIO0

Hope this helps right now for anyone else looking at updating these units

BubbaFatAss commented 6 years ago

Hi there,

I also bought a 4 pack of SP23's from Amazon, and was annoyed to find that they were sealed shut. I didn't do as good a job as you did about opening them, but in case you haven't got the pinouts yet, I've worked these out and have flashed mine with the standard SHP2 binary of Espurna which works nicely for me. The pinouts are as follows: sp23 pinout Sorry, I forgot to mark which of the two pads were RX or TX, but at least that's usually easy to swap round, and they're to nice easily identifiable solder pads. I have three more to flash, so I'll update this with the correct RX and TX pins when I do the next one.

Cheers

Andy

MJP-76 commented 6 years ago

@BubbaFatAss

Many thanks, Saved me the time working out the pins

I have 12 of these and a mate has a few more so is why I am making a template to drill the holes and will possibly even do a 3d print template

BubbaFatAss commented 6 years ago

I considered printing a new housing for them, but the first one has mostly heatgunned back in to place, with a bit of epoxy where necessary. I've just desoldered my 2nd and am about to flash it - the first is working very nicely. For £10 a pop for such a compact design of energy monitoring smart plug I'm prepared to do a bit of messing around. Not quite sure I could stomach 12 though! :)

MJP-76 commented 6 years ago

@ £10 a pop is why I have a 12 of them :) as they are the cheapest and easiest way to convert to smart sockets and with the ability to monitor power consumption is just an added bonus

Will post my template once done but no guarantee the hardware wont change as they do with these things

BubbaFatAss commented 6 years ago

I managed to get into the last two in a much cleaner way by hitting the sides hard-ish with a hammer. This cracked the glue, and allowed the parts to be separated with a spudger without destroying the casing. I've previously used Sonoff S20 / s26's which are nicer but don't monitor power and aren't as highly rated.

MJP-76 commented 6 years ago

Hole drilling template coming along however am on the second case I have had to crack open :)

@BubbaFatAss I might just try that trick with the hammer if my templates does not work out but I bet by the time I get to number 12 I will be spot on

First attempt - went for the big RX/TX solder pads and had lined up but kept moving around so tried superglue and hot glue to keep pins in place but very hit and miss on the connection 2018-11-10 19 24 57 2018-11-09 16 41 03 2018-11-09 16 41 15 2018-11-09 16 48 17

Second attempt - Trying for the chip connectors themselves 2018-11-10 19 25 14

Update on the pin-out: 2018-11-07 10 43 14

Note, that I have found that you can connect directly to the neutral plug leg as the ground so will only need 4 holes to be drilled and a crocodile clip onto the neutral plug leg

Now for the Flashing - I use ESPEasy Flasher

  1. Download the sonoff-basic.bin from github
  2. Run ESPEasy Flasher, select the bin (Must be in the same directory as FlashESP8266.exe)
  3. Connect to "sonoff-xxxx" SSID
  4. Open 192.168.4.1
  5. Point browser to IP assigned by your DHCP server (in my case I just fire up TasmoAdmin in HASSIO and do a scan)
  6. Configure unit as a "BlitzWolf SHP2"
  7. Complete MQTT etc etc as per your requirements

Hey Presto 2018-11-09 18 42 45

MJP-76 commented 6 years ago

There is now an option for "Teckin" in the Module type, Testing the two modules to see if I can notice a deference, but both seem to work and have power monitoring

MJP-76 commented 6 years ago

OK, So the "Teckin" module does not work. The on/off button does not work and even the "toggle" on the webpage does not work

No power usage either, Switched back to "BlitzWolf SHP2" and works on reboot

m24andrew commented 6 years ago

@matthewjporter Wow, amazing...I have just got a pack of four of these plugs so would be interested in your .stl to sort mine out once you are done...I'll keep watching your great work!

MJP-76 commented 6 years ago

@m24andrew Here is my current template in stl teckin-sp23_pinout_hole_template.zip

I have not put the holes in it yet as I have got them in roughly the right place so the digital calipers have just come out to play - Told the wife they would come in handy, same as the 3D printer :)

I have gone from this where I cracked it open and cut a nice big hole 2018-11-10 21 10 02 to this with it being cracked open and two smaller holes 2018-11-10 21 10 10 to this with just 4 drill holes 2018-11-10 21 10 18

I fear the top right hole is just a little low and needs moving up so am printing 4 base templates as attached and will then put the final holes in the stl

This would have been easier if you could just do an OTA update via the TUYA or the Smart Life app :(

Good job the plugs are still usable, and in my eyes even more so with the awesome Tasmota firmware on them

m24andrew commented 6 years ago

I know, I did all my old sonoff sockets OTA from the start but one missed out due to the firmware change they made! Thanks for the information, I love these little plugs and as you say, when they have Tasmota they will be great. Keep me posted about your final .stl with the holes and maybe I can save cracking one. I appreciate all your time and ingenuity!

MJP-76 commented 6 years ago

First Flash done without cracking the case open

Do not move a muscle 2018-11-10 22 03 49

Just waiting for the printer to complete and then new holes in the template and attempt #4

BubbaFatAss commented 6 years ago

OK, So the "Teckin" module does not work. The on/off button does not work and even the "toggle" on the webpage does not work

No power usage either, Switched back to "BlitzWolf SHP2" and works on reboot

Yeah, I think the Teckin module is for the SP22 plugs that use the TYWE2S chip instead of the ESP8266 that the SHP2 / SP23 uses. Can confirm mine are now all flashed and comfortably working with HomeAssistant via Espurna.

It's a real shame these aren't done up with screws, would make it so much easier to get into. The template looks really useful though - if I have any more to do I'll grab it and save bashing them with a hammer.

Cheers

Andy

dmartingarcia commented 6 years ago

I have a SP22 right now connected, and in DHCP gives a ESP-**** hostname. Can some versions exists of the same model? @BubbaFatAss

dmartingarcia commented 6 years ago

not many versions but just many hardware specifications in terms of chip brand.

m24andrew commented 6 years ago

First Flash done without cracking the case open

Do not move a muscle

Just waiting for the printer to complete and then new holes in the template and attempt #4

You are making it look so easy...can't wait for the final design!

MJP-76 commented 6 years ago

Thanks @m24andrew

Just ordered some pogo pins to make the connection easier as thes can be set in the template and just pushed into the holes

My philosophy is that I would rather spend a few hours (days in this case) working on a process that makes a long repetitive task like this as simple as possible and make it a simple job to do than the original task

In this case remove the hassle that is cracking open the case and then trying to put it all back neatly when all you have to do is drill 4 holes, insert some PoGo pins and flash

Again, why these manufactures don’t have an OTA update or even extend the pin-outs for easy access is beyond me

Surely they know they are being made for the iOT market and we like to play with these things

Side thought, might be worth trying to contact the manufacture and get the firmware put on at source :)

m24andrew commented 6 years ago

I am sure they tried with itead but got nowhere. I’ll order some pins too from amazon. Is the template with holes done or are you still tweaking? Thanks, Andrew

MJP-76 commented 6 years ago

Very hit and miss at the moment, Will update when my PoGo pins arrive

Might need to crack open another one to ensure holes are 100% aligned :(

m24andrew commented 6 years ago

@matthewjporter that’s a shame having to open another one. I look forward to your updates and again, great work!

NicoWallmeier commented 6 years ago

The new Teckin SP22 are working fine for me in general. The only problem I have is that the power computation is not working accurately. The measured voltage I could correct with the VoltageSet command. But the command PowerSet 60.0 does not work - it still shows 51 W instead of 60 W (I'm using a 60W bulb)...

arendst commented 6 years ago

Play with currentset too

milobt commented 6 years ago

@matthewjporter how did you get on aligning holes with a template? Do you have an updated STL yet that I can try? Thanks.

MJP-76 commented 6 years ago

@matthewjporter how did you get on aligning holes with a template? Do you have an updated STL yet that I can try? Thanks.

From what I can see they are aligned after a few adjustments, just not getting the best connection with some 1mm gauge wire poked in the hole :(

PoGo pins arriving today so will be testing later

Once I have confirmed, will upload the STL with the correct holes for drilling and the PoGo pins

MJP-76 commented 6 years ago

PoGo pins arrived and after a bit of fiddling I have now flashed 3 sockets 2018-11-13 11 21 14 Notice the green wire (5v in my case) is set shorter than the yellow (GND). I found that connecting GND to GPIO0 before 5V is critical to getting the device into flash mode and with the PoGo pins this makes it easier

Best also the connect/push in the RX/TX first before connecting power 2018-11-13 11 20 54

Not happy with the size of the hole as I have 1.5mm drill bit and 1.02mm PoGo pins so going to test with a 1mm drill bit but cant find my 1mm drill bit, thankfully a certain online retailer will deliver by tomorrow

Will start with the STL update for the holes and should be uploaded today or tomorrow

milobt commented 6 years ago

I was thinking of fixing the pogo pins into the 3D printed jig. You could still set the 5V pin slightly higher and then push the jig down to make connection on all pins. This way they would stay straight and hopefully in contact with the pads.

MJP-76 commented 6 years ago

I was thinking of fixing the pogo pins into the 3D printed jig. You could still set the 5V pin slightly higher and then push the jig down to make connection on all pins. This way they would stay straight and hopefully in contact with the pads.

Exactly what the plan is. Now I have them set at the right height am going to fix in place with some hot glue

Making the hole smaller is just me being a bit OC as they move around a tad

If I was doing hundreds of these, I might change the template to have a block to put the PoGo pins in and but since I only have twelve or so hot glue will do :)

MJP-76 commented 6 years ago

Interesting,

As i feared before, here is another Teckin SP23 socket, but it has different printing on it. 2018-11-13 14 29 41

I wonder what the insides look like, Maybe the same as @ocl80 posted as they were the first ones I purchased

Time to break out the hammer, but first let's drill some holes to check 2018-11-13 14 29 41

Yep, Nothing under those holes. I only have 4 so its "Hammer Time"

Bummer