Tasmota Using 8 pins successfully plus other tips

This site has been very good at helping me out, so figured I would share this post with some things I learned while playing with esp8266 (wemos mini) with tasmota loaded.

I’ve set up about 10 of these, but recently set up my most ambitious one.

With one chip I am controlling 3 relays, with 4 switches, and one led. Using 8 pins all together.

Per the tasmota documentation “Don’t use GPIO: 0, 1, 2, 6-11, 15, 16 if you can avoid it. 3 is RX, so best to avoid also (PWM not working here). That leaves 4, 5, 12, 13, 14 that don’t have constraints. The others can be used, but you have to mind the constraints outlined in this document.” This is how I got it to work:

TX/GPIO1 Led. If I put a switch or relay signal here it wouldn’t boot properly.
RX GPIO3 Relay 2
D2 GPIO4 Switch 1
D1 GPIO5 Relay 3
D6 GPIO12 Switch 4
D7 GPIO13 Switch 3
D5 GPIO14 Switch 2
D0 GPIO16 Relay 1

So why 4 switches for 3 relays? Relay 1 controls a staircase light, so there is a switch on top and on bottom. I tried hooking up both switches to the same GPIO pin, assuming that if either end was grounded it would trigger the switch, but that was not the case.

Also learned that you can not set up two different GPIO pins with the same switch number (ie switch 1). That is why I decided to set up one switch as 4, and was going to program it to toggle switch 1, BUT by accident I discovered that switch 4 automatically controls switch 1 without doing anything else.

I didn’t test it out, but my guess is that if you set up one relay, switches 1 through 4 would control it. If you set up two relays, switch 1 and 3 would control relay 1, and switch 2 and 4 would control relay 2. In my case, 3 relays, relay 1 gets controlled by switch 1 and switch 4.

On a different project I tried to set up more than one Led, but didn’t get too far. I had two relays/switches and had two led’s, led 1 and led 2. I had assumed that switch 2 would trigger Led 2 on and off, but that was not the case. Each switch did trigger the correct relay on and off, but both switches toggle Led 1. There is a work around I found watching this video but having the two leds wasn’t really necessary, and in fact better only having one for my needs. I am not sure what Led 2,3,4 are supposed to do, but sure there is some documentation out there for those interested.