Problems with Voltage

Hello!
First time posting on this forum, and i would like to apologise in advanced if my question is stupid or wrong but i keep banging my head as to why it won’t work. Basically i bought a EmonTX, 3 CT clamps and the RF receiver for my Pi 3 (and 4). I have some spare DS18B20s and i hooked one up to the EmonTX. When i connect the EmonTX to DC power (Tried a ac/dc phone charger and a powerbank just to be safe) it blinks 4 times, connects to the Pi and publishes data. The Temperature sensor works well, but i get 0W power readings and a small (0.06 - 0.8V) Vrms. Could someone point me in a direction to disable the voltage reading and calculate power assuming a PF of 1 and Vrms 230V?.
Thank you!

Welcome, @techtuki, to OEM.

I’m not sure what’s going on there, I need to investigate. I find what appears to be happening a bit surprising, because the detection threshold for the a.c. voltage is set to about 10% of the full scale input range - so about 40 V. If a.c. isn’t detected, it should switch to using the assumed mains voltage and report apparent power, which is what you are asking for. (The assumed voltage is in fact the UK standard ‘centre’ voltage of 240 V, but you can change that at power-up via the on-line programming facility.)

I can’t discount a really ‘dirty’ USB supply putting enough noise onto the power supply to get into the ADC and be registered as a voltage, so it might be worth checking with a different 5 V USB supply if you have one available.

1 Like

That was my guess, since i don’t know how good my usb supply is. Although i tested it with a powerbank not connected to the grid so that should have ruled out the supply. Should it display those weird readings if it defaulted to the 240V setting? I don’t have any more time today, but tomorrow i will try to update the software. Maybe the CTs are bad?
Thanks,
Edit: Maybe i should try a new mini usb cable since all i had on hand was an old one.

I need to check the numbers rather than relying on memory :roll_eyes:

Sorry, in the version of the sketch that you’re using, it doesn’t change to reporting apparent power and you can’t change the assumed voltage - I’m a version ahead of the latest published one.

What you need to do then is to edit the published sketch. You won’t be able to have the accumulated energy values (they are calculated deep inside the CM library), but you can use the rms current and your assumed voltage to give apparent power.

You need to look around line number 268 and the next few lines below for lines like

emontx.P1 = EmonLibCM_getRealPower(0);

and change each to

emontx.P1 = EmonLibCM_getIrms(0) * 240.0;

P1 is the power for CT1, the 0 is the logical channel number - CT1 = 0, CT2 = 1, etc.

1 Like

Thank you! Will try this out tomorrow.

The library used by the sketch - emonLibCM - detects and reports the presence of the a.c voltage, but the sketch you’re using doesn’t use it. If you want to make the switch automatically, you can use EmonLibCM_acPresent(); which returns true if a voltage above around 5.5 V is detected (using the UK a.c. adapter).