Re: Counting pulses from an electricity meter
Posted: Tue Nov 12, 2019 7:35 am
Hi,
is there any reason you want to write to your influxdb database every 250ms?
The ESP should be powerful enough to do the math and e.g. send an average value every minute.
Or, if you really want to get all the raw data, you could create a buffer and send 100 values in one go, which would result in a connection every 25 seconds.
The ESPs are known not only for notorious wifi outages, but also the internal housekeeping which can conflict with micropython and its tasks. It might be that by rare chance you run into a situation, where this conflicts. Very hard to debug and not much one could do about it.
Thus, I would agree with pythoncoder and try to make your code as fail-safe as possible. Sending only every minute, gives you enough time to reset the microcontroller and restart the measurement in case any of your safety protocols triggers.
is there any reason you want to write to your influxdb database every 250ms?
The ESP should be powerful enough to do the math and e.g. send an average value every minute.
Or, if you really want to get all the raw data, you could create a buffer and send 100 values in one go, which would result in a connection every 25 seconds.
The ESPs are known not only for notorious wifi outages, but also the internal housekeeping which can conflict with micropython and its tasks. It might be that by rare chance you run into a situation, where this conflicts. Very hard to debug and not much one could do about it.
Thus, I would agree with pythoncoder and try to make your code as fail-safe as possible. Sending only every minute, gives you enough time to reset the microcontroller and restart the measurement in case any of your safety protocols triggers.