No I2C with Sonoff 4CH R2

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
ajheyworth
New user
Posts: 9
Joined: 29 Aug 2018, 22:06

No I2C with Sonoff 4CH R2

#1 Post by ajheyworth » 20 Apr 2019, 09:06

Just diving into a Sonoff 4CH R2 which provides 4x relay outputs, a couple of unused GPIO pins on the board and 4x inputs tied to buttons.

I want to add an MCP23017 port expander to gain some more useful IO on the side and also for an OLED screen.

Q1. Trawling the internet it would seem that GPIO 01 and GPIO 03 are used for I2C. Does anyone else concur?

Q2. In ESP Easy Mega software, it seems that GPIO 01 and GPIO 03 are greyed out, so can't be allocated for I2C, yet I cannot see them allocated anywhere else.

Whilst on this topic...

Q3. Has anyone come across a very cheap IO breakout board tied to a port expander/circuit - just to provide a combination of both input and output connections? I've seen the relay boards, but am specifically looking for more inputs to reed switches etc.

Many thanks

papperone
Normal user
Posts: 497
Joined: 04 Oct 2016, 23:16

Re: No I2C with Sonoff 4CH R2

#2 Post by papperone » 21 Apr 2019, 08:19

ajheyworth wrote: 20 Apr 2019, 09:06 Q1. Trawling the internet it would seem that GPIO 01 and GPIO 03 are used for I2C. Does anyone else concur?
As far as I know the standard I2C pins are GPIO4 and GPIO5 and I use them in quite few projects....
My TINDIE Store where you can find all ESP8266 boards I manufacture --> https://www.tindie.com/stores/GiovanniCas/
My Wiki Project page with self-made PCB/devices --> https://www.letscontrolit.com/wiki/inde ... :Papperone

ajheyworth
New user
Posts: 9
Joined: 29 Aug 2018, 22:06

Re: No I2C with Sonoff 4CH R2

#3 Post by ajheyworth » 21 Apr 2019, 08:27

papperone wrote: 21 Apr 2019, 08:19
ajheyworth wrote: 20 Apr 2019, 09:06 Q1. Trawling the internet it would seem that GPIO 01 and GPIO 03 are used for I2C. Does anyone else concur?
As far as I know the standard I2C pins are GPIO4 and GPIO5 and I use them in quite few projects....
Here is the known GPIO list for the Sonoff 4CH R2:
GPIO 00 - Button 1
GPIO 04 - Relay 3
GPIO 05 - Relay 2
GPIO 09 - Button 2
GPIO 10 - Button 3
GPIO 12 - Relay 1
GPIO 13 - WiFi LED
GPIO 14 - Button 4
GPIO 15 - Relay 4

papperone
Normal user
Posts: 497
Joined: 04 Oct 2016, 23:16

Re: No I2C with Sonoff 4CH R2

#4 Post by papperone » 03 May 2019, 07:10

ajheyworth wrote: 21 Apr 2019, 08:27 Here is the known GPIO list for the Sonoff 4CH R2:
GPIO 00 - Button 1
GPIO 04 - Relay 3
GPIO 05 - Relay 2
GPIO 09 - Button 2
GPIO 10 - Button 3
GPIO 12 - Relay 1
GPIO 13 - WiFi LED
GPIO 14 - Button 4
GPIO 15 - Relay 4
Then there are chances you can't use I2C with yout sonoff 4CH Pro due to the fact you have no good GPIO avail for the protocol.
I can confirm GPIO1/3 are the hardware serial and probably can't be used reliably for I2C communication.
My TINDIE Store where you can find all ESP8266 boards I manufacture --> https://www.tindie.com/stores/GiovanniCas/
My Wiki Project page with self-made PCB/devices --> https://www.letscontrolit.com/wiki/inde ... :Papperone

User avatar
toffel969
Normal user
Posts: 469
Joined: 03 Jan 2017, 10:58
Location: Germany

Re: No I2C with Sonoff 4CH R2

#5 Post by toffel969 » 03 May 2019, 11:48

papperone wrote: 03 May 2019, 07:10
ajheyworth wrote: 21 Apr 2019, 08:27 Here is the known GPIO list for the Sonoff 4CH R2:
GPIO 00 - Button 1
GPIO 04 - Relay 3
GPIO 05 - Relay 2
GPIO 09 - Button 2
GPIO 10 - Button 3
GPIO 12 - Relay 1
GPIO 13 - WiFi LED
GPIO 14 - Button 4
GPIO 15 - Relay 4
Then there are chances you can't use I2C with yout sonoff 4CH Pro due to the fact you have no good GPIO avail for the protocol.
I can confirm GPIO1/3 are the hardware serial and probably can't be used reliably for I2C communication.
Hi

You can use GPIO1/3 as I2C after disabling serial in advanced tab.
Domoticz on Raspi 2 -- 14 ESP units (hacked Sonoff,NodeMCUs, Wemos, self-built units) running with RC140- Mega 2.0.0 dev8

User avatar
Schmurtz
New user
Posts: 2
Joined: 06 Jan 2017, 10:56

Re: No I2C with Sonoff 4CH R2

#6 Post by Schmurtz » 25 Oct 2020, 11:35

I am interested in the outcome of this question!
So is it finally possible to add an MCP23017 to the Sonoff 4CH R2 using I²C ?
Once serial RX/TX disabled you can use GPIO 1 and 3 for I²C ?

Someone has done it successfully ?

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

Re: No I2C with Sonoff 4CH R2

#7 Post by TD-er » 25 Oct 2020, 13:07

It should indeed be possible to use those pins for I2C.
Just make sure to uncheck "Enable Serial port:" on the Tools->Advanced tab.

I do advice to use a simple pin header for this, as you may need to use them later for serial again to upgrade ESPEasy as this one uses only an 1M flash chip.

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

Re: No I2C with Sonoff 4CH R2

#8 Post by Ath » 25 Oct 2020, 13:29

Schmurtz wrote: 25 Oct 2020, 11:35 Someone has done it successfully ?
I have several Sonoff S20's, that like the 4CH R2 only expose gpio 1 and 3, to connect I2C sensors, though you must take care of the fact that there may be dangerously high voltages on these connections, so please wire them safely!
/Ton (PayPal.me)

Post Reply

Who is online

Users browsing this forum: No registered users and 36 guests