Updated ADC (markdown)

blakadder 2019-10-31 14:13:22 +01:00
parent 09aec8cfb4
commit 8012e41aae
1 changed files with 6 additions and 6 deletions

12
ADC.md

@ -1,13 +1,13 @@
ESP chips have one ADC pin that can read analog signals. When referring to the ADC pin these terms are used interchangeably: ADC (Analog-to-digital Converter), TOUT, Pin6, A0 or Analog Pin 0.
ESP8266 has a single ADC pin available. It may be used to read voltage at ADC pin or to read module supply voltage (VCC). > When referring to the ADC pin these terms are used interchangeably: ADC (Analog-to-digital Converter), TOUT, Pin6, A0 or Analog0.
By default Tasmota allows the ADC pin to be used as an external input and assigned to a component. The signal can be interpreted as temperature, lux, potentiometer, button or "generic" voltage signal.
By default Tasmota uses ADC pin to read voltage. The signal comes from an analog [peripheral](peripherals), or sometimes from the device itself (see [Shelly 2.5](Shelly-2.5)). The signal can be interpreted as temperature, lux, button or "generic".
The reading will show in web UI's sensor section as "Analog0 %value%" and published in `tele/%topic%/SENSOR` JSON response as `"ANALOG":{"A0":%value%}`. The pin has a 10-bit resolution, which means _%value%_ can be between `0` and `1024`.
### Rule triggers
Use these triggers in rules:
`on ANALOG#A0div10 do ...` - when the A0 input changes by more than 1% it provides a value between 0 and 100
`on ANALOG#A0div10 do ...` - when the ADC input changes by more than 1% it provides a value between 0 and 100
`on Tele-ANALOG#A0 do ...` - triggers on tele messages with Analog object
> `MQT: tele/tasmota/SENSOR = {"Time":"2019-01-14T19:36:51","ANALOG":{"A0":1024}}`
@ -15,9 +15,9 @@ Use these triggers in rules:
Rule example: [using a potentiometer on analog pin](Rule-Cookbook#use-a-potentiometer).
## ADC_VCC
Instead of an input, ADC pin can be used to measure internal voltage of the ESP chip. To enable this feature you need to [compile your own build](Compile-your-build):
Instead of an input, ADC pin can be used to measure supply voltage of the ESP module (*this is reading in not 100% accurate*). To enable ADC_VCC feature you need to [compile your own build](Compile-your-build):
**If you enable ADC_VCC you cannot use the pin as analog input anymore. More precisely, it is used as an analog input but for internal voltage only.**
**If you enable ADC_VCC you cannot use the pin as analog input anymore.**
user_config_override.h flag:
```
@ -26,7 +26,7 @@ user_config_override.h flag:
```
Internal voltage is published in `tele/%topic%/STATE` under `"Vcc":` in mV:
Supply voltage is published in `tele/%topic%/STATE` under `"Vcc":` in mV:
```
11:14:59 MQT: tele/tasmota/STATE = {"Time":"2019-10-31T11:14:59","Uptime":"0T18:36:12","UptimeSec":66972,"Vcc":3.423,"Heap":28,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"MqttCount":6,"POWER":"OFF","Wifi":{"AP":1,"SSId":"Tasmota","BSSId":"00:00:00:00:00:00","Channel":13,"RSSI":100,"LinkCount":1,"Downtime":"0T00:00:06"}}
```