News:

Let's find out together what makes a PIC Tick!

Main Menu

How to remove mains hum from my ADC readings

Started by TimB, Jul 26, 2023, 02:07 PM

Previous topic - Next topic

TimB

Hi all

I have a board that measures water level probes using an opamp. I have a complex system to pulse 5v via various probes and read the results on a fixed probe that is under the water.

I have a board up that works perfectly running of a battery but when I connect it to a power supply it misbehaves so bad I wasted days thinking I had a software issue.

After prodding the sensors with my scope it started working again. Then I noticed the ripple you can see in the picture

An explanation of the signals in the picture.

The signal is the voltage on bottom probe pin
The square waves are the signal going high by the probe pin seeing the pulses from one of the drive pins being in the water and raising the voltage.
There is another pin that is not in the water but maybe influencing the signal a bit. Perhaps it is the path for the background hum. It is being read by the ADC as a signal from the second probe and hence the issue I was having until I drained some of the current off through the scope probe

What ever the cause I want to get rid of it. Any ideas please?

Thanks Tim


trastikata

Hello TimB,

can you share the schematic for the power supply part of you design? 

John Lawton

Yes, we would need to see the schematic, but one possible issue is the creation of a ground loop via the power supply if one of its outputs is grounded, as your 'scope etc will be grounded too.

John

TimB


Thanks

This is the schematic. There are a lot of 100nf caps across the board. Power comes in via a big 240 -12v power supply brick.

The unit with the issues is powered of VDD via an expansion board that has +5v/VDD and Grnd going out to 4 devices all talking via 2 sets of i2c lines. There is no smoothing on the expansion board

Also included the battery powered look at the signal


trastikata

#4
Ground loop is one possibility, another one is a noisy supply and poor regulation with too little drop-out voltage.

For noise sensitive circuits with a grid supply(or switching), I usually make it two-stage (12-9 and 9-5 or 9-5 and 5-3.3 volts) with LDO regulators and enough drop-out voltage. Don't forget your low ESR decoupling and tank capacitors.

Edit: you posted it while I was writing. Try placing a  9 volts LDO between the 12v and the 5v LDO and check again. If possible replace the electrolytic caps with tantalum .

TimB

Some extra info I have found

The whole "unit" image below should really be connected to steam and condensed to water. But since I do not have a steam supply in my spare room I'm pumping water through the unit. The pump is a little 12v one sitting in a tub.

I just noticed that with the pump off I'm getting no hum on the signal. So it may be hum induced through the water line (approx 2mtrs of tubing) through to the probe.  Or it could be the pump power brick is supper noisy or the pump is causing the issue as it is noisy.

Dun know  ::)

TimB

#6

Thought I fixed it with a new power supply but its just as bad

John Lawton

12V pump, how could that be causing 'hum' assuming it is DC driven?
Possibly the power supply feeding it has issues. Are you also feeding your analogue circuitry from that supply?

top204

If it is just the ADC readings that are effected, try a High Pass filter on their inputs, to eliminate any frequencies below what are required. I the olden days, we used to call this a "Rumble Filter". :-)


TimB

The feed to the pump is separate from the feed to the panel.

The pump is a DC 12v job and is immersible so it will have some electronics to drive the blades like a brushless fan.

They are dirt cheap so probably very noisy.

I need to work out what cap value to use on the input to simulate the scope I have on it so I do not need to have the scope prodding the sensor probe all the time so I can use it while I find a proper solution.

TimB


High pass filter!

Ok trying to educate myself on them now and work out what freq I need as the cap + r required

TimB

#11
Ok ran a SIM of the signals and there seems to be an issue

The filter seems to be generating am AC signal that is making the signal sit at about 50% My code can still cope with that although its not ideal.

The image below shows what I'm actually doing with the signal in my code

I have 3 probes

Probe 1 is an input
Probe 2 is an output
Probe 3 is an output

I drive Probe2 high the read the signal back via Probe 1
I then drive Probe2 low for a few us kill any capacitance

Then I drive Probe3 high and read the signal back via Probe 1
I then drive Probe3 low for a few us kill any capacitance

Repeat 4 x to get an average

Do some tests on the results and work out what is happening

The issue is that in the SIM when the signal changes by adding Probe3 it effects the filter masking it out

Images are

1 No filter
2 Filter 100k + 0.1uf signal 2
3 Filter..... signal 2 + 3




John Lawton

Just a thought. I see you've wired your cabinet neatly with conduit, but does that mean you are running the motor wires parallel to sensitive signal cables, causing crosstalk between them? If so, it might be worth running the motor cables entirely separately from other cabling.

TimB


trastikata

#14
Quote from: TimB on Jul 26, 2023, 08:23 PMOk ran a SIM of the signals and there seems to be an issue
...
2 Filter 100k + 0.1uf signal 2

This looks like a Low-pass, not a High-pass filter.

P.s. Still my advise stays - try with placing a 9v LDO regulator before the 5v LDO regulator.

TimB

Quote from: trastikata on Jul 26, 2023, 08:50 PM
Quote from: TimB on Jul 26, 2023, 08:23 PMOk ran a SIM of the signals and there seems to be an issue
...
2 Filter 100k + 0.1uf signal 2

This looks like a Low-pass, not a High-pass filter.

P.s. Still my advise stays - try with placing a 9v LDO regulator before the 5v LDO regulator.

The issue is that it is not possible to insert another reg on an existing main board. And I need the 12v on the board as I drive other devices with it so regulating the 12v off the board will not work




trastikata

#16
Quote from: TimB on Jul 26, 2023, 09:28 PMThe issue is that it is not possible to insert another reg on an existing main board. And I need the 12v on the board as I drive other devices with it so regulating the 12v off the board will not work

TimB, sometimes those power supplies have a pot outside to regulate the 12v - if you have it, you can try upping the voltage to max, probably up to 14-15 volts and placing a 12v regulator between the power supply and the main board 12v connector. Of course disconnect everything that can be damaged by the higher voltage.

If you have a spare laptop supply - those are usually 19-21 volts and you can try the same - place a 12v regulator between the board and the supply and if it helps removing the 60hz noise, this might be a solution.

trastikata


TimB


The noise is coming from the water pump and varies depending on the load and water level. So I'm going to concentrate or removing the noise at the source and next pcb change I will add another regulator as it will run on 24v.


John Lawton

Tim,
I wonder whether motor current is travelling through tracks on the board that are shared by other circuitry? That could cause voltage drops on the 0V line that could affect other circuitry. Just guessing really as not seen the board layout and overall wiring scheme.

John