Modding external I2C to SONOFF S20

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
Wiki
Normal user
Posts: 413
Joined: 23 Apr 2018, 17:55
Location: Germany

Modding external I2C to SONOFF S20

#1 Post by Wiki » 13 Oct 2018, 16:10

Hi,

playing around with the SONOFF S20 I wanted to access I2C on this device. Flashing the S20 with espeasy is a known procedure and widely documented. Ih you disable the serial port of the device in Advanced Settings, you will have access to GPIO 1 and GPIO 3 of the built in ESP. But:
To access the GPIO-ports 1 and 3 you have to open the case of the S20. For me thats not my preferred method of adding devices to my boards. So I modified the case to fit in a Molex plug as a power source 3.3V and a Dupont plug as SDA/SCL port.
SONOFF20.1.jpg
SONOFF20.1.jpg (23.62 KiB) Viewed 7701 times
I placed the hole in the lower part of the case right above the PCB and glued the plugs with epoxy for stability.
SONOFF20.4.jpg
SONOFF20.4.jpg (6.84 KiB) Viewed 7701 times
I used these components for the plugs:
SONOFF20.5.jpg
SONOFF20.5.jpg (7.82 KiB) Viewed 7701 times
The wiring inside looks like this (be sure to loop the cables to avoid contact with the switch of the upper case part):
SONOFF20.6.jpg
SONOFF20.6.jpg (36.96 KiB) Viewed 7701 times
How the mounted case looks from outside:
SONOFF20.7.jpg
SONOFF20.7.jpg (4.95 KiB) Viewed 7701 times
I2C cable with BMP280 attached:
SONOFF20.8.jpg
SONOFF20.8.jpg (28.86 KiB) Viewed 7701 times
The plugs are held by a shrink tube:
SONOFF20.9.jpg
SONOFF20.9.jpg (3.66 KiB) Viewed 7701 times
Last edited by Wiki on 13 Oct 2018, 16:14, edited 1 time in total.

Code: Select all

pi@raspberrypi:~ $ man woman
No manual entry for woman
pi@raspberrypi:~ $

Wiki
Normal user
Posts: 413
Joined: 23 Apr 2018, 17:55
Location: Germany

Re: Modding external I2C to SONOFF S29

#2 Post by Wiki » 13 Oct 2018, 16:13

My next action will be the construction of a 3D-printed 90° plug housing.

Code: Select all

pi@raspberrypi:~ $ man woman
No manual entry for woman
pi@raspberrypi:~ $

mrwee
Normal user
Posts: 225
Joined: 31 Aug 2016, 12:52

Re: Modding external I2C to SONOFF S20

#3 Post by mrwee » 13 Oct 2018, 17:36

Have you made sure that none of these are connected to mains when the S20 is powered on? Think I've read that there's no insulation between LIVE and 3.3V/GND :shock:

Wiki
Normal user
Posts: 413
Joined: 23 Apr 2018, 17:55
Location: Germany

Re: Modding external I2C to SONOFF S20

#4 Post by Wiki » 13 Oct 2018, 18:08

Hi,

the four pins onboard the S20 are directly connected to the ESP8266. So if there would be any connection to LIVE the ESP has to be able to run by 230V - sounds new to me.

So I think, there is no connection. But NEVER OPEN THE CASE IF THE S20 IS CONNECTED TO LIVE. But: I will not be responsible for any harm, following my post. Do it on your own risk and do it only, if you know, what you are doing.

Code: Select all

pi@raspberrypi:~ $ man woman
No manual entry for woman
pi@raspberrypi:~ $

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

Re: Modding external I2C to SONOFF S20

#5 Post by TD-er » 13 Oct 2018, 21:57

It is still very well possible the pins are not isolated from the mains.
The ESP8266 is normally not connected to anything accessible to users. But that doesn't mean the "GND" of the ESP is isolated from the mains.
So indeed be warned about the possible dangers when touching these pins with your hands.
Please test with a voltage finder or test with your multimeter if there is an electrical connection between GND of the low voltage part and one of the mains pins.

Wiki
Normal user
Posts: 413
Joined: 23 Apr 2018, 17:55
Location: Germany

Re: Modding external I2C to SONOFF S20

#6 Post by Wiki » 14 Oct 2018, 12:22

At first, @both: thank you for your hints. You are right, messing around with 230V is not a game.

I checked with my multimeter and there is no electrical connection between the mains and the pins.

