ADC A0 reading is often 0 despite proper signal

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
tparvais
Normal user
Posts: 99
Joined: 28 Oct 2015, 23:13

ADC A0 reading is often 0 despite proper signal

#1 Post by tparvais » 23 Apr 2020, 11:35

Hello

Uising Wemos D1, last Mega build.
Very simple configuration with current sensor 'HW-670' with analogue output to measure power used by motor pump.


1 reading per second. sometimes i have properly a value, most of the time, output is zero on ESP.

Multimeter shows always 150mV stable output of current sensor.

Any idea why ADC ESP does not give proper constant value ? (469 displayed ~ 92 Watts via formula)

Thanks

Logging: Debug Dev (9)
911399: ADC : Analog value: 0 = 0.000
912399: ADC : Analog value: 0 = 0.000
913399: ADC : Analog value: 0 = 0.000
914399: ADC : Analog value: 0 = 0.000
915399: ADC : Analog value: 0 = 0.000
916399: ADC : Analog value: 0 = 0.000
917399: ADC : Analog value: 0 = 0.000
918399: ADC : Analog value: 0 = 0.000
919399: ADC : Analog value: 0 = 0.000
920399: ADC : Analog value: 0 = 0.000
921399: ADC : Analog value: 0 = 0.000
922399: ADC : Analog value: 0 = 0.000
923399: ADC : Analog value: 0 = 0.000
924399: ADC : Analog value: 0 = 0.000
925399: ADC : Analog value: 0 = 0.000
926399: ADC : Analog value: 0 = 0.000
927399: ADC : Analog value: 0 = 0.000
928399: ADC : Analog value: 0 = 0.000
929399: ADC : Analog value: 0 = 0.000
930399: ADC : Analog value: 0 = 0.000
931399: ADC : Analog value: 0 = 0.000
932399: ADC : Analog value: 0 = 0.000
932459: WD : Uptime 16 ConnectFailures 0 FreeMem 20992 WiFiStatus 3
933399: ADC : Analog value: 0 = 0.000
934399: ADC : Analog value: 0 = 0.000
935399: ADC : Analog value: 0 = 0.000
936399: ADC : Analog value: 0 = 0.000
937399: ADC : Analog value: 0 = 0.000
938399: ADC : Analog value: 0 = 0.000
939404: ADC : Analog value: 469 = 92.630
940399: ADC : Analog value: 0 = 0.000
941399: ADC : Analog value: 0 = 0.000
942399: ADC : Analog value: 0 = 0.000
943399: ADC : Analog value: 0 = 0.000
944399: ADC : Analog value: 0 = 0.000
945399: ADC : Analog value: 0 = 0.000
946399: ADC : Analog value: 0 = 0.000
947399: ADC : Analog value: 0 = 0.000
948399: ADC : Analog value: 0 = 0.000
949399: ADC : Analog value: 0 = 0.000
950399: ADC : Analog value: 0 = 0.000
951399: ADC : Analog value: 0 = 0.000
952399: ADC : Analog value: 0 = 0.000
953399: ADC : Analog value: 0 = 0.000
954399: ADC : Analog value: 0 = 0.000
955399: ADC : Analog value: 0 = 0.000
956399: ADC : Analog value: 0 = 0.000
957399: ADC : Analog value: 0 = 0.000
958399: ADC : Analog value: 0 = 0.000
959399: ADC : Analog value: 0 = 0.000
960401: ADC : Analog value: 480 = 94.802
961399: ADC : Analog value: 0 = 0.000
962399: ADC : Analog value: 0 = 0.000
962459: WD : Uptime 16 ConnectFailures 0 FreeMem 20992 WiFiStatus 3
963399: ADC : Analog value: 0 = 0.000
964217: SYS : 16.00,-43.00,10.30
964405: ADC : Analog value: 469 = 92.630
965399: ADC : Analog value: 0 = 0.000
966399: ADC : Analog value: 0 = 0.000
967399: ADC : Analog value: 0 = 0.000
968399: ADC : Analog value: 0 = 0.000
969399: ADC : Analog value: 0 = 0.000
970399: ADC : Analog value: 0 = 0.000

TD-er
Core team member
Posts: 8747
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: ADC A0 reading is often 0 despite proper signal

#2 Post by TD-er » 23 Apr 2020, 13:23

Hmm this is a good question and one that may put me on some ideas to look into a somewhat similar issue I'm having with one of my own boards.
Let me explain.

I have one board mounted in my car, to monitor outside CO2 (even when driving) and keep track of the car battery voltage.
That last one is now with the Covid-19 lockdown even more important than ever.

