emonVS Power Supply reporting Strange voltages

@TrystanLea
As a first step, you could try the changes suggested (changing two resistor values, no PCB changes) to see if they help …

These changes also move the 2.2uF capacitor so that it is not ~directly connected (10R in series) from the MCP1501 output to ground. This removes any possible tendency for it to oscillate with a large capacitive load.

1 Like

Thanks @rupert !

Some more pictures:

No additional capacitor across AVref. Yellow: AVref, Blue: 3.3 V:

1 µF tantalum capacitor across AVref. Yellow: AVref, Blue: 3.3 V:

As above, different timebase:

4.7 µF tantalum capacitor across AVref. Yellow: AVref, Blue: 3.3 V:

As above, different timebase:

The guilty party is positively identified – it is indeed the 2.2.µF capacitor, but we all knew that anyway. Simply removing it gets rid of most of the trouble, on both VREFA and the 3.3 V supply.

(Ignore the blue trace).

Removing the capacitor (and only that) looks OK to me.

Looking at the count coming out of the ADC, the spread of values is:

ADC   number
3567	0
3568	0
3569	0
3570	2
3571	9
3572	101
3573	145
3574	93
3575	19
3576	0
3577	0
3578	0

There are no outliers outside this range as far as the limits I’ve put in the library at the nominal count for 0.9 V ±2%, i.e. 3530 to 3675.

0.9 × 4095 / 3573 = 1.0315 V, so my 1.024 V internal reference is 0.73% high.

3 Likes

Robert,… Just trying to get the modified thresholds incorporated into the code…
I have to this end created a ‘mint’ environment with arduino 1.8.4… followed the ‘how to’ stuff,… and I can now compile without issue. ( all the ‘board issues’ I had, went away )
One complication is I am now trying also trying to compile a 12 CT, set of code,… using the EmonTx4_12CT_rf source.ino file,… and unless I’m missing the obvious I cannot find references to EmonLibCM_acPresent() or acDetectedThreshold…
Are you able to spread any light on this…
Many Tx
Mark

I don’t understand your question.

I’ve never published a sketch for the emonTx4 using emonLibCM - that’s obsolete as far as the emonTx4 and 12 current inputs is concerned. If it’s Trystan’s sketch on Github, can you give me a link? Searching for the file name you’ve given returns nothing. It also doesn’t make sense to try to use emonLibCM with a 12 current inputs emonTx4, because emonLibCM can only handle 6 - one voltage and 5 current - analogue inputs.

You probably need to download emonLibCM and emonLibDB, and start with the documentation.
acDetectedThreshold is on line 215 of emonLibCM.cpp, and line 283 of emonLibDB.cpp
EmonLibCM_acPresent is on line 424 of emonLibCM.cpp, it is obviously not part of emonLibDB. The equivalent is on line 566 of emonLibDB.cpp

sorry Robert, ( I changed from the original name when I saved it locally ),… I was just following this link for the Additional 6CT’s order to compile for 12 CTs
This is the link I have used,… following the EmonTx4 expainsion boards section for the emonTx4 docs.

2. Using the Arduino IDE, open the `EmonTx4DB_rf` firmware example. Navigate to:

File > Examples > emonLibDB > Examples > EmonTx4DB_rf

I also found this text with the docs

While the EmonTx4DB_rf firmware example does not use all of the libraries listed (it just needs emonLibDB and RFM69_LPL), it is worthwhile installing them all so that you have the capability to compile all EmonTx4 firmwares.

So what is the objective now? Are you back to this:

If so, then it’s decision time: If you never want it to fall back to using a fixed 240 V, and I can’t see the point if you’re using the same voltage as you’re measuring for power, then you don’t need acPresent and if you’re not using it, there’s no need to change the threshold - it will use whatever voltage it gets to calculate real power until the d.c. fails at around 100 V and everything stops. And you can use the example sketch you got with the library pretty much as-is - just remember it’s one of three demonstration sketches so the three together illustrate the use of every API call there is. You only use the bits you need to provide the information you want.

