ESP-12E as pulse sensor with Eastron SDM120



  • Hi all!
    I've bought an eastron sdm120 KWH meter. It has a pulse output which is set to 1000pulse/kwh; However I can't seem to figure out how to count those pulses. The output on the modules has a + and - terminal. So I connected the - to the common ground with the ESP and the + to one of the GPIO ports of the ESP-12E. I've found a script which puts the specific GPIO into INT mode. The script is for a 'pulse counter' based on a phototransistor. However like I said I'm using the output from the module.

    Anyone have some thoughts on the type of pulses would be generated by the SDM or how to find out. I've read about an open collector type, but don't know really how that works.

    I'd like to count the pulses and have them send like every minute to Domoticz.

    Any help appreciated.

    KR,
    Onno.


  • Hero Member

    I have not used one of those but looking at the Manual it seems you may need to supply a + voltage to pin 7 to get a pulse out on pin 6.

    From the last page of the manual:

    Pulse output
    The SDM120 Series DIN rail energy meter is equipped with a pulse output which is fully separated
    from the inside circuit. That generates pulses in proportion to the measured energy for accuracy
    testing. The pulse output is a polarity dependant, passive transistor output requiring an external
    voltage source for correct operation. For this external voltage source, the voltage (Ui) should is 5-27V
    DC, and the maximum input current (Iimax) is 27mA DC. To connect the impulse output, connect
    5-27V DC to connector 7 (anode), and the signal wire (S) to connector 6 (cathode).



  • Thanks. Tried that however somehow the counter went bold and is counting 'something' but no kWh. Meter is still on the same kWh total while according to my mounter, it already used 2kWh since the start:
    2016-07-30;14:43:34;1469882614;26994;13
    2016-07-30;14:44:34;1469882674;29993;431
    2016-07-30;14:45:34;1469882734;32992;990
    2016-07-30;14:46:34;1469882794;35991;1529
    2016-07-30;14:47:34;1469882854;38990;2158

    Thing is that the manual that came with the meter doesn't show any information about input voltage etc for this meter like the one you've send. The PDF of this meter you can find here: sdm120c

    The lua script I'm using is like:
    pin = 2
    min_pw_ms = 20
    upload_rate_ms = 60000

    pulse_detected = 0
    timestamp = 0
    counter = 0
    conn = nil

    gpio.mode(pin, gpio.INT)

    function pin1up(level)
    pulse_detected = 1
    end

    function maintask()
    print("Counter is:"..counter)
    if not wifi.sta.getip() then
    print("Connecting to AP, Waiting...")
    else
    -- gpio.write(0, gpio.HIGH)
    print("Uploading to server...")
    upload()
    end
    end

    function pulsetask()
    timestamp = timestamp + 1
    if pulse_detected == 1 then
    counter = counter + 1
    pulse_detected = 0
    end
    end

    gpio.trig(pin, "up", pin1up)
    tmr.alarm(0, upload_rate_ms, 1, maintask);
    tmr.alarm(1, min_pw_ms, 1, pulsetask);

    maintask();

    Update: Just found some other schematics.. maybe I'm missing some pull-up/down ... going to do some more testing ;o)



  • ok, so the pull down resistor does make it a bit more stable. Still getting lot of more counts then what the meter is giving. A bit strange because the led I've added flashes only once at the same time as the led on the meter. The led on/off is within the same function:

    function pin1up(level)
    gpio.write(led, gpio.HIGH)
    pulse_detected = 1
    gpio.write(led, gpio.LOW)
    end

    But I'm getting closer. Will keep all updated. I think I'll make the pull down stronger, maybe that will filter out the noise.
    If someone has other/better ideas, please let me know.

    KR,
    Onno.



  • If you have TL light in the room where the meter is located will cause false pulses when you turn on/off the light. Try adding caps on both ends (near the kwh meter and your arduino)


Log in to reply
 

Suggested Topics

  • 87
  • 5
  • 2
  • 1
  • 3
  • 8

1
Online

11.4k
Users

11.1k
Topics

112.7k
Posts