arendst / Tasmota

Alternative firmware for ESP8266 and ESP32 based devices with easy configuration using webUI, OTA updates, automation using timers or rules, expandability and entirely local control over MQTT, HTTP, Serial or KNX. Full documentation at
https://tasmota.github.io/docs
GNU General Public License v3.0
22.24k stars 4.82k forks source link

Noob question about Switchmode #866

Closed sfanicola closed 6 years ago

sfanicola commented 7 years ago

Hi guys, don't get bored about my maybe noob question, but I really started from 0 and learned a lot thanks to the guide and the wiki. But there's one thing I can't understand... I've got a Sonoff Basic and would like to configure it from simple turn ON/OFF in Switchmode 6 so in configuration module I selected GPIO 01 09 Switch1 and sent the command via mqtt, receiving {"SwitchMode1":6} as answer. Here comes the noob, how can I use this switch mode? Is a command enough? Should I connect something to the GPIO 01? I would like to use it to open my house gate and don't want to risk to burn something down. I hope something I've done is right :) Thanks in advance

ionciubotaru commented 7 years ago

Easy way - connect your switch to gpio0

Hard way:

sfanicola commented 7 years ago

So you mean I should, after those settings, connect the wires of the switch directly on the gpio and not on the normal output? What about voltage? Input is 220V and output on the gpio?

ionciubotaru commented 7 years ago

It is a misunderstanding, connect 220V to relay output, not to GPIO The switch has no electric potential, it is just a switch.

sfanicola commented 7 years ago

Ok that was a stupid question about voltage. I think I get it. Last question, turning almost on my first post ... Once I set the GPIO1 as a switch, can I control this switch through command without attaching a physical switch? Btw ... to open my gate the sonoff basic is too much power! Maybe I need a 1 Channel 5V ?

ionciubotaru commented 7 years ago

Switch1 is input device. I think you want to control RELAY1 - this is possible POWER1 ON

sfanicola commented 7 years ago

yep, but with the sonoff basic input 220V output will be 220V and will blow my gate circuits :) I have to change relay and take a "1 Channel Inching /Self-lockIing Mode WiFi Wireless Switch 5V/12V" one. Thank you for your kind answer, even if my questions wasn't exactly on focus.

ionciubotaru commented 7 years ago

https://www.banggood.com/DC-5V-24V-DIY-WIFI-Wireless-Switch-Sonoff-SV-Module-For-Smart-Home-p-1063987.html?rmmds=search - this is better

or this

http://www.electrodragon.com/product/wifi-iot-relay-board-spdt-based-esp8266/ SPDT 5 pins relay, Songle 10A/250VAC/30VDC, NOT connected to the AC mains. Three states: normally ON, normally OFF and Common pin.

sfanicola commented 7 years ago

Is the last one compatible with Sonoff-Tasmota? On the compatibility list I found this: http://www.electrodragon.com/product/wifi-iot-relay-board-based-esp8266/

ionciubotaru commented 7 years ago

all electrodragon models are compatibile with tasmota - I use more than 10 different electrodragons in my house

sfanicola commented 7 years ago

Wow! Would love to see that :) Thank you for your kind answers and patience ;)

sfanicola commented 7 years ago

sorry that I continue bothering you... but the relay Electrodragon SPDT arrived this morning. Don't want to burn it! Is there something I need to know how to flash it?

ionciubotaru commented 7 years ago

Just be careful to use a 3V3 FTDI and supply power to ELD via FTDI do not connect it to 220V during programming or when ftdi is nonnected

sfanicola commented 7 years ago

Ok ... so I have to power it just through FTDI while the flash. But after, can I connect the input to 220V or do I need a input power module?

ionciubotaru commented 7 years ago

After flash look at the messages on the serial interface and configure Tasmota In the end remove FTDI and connect it to 220V

sfanicola commented 7 years ago

Great! Everything works now! Thank you very much ionciubotaru ;) Just a final question. I connected the Tasmota ECT instead of the phisical button I had. But I don't want to loose this button... So I turn back to the first confusing question made on top... Is there a way to connect the old button to the relay making it a sort of wired remote button? I guess i have to connect this button to a GPIO, or maybe two? the button to work needs 2 cables...

ionciubotaru commented 7 years ago

Connect the button between gpio0 and gnd

sfanicola commented 7 years ago

ehm... where is gpio0?

sfanicola commented 7 years ago

I understand it finally... sorry for the ignorant questions... I connected the Button on Gpio1 and set it as Switch1. thank you once again

sfanicola commented 7 years ago

Can’t understand switchmode / SwitchTopic page... with the real switch connected the relay starts randomly by itself... Can’t understand why, neither watching the console

davidelang commented 7 years ago

look at the logs, they will tell you what is happening

what's probably happening is that stray electricity and RF is being picked up by the switch wires. You probably need to hook up a pull-up resistor and bypass capacitor.

On Sat, 30 Sep 2017, sfanicola wrote:

Can’t understand switchmode / SwitchTopic page... with the real switch connected the relay starts randomly by itself... Can’t understand why, neither watching the console

sfanicola commented 7 years ago

could bigger wires, maybe shielded ones, could solve the problem?

davidelang commented 7 years ago

bigger wires won't help, shielded may make a difference (may make it less neccessary to put in a bypass capacitor)

but you really should just add a pull-up resistor and try a bypass capacitor, it's simple and 99% of the time your problems go away. k

sfanicola commented 7 years ago

Ok, I will try the resistor, but my electronic welding abilities are really bad :) Where exactly should I hook it up?

davidelang commented 7 years ago

between the GPIO pin and 3.3v, use a resistor in the ~4-10Kohm range.

sfanicola commented 7 years ago

huh... I thought to put it on the wire... now I'm confused. why the 3.3V... there is nothing attached

davidelang commented 7 years ago

you connect the resistor between the wire that is attached to the GPIO and 3.3v so that when the switch is not closed, the wire/GPIO will be pulled up to 3.3v by the resistor.

when you close the switch, you connect the wire/GPIO to ground, and while some current flows through the resistor, it's not enough to counteract the direct path to ground.

stale[bot] commented 6 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] commented 6 years ago

This issue will be auto-closed because there hasn't been any activity for a few months. Feel free to open a new one if you still experience this problem.