Does anyone have a source where these concerns are coming from? I would be really interested. I could imagine, that in the past someone has tested a noninsulated low voltage version of the S20. The revision of my board is 1.3. That means that there were other revisions before.

If there are serious concerns about the safety of this mod this thread should be deleted before someone gets harmed.

Code: Select all

pi@raspberrypi:~ $ man woman
No manual entry for woman
pi@raspberrypi:~ $

mrwee
Normal user
Posts: 225
Joined: 31 Aug 2016, 12:52

Re: Modding external I2C to SONOFF S20

#7 Post by mrwee » 14 Oct 2018, 20:37

I can't remember if it was Tinkerman or if it was noted on the Tasmota / Espurna websites. As you state, it might have been an early version. But good that it's no longer the case :)

Wiki
Normal user
Posts: 413
Joined: 23 Apr 2018, 17:55
Location: Germany

Re: Modding external I2C to SONOFF S20

#8 Post by Wiki » 14 Oct 2018, 22:00

The device on the picture red surrounded, the transformer, is the device for galvanically seperating high and low voltage circuits as it does in every charging device for smartphones e.a. So from the moment of opening the case it was a standard switching power supply for me and therefore a "safe" low voltage circuit. May be I should spend a little bit more time to avoid this routine and ask at first my multimeter if my instinct is working correctly. Could be the healthy way. Nevertheless, thanks again for the hints.
SONOFF20Trans.jpg
SONOFF20Trans.jpg (37.17 KiB) Viewed 7658 times
Once again: Follow this idea at yout own risc and only if you know, what you are doing. I am far away from being perfect.

Code: Select all

pi@raspberrypi:~ $ man woman
No manual entry for woman
pi@raspberrypi:~ $

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

Re: Modding external I2C to SONOFF S20

#9 Post by TD-er » 15 Oct 2018, 00:05

The modules that also measure current and voltage are for sure not isolated from mains.
For example the Sonoff POW versions, but there may be others too.

Wiki
Normal user
Posts: 413
Joined: 23 Apr 2018, 17:55
Location: Germany

Re: Modding external I2C to SONOFF S20

#10 Post by Wiki » 15 Oct 2018, 01:32

Yes, maybe. But before writing down a statement I have to take in mind, that e.g. AC current can be measured using the hall effect - and galvanically seperated though. We'll see.

Code: Select all

pi@raspberrypi:~ $ man woman
No manual entry for woman
pi@raspberrypi:~ $

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

Re: Modding external I2C to SONOFF S20

#11 Post by TD-er » 15 Oct 2018, 11:35

Wiki wrote: 15 Oct 2018, 01:32 Yes, maybe. But before writing down a statement I have to take in mind, that e.g. AC current can be measured using the hall effect - and galvanically seperated though. We'll see.
True, but for proper energy monitoring you should also measure the voltage.
And that's a lot more difficult to do without a direct connection.

For these purposes, I have a contact less high voltage sensor, just to make sure there isn't any spot which carries high voltage.
I have the "Uni-T UT-12A" I use for first inspections.

Wiki
Normal user
Posts: 413
Joined: 23 Apr 2018, 17:55
Location: Germany

Re: Modding external I2C to SONOFF S20

#12 Post by Wiki » 15 Oct 2018, 13:29

Oh yes, I think I know what you are talking about, P=UxI :D

Btw I am using the VC840 for years.

Code: Select all

pi@raspberrypi:~ $ man woman
No manual entry for woman
pi@raspberrypi:~ $

vinnie_ki
New user
Posts: 3
Joined: 03 Oct 2018, 12:31

Re: Modding external I2C to SONOFF S20

#13 Post by vinnie_ki » 16 Oct 2018, 15:16

Why don't you use a 4 pole jackplug and socket? The Sonoff TH also uses this connection. It is a much cleaner solution.

Wiki
Normal user
Posts: 413
Joined: 23 Apr 2018, 17:55
Location: Germany

Re: Modding external I2C to SONOFF S20

#14 Post by Wiki » 17 Oct 2018, 11:42

Hi,

because I didn't know this kind of plug. Thanks for the tip.

I have had a glance on the pages of Tinkerman. For the SONOFF POW he figuered out, that the chip for current/voltage measurement has to have a connection between GND ans one of the mains. So its really no good idea to do a mod like this using a SONOFF POW.

Code: Select all

pi@raspberrypi:~ $ man woman
No manual entry for woman
pi@raspberrypi:~ $

Post Reply

Who is online

Users browsing this forum: No registered users and 30 guests