S0 Electricity meter on pulse counter does not work
Moderators: grovkillen, Stuntteam, TD-er
S0 Electricity meter on pulse counter does not work
Hi,
have a wemos D1 with latest espeasy build (2022_04_27).
Attached to it and working: An Panasonic EX-26A to collect pulses from a watermeter. I attached it as shown here (https://github.com/Froschie/water-meter ... on-diagram) in the schematics exactly the same way, but on D7 Pin - so there is a parallel 10k-resistor between 3.3V and D7
Now I tried to attach two Electricity meters S0 (https://www.amazon.de/gp/product/B01EFSXU6I) to Pin D6 and D5. Both do not work, there is no count recognized.
The 3.3V line is attached to "+" (or Pin 20) to the Power meter, the "-" (or Pin 21) is attached with a 10k resistor in series - one time to D6, the other to D7.
I have the Pulse Counter Tasks set on position 1 (the working WaterMeter) and position 2 and 3 (the not working Power Meters) (I read this: viewtopic.php?p=46358&sid=e99040789d644 ... 689#p46358 ).
I tried all working modes in the Pulse Counter tasks.
Any ideas what I need to change?
Thanks.
have a wemos D1 with latest espeasy build (2022_04_27).
Attached to it and working: An Panasonic EX-26A to collect pulses from a watermeter. I attached it as shown here (https://github.com/Froschie/water-meter ... on-diagram) in the schematics exactly the same way, but on D7 Pin - so there is a parallel 10k-resistor between 3.3V and D7
Now I tried to attach two Electricity meters S0 (https://www.amazon.de/gp/product/B01EFSXU6I) to Pin D6 and D5. Both do not work, there is no count recognized.
The 3.3V line is attached to "+" (or Pin 20) to the Power meter, the "-" (or Pin 21) is attached with a 10k resistor in series - one time to D6, the other to D7.
I have the Pulse Counter Tasks set on position 1 (the working WaterMeter) and position 2 and 3 (the not working Power Meters) (I read this: viewtopic.php?p=46358&sid=e99040789d644 ... 689#p46358 ).
I tried all working modes in the Pulse Counter tasks.
Any ideas what I need to change?
Thanks.
Re: S0 Electricity meter on pulse counter does not work
hm, from the manual: Pulse output - OC, 12 ... 27 V / 27 mA (max) / 90 ms
means I need to put 12V on the + I guess.
means I need to put 12V on the + I guess.
Re: S0 Electricity meter on pulse counter does not work
Or, more likely, a level converter? As the ESP probably won't survive that 12V
/Ton (PayPal.me)
Re: S0 Electricity meter on pulse counter does not work
OC means open collector.
So it seems it is the transistor part of an optocoupler.
This means it may indeed pull the voltage on the pin upto the voltage you supply.
Better measure the actual voltage there.
N.B. the transistor side of an optocoupler has a specific direction to conduct current, just like a diode.
So make sure you've not swapped the + and -.
If you did, you may have saved your ESP, so measure first.
So it seems it is the transistor part of an optocoupler.
This means it may indeed pull the voltage on the pin upto the voltage you supply.
Better measure the actual voltage there.
N.B. the transistor side of an optocoupler has a specific direction to conduct current, just like a diode.
So make sure you've not swapped the + and -.
If you did, you may have saved your ESP, so measure first.
Re: S0 Electricity meter on pulse counter does not work
can I use there PC817 optocoupler? I have some of https://www.aliexpress.com/item/1005002006610372.html around here
Re: S0 Electricity meter on pulse counter does not work
I don't think you need to add another optocoupler.
What you need is something like this: (which by accident also uses the exact same optocoupler as you mentioned)
The left side of the schematic isn't interesting as that's already taken care of.
The right side now shows a resistor which pulls up Vout to the 5V level (or whatever voltage you apply there) when the transistor is open.
When the transistor closes, it will pull Vout to GND.
By adding a second resistor over Vout and GND, you will create a voltage divider.
This second resistor is then "shorted" to GND when the transistor closes.
The max. voltage over GND and Vout is depending on the ratio between both resistors.
Let's assume you have a 1:2 ratio of resistors, like 10k and 4k7.
10k between the "15V" you plan on using and Vout
4k7 between Vout and GND.
The highest voltage over Vout and GND is then roughly 1/3rd of the 15V. = 15V * (4k7 / (10k + 4k7)) = 15 * 0.32 = 4.8V
What you need is something like this: (which by accident also uses the exact same optocoupler as you mentioned)
The left side of the schematic isn't interesting as that's already taken care of.
The right side now shows a resistor which pulls up Vout to the 5V level (or whatever voltage you apply there) when the transistor is open.
When the transistor closes, it will pull Vout to GND.
By adding a second resistor over Vout and GND, you will create a voltage divider.
This second resistor is then "shorted" to GND when the transistor closes.
The max. voltage over GND and Vout is depending on the ratio between both resistors.
Let's assume you have a 1:2 ratio of resistors, like 10k and 4k7.
10k between the "15V" you plan on using and Vout
4k7 between Vout and GND.
The highest voltage over Vout and GND is then roughly 1/3rd of the 15V. = 15V * (4k7 / (10k + 4k7)) = 15 * 0.32 = 4.8V
Re: S0 Electricity meter on pulse counter does not work
I tried to understand, i am sure i did not.
I have now changed the s0 input voltage to 12v. before connecting it to gnd i have two resistors placed, 3.3k, 10k, then to ground.
Between the two resistors there is the leg which goes to the gpio.
If i connect only the +12v and gnd (and bridge the two ends where the s0 would be in between) i can measure 2.98v between the gpio-pin and gnd.
Still if i connect everything together the pulse counter (switched to change mode) does only account manually closing the two contacts. If the s0 counter does it is not recognized.
Do i need to put between the gpio and gnd an additional 10k resistor to have it on LOW all the time, until a pulse comes?
Thanks, and sorry if the questions are maybe stupid.
I have now changed the s0 input voltage to 12v. before connecting it to gnd i have two resistors placed, 3.3k, 10k, then to ground.
Between the two resistors there is the leg which goes to the gpio.
If i connect only the +12v and gnd (and bridge the two ends where the s0 would be in between) i can measure 2.98v between the gpio-pin and gnd.
Still if i connect everything together the pulse counter (switched to change mode) does only account manually closing the two contacts. If the s0 counter does it is not recognized.
Do i need to put between the gpio and gnd an additional 10k resistor to have it on LOW all the time, until a pulse comes?
Thanks, and sorry if the questions are maybe stupid.
Re: S0 Electricity meter on pulse counter does not work
The one on D6 started working after setting debounce from 100 to 0ms
The other did not until moving from D5 to D2 (and also debounce to 0ms)
The other did not until moving from D5 to D2 (and also debounce to 0ms)
Re: S0 Electricity meter on pulse counter does not work
OK, debounce change I can understand as the S0 pulse may be shorter than 100 msec.
No idea why that other change was needed.
See: https://espeasy.readthedocs.io/en/lates ... on-esp8266
D2 (GPIO-4) is often used for I2C, so maybe there is some pull-up resistor present which makes the difference?
Or maybe that pin on D5 (GPIO-14) got damaged in earlier tests?
No idea why that other change was needed.
See: https://espeasy.readthedocs.io/en/lates ... on-esp8266
D2 (GPIO-4) is often used for I2C, so maybe there is some pull-up resistor present which makes the difference?
Or maybe that pin on D5 (GPIO-14) got damaged in earlier tests?
Re: S0 Electricity meter on pulse counter does not work
the "working" measurement were wrong one, so pulses seemed not related to the pulses of the S0 counter.
In the meanwhile I have tried to add a 10k between GND and the GPIO to pull the GPIO to low until a pulse triggers. so far it has not counted any more anything, so in a complete, but static not-working state again
In the meanwhile I have tried to add a 10k between GND and the GPIO to pull the GPIO to low until a pulse triggers. so far it has not counted any more anything, so in a complete, but static not-working state again
Re: S0 Electricity meter on pulse counter does not work
I re-read your start post, and you mention you have 3V3 connected to the S0. (this is too low)
Can you draw how it is now connected?
See also here for some basic schematics on how to connect the S0 bus: https://sbc-support.com/uploads/tx_srcp ... 1.1_01.pdf
Can you draw how it is now connected?
See also here for some basic schematics on how to connect the S0 bus: https://sbc-support.com/uploads/tx_srcp ... 1.1_01.pdf
Re: S0 Electricity meter on pulse counter does not work
thanks for your time and help!
currently it looks like this: Counting the pulses on D7 (GPIO-13) of the EX-26A works.
There are two S0 counters, red and orange. both do not work.
in the green rectangles I measured the voltage divider, so manually closing the "S0" switch and putting +12V and GND as in the schema lets me measure 2.95V between the line which goes to the D5 / D6 pin and GND.
the orange marked 10k resistors I put in to assure to have LOW on D5 / D6. my understanding is that if the 2.95V arrive the pin will get HIGH, if not the resistor puts it to LOW.
without both of the orange marked resistors one of the two S0 counters liked to recognize pulses (never both at the same time!), but they were not correct and also only with debounce time set to 0. with debounce time set to 100 both did never show up something.
this looks also reproducable with manually closing. so currently only D6 "works" if I close manually the two pins (s0+ and S0-). yesterday where I had D5 wired to D4, only D4 did work on manually closing.
in general I do not solder on the device itself, I made a small connector hat where I plug on the cables. the voltage divider are "in the cable", the 10k resistors which are attached between GND and 3.3V or the pin, are on the legs of the downside. so there is no "soldermess". the thicker black is the EX-26A, the 2-pole-connectors are 12V and the 3-pole-connector is D5, D6, D7. a 0.75mm² cable is used to the S0 counters, one time about 1m long, the other about 2m. only the last 15cm where I added the voltage-divider is the thin one.
espeasy devices config: pulse counter device parameter (tried all mode type, I would expect to need Pulse HIGH - this works on manually closing most relieable):
currently it looks like this: Counting the pulses on D7 (GPIO-13) of the EX-26A works.
There are two S0 counters, red and orange. both do not work.
in the green rectangles I measured the voltage divider, so manually closing the "S0" switch and putting +12V and GND as in the schema lets me measure 2.95V between the line which goes to the D5 / D6 pin and GND.
the orange marked 10k resistors I put in to assure to have LOW on D5 / D6. my understanding is that if the 2.95V arrive the pin will get HIGH, if not the resistor puts it to LOW.
without both of the orange marked resistors one of the two S0 counters liked to recognize pulses (never both at the same time!), but they were not correct and also only with debounce time set to 0. with debounce time set to 100 both did never show up something.
this looks also reproducable with manually closing. so currently only D6 "works" if I close manually the two pins (s0+ and S0-). yesterday where I had D5 wired to D4, only D4 did work on manually closing.
in general I do not solder on the device itself, I made a small connector hat where I plug on the cables. the voltage divider are "in the cable", the 10k resistors which are attached between GND and 3.3V or the pin, are on the legs of the downside. so there is no "soldermess". the thicker black is the EX-26A, the 2-pole-connectors are 12V and the 3-pole-connector is D5, D6, D7. a 0.75mm² cable is used to the S0 counters, one time about 1m long, the other about 2m. only the last 15cm where I added the voltage-divider is the thin one.
espeasy devices config: pulse counter device parameter (tried all mode type, I would expect to need Pulse HIGH - this works on manually closing most relieable):
Re: S0 Electricity meter on pulse counter does not work
The extra 10k resistors (orange in your schematic) are not useful and I think they may be the source of your problem. Or at least "may cause issues".
They are parallel to the 3k3 resistor, effectively lowering the resistance of those 3k3 resistors.
The effective resistance is then 2k5 Ohm, thus lowering the voltage over the GPIO pin.
The optocoupler in the S0 may also have some diode in series and thus cause a voltage drop of roughly 1.5V.
This means the voltage over the 10k + 2k5 is not 12V but more like 10.5V.
This makes the voltage over the GPIO pin about 2.1V which may be too low to see a high level.
Even with the orange 10k resistors removed you may only get about 2.6V
If you change those 3k3 resistors to 4k7 you may have about 3.3V
But first try to remove the orange 10k resistors.
They are parallel to the 3k3 resistor, effectively lowering the resistance of those 3k3 resistors.
The effective resistance is then 2k5 Ohm, thus lowering the voltage over the GPIO pin.
The optocoupler in the S0 may also have some diode in series and thus cause a voltage drop of roughly 1.5V.
This means the voltage over the 10k + 2k5 is not 12V but more like 10.5V.
This makes the voltage over the GPIO pin about 2.1V which may be too low to see a high level.
Even with the orange 10k resistors removed you may only get about 2.6V
If you change those 3k3 resistors to 4k7 you may have about 3.3V
But first try to remove the orange 10k resistors.
Re: S0 Electricity meter on pulse counter does not work
thank you for your recommendations.
removed the orange 10k resistors (had already tests done without them) and changed the two 3.3k to 4.7k one.
additionally, as D5 and D6 did not work relieable, changed to D1 and D2.
now I can see it working with about 10% loss of the pulses, on both counters.
do you have suggestions to this too?
Mode Type is to Pulse High and Debounce Time to 2ms
removed the orange 10k resistors (had already tests done without them) and changed the two 3.3k to 4.7k one.
additionally, as D5 and D6 did not work relieable, changed to D1 and D2.
now I can see it working with about 10% loss of the pulses, on both counters.
do you have suggestions to this too?
Mode Type is to Pulse High and Debounce Time to 2ms
Re: S0 Electricity meter on pulse counter does not work
S0 pulse width is minimal 30 msec, so 2 msec debounce should work.
If you're still seeing too many pulses, you may increase it upto roughly 50% of this minimal 30 msec.
There is one thing I don't know for sure and that's what will happen with pulses that happen on both pins at the same time.
For example, what will happen if both pulses are (partially) overlapping? I guess the first one (or the one with lowest task nr) may be counted where the other one may be missing.
If you're still seeing too many pulses, you may increase it upto roughly 50% of this minimal 30 msec.
There is one thing I don't know for sure and that's what will happen with pulses that happen on both pins at the same time.
For example, what will happen if both pulses are (partially) overlapping? I guess the first one (or the one with lowest task nr) may be counted where the other one may be missing.
Re: S0 Electricity meter on pulse counter does not work
having on D1 and D2 on the same time a pulse is very unlikely - there are pulserates of about 30seconds to 3 Minutes on both - so the possibility to fetch the 30ms at the same time is very unlikely.
one of the counters stopped working over night.
after setting it to mode "Change" it works again, I can see now also 2 pulses with 85ms in between.
and I have no idea why it worked before with mode HIGH and stopped working without doing anything.
the other counter still works, although still counts about 10% less
one of the counters stopped working over night.
after setting it to mode "Change" it works again, I can see now also 2 pulses with 85ms in between.
and I have no idea why it worked before with mode HIGH and stopped working without doing anything.
the other counter still works, although still counts about 10% less
Re: S0 Electricity meter on pulse counter does not work
During last night there were no pulses lost with "change" mode and 100ms debounce time.
Re: S0 Electricity meter on pulse counter does not work
Great!
No idea what those 'lost pulses' may be like, but if they are anythink like lost Lego bricks you will only find when stepping on them, then it is best not to loose those pulses
No idea what those 'lost pulses' may be like, but if they are anythink like lost Lego bricks you will only find when stepping on them, then it is best not to loose those pulses
Who is online
Users browsing this forum: Google [Bot] and 16 guests