mirror of https://github.com/arendst/Tasmota.git
cleanup
parent
0b1b9da370
commit
8aa2741571
|
@ -1,34 +1,18 @@
|
|||
One capability of Tasmota is that you can connect additional things to available pins on the [ESP8266](https://en.wikipedia.org/wiki/ESP8266) that controls these devices.
|
||||
|
||||
If a pin is defined as GPIO_USER in the module template, you can assign one of the following example functions (complete [list](https://github.com/arendst/Sonoff-Tasmota/wiki/Components#components-list)):
|
||||
```
|
||||
* GPIO_NONE, // Not used
|
||||
* GPIO_DHT21, // DHT21, AM2301
|
||||
* GPIO_DHT22, // DHT22, AM2302, AM2321
|
||||
* GPIO_DSB, // Single wire DS18B20 or DS18S20
|
||||
* GPIO_I2C_SCL, // I2C SCL
|
||||
* GPIO_I2C_SDA, // I2C SDA
|
||||
* GPIO_WS2812, // WS2812 Led string
|
||||
* GPIO_IRSEND, // IR remote
|
||||
* GPIO_SWT1, // User connected external switches
|
||||
* GPIO_KEY1, // Button usually connected to GPIO0
|
||||
* GPIO_REL1, // Relays (0 = off, 1 = on)
|
||||
* GPIO_REL1_INV, // Relays with inverted signal control (0 = on, 1 = off)
|
||||
* GPIO_LED1, // Leds (0 = off, 1 = on)
|
||||
* GPIO_LED1_INV, // Leds with inverted signal control (0 = on, 1 = off)
|
||||
```
|
||||
If a pin is defined as GPIO_USER in the module template, you can assign a function to it. (Complete [list](https://github.com/arendst/Sonoff-Tasmota/wiki/Components#components-list)) of functions.
|
||||
|
||||
To make a link between the different naming schemes of pins, connectors and logical functions, the [Pin Definition overview](https://github.com/esp8266/esp8266-wiki/wiki/Pin-definition) in the esp8266 wiki is quite helpful.
|
||||
|
||||
## Restrictions
|
||||
## Restrictions 🚨
|
||||
|
||||
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](https://tttapa.github.io/ESP8266/Chap04%20-%20Microcontroller.html).
|
||||
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 any constraints. The others can be used, but you have to mind the constraints outlined in [this document](https://tttapa.github.io/ESP8266/Chap04%20-%20Microcontroller.html).
|
||||
|
||||
# Examples
|
||||
## Connect switch
|
||||
If you take a Sonoff Basic and connect a switch between pin4 (ground) and pin5 (GPIO14) of the 5 pin programming header you now have a second switch connected to the device. You can set this through the module config page as option ``09 Switch1`` or from the command line with ``gpio14 9``.
|
||||
## Examples
|
||||
### Connect switch
|
||||
If you take a Sonoff Basic and connect a switch between pin4 (GND) and pin5 (GPIO14) of the 5 pin programming header you now have a second switch connected to the device. You can set this through the module config page as option ``09 Switch1`` or from the command line with ``gpio14 9``.
|
||||
|
||||
If you have fewer than two relays on the module, the additional switch(es) will not show up any different than the built-in switch and will control the single relay unless you set switchtopic to something other than 0 (either 1 or a custom topic). Once this is done the built-in switch will produce ``stat/<topic>/POWER1`` while the new switch will produce ``cmnd/<switchtopic>/POWER1``
|
||||
If you have fewer than two relays on the module, the additional switch(es) will not show up in the web UI and will control the single relay unless you set switchtopic to something other than 0 (either 1 or a custom topic). Once this is done the built-in switch will produce ``stat/<topic>/POWER1`` while the new switch will produce ``cmnd/<switchtopic>/POWER1``
|
||||
|
||||
With more relays on the modules, the additional switch will create additional POWER\<n> events without the need to set switchtopic.
|
||||
|
||||
|
@ -45,8 +29,6 @@ Instead of connecting a switch, you could connect a 4-pin 2.5mm jack, with the p
|
|||
|
||||
You can then plug a sensor into the jack like you would to a Sonoff TH10/TH16 and define what sensor you have connected to GPIO14
|
||||
|
||||
On the sonoff TH10/TH16 version 2.1 devices, the r1 is wired to GPIO4. No soldering required.
|
||||
|
||||
## Electrical considerations
|
||||
|
||||
When you switch a GPIO pin to an input and hang a long wire off of it, that wire can pick up stray signals and cause the voltage on the GPIO pin to vary. This can cause the system to think the switch has changed.
|
||||
|
|
Loading…
Reference in New Issue