Thermocouple Noise When Using AP Mode


 

Bryan Mayland

TVWBB Hall of Fame
I've been doing some experimentation on the bench with a HeaterMeter 4.3.4 and a Pi 3B+ and I'm seeing just a ton of noise on the thermocouple input when the Pi is set to AP mode. I see the noise icon in the webui home page and it looks like this on the noise graph.
1612281956168.png

It looks like this on the output from the thermocouple amplifier.
WifiAPTCOut.png

Note that it drops completely to 0V every 100ms, which is the AP beacon interval of the wifi network. When in wifi client mode, these drops aren't there at all, although there does appear to be a tiny change in the output if transferring something over the network (wget a large file across the network). I've looked at the power supply voltages on the oscilloscope and they look pretty good. The 5V line has a bit of a dip and overshoot at the 100ms interval, the 3.3V regulator rejects some of that so the output to the amplifier is cleaner.
  • Added a 10uH inductor before the 3.3V regulator
  • Added a ferrite bead before the thermocouple amp
  • Increased the ground resistor on the amplifier from 1K to 1M
  • Doubled the capacitors on the 3.3V rail to 2x100uF
  • Doubled the decoupling capacitor at the amplifier to 2x0.1uF
The power input now has less than 5mV of ripple to it, which is probably just the scope picking up noise from the ground wire, and I still have a full scale drop out on the amplifier every time the wifi transmits. The wifi antenna is located pretty close to the thermocouple amplifier, so I tried to wrap the amplifier with a little aluminum foil shield but it didn't seem to make a difference. I also replaced the actual thermocouple with just a shunt to remove the possibility that the wire was acting as an antenna.

I suppose I posting this more for informational purposes than anything else. I think the only way to improve this is to physically separate them. I haven't tried the Pi ZeroW to see if it has the same problem, but I'd be interested to hear if anyone has any ideas on how to resolve this.
 

Steve_M

TVWBB Guru
Interesting observation. I think the 3B+ has 2.4 and 5Ghz wifi. It would be interesting to see if it happened on both frequency bands.
 

Bryan Mayland

TVWBB Hall of Fame
Interesting observation. I think the 3B+ has 2.4 and 5Ghz wifi. It would be interesting to see if it happened on both frequency bands.
Wow that's a super-excellent idea! I switched over to 5GHz (channel 40) AP mode and there is zero noise there on the thermocouple probe just like client mode. That's just crazy.
 

Steve_M

TVWBB Guru
Another experiment to try is if there's more TC noise when running in client mode on 2.4 vs 5GHz
 

Bryan Mayland

TVWBB Hall of Fame
I think there's actually some effect from client mode 2.4GHz as well, as sometimes when I load the web page there's a single tick of slightly off data you can only see if you look at the display. I think it just shows up more in AP mode because it blasts out a beacon packet every 100ms at full power and it overlaps the ADC read more often. I tried doing an `iw phy phy0 set txpower fixed N` and tried a ton of different Ns and they all showed the same behavior of the amplifier.

It is just boggling that the power looks good, the ground looks clean, but somehow a microwave signal cuts the amplifier output down to 0. I wonder if the arrangement of the components somehow forms an antenna. I have one of the Adafruit AD8495 breakout boards I might try to solder up and hold it over the Pi's wifi antenna and see if it is also affected the same way. They use a bias reference voltage which might make it behave differently, which I am adverse to using because it reduces the resolution of our ADC from ~0.22C per ADC LSB to ~0.65C.
 

Steve_M

TVWBB Guru
Interesting findings for sure. Testing AP mode across channels 1 through 11 in 2.4GHz mode would also be an interesting experiment to see if it's more pronounced at a certain frequency or if it's the whole 2.4Ghz range.

With my espresso PID using the ESP8266 ( Wemos D1 Mini ) and the AD8495 from an HM Board, I found things to be really noisy. Switching to a pre-built AD8495 board with the 2.5v reference voltage made a huge diff, but I also added a 15 bit ADC for improved resolution since the ADC on the ESP8266 units are kinda trash anyways.
 

Gary V

TVWBB Fan
I am wondering if what I experienced was similar to what you experienced.

Brian, Went ahead and updated to your current snapshot. Just found a good one for you to try. Go into your config screen page. Make sure you have a damper connected and your heatermeter setup with a thermocouple. Now turn heatermeter to on and lets set it to 60-70 degrees at the heatermeter. I have mine on my office table right now. Now from your config page, go click the wifi page. I get a jump in the control loop. What do you get. This is not the only situation this occurs with Try other page to page clicks too.

After spending lots of spare time looking into this, I started to wonder if the clock frequencies for AVR, Pi and for WiFi control might be having harmonic over riding issues. We look at base clock timing, but often we do not look at the harmonics and their low level voltage levels. Example is from waaaay back when I was working with processor controlled xray measuring systems. The machine that was doing the work had a mechanical hydraulic response limit of 24hz. The processor for the measuring systems had it`s own clock and subsequent source of harmonics. I found when I developed the digital filter in the code for the measuring system, since 60hz and 120hz was the prevalent harmonics in the machines controls, I had to calculate a rolloff at 37.5 hz so that harmonics seen by the ultra sensitive xray measuing device would not pass the harmonic spikes from from it`s AD convertor the controlling machine and back to the process control control PID for the controlling machine. Very sensitive system. I could still provide sufficient data to the machines PID control loop when I filtered out everything above 37.5 Hz.
 

Bryan Mayland