This monitoring of the car battery is done using the internal ADC and it was always very very smooth and stable.
But the last 3 weeks I do have quite some fluctuation in the measured values, even though I am using oversampling for about a minute.

N.B. the firmware has not changed on that board for months and the board also has not changed.

The only thing that has changed is that it is now connected to a different WiFi access point.

So it may very well be that I also have every now and then some "0" values, which may be seen as "100 mV noise" in my setup due to oversampling.
But it is striking this "noise" started to appear when I switched to a different AP.
So maybe that one does cause more specific WiFi activity which interacts with the ADC.
After all, the ADC is also used for some WiFi functions, but until now I only thought it was interacting only during RF calibration.
Apparently not.

I will do some tests here and see if I also have these 0 values every now and then.

As a test, you can try to use a different AP (preferably different vendor)

tparvais
Normal user
Posts: 99
Joined: 28 Oct 2015, 23:13

Re: ADC A0 reading is often 0 despite proper signal

#3 Post by tparvais » 23 Apr 2020, 14:10

TD-er wrote: 23 Apr 2020, 13:23 As a test, you can try to use a different AP (preferably different vendor)
Hello

Thank you for feedback.

I've in the same room, in my basement 5 others ESP connected to the cable Wifi Router installed there that don't have this issue.

I'll have a look btw

But Wifi connection seems ok, what is strange is that he reports "0" (via MQTT and Weblog) instead of proper measurements.

Thank you

TD-er
Core team member
Posts: 8747
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: ADC A0 reading is often 0 despite proper signal

#4 Post by TD-er » 23 Apr 2020, 15:17

WiFi connection here is also very stable, but like I said I noticed this (significant) noise after changing to another access point, one model I never used before.
It is the Mikrotik cAP lite, but I do have other Mikrotik access points which did not show this behavior.

User avatar
ThomasB
Normal user
Posts: 1065
Joined: 17 Jun 2018, 20:41
Location: USA

Re: ADC A0 reading is often 0 despite proper signal

#5 Post by ThomasB » 24 Apr 2020, 19:51

Very simple configuration with current sensor 'HW-670' with analogue output to measure power used by motor pump.
1 reading per second. sometimes i have properly a value, most of the time, output is zero on ESP.
I've not used it, but that sensor's photo shows a AC current transformer with buffer amp.
https://bit.ly/3aAhFGT

Unless it has a AC to DC conversion hardware, I would expect the output would be AC output with a DC offset.
EDIT: I did some searching and confirmed it is AC output. See: https://www.youtube.com/watch?v=zyJnqdqIR_A

Keep in mind that the sensor measures AC current. If your Pump is DC then this sensor would not be the correct choice.

A typical software solution would sample the AC sensor's output voltage at a very high rate (>2X AC freq) and then perform RMS conversion. That's not supported by ESPEasy's analog input function.

But it can be done in hardware. One possible idea is to use a Schottky rectifier on the sensor's signal output. The resulting DC voltage will require some filtering. Connect the filtered DC to ESP's Analog input.

- Thomas

tparvais
Normal user
Posts: 99
Joined: 28 Oct 2015, 23:13

Re: ADC A0 reading is often 0 despite proper signal

#6 Post by tparvais » 24 Apr 2020, 21:45

My god. I didn’t think about this ... I have other current sensor with ferrite and output is always dc even ac source

I will add a shotky diode and capacitor to filter output ...

TD-er
Core team member
Posts: 8747
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: ADC A0 reading is often 0 despite proper signal

#7 Post by TD-er » 25 Apr 2020, 15:37

For measuring AC there are several chips available, some even supported by ESPEasy.
Like Thomas said, it will not be practical to use the internal ADC for measuring quickly changing voltages.

tparvais
Normal user
Posts: 99
Joined: 28 Oct 2015, 23:13

Re: ADC A0 reading is often 0 despite proper signal

#8 Post by tparvais » 25 Apr 2020, 17:26

TD-er wrote: 25 Apr 2020, 15:37 For measuring AC there are several chips available, some even supported by ESPEasy.
Like Thomas said, it will not be practical to use the internal ADC for measuring quickly changing voltages.
I Know there are chips for that but advantage of this approach is that I shall not change the primary circuit. I have several esp using this kind of current transformer with DC output that work like a charm

https://www.amazon.fr/transformateur-Co ... B07JGXNKJ8

I used this hw-670 because this one the only one in my stock ...

Post Reply

Who is online

Users browsing this forum: No registered users and 41 guests