I purchased Mottramlabs Wemos D1 Minni Version ESP8266 Mains Power Sensor and a SCT-013 100A/50ma clamp sensor and put it on my d1_mini clone ( D1 Mini NodeMcu ESP8266 ESP-12F)
It installs correctly in HomeAssistant and esphome, shows up as a device in esphome (small-bandsaw-current-sensor) and as a sensor in HA.
But it only ever registers half an amp draw under any situation.
yaml here:
esphome:
name: small-bandsaw-current-sensor
esp8266:
board: d1_mini
# Enable logging
logger:
# Enable Home Assistant API
api:
# Enable Over-The-Air updates
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
manual_ip:
static_ip: 192.168.2.17
gateway: 192.168.2.1
subnet: 255.255.255.0
sensor:
- platform: adc
pin: A0
name: "Small Bandsaw Current Sensor"
unit_of_measurement: "Amps" # Amperes, for current
update_interval: 1s
# filters:
# - calibrate_linear:
# - 0.0 -> 0.0 # 0V corresponds to 0A
# - 1.3 -> 10.0 # 1.3V corresponds to 10A (adjust based on your setup and observations)
log output here:
[09:33:19][D][sensor:093]: 'Small Bandsaw Current Sensor': Sending state 0.52539 Amps with 2 decimals of accuracy
[09:33:19][D][sensor:093]: 'Small Bandsaw Current Sensor': Sending state 0.52539 Amps with 2 decimals of accuracy
[09:33:20][D][sensor:093]: 'Small Bandsaw Current Sensor': Sending state 0.52539 Amps with 2 decimals of accuracy
I am clamping around one of two wires of a heat gun to test the sensor. it doesn't change whether the gun is on or off ... on either wire (just in case the gun was miswired). I am NOT clamping around the whole cord.
I have switched between 2 sct-013 sensors, 2 mottramlabs pcb boards and 2 d1_minis, same result every time.
Anybody see what I'm doing wrong?
I’ve tried both current and voltage. Same thing with voltage in the logs…
[11:57:57][D][sensor:093]: 'Small Bandsaw Current Sensor': Sending state 0.52344 v with 2 decimals of accuracy
[11:57:58][D][sensor:093]: 'Small Bandsaw Current Sensor': Sending state 0.52441 v with 2 decimals of accuracy
[11:57:59][D][sensor:093]: 'Small Bandsaw Current Sensor': Sending state 0.52344 v with 2 decimals of accuracy
I also switched to a light bulb thinking the heat gun might be too much. no changes, it reads half a volt from A0 continuously whether the light bulb is on or not. But I can check the current on the light bulb circuit and the SCT-013 measures zer0 when the bulb is off but a few millivolts when on.
This can’t be a fault in the d1_mini, sct-013 or the mottramlabs pcb that connects them, because I just build a second one and it does exactly the same thing.
I’ve emailed mottramlabs, it is certainly possible that although my d1_mini clone has the same pinouts and is supposed to work the same, it might have some difference that is causing this.
Other than that, not sure what to do…
here’s the yaml on the new sensor:
esphome:
name: large-bandsaw-current-sensor
esp8266:
board: d1_mini
# Enable logging
logger:
# Enable Home Assistant API
api:
# Enable Over-The-Air updates
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
manual_ip:
static_ip: 192.168.2.16
gateway: 192.168.2.1
subnet: 255.255.255.0
sensor:
- platform: adc
pin: A0
name: "Large Bandsaw Current Sensor"
unit_of_measurement: "v"
update_interval: 1s
#filters:
# - calibrate_linear:
# - 0.0 -> 0.0 # 0V corresponds to 0A
# - 1.3 -> 10.0 # 1.3V corresponds to 10A (adjust based on your PCB's characteristics)
here’s the log output;
[13:24:00][D][sensor:093]: 'Large Bandsaw Current Sensor': Sending state 0.53223 v with 2 decimals of accuracy
[13:24:01][D][sensor:093]: 'Large Bandsaw Current Sensor': Sending state 0.53223 v with 2 decimals of accuracy
Could you be trying to input AC from transformer into GPIO pin that expects DC voltage? You may want to look at dedicated ac->dc chips like ACS712 or something like it.
The d1_mini has one analog pin, A0.
That’s where the mottramlabs power sensor sends the information.
I’m using a clamp current sensor, the SCT-013. The mottram labs power sensor pcb is designed to work with this specific sensor, and output useable information to the d1_mini esp8266 board via pin A0.
So the setup is supposed to work and it’s all designed specifically to work together. But it isn’t
I have checked the sct-013 with a multimeter and it does put out a signal of a couple of volts AC when power is going through the wire. I have checked and the d1_mini gets a constant signal of about 1500mvts from the mottramlabs pcb - but that doesnt change if the input from the sct-013 changes.
And I’m only clamping the wire, not the whole cable.
Still lost here…
At 20A going through the primary wire there should be 10mA being output on the secondary. With a 22ohm burden resistor that is 0.22V. That isn’t going to give you many bits of resolution and the absolute accuracy of that current sensor is not great. But, it should still give you some information.
A picture of your setup is probably worth a thousand words.
Your sensor outputs a current (mA) proportional to the input current. An ADC doesn’t measure current, it measures voltage (which is why it’s always showing the same value: the output voltage of the sensor doesn’t change).
Switching the CT between voltage and current isn’t relevant because it’s the sensor output that’s the issue here. You need to use a resistor to “convert” the mA output to a voltage drop that the ADC can measure.
Isn’t that the entire purpose of the Mottram Labs PCB unit that I have set up?
“# MLP191020 - Wemos D1 Mini Version ESP8266 Mains Power Sensor —
Single phase mains power sensor using a current transformer (not included) and a Wemos D1 Mini (not included). The transformer used is a “Current Transformer AC current sensor 100A SCT-013-000” available on eBay. This plugs into the sensor PCB and the ESP8266 (Wemos D1) and uses the analog input to measure the mains current draw. The Wemos is powered by it’s micro USB input. This makes a very simple sensor setup that could report the measured current via MQTT”
My understanding from my reading is that the Mottram Labs pcb unit contains all the necessary circuitry to convert the SCT-013 units AC voltage into a DC signal for the d1_mini to read at A0.
No Burden resistor is needed in fact, on SCT-013 units of higher capacity, the instructions are to REMOVE that Burden resistor. As the SCT clamp unit I am using does not have a resistor, I don’t need to remove it - but I don’t believe I need to add it, either.
So I have the d1 mini piggybacked onto the MLP191020 Mottram labs chip, with the SCT-013 connected to the Mottramlabs PCB via its onboard mini jack, and that is all that I believe is necessary - the whole reason for going this route is that it seemed the simplest “out of the box” solution to add current sensing to the d1_mini.
Since your CT has current output, playing with it without burden attached while current flowing through primary is dangerous. It would generate high voltage on the open output, and thereon frying electronics when connected.
[12:52:16][D][ct_clamp:041]: 'Large Bandsaw Current Sensor' - Raw AC Value: 0.000A after 25 different samples (125 SPS)
[12:52:16][D][sensor:093]: 'Large Bandsaw Current Sensor': Sending state 0.00046 A with 0 decimals of accuracy
You can see that the ct_clamp is giving data and it is accurate, I could use it. The other sensor - the d1_mini pin A0 continues to give no useful data.
I can’t find ct_clamp as an entity to get data from, only the other sensor (Perhaps because both have the same name?)
This is By Design. The A0 sensor is integrated by the current sensor to give you meaningful data. Pay no attention to the A0 sensor its data is only meaningful to the current sensor, which is what is telling you there is currently no real current (and therefore power and energy) draw.
But, if you really want meaningful data you should be using a power meter that provides voltage, current, power and integrates it to provide energy (which is maybe what is of interest, unless you really just want to know if the band saw is on or off).
That is a new problem then. I don’t typically use HA, so won’t be much help. But most people report success after deleting the device from both esphome (make sure you backup your YAML) and HA and the recreate it especially in HA.
Your esphome device is working now, but there is a failure in communication with HA. That is a very different problem, but is usually fairly easy to solve.