TVWBB Hall of Fame
Yeah I think you're seeing the same thing, but it isn't clock harmonics because I can reproduce it using just an AD8495 chip (which is just an analog opamp) and a Raspberry Pi. It seems to be when the Pi transmits at full power, the AD8495 output changes. If I move the AD8495 around there are places where the output drops up to full scale, and other places where the output actually goes up a little during the transmit. If the perturbance and the ADC temperature sampling take place at the same time, the temperature appears to change. It happens even 100mm away from the Pi, so there're really nowhere the HeaterMeter can go to not be affected and there's no way to sync the two up so they don't coincide because there's no telling when the Pi is transmitting a packet.

Client mode is less affected because there's only 0.2-1.0 packets per second going out, where AP mode is 10 packets per second, and a wifi scan probably does a bunch of transmits too.
 

Darren L

TVWBB Member
I'm showing my ignorance here: Is this with a thermocouple or a sourced signal? Wondering if a grounded TC would make any difference. I like the Faraday cage idea.
 

Bryan Mayland

TVWBB Hall of Fame
I tested it first with a thermocouple but eventually just switched to using a shunt to connect the input pins of the amplifier together. One leg of the shunt is connected to ground (through a 1k resistor in the standard build, or what became a 1M resistor in this test setup).

I need to try making a full aluminum foil box around the thermocouple input and connect that directly to ground too, but most of today has been take up by... well, let's say "infuriating nonsense".
 

Gary V

TVWBB Fan
If a RF cage around thermocouple amp might be a tough design, maybe changing the RC on the amp input to limit signals from DC to up to 37.5 hz might offer a solution. We don`t need the wider bandwidth, only mv changes from the welded junction. Sometimes we can mask signals we do not want by messing with bandwidth. Also can the thermocouple amp be wired up in Common Mode signal isolation or is the mv signal too low to work with common mode techniques?
 

Bryan Mayland

TVWBB Hall of Fame
The thermocouple inputs have both differential and common mode filters, common mode cutoff 159kHz, differential cutoff 7.579kHz. The datasheet recommends them because "The primary purpose of the filter is to remove RF signals, which, if allowed to reach the AD849x, can be rectified and appear as temperature fluctuations." I'm not sure where the values I use came from, I thought they were in the datasheet, but there are no values in the recommended circuit. CN-0271 recommends different values but with similar cutoffs, 159Khz common 758Hz differential. The wifi should be common mode noise so I don't think changing the values would make any difference.

Increasing the size of the capacitor on the RC filter to the ATmega input would lower the cutoff, but if you do the math to try to figure out how big the capacitor would have to be to reject a ~150mV signal becoming 0V for 3-5ms without dropping more than 1mV (the ADC resolution), the capacitor would be giant.

This is how RF engineers normally test stuff, right? AD8495 covered with aluminum foil on both sides and then connected to the ground terminal. No change at all in error, as you can see by the "05Nz" reading. Please excuse the vulgarity of the labeling of the LCD board.

DSC07407.JPG
 
Last edited:

Gary V

TVWBB Fan
I have not had good luck using aluminum foil for rf shields but that does not mean it does not work. I usually use copper foil. But besides that, have you tried the same test and observations using the original Pi3. That processor was clocked at 1.2 ghz versus the 3+ at 1.4ghz. I am curious if you see the same thing with a Pi3. My Pi 3 is being used by my son in another state and he really would just look at me a say WHATTT if I asked him to do some test. Not his cup of tea, electronics, but you need a fishing guide, well he got you covered.
 

Bryan Mayland

TVWBB Hall of Fame
But besides that, have you tried the same test and observations using the original Pi3.


Exact same issue. You can tell it isn't related to the clock speed of the CPU because the output is perfectly flat during the boot process and the INSTANT the wifi is enabled, the noise starts.
1612459218025.png

I also tried the Pi Zero W, which shows maybe 80mV dropouts instead of 100mV, so it is affected as well with just a 1000MHz clock. A Pi B+ with an external adapter shows 5-15mV drops, and that one is fun because you can put your hand about a foot away and move it around and watch the dropout change from -15mV to +5mV depending on where your hand is reflecting the wifi signal back.

I have also spent a few hours with a 3B+ in 5GHz AP mode and it has absolutely zero issues that I can see, with the highest reported noise value being 1. It seems the only solution is to use 5GHz (AP or Client mode). I believe the wifi module always fires up in 2.4GHz mode first, because when the 5GHz AP mode starts up, there's ONE period where it shows full drops and then becomes this. Note that the noise is still there but it is positive and barely visible above the measurement error
DS1Z_QuickPrint1.png
 

Gary V

TVWBB Fan
I wonder if the power output is higher with the 2.4ghz band. Granted the 2.4ghz band has better transmission than the 5ghz band. Also I have not looked, but I wonder if the bandwidth of the 2.4ghz could cause issues. My router selects 20, 40 mhz i believe. Would have to logon to see if it goes up to 80 mhz. I did some testing with copper foil and then some conductor isolation with various caps and I get the same results as you in your first test. Will test the 5ghz band later today.
 

Gary V

TVWBB Fan
didn`t hook scope up since it is in the shop that got flattened last week from a wind storm, but here is my noise graph from heatmeter. Now on 5ghz radio. Thermocouple is shown. Graph looks the same whether I am using 2.4 ghz or 5 ghz radio. Also doing this in office where I am 4' from router. Same weird servo jumps as with 2.4 ghz radio I am seeing on 5 ghz radio.
5ghz radio.png
 

Bryan Mayland

TVWBB Hall of Fame
The noise graph there looks normal and the last segment of your graph the temperatures look pretty stable too (compared to the previous two segments). Is the pit temperature bouncing around a lot even on 5GHz? It doesn't look like it would be with that graph (ignore the servo, focus strictly on the temperature).
 

Top