For my smart garden irrigation build, a requirement is to measure the water flow and temperature measurement from the groundwater source. I picked an Autosen AS010 vortex flow meter (G1 1/4″M, DN25), which outputs both readings as separate 4-20 mA current loops on the same M12 connector. Getting both channels working with ESPHome turned into a small troubleshooting session, so I am documenting the full wiring, the config, and the actual log output that proved it worked.

The hardware

AS010Vortex flow meter G1 1/4AAS010 dimensions

AS010 PinoutAS010 M12 sensor cable

The AS010 needs 10-33 VDC and communicates through a standard M12 sensor cable with 4 pins:


Brown  -> +V (power)
Blue   -> 0V / DC- (power return)
White  -> OUT2 (Temperature, 4-20mA)
Black  -> OUT1 (Flow, 4-20mA)

To turn each 4-20 mA loop into something ESPHome can read over I2C, I used a M5STACK-U162 analog-to-I2C converter per channel, and an M5Stack AtomS3 Lite as the ESPHome brain for each one. So the final setup is two independent AtomS3 Lite + U162 pairs reading from the same physical sensor: one dedicated to temperature, one to waterflow.

M5Stack Atom S3 LiteM5Stack AIN4-20mA

 

Wiring both channels

The power wiring is shared, the signal wiring is per channel:


AS010 BROWN -> +24V
AS010 BLUE  -> DC- / 0V

AS010 WHITE (OUT2 / Temperature) -> Temperature U162 IN+
Temperature U162 IN-             -> DC- / 0V

AS010 BLACK (OUT1 / Flow) -> Flow U162 IN+
Flow U162 IN-              -> DC- / 0V

U162 wiring
AtomLite and U162

The important detail here: both U162 units must share the same DC- reference as the AS010 own 0V. During my first flow test I still had the black wire tied to DC- from an earlier temperature-only test, and that is exactly what kept the flow channel dead. Once black was moved to the Flow U162 IN+ only, it started reading correctly.

Each U162 sits on the AtomS3 Lite I2C bus (SDA on GPIO2, SCL on GPIO1, 50 kHz), and both boards see their converter at the same I2C address:


[C][i2c.idf:113]: Results from bus scan:
[C][i2c.idf:119]: Found device at address 0x55

ESPHome configuration

Each AtomS3 Lite runs its own template sensor pair: one raw current sensor in mA, and one converted engineering-unit sensor. This is what the temperature node config resolves to, matching exactly what showed up in its boot log:


sensor:
  - platform: template
    name: "Autosen Temperature Current"
    id: autosen_temperature_current
    unit_of_measurement: "mA"
    accuracy_decimals: 2
    device_class: current
    state_class: measurement
    update_interval: 5s

  - platform: template
    name: "Autosen Temperature"
    id: autosen_temperature
    unit_of_measurement: "C"
    accuracy_decimals: 1
    device_class: temperature
    state_class: measurement
    update_interval: 5s

The flow node mirrors this with its own custom ain420_flow component reading the U162 over I2C, producing a raw mA sensor plus a converted L/min sensor.

Each ESPHome device yaml will be shared at the bottom of this post. Be aware of the API key mask and the Wifi static IP address.

Bringing the temperature channel online

With just the temperature wiring connected, the AtomS3 Lite booted, found the I2C device, connected to Wifi, and paired with Home Assistant right away:


[I][app:151]: ESPHome version 2026.8.2 compiled on 2026-08-31 21:46:42 +0200
[I][app:158]: ESP32 Chip: ESP32-S3 rev0.2, 2 core(s)
[C][mdns:259]: Hostname: esphome-atoms3lite-irri-temp
[D][ain420:079]: Raw current: 947 -> 9.47 mA
[I][wifi:1609]: Connected
[C][wifi:1268]: IP Address: 192.168.20.39
[D][api.connection:2593]: Home Assistant 2026.8.3 (192.168.1.46): connected
[D][ain420:079]: Raw current: 949 -> 9.49 mA

9.48 mA on the temperature loop corresponded to roughly 26 degrees C, which matched the actual room/water temperature at the time, so the temperature channel was confirmed working end to end.

Bringing the flow channel online

The flow node came up the same way electrically (I2C device found at 0x55 on the second AtomS3 Lite), but the raw current sat at 0.03 mA, which is essentially no signal:


[D][ain420_flow:107]: Raw current: 3 -> 0.03 mA

The cause turned out to be simple: I had forgotten to plug in the AS010 power supply, so the loop itself had no current flowing at all – the ESPHome side was working fine the whole time. As soon as power was connected, the reading jumped to the expected 4 mA baseline:


[D][ain420_flow:107]: Raw current: 3 -> 0.03 mA      (power supply off)
[D][ain420_flow:107]: Raw current: 404 -> 4.04 mA    (AS010 powered, flow loop active)

4 mA is the zero flow point on a standard 4-20 mA loop, so 4.04 mA with no water moving is exactly right. I convert that to liters per minute with:


Flow [L/min] = 9.375 x (mA - 4)

At 4.04 mA that comes out to 9.375 x 0.04, roughly 0.375 L/min, which rounds to about 0.4 L/min – a small offset above the ideal 4.00 mA baseline rather than a real flow reading. I will likely add a small deadband in software later so anything between roughly 4.00-4.10 mA displays as a clean 0.0 L/min instead.

Result

With both channels verified:


Temperature: 9.48 mA -> ~26 C
Flow:        4.04 mA -> ~0.4 L/min (effectively zero flow, no water moving)

Two AtomS3 Lites, two U162 converters, two 4-20 mA loops off a single Autosen AS010 – both channels are now live in ESPHome and ready to be exposed to Home Assistant for the irrigation system flow-based leak detection and scheduling automations.

Example of how the water temperature entities are shown within the ESPHome device. You can see the conversion of the mA value to degrees Celsius is done with the ESPHome yaml.

Autosense Water Temperature entities

 

Update Sept 16th 2026:

A new version of esphome-atoms3lite-irri-flow.txt is attached.

The idle value is appr 0.3 L/min, is causing issues with the HA utility meter suddenly spikes when multiple irrigation sessions are running at one day.

Row 155-157 is replaced with:

if (current_ma <= 4.10f) {
return 0.0f;
}

Attachments

Privacy Preference Center