If you want to use a different sketch, then I’ll think a bit more.

Robert,… Just looking to upload new firmware,… 12CTs,… and removing the mains input voltage switch over,…
I have modified your script,… and I can apparently execute commands on my emonpiCMS,… But before I jump in and blow new firmware,… I have some questions if you be so kind,…
Currently,… my emontx4 I have radio control switched off,… data is just sent over USB-C,… will this setting and my CT setting 50A,… 20Amp etc be remembered,…( I have not changed since default I believe,… but that was some time ago ) or is this a case of setting in the new code,… ( which I have found I believe ).
And as Long as I keep the same ID’s then emonPiCMS will essentially ‘see no change’ in CT 1-6,… it will just have CTs 7- 12 to process now… on a new ID
And finally,… the HEX code at:-
emontx4/firmware/EmonTxV4/compiled at main · openenergymonitor/emontx4 · GitHub.

which is the default HEX firmware loaded,… when emonTx4 is purchased,… I just want this as backup so I can at least restore things back as was ‘new’… classic, native, and LPL… what are they pls…
Many Tx

What’s wrong with your editor - ellipses all over the place? What missing words is each intended to represent? If it’s a gimmick, it makes it too hard to read.

Sorry Robert,… I was just using the open energy web editor,… I have not knowingly added any crtl->characters,… I was just typing/entering via keyboard.
the only thing I cut and pasted was the Git-hub reference,… which seems to work for me when I view my post
…It looks ok to me,… baffled…

FWIW, I see the same thing Robert does. (the ellipses - the strings of periods) To wit:

and the original post Robert commented on:

Let me try again,… I have copied the file and loaded in into vi,… and cat’d the file output…:- so here goes ‘take2’
Robert,… Just looking to upload new firmware,… 12CTs,… and removing the mains input voltage switch over,…
I have modified your script,… and I can apparently execute commands on my emonpiCMS,… But before I jump in and blow new firmware,… I have some questions if you be so kind,…
Currently,… my emontx4 I have radio control switched off,… data is just sent over USB-C,… will this setting and my CT setting 50A,… 20Amp etc be remembered,…( I have not changed since default I believe,… but that was some time ago ) or is this a case of setting in the new code,… ( which I have found I believe ).
And as Long as I keep the same ID’s then emonPiCMS will essentially ‘see no change’ in CT 1-6,… it will just have CTs 7- 12 to process now… on a new ID
And finally,… the HEX code at:-
emontx4/firmware/EmonTxV4/compiled at main · openenergymonitor/emontx4 · GitHub 1.

which is the default HEX firmware loaded,… when emonTx4 is purchased,… I just want this as backup so I can at least restore things back as was ‘new’… classic, native, and LPL… what are they pls…
Many Tx

It looks the same to me – and it’s only your posts that look like that, everyone else’s come out just fine. Do you not see what Bill reproduced in his screenshot? I see exactly that. Everywhere there should be either a comma or full stop followed by a space, you, your machine or your web browser is sending comma, 3 dots and a space except at the end of a paragraph – you/it appears to get that right.

Bear in mind the Discourse editor will replace two full stops with an ellipsis.

Ahh, I do use triple full stops in places, but the png file looks fine to me, so odd
Anyhow, went back to vi, and deleted triple full stops, some were full stops, I discovered, but many ( that looked like full stops), were in actual fact a single character, which I can only assume led to the funny display. Hope this works ( no double or triple full stops ).

Take 3:-
Robert, Just looking to upload new firmware, 12CTs, and removing the mains input voltage switch over,
I have modified your script, and I can apparently execute commands on my emonpiCMS, But before I jump in and blow new firmware, I have some questions if you be so kind,
Currently, my emontx4 I have radio control switched off, data is just sent over USB-C, will this setting and my CT setting 50A, 20Amp etc be remembered, ( I have not changed since default I believe, but that was some time ago ) or is this a case of setting in the new code, ( which I have found I believe ). And as Long as I keep the same ID’s then emonPiCMS will essentially ‘see no change’ in CT 1-6, it will just have CTs 7- 12 to process now on a new ID And finally, the HEX code at:-
emontx4/firmware/EmonTxV4/compiled at main · openenergymonitor/emontx4 · GitHub 1.

