Sonoff basic using button as an override off

848 views
Skip to first unread message

tomasz....@hotmail.com

unread,
Sep 26, 2017, 9:43:54 AM9/26/17
to SonoffUsers

Hi,

I want to use Sonoff basic to control submersible pump. The pump should turn off when the water level is low. I have a float switch, which I want to connect to the button in the sonoff. It should work in the way that if the float switch is off, the power should be ALWAYS off. Otherwise it should be controlled by the signals sent to sonoff.

What's the proper configuration to achieve such behavior?

Cheers,
Tomasz

Phil

unread,
Sep 26, 2017, 11:27:18 PM9/26/17
to SonoffUsers
Very Do-able, but rather than connect your input device(float switch) to the existing buttons connection (gpio0), connect it to the available gpio pin (read the manual/wiki)
 the button (gpio0) has functions beyond an overriding on/off switch,
 so dont overload it with extra inputs with unpredictable behaviour.

tomasz....@hotmail.com

unread,
Sep 27, 2017, 2:41:34 AM9/27/17
to SonoffUsers
Alright, I'll use pins to connect the float switch.
However, my question is mostly if there's an existing option to make sure that power is off when the float switch is off. Sonoff should ignore any commands coming to it when float switch is off. Then when the water level is high enough again and float switch is in on state, it should start listening again to new commands coming to it over WIFI. 
The float switch acts as a protection for the pump when the water level is very low (it's a submersible pump). 

Thanks,
Tomasz

Andy Maddick

unread,
Feb 4, 2018, 6:41:29 AM2/4/18
to SonoffUsers
Tomasz,
I am very new to Sonoff devices, but have the background to work through this.. 
I have some great ideas and doing similar things to you using pumps & float switches
I would really appreciate a chat with you, maybe look my up on Facebook - very easy to find with a name like mine :D

Mike Roberts

unread,
Feb 4, 2018, 3:00:24 PM2/4/18
to SonoffUsers
Tomasz

I think you need to make a hardware cutout for this.  These home automation systems only send commands when things change. This means that for example after your float switch changes to turn the pump off it can still be turned on my a MQTT command from elsewhere - e.g, power control by your home automation system.

Mike

Andy Maddick

unread,
Feb 4, 2018, 3:23:19 PM2/4/18
to SonoffUsers
Mike,
One way that jumps to mind...
Relay energised = pump on, float switch is NC while level is high enough, goes NO when level drops below set level
float switch can not handle much current, cut circuit board track to relay, cut track is bridged by float switch
Now no matter what command is sent, IF float is below set level - pump is protected & will not turn on..


But there must be other ways... like if GPIO014 is used connected to float...
Then I dont know 'yet' can GPIO014 's state be looked at internally in firmware before relay is actioned ?
I have many questions for different scenarios..

Vimal Ori

unread,
Feb 5, 2018, 12:46:20 AM2/5/18
to SonoffUsers
Not sure if I understand this correctly ... if you already have a float switch why bother with a sonoff? What else are you trying to achieve? 
The float switch by itself should achieve that behaviour, no?

tomasz....@hotmail.com

unread,
Feb 5, 2018, 6:03:54 AM2/5/18
to SonoffUsers
Yes, I think that would be the most robust, but I'd like to avoid modifying the hardware. However, I think it's still possible to add a new 'mode' which would ignore any MQTT being sent or received when the GPIO is i.e. in a low state.

tomasz....@hotmail.com

unread,
Feb 5, 2018, 6:05:11 AM2/5/18
to SonoffUsers
Hi Andy,

Great to hear you have some ideas. I haven't had time to actually get to doing anything yet, but I'd like to do it before spring.

Tomasz

Mike Roberts

unread,
Feb 5, 2018, 9:36:28 AM2/5/18
to SonoffUsers
Andy

Yes you could put the switch in the line to the relay coil.  The problem then is this makes it difficult to also use it as an input.  However you could put it in the 5v supply to the relay (check it is 5v) and have a voltage divider to bring the relay input down to 3v3 for input to the Sonoff.

Note I am not sure which Sonoffs (if any) conform to double isolation standards for their low voltage circuits.  The Basic certainly looks like it dosn't.  So treat all wiring as if mains to be safe.

Mike

Andy Maddick

unread,
Feb 5, 2018, 3:13:07 PM2/5/18
to SonoffUsers
Ok as a n00b and having NO idea what can be done with custom firmware, question time
(even if sonoff needs a mem chip upgrade 1M -> 4M)
1. Can the Sonoff run a timing routine (Wifi signal sent once, starts 5 Minute ON ) ?
2. Can that 5 Min routine be halted by a change in state at GPIO014 ?
3. Can that change in state at GPIO014  also be reported back to MQQT, server etc
I could add a bunch more questions, but these are the vital ones which will let me expand my imagination :D

Phil

unread,
Feb 5, 2018, 4:49:23 PM2/5/18
to SonoffUsers
1) yes
2) no .. but...
3) yes, and a subscriber (NodeRed perhaps) to the topic can react and publish the halt (OFF) command Q2 requested.. 

Andy Maddick

unread,
Feb 5, 2018, 11:05:48 PM2/5/18
to SonoffUsers
Thanks Phil,
Now I have more homework to do..
Clearly I must delve into the world of 'custom firmware' - happy to learn if it opens up the world of what's possible..
I need a Sonoff to act as a Wifi timer, a pump is activated, water rises until it reaches float switch, float switch either breaks that 'timer cycle' or simply stops water level here until 'timer cycle' is complete..
But the important part is that the 'float switch' (OR another float switch IE 2 in total)
is CONFIRMATION that the watering cycle actually took place... otherwise generate Fault / Alarm state
still trying to work out if this 'idiot proof' structure can be achieved with just a sonoff basic
Cheers

Phil

unread,
Feb 6, 2018, 4:27:52 PM2/6/18
to SonoffUsers
take a mental step backwards and start thinking about sonoff devices loaded with tasmota as simple switches that can respond to messages to turn on or off.
they can also have sensors attached from which they can gather data to publish in message format.


you then use something else to manage and handle all the switch and sensor messages, within which constructs such as timers and alarms can be represented and employed.
The messages are MQTT and most folk host a mqtt broker on the same computer as thier control software. fwiw  I use a raspberry Pi3 with Mosquito mqtt broker and NodeRed as configured by Peter Scargills 2016? christmass script.

Reply all
Reply to author
Forward
0 new messages