EmonLibDB - Version 1.0.0

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.

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_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.zip f65c66fcf4c936422b8f8e7e78f6119c
emonLibDB.cpp 6c362cbf67651b29a195bcccc4658113
emonLibDB.h 90f784fe4a29b60c929a41dcb18b3289
emonLibDB User Doc.pdf ae1487fd9d9367b3135273f7634a961f

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.

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.

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.