which is the default HEX firmware loaded, when emonTx4 is purchased, I just want this as backup so I can at least restore things back as was ‘new’ classic, native, and LPL what are they pls
Many Tx

Now I can read it.

That single character is called an ellipsis. See Unicode Character 'HORIZONTAL ELLIPSIS' (U+2026)

You’ll need to get the answer to that from the sketch you’re going to use. If you use my demonstration sketch that is bundled with the distribution of emonLibDB, then absolutely nothing is saved. The easiest will be to start with “EmonTx4DB_max.ino” which has no radio commands in it, nothing to switch between “guessed apparent power” and real power, and then use the API commands
void EmonLibDB_set_vInput(uint8_t _input, double _amplitudeCal),
double _phase)
and
void EmonLibDB_set_cInput(uint8_t _input, double _amplitudeCal,
double _phase)
to set (i.e. edit: change the numbers) the required values for the necessary channels - all is fully documented in emonLibDB User Doc.pdf

Your best move will be to use the serial monitor to get the emonTx4 to list the configuration settings to screen, then copy and paste that into a text file for safekeeping. You can refer to the file when editing the new sketch.

Correct.

I have no control over what appears on Github, neither is it clear, either from the relevant “Shop” page or Github, which is the “Shop Default” sketch for any particular set of options on the order form. So I can’t say which sketch you had when you received it.

Hi Robert I have compiled and uploaded new firmware,… ( and it actually appears to be working ).
Well If I look in emonhub, it reports CT’s 1-12, (which has to be a plus.)
My only ( known ) problem is the CTs do not show up in emonPiCMS, and only only have 1-6 CTs listed,… which are not being updated,…
But the data is being broadcast on USB as follows;-

