Gentlemen, help me figure out how to connect and process the signal from the ZMPT101B correctly. There seem to be examples in C++ for arduino, but they use libraries, but I can’t figure out how to do it correctly with esp8266)) I connected the sensor to the analog port, and it seems that there are readings in the esp home logs, the readings jump very much, although the measured voltage is relatively stable ± 5 v . I also tried using ina226, but it didn’t work.
I believe that this sensor can also show a sine, so for a simple RMS voltage display, you need to describe the reading principle.
esphome:
name: "esphome-web-2"
friendly_name: Wemos d2
on_boot:
- priority: 600
then:
- switch.turn_on: pwm_switch
esp8266:
board: d1_mini
logger:
level: DEBUG
api:
ota:
- platform: esphome
i2c:
wifi:
networks:
- ssid: Pro4
password: Milk33kg
globals:
- id: pwm_level
type: float
restore_value: no
initial_value: '0.0'
- id: pwm_frequency
type: int
restore_value: no
initial_value: '1000'
sensor:
- platform: adc
pin: VCC
name: "VCC Voltage"
update_interval: 1s
accuracy_decimals: 4
[21:00:34][D][sensor:093]: 'VCC Voltage': Sending state 3.22559 V with 4 decimals of accuracy
[21:00:35][D][sensor:093]: 'VCC Voltage': Sending state 3.21387 V with 4 decimals of accuracy
[21:00:36][D][sensor:093]: 'VCC Voltage': Sending state 3.22852 V with 4 decimals of accuracy
[21:00:37][D][sensor:093]: 'VCC Voltage': Sending state 3.22754 V with 4 decimals of accuracy
[21:00:38][D][sensor:093]: 'VCC Voltage': Sending state 3.22754 V with 4 decimals of accuracy
[21:00:39][D][sensor:093]: 'VCC Voltage': Sending state 3.22656 V with 4 decimals of accuracy
[21:00:40][D][sensor:093]: 'VCC Voltage': Sending state 3.22852 V with 4 decimals of accuracy
[21:00:41][D][sensor:093]: 'VCC Voltage': Sending state 3.22852 V with 4 decimals of accuracy
[21:00:42][D][sensor:093]: 'VCC Voltage': Sending state 3.22656 V with 4 decimals of accuracy
[21:00:43][D][sensor:093]: 'VCC Voltage': Sending state 3.22559 V with 4 decimals of accuracy
[21:00:44][D][sensor:093]: 'VCC Voltage': Sending state 3.22656 V with 4 decimals of accuracy
[21:00:45][D][sensor:093]: 'VCC Voltage': Sending state 3.21484 V with 4 decimals of accuracy
[21:00:46][D][sensor:093]: 'VCC Voltage': Sending state 3.17871 V with 4 decimals of accuracy
[21:00:47][D][sensor:093]: 'VCC Voltage': Sending state 3.05273 V with 4 decimals of accuracy
[21:00:48][D][sensor:093]: 'VCC Voltage': Sending state 3.04492 V with 4 decimals of accuracy
[21:00:49][D][sensor:093]: 'VCC Voltage': Sending state 3.17090 V with 4 decimals of accuracy
[21:00:50][D][sensor:093]: 'VCC Voltage': Sending state 3.05664 V with 4 decimals of accuracy
[21:00:51][D][sensor:093]: 'VCC Voltage': Sending state 3.21289 V with 4 decimals of accuracy
[21:00:52][D][sensor:093]: 'VCC Voltage': Sending state 3.16992 V with 4 decimals of accuracy
[21:00:53][D][sensor:093]: 'VCC Voltage': Sending state 3.16895 V with 4 decimals of accuracy
[21:00:54][D][sensor:093]: 'VCC Voltage': Sending state 3.18750 V with 4 decimals of accuracy
[21:00:55][D][sensor:093]: 'VCC Voltage': Sending state 3.04980 V with 4 decimals of accuracy
[21:00:56][D][sensor:093]: 'VCC Voltage': Sending state 3.07617 V with 4 decimals of accuracy
[21:00:57][D][sensor:093]: 'VCC Voltage': Sending state 3.17383 V with 4 decimals of accuracy
[21:00:58][D][sensor:093]: 'VCC Voltage': Sending state 3.16992 V with 4 decimals of accuracy
[21:00:59][D][sensor:093]: 'VCC Voltage': Sending state 3.17090 V with 4 decimals of accuracy
[21:01:00][D][sensor:093]: 'VCC Voltage': Sending state 3.05859 V with 4 decimals of accuracy
[21:01:01][D][sensor:093]: 'VCC Voltage': Sending state 3.05566 V with 4 decimals of accuracy
[21:01:02][D][sensor:093]: 'VCC Voltage': Sending state 3.05664 V with 4 decimals of accuracy
[21:01:03][D][sensor:093]: 'VCC Voltage': Sending state 3.05371 V with 4 decimals of accuracy
[21:01:04][D][sensor:093]: 'VCC Voltage': Sending state 3.07715 V with 4 decimals of accuracy
[21:01:05][D][sensor:093]: 'VCC Voltage': Sending state 3.05273 V with 4 decimals of accuracy
[21:01:06][D][sensor:093]: 'VCC Voltage': Sending state 3.17383 V with 4 decimals of accuracy
[21:01:07][D][sensor:093]: 'VCC Voltage': Sending state 3.05664 V with 4 decimals of accuracy
[21:01:08][D][sensor:093]: 'VCC Voltage': Sending state 3.05664 V with 4 decimals of accuracy
[21:01:09][D][sensor:093]: 'VCC Voltage': Sending state 3.13867 V with 4 decimals of accuracy
[21:01:10][D][sensor:093]: 'VCC Voltage': Sending state 3.12988 V with 4 decimals of accuracy
[21:01:11][D][sensor:093]: 'VCC Voltage': Sending state 3.13477 V with 4 decimals of accuracy
[21:01:12][D][sensor:093]: 'VCC Voltage': Sending state 3.05566 V with 4 decimals of accuracy
[21:01:13][D][sensor:093]: 'VCC Voltage': Sending state 3.10059 V with 4 decimals of accuracy
[21:01:14][D][sensor:093]: 'VCC Voltage': Sending state 3.11035 V with 4 decimals of accuracy
[21:01:15][D][sensor:093]: 'VCC Voltage': Sending state 3.06738 V with 4 decimals of accuracy
[21:01:16][D][sensor:093]: 'VCC Voltage': Sending state 3.08008 V with 4 decimals of accuracy
[21:01:17][D][sensor:093]: 'VCC Voltage': Sending state 3.07812 V with 4 decimals of accuracy
[21:01:18][D][sensor:093]: 'VCC Voltage': Sending state 3.05957 V with 4 decimals of accuracy
[21:01:19][D][sensor:093]: 'VCC Voltage': Sending state 3.05273 V with 4 decimals of accuracy