sonoff s20 i2c question

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
bobbybeans
Normal user
Posts: 119
Joined: 26 Feb 2017, 17:30

sonoff s20 i2c question

#1 Post by bobbybeans » 30 Mar 2017, 11:30

hey guys
I received 2 sonoff s20's in the mail. I flashed them with espeay r148 and set it all up for working
I have 2 questions
1) does this support i2c? I know the firmware does and the chip but does anybody know where to hook it up? or am I going to have to look at the pitout diagram and jankily solder wires to the I2c pins? Reason I ask is I have some LED lights that turn on after sunset at night so you can see in the hallway if you get up during the night. However they are on all the time even if the main lights are on. So I was going to hook up BH1750. Do you think that is possible? also do you think it'd be possible to make to look nice without having the sesor dangiling off?

2) my lights in the thallway run esp01 and just a basic relay and DHT22. the setup looks terrible as I custom made a box for it with my 3d printer. Does the S20 have extra pins anywhere that I can hook up a DHT22 to 1 pin? or am I going to have to do the same as above?

Zeric
Normal user
Posts: 18
Joined: 29 Mar 2017, 22:37

Re: sonoff s20 i2c question

#2 Post by Zeric » 30 Mar 2017, 18:19

The only holes for header pins are vcc/tx/rx/gnd. You could reconfigure the TX (GPIO-1) and RX (GPIO-3) in esp easy for other functions after disabling the serial port from the advanced menu. My understanding is you can use GPIO-1 and GPIO-3 for SCL and SDA with i2c, but I haven't tried it. Similarly you could also use one of those pins with a DHT22.

Use caution with the S20 if you are using the US version of the device. The design incorrectly switches Neutral, not Hot. This is a potential safety hazard (depending on what's plugged in to it) and is in violation of the National Electric Code.

bobbybeans
Normal user
Posts: 119
Joined: 26 Feb 2017, 17:30

Re: sonoff s20 i2c question

#3 Post by bobbybeans » 30 Mar 2017, 23:34

Thanks for that info! I didn't even know that was even possible to remap the tx,rx. Cool!
What happens if I have to reflash it /the webpage is not responding? would be disabling serial effectively just turn it into a paperweight if that happened?
Looking this up I can find the disable serial in the adv. But how to i remap the pins? and will it only work for the ones you specified? I see in the hardware tab the sda and scl. is it as easy as just selecting which pin i want? if anyone could enlighten me that would be great

Thanks for the info, I actually saw that in a picture today, it wasn't a post i dont think because i was trying to look at pinouts and layouts of the board, while i was at work... :P

Luckily i have the UK version, do you know if it affects that one? as if it does I was probably going to complain to the seller and they should take them off the market

Zeric
Normal user
Posts: 18
Joined: 29 Mar 2017, 22:37

Re: sonoff s20 i2c question

#4 Post by Zeric » 31 Mar 2017, 02:03

If you need to flash over serial again, it's not a problem. Just disconnect whatever sensor(s) you have on the tx/rx pins and flash away using the same procedure you did originally.

For i2c, you simply go to the hardware page and map scl and sda to GPIO-1 (TX) and GPIO-3 (RX) with the drop down selection. Again, I haven't tried this but as far as I know it works. For the S20, GPIO-1 and GPIO-3 are the only easily accessible pins and you can use them for most anything you want as long as the serial port has been disabled. All other uses would be defined in an individual entry in the Device table, only SDA/SCL are in the hardware menu.

On the Neutral/Hot issue, I doubt it effects the other ones. It's most likely only an issue with the US version.

bobbybeans
Normal user
Posts: 119
Joined: 26 Feb 2017, 17:30

Re: sonoff s20 i2c question

#5 Post by bobbybeans » 03 Apr 2017, 16:32

thanks I will check this all out today

xbmcnut
Normal user
Posts: 49
Joined: 17 Mar 2016, 08:49
Location: Auckland, NZ
Contact:

Re: sonoff s20 i2c question

#6 Post by xbmcnut » 11 Jul 2019, 12:45

bobbybeans wrote: 03 Apr 2017, 16:32 thanks I will check this all out today
You ever get it working? I tried today and the I2C scan came up with a whole bunch or sensor addresses but then defaulted to use 0x23, the default. The value initially reported, bounced around a bit then got stuck on one value never to update again.
Numerous Sonoff's and Shelly's, Home Assistant on Intel NUC i3, Aeotec Z-Stick (Gen 5), deCONZ Zigbee Stick, 3 x Echo Dot's and 5 x Google Home

Post Reply

Who is online

Users browsing this forum: No registered users and 11 guests