Sonoff 4CH PRO - I need 4 input

1,581 views
Skip to first unread message

Roberto Giovannini

unread,
Jan 7, 2018, 12:35:05 PM1/7/18
to SonoffUsers
Hi to everybody,
my name is Roberto and I'm starting to use Sonoff devices with Tasmota firmware.
At the moment I own four Basic devices, two of them are used to replace my thermostats.
I'm planning to add remote control to three lights in my house, using a Sonoff 4CH PRO.
When you mix wall switch (the ones already fitted) and remote controls means that your control system should be aware of the ON-OFF status of a light, at least to correctly represent its status on a dashboard.
Looking at 4CH PRO schematic it seemed to me that pins 15, 16, 17 and 18 (GPIO11, GPIO06, GPIO07 and GPIO08) are not used, so I tought it would be possible to define them as GPIO_USER in the module template.
In the module templete, however, those pins seem not available as they are labelled as "Flash connection".
Could anybody please help me to understand if (and how) I can connect at least 3 switch sensors to the 4CH PRO?
TIA
Roberto

Phil

unread,
Jan 7, 2018, 10:26:43 PM1/7/18
to SonoffUsers
I probably mis read the problem, but cant you simply wire the switch connections to the back ends of the micro switches already dedicated to relay control? S1,-S4 on gpio 0,9,10,14


Roberto Giovannini

unread,
Jan 8, 2018, 4:00:40 AM1/8/18
to SonoffUsers
Hi Phil,
are you telling me that if I set those GPIOs as GPIO_USER in the module template I can use them for reporting the status of the external switches connected to them instead of for the original use (relay control)?
In this case what you suggested can answer my question.
Thanks
Roberto

Mike Roberts

unread,
Jan 8, 2018, 6:31:32 PM1/8/18
to SonoffUsers
Roberto
I think we may have misread your requirement.

You do not need to do anything to your sonoff.

If you monitor the MQTT traffic you will see that the sonoff will report any changes to each switch regardless of where the initiation comes from.  I do this on my system (Node-Red on a Pi)  When a switch is operated on the Node-Red dashboard it sends the MQTT command to switch the relay on.  However at this moment the switch does not show on.  It waits until it sees the sonoff MQTT message saying it is on and then shows on.  In this way if the sonoff is turned off directly the dashboard switch will also change.  This arrangement is part of my electic blanket example at the end on my instructable at: https://www.instructables.com/id/Home-Automation-Sonoff-Tasmota-Sensors-LEDs-Develo/  The Node-Red flow is included so you can try it if you wish (delete the parts you do not need and duplicate/modify for each of your switches).

Mike
Message has been deleted
Message has been deleted
Message has been deleted

Roberto Giovannini

unread,
Jan 11, 2018, 9:02:40 AM1/11/18
to SonoffUsers
Thanks Marco,
following your answer I look again into sonoff_template.h and I found that

GPIO_USER,        // GPIO01 Serial RXD and Optional sensor
GPIO_USER,        // GPIO02 Optional sensor
GPIO_USER,        // GPIO03 Serial TXD and Optional sensor

So, after program flashing, GPIO1, GPIO02 and GPIO03 should be usable as user input (three are enough in my case).

It was not clear to me why you say that GPIO4 and GPIO14 are user configurable while in sonoff_template.h they are defined as:

GPIO_REL3, // GPIO04 Sonoff 4CH Red Led and Relay 3 (0 = Off, 1 = On) GPIO_KEY4, // GPIO14 Button 4

Roberto
Reply all
Reply to author
Forward
0 new messages