# Biasing an AC signal for sampling - detect minor changes via Arduino

I am trying to bias an AC signal and to the best of my knowledge I've come up with this circuit. please be easy on me am just getting used to the concept/terms of sampling and biasing.

I am trying to get the slightest variation on of the AC signal and when simulating on LTSpice i can see a difference of .1 to .7v. Wish to know if this design would be enough for MUC such as the arduino sample. Should i smooth the signal ?

What am i trying to achieve ? A way to read the current from the secondary winding of a MOT (Microwave Oven Transformer for spot welding 18650 cells) by reading the voltage and a known resistance and by using Ohms Law I=V/R calculate the current putout during weld.

So i could use a current transducer but for the thickness of the cable of 25mm2 a CT would be very expensive. hence thought of going this way, I have two variables already which is voltage and Resistance hence within the code i could get the current. To get the voltage i have tapped on 2 points on the secondary cable at 40cm apart and i get a sinewave of 1 to 3 Vpp. So just need to scale the ac voltage safe enough to be fed into an arduino ADC and the easiest way would be to add a dc biase (i hope i've used the terms correctly) or some say it as level shifting with an opamp and some resistors and caps.

simulate this circuit – Schematic created using CircuitLab

• "i can see a difference of .1 to .7v" - that doesn't sound right given the circuit you've posted. – Andy aka Mar 17 '18 at 10:26
• i meant when i change the source voltage by 1.1 or 1.8. Sorry i forgot make it clear. – George Mar 17 '18 at 10:28
• That still doesn't sound right. If you input (say) a sine wave at V2 then you should see a smaller sine wave at "TO_ADC" superimposed on 2.5 volts DC. That's what I'd expect to see. Also, why would you wish to "smooth the signal"? – Andy aka Mar 17 '18 at 10:30
• yes i do see the super imposed wave but my concern is how sensitive can i make the dc offset or follow the ac signal. An opamp to follow the ac signal ? – George Mar 17 '18 at 10:37
• R2 & R3 are low in comparison with R1. 2 no. 100ks would be better. – Paul Uszak Mar 17 '18 at 11:09

## 2 Answers

would a 0.1v change be detected at the ADC ?

If the analogue signal range of your ADC is from 0 volts to +5 volts then biasing the AC signal to 2.5 volts is a good start. If your AC signal can be quite large and possibly cause a peak outside the range 0 volts to +5 volts then you need to attenuate. You have some attenuation; R1 and R2 and R3 form a 3:1 attenuator. If you need more then you need to make R1 bigger.

If the ADC has a digital resolution of 10 bits then $2^{10}$ = 1024

So your analogue resolution is 5 volts / 1024 = 4.883 mV.

This is the smallest change in analogue signal you can detect.

• Or is it 5/1023? – Paul Uszak Mar 17 '18 at 13:34
• "If the analogue signal range of your ADC is from 0 volts to +5 volts" Does that mean the voltage from the source or the actual spec of the ADC. using the ADC of an Arduino, yes it is 0 to 5v. Sine Wave Vpp is at 1.1 to 3v, it varies because the delay to keep the load in the ON state is controlled and can be varied. – George Mar 17 '18 at 20:19

With the Arduino's 10 bit sample depth, and the standard (5V) internal reference you can normally read voltage to a resolution ~4.9mV. If you switch to the internal low (1.1V) reference, you can go down to a ~1.1mV resolution. Please be aware though that at these resolutions, noise on the circuit will start to become an issue.

If the signal's a constant sine (if you get my meaning) you may have time to sample continuously at the standard rate of 10 KSa/s. Or you can go up to at least 44 KSa/s by adjusting the internal ADC clock divider, with little to no loss of precision. Where I'm going with this is towards oversampling. It takes some more code and mathematics, but you can increase the effective sample depth in line with

$$samples = 2^{2n}$$

where n is the additional increase in sample bit depth. I personally find that you get better performance from such sample circuits by adding the bias by an op amp with the bias offset applied to one of the inputs. It creates a very low output impedance signal for driving the ADC, and makes bias adjustment simple with just a pot.

• Thank you appreciate your reply. Could you please explain how to sample a sine wave on an arduino. If i understand, its by taking the min and max value and find the difference. Then iSense = analogRead(A2); iSense = ((maxReading - minReading) / ISamples); iSense = ((iSense * 5) / 1024); iSense = (iSense / 0.0003); // iSense is the voltage ohms law to calculate current – George Mar 17 '18 at 20:27
• @George Whoa there! Current? What current? Where did iSense come from? And there's a load with a delayed ON state? I'm getting confused (as usual) as to what exactly you're trying to sample. – Paul Uszak Mar 17 '18 at 21:41
• It may be worth while revisiting your main question and putting in some more details. Specifically what you're trying to accomplish, rather than how you think it should be done. I personally hate the nomenclature, but there is a concept called the XY problem that might help you forming a more answerable question. – Paul Uszak Mar 17 '18 at 21:44
• i edited the orginal post by adding few more info. I thought I'd keep it simple and stick to the point. Sorry i did not explain it clearly earlier. – George Mar 19 '18 at 16:49
• I just tested this on a breadboard seems like a fail idea to me but i know the idea is possible but i lack the knowledge/experience to accomplish this. – George Mar 21 '18 at 20:00