2024-04-17 12:59:56,661 DEBUG    MQTT       Publishing: emon/emonpi_5/t4 0
2024-04-17 12:59:56,662 DEBUG    MQTT       Publishing: emon/emonpi_5/t5 0
2024-04-17 12:59:56,663 DEBUG    MQTT       Publishing: emon/emonpi_5/t6 0
2024-04-17 12:59:56,664 DEBUG    MQTT       Publishing: emon/emonpi_5/pulsecount 0
2024-04-17 12:59:56,697 DEBUG    USB0       Analog in = 0
2024-04-17 12:59:56,800 DEBUG    USB0       Ch 1 I=3.230 W=699 VA=775 Wh=65 pf=0.9010
2024-04-17 12:59:56,903 DEBUG    USB0       Ch 2 I=0.113 W=4 VA=27 Wh=0 pf=0.1322
2024-04-17 12:59:57,005 DEBUG    USB0       Ch 3 I=0.108 W=8 VA=26 Wh=0 pf=0.2958
2024-04-17 12:59:57,108 DEBUG    USB0       Ch 4 I=0.088 W=3 VA=21 Wh=0 pf=0.1361
2024-04-17 12:59:57,211 DEBUG    USB0       Ch 5 I=1.968 W=445 VA=473 Wh=36 pf=0.9413
2024-04-17 12:59:57,315 DEBUG    USB0       Ch 6 I=1.192 W=173 VA=286 Wh=18 pf=0.6040
2024-04-17 12:59:57,418 DEBUG    USB0       Ch 7 I=0.022 W=0 VA=5 Wh=0 pf=0.0016
2024-04-17 12:59:57,521 DEBUG    USB0       Ch 8 I=0.022 W=0 VA=5 Wh=0 pf=-0.0401
2024-04-17 12:59:57,624 DEBUG    USB0       Ch 9 I=0.009 W=0 VA=2 Wh=0 pf=-0.0429
2024-04-17 12:59:57,728 DEBUG    USB0       Ch 10 I=0.009 W=0 VA=2 Wh=0 pf=-0.0277
2024-04-17 12:59:57,831 DEBUG    USB0       Ch 11 I=0.008 W=0 VA=2 Wh=0 pf=-0.0393
2024-04-17 12:59:57,934 DEBUG    USB0       Ch 12 I=0.009 W=0 VA=2 Wh=0 pf=-0.0890
2024-04-17 13:00:01,557 DEBUG    EmonPi2    735 NEW FRAME : OK 5 162 2 81 0 243 2 38 92 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 (-0)
2024-04-17 13:00:01,559 DEBUG    EmonPi2    735 Timestamp : 1713355201.557728
2024-04-17 13:00:01,559 DEBUG    EmonPi2    735 From Node : 5
2024-04-17 13:00:01,559 DEBUG    EmonPi2    735    Values : [674, 81, 755, 235.9, 0, 0, 0, 0, 0, 0, 0]
2024-04-17 13:00:01,560 DEBUG    EmonPi2    735 Sent to channel(start)' : ToEmonCMS
2024-04-17 13:00:01,560 DEBUG    EmonPi2    735 Sent to channel(end)' : ToEmonCMS
2024-04-17 13:00:01,792 DEBUG    MQTT       Publishing: emon/emonpi_5/power1 674
2024-04-17 13:00:01,793 DEBUG    MQTT       Publishing: emon/emonpi_5/power2 81
2024-04-17 13:00:01,794 DEBUG    MQTT       Publishing: emon/emonpi_5/power1pluspower2 755
2024-04-17 13:00:01,795 DEBUG    MQTT       Publishing: emon/emonpi_5/vrms 235.9
2024-04-17 13:00:01,796 DEBUG    MQTT       Publishing: emon/emonpi_5/t1 0
2024-04-17 13:00:01,797 DEBUG    MQTT       Publishing: emon/emonpi_5/t2 0
2024-04-17 13:00:01,798 DEBUG    MQTT       Publishing: emon/emonpi_5/t3 0
2024-04-17 13:00:01,799 DEBUG    MQTT       Publishing: emon/emonpi_5/t4 0
2024-04-17 13:00:01,800 DEBUG    MQTT       Publishing: emon/emonpi_5/t5 0
2024-04-17 13:00:01,800 DEBUG    MQTT       Publishing: emon/emonpi_5/t6 0
2024-04-17 13:00:01,801 DEBUG    MQTT       Publishing: emon/emonpi_5/pulsecount 0
2024-04-17 13:00:01,964 DEBUG    EmonPi2    736 NEW FRAME : OK 24 182 0 0 0 204 1 26 0 1 0 0 0 (-62)
2024-04-17 13:00:01,965 DEBUG    EmonPi2    736 Timestamp : 1713355201.964103
2024-04-17 13:00:01,965 DEBUG    EmonPi2    736 From Node : 24

I thourght for a while I was on to something,… now I have come across a brick wall in that avdude does not want to play ball with the command that had previously workd??

avrdude -C/opt/openenergymonitor/EmonScripts/update/avrdude.conf -v -pavr128db48 -carduino -D -P/dev/ttyUSB1 -b115200 -Uflash:w:$targetfile:i

Hello @diyhouse (@Robert.Wall on the phone with Mark as I type this)

Here’s the firmware example that you need that will print in the right format that emonHub can pickup:
https://github.com/openenergymonitor/emontx4/tree/main/firmware/EmonTx4_DB_12CT_WiFi

This prints data to serial in the following format:

MSG:1,V1:243.23,P1:100,P2:200,P3:300...  up to P12:Value

EmonHub will pick this up and forward via MQTT to Emoncms.

This firmware example was initially developed for use with the EmonESP WiFi module and so only prints out the voltage and power values but it works fine with the EmonHub interfacer that reads from the USB port

I’ve deleted my reply to @diyhouse’s pleas - I was clearly wasting my time trying to help.

1 Like