logo elektroda
logo elektroda
X
logo elektroda

How to connect ESP32 to FF LE-03D CT energy meter for pulse reading?

prezmulti 210 24
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #1 21805620
    prezmulti
    Level 7  
    Connection of esp32 to F&F LE-03D CT energy meter

    I already have the code written and it counts the pulses, but I don't know how to connect it with the counter so it reads the pulses from the counter
  • ADVERTISEMENT
  • #2 21805729
    kmarkot
    Level 30  
    Connect from the pulse output of the counter to the ESP under GND and the selected input D (gpio)
  • ADVERTISEMENT
  • #3 21805769
    prezmulti
    Level 7  
    Yes, I know, but there is a problem with this connection because it miscounts the pulses coming out of the counter.
    Single pulses ok, but the problem is with a large number of pulses.
    There is a high current consumption at times (injection device) per day of more than about 1000 - 1300 kWh
  • ADVERTISEMENT
  • #4 21805784
    inot
    Level 38  
    You have not written how this meter issues pulses according to the energy consumed. No one is going to look to the user manual for a hint.
  • #5 21805786
    prezmulti
    Level 7  
    Counter data
    pulse output
    open collector type
    maximum voltage 27 V DC
    maximum current 27 mA
    pulse constant 300 imp/kWh
    pulse time 35 ms
    operating temperature -25÷55°C
  • #6 21805799
    inot
    Level 38  
    This should not cause a speed problem. After all, 300 pulses pro kWh is very low. It's more likely to be other causes of incorrect counting. How do you adjust the 27 V signals to the logic level of the ESP?
  • #7 21805804
    prezmulti
    Level 7  
    First directly connected S0- output to GND S0+ to esp pin 14 in my case / second option via resistor with ceramic capacitor (there was already a similar topic on the forum somewhere)

    Directly overestimates the measurement and through the resistor underestimates the measurement
  • ADVERTISEMENT
  • #8 21805823
    inot
    Level 38  
    And does this pin have a pull-up resistor?
  • #9 21805833
    prezmulti
    Level 7  
    The ESP32 has internal pull-up resistors that can be activated by software (e.g. in Arduino via INPUT_PULLUP), which simplifies the connection of buttons and sensors: simply connect a pin to GND or an open-drain output signal; many pins (e.g. GPIO2, 4, 5, 12, 13, 14, 15, 25, 26, 27)

    In my code pinMode(PULSE_PIN, INPUT_PULLUP)
  • #10 21805838
    inot
    Level 38  
    How do you count these pulses? The easiest way is to use the interrupt function. What is the length of the wires between the counter and the ESP?
  • #11 21805843
    prezmulti
    Level 7  
    attachInterrupt(digitalPinToInterrupt(PULSE_PIN), onPulse, FALLING);


    This is how I have it in my code

    Cable length 2 m 2 x 0.5 mm
  • #12 21805847
    inot
    Level 38  
    The extra interrupt (i.e. extra pulses) can be caused by signal interference. Two metres is already a piece of antenna.
  • #13 21805856
    prezmulti
    Level 7  
    So do I have to make the esp right at the counter and do I use an additional resistor with a capacitor?

    How many miles senukd to set ?
    if (now - lastPulseTime > 20) - I tried various
  • #14 21805861
    inot
    Level 38  
    prezmulti wrote:
    if (now - lastPulseTime > 20)

    And that didn't pass the test and change the measurement results to some extent?
  • #15 21805868
    prezmulti
    Level 7  
    .It didn't change, I can't remember exactly but with all the tests I did there was a misrepresentation of about 30 per cent to the meter readings.

    For a test I connected through a second meter but direct heating furnace about 10 Kw and the esp without the capacitor dot resistor ) showed a measurement equal to the meter at 150 milliseconds

    Added after 1 [minute]:bbfae5d4a

    the fact was that I had a short section of cable
  • #16 21805922
    inot
    Level 38  
    It seems to me that using an internal pull-up resistor is not a very good idea. The value of this resistor is about 50 kΩ, which means a small current flows in the loop. According to the SO standard, the ideal current is 10-20 mA.
  • #17 21805956
    prezmulti
    Level 7  
    So now what can I do according to you? I've recently started my adventure with ESP, I'm also not so super familiar with it
  • #19 21805977
    prezmulti
    Level 7  
    Ok. When I have time tomorrow I'll try it out

    And another question bu I was thinking of using a phototransistor to peak the pulses from the diode on the counter. Is this a good idea ?
  • #20 21805985
    michal.zd
    Level 30  
    prezmulti wrote:
    Directly overestimates the measurement and through the resistor underestimates the measurement

    The use of a resistor and capacitor as long as there is a connection as I think (no diagram, you would paint) amounts to a low pass filter. It's not surprising that it underestimates. I'm surprised it overestimates directly without that filter.
    Maybe you have too long wires from the meter to your module. Together with the rather high resistance inside the pullup (I don't remember how many kiloohms, colleagues above stated) the wires pick up interference, or even oscillations occur. Adding
    inot wrote:
    an external resistor of ≈ 2 kΩ

    It should help, but I would start with a larger value, such as 4.7k.
    prezmulti wrote:
    do I use an additional resistor with a capacitor ?

    no.
  • #21 21805989
    inot
    Level 38  
    An optocoupler can be used, but then an additional voltage is needed.
  • #22 21805991
    michal.zd
    Level 30  
    prezmulti wrote:
    using a phototransistor to peak the pulses from the diode on the counter. Is this a good idea ?

    You have a ready-made output, unnecessary complications.

    Added after 1 [minute]:

    inot wrote:
    You can use an optocoupler

    You can, but you also don't need one.
ADVERTISEMENT