EmonLibDB - Version 1.0.2

EmonLibDB is a Continuous Monitoring library specifically for the EmonTx4 energy monitor.

It is able to monitor continuously 3 voltage channels and 12 current/power/energy channels, three pulse inputs (or two pulse inputs and one low voltage analogue input).

It has has not been possible to include temperature measurement.

Like emonLibCM, emonLibDB will always give an accurate measurement of the average over the reporting period of the voltage, and for each current/power channel the current, real and apparent power and power factor. A cumulative total of Watt-hours for each channel is also available. It is suitable for single phase, three phase or split phase operation at 50 Hz or 60 Hz. it is also possible to monitor current and real power/active energy in one or more arms of a load wired in delta on a 3-phase 240/415 V system, or 240 V loads in the North American split-phase system.

When used with the emonVs, a combined monitor and power supply, no adjustment is necessary for the system voltage, the input voltage range is 85 V – 254 V, and only minor adjustments will be needed to trim the calibration. The currrent/power inputs can be calibrated for any realistic current, the calibration value being the nominal rating of the current transformer.

The library is distributed as a compressed Zip file. This contains the library files themselves (emonLibDB.cpp & emonLibDB.h), three directories with example sketches and a PDF format User Documentation file that contains notes on using the library, a full description of each method, instructions both for setting the initial configuration and for calibration, and brief notes explaining the example sketches.

INSTALLING THE LIBRARY
The directory emonLibDB together with its contents should be extracted from the zip file and copied into the “libraries” directory, alongside (in the same level of the hierarchy as) the emonLib or emonLibCM directory.

If you wish to use the example sketches, these (in their respective directories) should be moved or copied into your Sketchbook.

The User Documentation PDF file can be moved or copied to a convenient location of your choosing.

EmonLibDB V1_0_2.zip (105.0 KB)
Version 1.0.2 1/12/2023

MD5 Hashes: 
emonLibDB_V1.0.2.zipbf9c2679386c923fa98a977fb00dfac1
emonLibDB.cpp64ed60aeadccc49af64653a94f86a324
emonLibDB.hf4e3b4e92c238fb78b9598d01713eeb0
 
emonLibDB User Doc.pdf591621661a557cab385e0c6efe3103a1

It is my intention to post any updates here, in this Topic.

The contents of the zip file will also be available as multiple separate downloads from Github.

USING THE LIBRARY
Three example sketches are provided as part of the distribution:
EmonTxV4DB_min is the absolute minimum sketch required to exercise the library and produce meaningful values.
EmonTxV4DB_max gives an example of every API call available. However, as distributed, it actually changes nothing as everything is again given the default value. If you need to change one of the defaults, then only the API call that sets that value is needed, and you can copy and add that call to the "minimum’ demo sketch.
EmonTxV4DB_rf specifically illustrates using two data packets and two NodeIDs to send the complete set a data generated by 12 channels, using the Low Power Lab library.

The EmonLibDB library is not a direct replacement for the modified versions of emonLibCM for the emonTx4.

Acknowledgements.
Jörg Becker (@joergbecker32) for his background work on interrupts and the ADC.
Robin Emley (@calypso_rae) for his energy diverter software, from which the major part of the library was derived by @TrystanLea
@ursi (Andries) and @mafheldt (Mike Afheldt) for suggestions made at EmonLib: Inaccurate power factor and Rms calculations in EmonLib and Learn documentation - #3 by mafheldt
Angus Logan (@awjlogan) for his suggestions regarding memory use
Dr.C B Markwardt (@cbmarkwardt)for his suggestion to use the AVR Hardware Multiplier, and to @dBC for reminding me.

 

Please see emonLibDB (Support) to comment or request support.

Changes from V1.0.0

It has been found that the multiply routines used in calculating the rms and power values of each sample of current and voltage could be speeded up significantly. As a consequence, the overall sample rates have been increased by approximately 9%.
The user interface and the example sketches, and consequently all publiched sketches, are unaffected by this change. The documentation has minor changes to reflect the new sample rate.

Changes from V1.0.1

Casts, included to prevent some intermediate calculations overflowing, which had been inadvertently removed whilst editing, have been restored.

 

Previous versions:
EmonLibDB V1_0_0.zip (106.0 KB)
Version 1.0.0 Released 6/5/2023. Re-released with missing file included, also r.f. example changed to use later version of LPL. 7/5/2023.

MD5 Hashes: 
emonLibDB_V1.0.0.zipf65c66fcf4c936422b8f8e7e78f6119c
emonLibDB.cpp6c362cbf67651b29a195bcccc4658113
emonLibDB.h90f784fe4a29b60c929a41dcb18b3289
emonLibDB User Doc.pdfae1487fd9d9367b3135273f7634a961f

EmonLibDB V1_0_1.zip (104.9 KB)
Version 1.0.1 Released 25/11/2023.
This version was withdrawn due to problems with the maths.

MD5 Hashes: 
emonLibDB_V1.0.1.zipd8f2ca2000f1e450cfcb15b3856efe7b
emonLibDB.cpp0362f15c6e8b096b7e32cb3a56eb1417
emonLibDB.h82770c32db02e4f01f801659b322bb30
 
emonLibDB User Doc.pdf87212e0fbf620433e8303c431cc1a0c0
3 Likes