High resolution, high frequency PWM - Page 1
Forum section: electronics / projects

author: azeeman
author_rank: Regular Contributor
timestamp: October 11, 2025, 07:56:30 pm
content: Here's a simple circuit demonstrating how to make a PWM with very high resolution with a very short period, using a very simple circuit. In this circuit the gate on time can be controlled from about 100ns to 1.68us with a PWM period of 2.5 us. The PWM duty cycle is controlled by an analog voltage which determines the resolution. There is no theoretical limit to the resolution and by using stacked DACs, resolution to 20 bits or more is possible.The Arduino is used only to generate a 400 kHz reset signal which is generated by timer counter 0 using OCR0A as the timebase and OCR0B as the output. The 16 MHz clock is divided by 40 giving a 400 kHz PWM period. The reset pulse is one clock cycle or 125 ns. A 2N3904 is used to discharge the timing capacitor because it's easy to drive and it's what I have on hand.Both a Schmitt trigger input for the timing circuit and a MOSFET gate driver are required so an MCP1407 is used which is ideal as it has a Schmitt input with low input bias current and substantial drive current for use with any MOSFET.The control is definitely not linear and not calibrated and is intended only for use inside a feedback loop where the high resolution gives the circuit analog resolution with digital efficiency.Since this is only a proof of concept I'm using a variable power supply with 10 mV of resolution. This gives about 25 ns of PWM resolution.By using two 12 bit DACs where one DAC interpolates the two steps of the other DAC, the resolution of the first DAC with a 5 V reference is 1.2207 mV. The second DAC has to interpolate at least two steps plus some allowance for tolerances so let its range be 1.2270 mV * 2 * 1.1 = 2.686 mV with resolution of 2.686 mV/4096 = 655 nV. This is equivalent to 5 V/655 nV or 23 bits. It's very important to note that this is only the resolution for setting the output and does not imply 22 bit precision or accuracy. The two DACs together act as coarse and fine potentiometers which are adjustable under software control. The software will adjust the fine potentiometer first and if it runs out of range, it will be set to mid range and then the coarse pot adjusted. Once the coarse pot is adjusted, the fine pot will be adjusted until the desired output is achieved. For an example of how this will be done, I'm using this technique on another project which is still in the research stage.https://www.eevblog.com/forum/metrology/digital-null-meter-design/50/

author: azeeman
author_rank: Regular Contributor
timestamp: October 12, 2025, 06:47:48 pm
content: I've added design notes showing how to use two 12 bit DACs to increase resolution to over 22 bits. The outputs are combined using a resistor network with the values determined by a Python script using what I call quantum annealing. The script uses a model which describes the design constraints and the functions to determine these. The script then selects from standard 1% resistor values to find the closest match to the constraints.The algorithm is very simple it tweaks each resistor in turn for each design constraint and then determines which tweak, if any, gives the best fit. This is repeated multiple times and then the best overall fit is selected. The algorithm is surprisingly fast and works for even very complex networks.Although 22 bits of resolution may seem to be overkill, the main reason for such high resolution is noise reduction and programmable frequency response. Because the circuit is intended to be used in a feedback loop, any noise being fed back is either done deliberately by the program or by quantization error. With the quantization error reduced down to the nanovolt level, there's not a lot of opportunity to introduce noise. Also, because the step sizes are so small, the effective bandwidth can be reduced to cycles per day or increased to hundreds of kHz in a few CPU cycles. A conventional ADC with PID loop can be used to control the output voltage or a single bit null detection algorithm can be used. I prefer the latter because it's very simple to implement and has the potential to have substantially less output noise and much faster response with minimal hardware.I have a preliminary algorithm to do this and I'm waiting for a prototype board to test out the algorithm on real hardware. If it works, it should be possible to make a switching regulator with linear regulator noise performance and output range, but without the low efficiency.

author: rteodor
author_rank: Frequent Contributor
timestamp: October 12, 2025, 06:59:04 pm
content: I'm wondering what would/could happen if V1-R2-R4 could be replaced by a programmable current source made out of those DACs...LE: Sorry, I'm way behind with reading all that but I had to ask.

author: azeeman
author_rank: Regular Contributor
timestamp: October 12, 2025, 07:22:39 pm
content: I'm not familiar with programmable current sources, but I assume the end result would be the same. The main goal is to get high resolution and low quantization error. By using overlapping DACs the quantization error problem is solved, but getting good accuracy is still unresolved.The resistor network also suffers from reduced output range because of the inherent attenuation required in the combining network. I'm curious if programmable current sources could get around this problem.

author: rteodor
author_rank: Frequent Contributor
timestamp: October 12, 2025, 08:07:48 pm
content: I guess my mind was locked onto a more simple application: high frequency andaccuracyresolution PWM without feedback loop and with linear control. Thus the idea of current source.Can you detail a bit how the frequency response is programmable ? I'm a bit lost with that.

author: MariuszD
author_rank: Regular Contributor
timestamp: October 12, 2025, 09:10:32 pm
content: Quote from: azeeman on October 12, 2025, 06:47:48 pmThat's not true, the duty cycle will be determined by the transistor's storage time ~1us, fluctuations in the 5V power supply, and fluctuations in the 9V power supply causing changes in the switching thresholds, as well as transistor noise within the driver. Both 9V and 5V are not stable low-noise reference voltages, but noisy voltages powering the digital circiuits. The MOSFET driver was not designed to have stable switching thresholds, or for the transistors inside to have low noise. All these phenomena will cause jitter. This jitter will determine the actual usable resolution of the system, but it certainly won't be in nanovolts range. Good quality operational amplifiers have low frequency noise levels in the microvolt range, but what about a MOSFET driver that has never been optimized for analog performance?I understand the method of improving poor quality hardware thru software, but at a certain point, hardware flaws can no longer be fixed. To create a high-resolution dac, you need to create a circuit with stable parameters.Connect the PWM output to multistage RC filter, and to an oscilloscope, and show us how noisy your circuit is. Software can correct slow changes, but it won't correct wideband noise.

author: azeeman
author_rank: Regular Contributor
timestamp: October 12, 2025, 10:13:14 pm
content: Frequency response is basically the rate of change of voltage. If the the resolution is down in the nanovolts then even high speed stepping through the DAC output will result in a slow changing signal. This effectively filters out noise because the feedback signal cannot change as fast as the noise. Remember that noise by definition averages to zero. The DAC output may go up when the noise goes positive, but only by a tiny amount and then the noise can just as easily go the other way and then the DAC output goes down a tiny amount. The effective bandwidth can be down to cycles per day if desired.But the DAC output can just as easily move up and down a few volts per step and then the rate of change becomes very rapid and the effective bandwidth then becomes extremely high. This is why I was alluding to a single bit feedback control. By using a probabilistic algorithm along with single bit feedback some very interesting phenomena occur. Take an op-amp with very high gain. Once the input voltage difference is above tens or hundreds of nanovolts, the output will be either at the positive rail or the negative rail. It doesn't matter whether the voltage difference is 100 nanovolts or 1 Volt, the op-amp output is the same.This creates very well defined threshold which is reason why digital computers exist. If the voltage difference between the inverting and non-inverting op-amp input is greater than the peak to peak noise, the op-amp output will not change. The output is effectively immune to noise. John Von Neumann studied this and showed that this makes perfect signal replication possible provided that the signal to noise ratio is sufficiently high enough.To determine the certainty just count the possible states that the op-amp output can be in and see if a particular output pattern is rare or common. Think about tossing a coin. The odds of a head or tail is 50%. But with two tosses, there are four possible outcomes with one outcome two heads in a row and another outcome two tails in a row. Now try 10 tosses. There are 2^10 or 1024 possible outcomes, but only one of those outcomes is 10 heads in a row and only one outcome is 10 tails in a row. For the op-amp output if the output stays high for 10 samples, there is a very good probability that the feedback signal is too high or if the op-amp output stays low for 10 samples, there is a very good probability that the feedback signal is too low. In those two cases, it makes sense to crank up the DAC feedback. If after 10 more samples the op-amp output is still in the same state, it makes sense to crank up the output even more and just keep cranking it up until the op-amp output changes state.At that point, the feedback is brought back one tiny step after every sample until there is high certainty again. If the DAC quantization is less than the peak to peak noise, the change of the DAC output doesn't increase the noise and the DAC setting, if used as an indication of the input signal, will have less variation than the noise.Of course this assumes that the signal of interest is low in frequency relative to the sampling rate. If the PWM is being used to regulate a DC power supply than by definition, the output shouldn't be changing that quickly. Of course there has to be tradeoffs for load and line changes, but a DC power supply has to be distinguishable from an audio amplifier and can't have a very high frequency response.I've attached a Python script which simulates a load cell meter using single bit feedback. Of course, this is a toy model, but it does demonstrate some of the phenomenon mentioned above. In the model, four eight bit DACs are combined to null out the load cell common mode and the op-amp input offset on one side of the load cell. The op-amp input is then switched to the other side and a twelve bit DAC is used to measure the difference voltage. This program demonstrates how a probabilistic algorithm with single bit feedback can be used for measurement.I've also attached the circuit board files, but I don't have the board yet and don't know if it is functional or not.

author: azeeman
author_rank: Regular Contributor
timestamp: October 12, 2025, 10:48:30 pm
content: What you say is true in the analog domain, but not in the digital domain. If single bit feedback with a probabilistic algorithm is used then quantization error is more significant than noise. If an op-amp is used as a single bit null detector, once the differential input voltage is more than roughly 200 nV the output of the op-amp is going to be either at the positive or negative rail. Increasing the differential voltage will not push the op-amp output past the power supply voltage. As long as the voltage differential between the op-amp inputs is greater than the peak to peak noise, noise will have almost no influence on the op-amp output and the feedback signal.If the feedback quantization is less than the peak to peak noise, and the differential input voltage is also very low, than the noise will have an effect, but the feedback can only go up and down by its quantization value. If the peak to peak noise is 1 V and the quantization is 10 nV at every sample the odds of the input being 1 V or -1 V is 50%. If the DAC output slavishly follows the op-amp output, its probability of being 10 nV or -10 nV is also 50%. In effect, the noise amplitude is chopped off.If the noise is low enough in frequency such that multiple samples result in the op-amp output remaining in one state, then the feedback signal will follow, but at a much lower rate. The rate at which it follows is controlled by software and can be changed based on probabilistic rules. If the signal is known to be slow moving, then the feedback can also be programmed to be slow moving. If there is high certainty that the signal is fast moving in one direction or the other, the feedback can be changed the same way.Because the op-amp output is single bit it acts as a coin toss. If a coin is tossed 10 times in a row there are 2^10 or 1024 possible outcomes. Out of those outcomes only one is 10 heads and only one is 10 tails. The odds of getting the same output is 1 in 1024. Now toss the coin 32 times which gives 2^32 or over four billion possible outcomes. Out of those outcomes there is only one outcome with 32 heads in a row and only one outcome with 32 tails in a row. The odds are now one in 4 billion with only 32 samples.There is also another way to calculate signal certainty based on probability and that is by comparing the number of ones and zeros. As above, the all ones and all zeros are extremely low probability, but the probability changes very rapidly as the the ratio changes even slightly. A simple test of certainty is to weight a high as 1 and a low as -1 and then add the outputs over a fixed number such as 16 samples. If the sum is less than two or three, the certainty is quite high that there is very little DC in the signal. This can be used to determine when a null is complete. This is based on combinatorics where there is a count of all possible patterns containing different ratios of ones to zeros. The numbers blow up very quickly.https://www.mathsisfun.com/combinatorics/combinations-permutations.htmlThis is how digital computers work, once the signal to noise ratio is high enough and there is sufficient gain in the system, perfect signal replication is possible. I believe John Von Neumann was the first to study this, and once discovered, was used to design digital computers. Prior to that discovery all computers were analog.https://fab.cba.mit.edu/classes/865.18/replication/Pesavento.pdf

author: azeeman
author_rank: Regular Contributor
timestamp: October 13, 2025, 02:29:16 am
content: Instead of using an oscilloscope and multistage RC filter for measuring noise, a PC sound card along with Python and Numpy is great for signal analysis. Grab a ten second sample and frequency resolution down to 0.1 Hz is possible with 90 dB dynamic range. Grab an even longer sample and even higher resolution is possible.Signal amplitude should be less than 3 V peak to peak because clipping is not detected. I detect clipping by checking if any samples are at maximum amplitude, there is no other way of testing for clipping as far as I can tell.The phase match between left and right channels is extremely precise because of the digital ADC conversion and this makes it easy to create lock in amplifiers and I also use the sound card for my LCR meter. I use ALSA for setting the controls and Python subprocesses to capture the data using ALSA's command line interface. I tried using other Python sound applications, but they caused phase errors in the data. ALSA will capture a continuous stream using the 'arecord' command. The 'aplay' command can also be started in another subprocess to provide stimulus.It's also possible to capture up to four input channels at once although phase match between the two left-right pairs is not very good.This is a code snippet for reading a wave file using SciPy and NumPy.import os.path, sys, numpyimport scipy.io.wavfile as wavfiledef readWaveFile(filePath):# Only 8, 16 and 32 bit files are readable by SciPywith open(filePath, mode = 'r+b') as waveFile:sampleRate, waveData = wavfile.read(waveFile)# Normalize data so that range is -1.0 to 1.0 regardless of precisionif waveData.dtype == 'int16':fullScale = 2**16elif waveData.dtype == 'int32':# 24 bit data is stored as 32 bitsfullScale = 2**32waveData = (waveData.astype(numpy.float64) * 2 + 1) / (fullScale + 1)shape = waveData.shapeif len(shape) == 1:# Single channel of datastreams = else:# Multiple channels, deinterleave data by using transpositionstreams = waveData.Treturn streams, sampleRateCalculating an FFT is even easier.transformData = numpy.fft.rfft(stream)I don't recommend this technique for the casual user because working with ALSA is a real pain, but for a really cheap and high quality signal analyzer, the sound card can't be beat. I've developed the software tools and am happy to share them, but they aren't the easiest to use.

author: Smokey
author_rank: Super Contributor
timestamp: October 13, 2025, 03:34:45 am
content: What's wrong with using a sawtooth waveform and a comparator like back in the day?Or skip the arduino (! I know!) and use a real microcontroller with high resolution PWM?

author: MariuszD
author_rank: Regular Contributor
timestamp: October 13, 2025, 01:16:03 pm
content: Quote from: azeeman on October 12, 2025, 10:48:30 pmI suspect you'll want to connect this to some kind of analog system. Your algorithm will maintain the average value, but temporary fluctuations will pass thru to the output.For example, the microcontroller will light up an LED, the 5V bus voltage will drop by a few millivolts, which will change the capacitor charging rate and alter the duty cycle by a fraction of a percent. If the noise is significant, the algorithm will need some time to compensate for this error.Quote from: azeemanIn a real system, noise matters, because you don't have infinite time to average the results. The probability could be exactly 50%, but real observations may yield 60 results of -1 and 40 results of 1. This is a random process, the fact that there are two values won't eliminate the noise.Disturbances and noise will always be present, so the algorithm will always have something to correct. The greater the noise, the harder it will be to keep up with the setpoint, and the larger the deviations will be.In reality, noise from switching power supplies is also encountered. These are not random but periodic waveforms. If you choose the sampling frequency incorrectly, aliasing will occur. You can observe slowly changing disturbances that cannot be averaged out.

author: azeeman
author_rank: Regular Contributor
timestamp: October 13, 2025, 01:27:54 pm
content: To create a PWM with a 2.5 microsecond period and 20 bit resolution would require a clock frequency of 419 GHz. Not a lot of Arduinos work at that frequency.To understand what I'm trying to do, go back in history and see how some of the greatest physicists used to measure extremely low voltages.https://en.wikipedia.org/wiki/Mirror_galvanometerFor a more modern take on this technique, Marco Reps has a video on a 1960's take.They used DC nulling techniques. This later changed with the invention of the chopper, but although the chopper is much easier to use, it uses AC nulling which has unsolvable problems, particularly with noise.For DC nulling, noise is not a problem because it is purely an AC phenomenon. A low pass filter with a sufficiently low bandwidth can reduce noise to any arbitrary level. In the device shown by Marco Reps, the low pass filter is done by immersing the mirror in oil. The old timers would just enclose the galvanometer to prevent air currents from affecting it and rely on the inertia of the relatively heavy mirror and frictional losses in the string.AC nulling requires three variables to match, amplitude, frequency and phase. By using synchronous choppers, on the surface this looks easy to do, but there is one fatal flaw, noise cannot nulled out.Even worse, the noise at the input is amplified, filtered to some extent and then sent back to the input. It's impossible to predict the noise amplitude and therefore there will always be residual noise.With DC nulling, only the amplitude has to be nulled out. Noise is not a problem because it is AC and over time it averages to zero. If only pure DC is fed back to the input, nulling down to arbitrary levels is possible. This is how the 1960's device in Marco Reps video worked and was able to resolve parts per billion.With modern electronics its now easy to create electronically what was historically done mechanically. Before, to match two voltages using a galvanometer, a Kelvin-Varley divider was used.https://www.fluke.com/en-us/product/calibration-tools/electrical-calibration/electrical-standards/720aAn electronic equivalent of the Kelvin-Varley divider is the modern digital to analog converter, but these are only available to about 16 bits and are very expensive. The Kelvin-Varley divider works by cascading multiple voltage dividers each with a limited range such as 10:1. Stack enough of these dividers in series and resolution down to the parts per billion is possible. Combine with a mirror galvanometer which can have its input DC offset adjusted down to near zero and now its possible to make extremely high resolution measurements.The solution to generating high resolution using non precision potentiometers is well known, simply have a coarse adjustment potentiometer feeding into a fine adjustment potentiometer. For better resolution, add a mechanical feature to allow finer adjustment and it becomes possible to adjust to very high resolution. The coarse potentiometer can adjust to perhaps 1%. If the fine adjustment potentiometer's can also adjust to within 1% then adjustment to .001% is possible. Now add a third potentiometer and adjustment to .00001% is possible and so on down the line.The potentiometers don't have to be precision devices, they only have to be stable. The Kelvin-Varley divider has high output resistance and will have high thermal noise as a result. But this is not a problem because the noise doesn't have sufficient power to perceptively twist the galvanometer string. The noise will shake the string, but it will not put a permanent twist in it.To automate the nulling process, the potentiometers can be servo driven. This was done historically by using AC servos and was used for early computers. Curious Marc has several videos describing these techniques.Again, this is a very expensive solution and modern electronics can solve the problem. A multiplying DAC is essentially a servo controlled potentiometer. Unfortunately, it's not possible to cascade DACs because they generally have op-amp outputs which introduce offsets. What is possible is to attenuate the DAC outputs and combine them resistively. The inherent offsets are divided down and because resistors don't introduce offset, it becomes easy to generate arbitrarily low voltages. This effectively creates a servo driven Kelvin-Varley divider for very low cost.The mirror galvanometer is replaced by a CMOS op-amp which has extremely high input resistance and very high sensitivity. For example the MCP6002 has input current of +\- 1 pA.https://ww1.microchip.com/downloads/en/DeviceDoc/MCP6001-1R-1U-2-4-1-MHz-Low-Power-Op-Amp-DS20001733L.pdfIt does have significant input offset of -/-4.5 mV, but offset drift is only 2 uV per degree C. If the rate of change of chip temperature is kept low enough and the servo driven potentiometers are reasonably fast, it's very easy to null out the fixed offset of a few millivolts and then monitor and adjust for the drift.But what about the noise? Over a 0.1 Hz to 100 Hz frequency there is a possibility of up to 6.1 uV of peak noise. Although given as a frequency, this specification really means that over a 10 ms to 10 s interval, there will be noise spikes of up to 6.1 uV.This noise will have an effect only if the peak noise exceeds the differential voltage at the input of the op-amp. The DC differential gain of the op-amp is minimum of 88 dB or 25,000. This can be further amplified by feeding the output of one op-amp into another giving a total minimum gain of 631 billion. So if there is even a nanovolt of voltage difference after input offset is taken into account, the output of the op-amp will either be pinned maximum positive or maximum negative.It doesn't matter if the overall input difference is 1 nV or 5 V, the output will be pegged one way or the other. This is a mirror galvanometer on steroids, but with only a single bit output. The mirror is either pegged to the left or pegged to the right.This leaves two problems to solve, first the input offset has to be both statically and dynamically balanced. Static is very simple, just add in a fixed voltage to one input of the op-amp. Dynamic balancing is done by periodically switching the op-amp input to ground and then nulling it and saving the null voltage on a capacitor. Typically, AC nulling techniques are used which doesn't solve the noise problem and holding a voltage on a capacitor is also problematic.Instead if DC nulling is done using servo controlled potentiometers, the null voltage can be very stable. Also, buy running the servos very slow so they can only track offset drift while ignoring the AC noise, its possible to null down to very low levels. Remember, the input offset drift is only 2 uV per degree of temperature change. If the temperature changes at 1 degree per second, the null voltage only needs to change by 2 uV per second. It doesn't have to try and track each 6.1 uV noise pulse because over time these will always average to zero.If the servo potentiometer resolution is 100 nV, it has to change 2 uV/100 nV = 20 steps per second. Increase the resolution to 1 nV and now the servo has to change 2,000 steps per second. This is not difficult for a modern DAC.As shown above, DC null techniques have existed since the early days of electrical measurement and have been proven to work down to the parts per billion using mechanical devices. DC nulling has been supplanted by AC null techniques which have almost insurmountable noise problems at low levels, but are easy to implement using modern electronics.The trick is to implement DC null techniques using the ancient lore with modern electronics. This is where I stand right now. I've balanced op-amp input offset down to the uV levels using high resolution PWMs, but at the resolution required, the PWM filter settling times are incredibly long and its not possible to track drift or make timely measurements.By cascading DACs, I can easily generate low voltages with very high resolution. The only thing left is creating an algorithm to control the potentiometer servos using a single bit null detector. I think I have a working algorithm and I created a Python simulator to test it, which works well. But until I have a working printed circuit board and can test out the algorithm in real life, I can't be sure that the algorithm will work.I have used similar algorithms with PWMs for controlling precise currents and voltages and they worked well and showed very high noise tolerance, but are very slow and the voltage levels were in the millivolts and only static input offset compensation was used. The question is how well will servo controlled potentiometers work with both static and dynamic offset compensation at microvolt or nanovolt levels.DC nulling technology down to the nanovolt level is proven. Noise tolerance down to the nanovolt level is proven. The only thing left to prove is a single bit DC nulling algorithm using servo controlled potentiometers also known as digital to analog converters.

author: azeeman
author_rank: Regular Contributor
timestamp: October 13, 2025, 01:33:22 pm
content: Aliasing is a problem only when the interfering frequency is very close to the sampling frequency. Remember that sampling generates sum and difference frequencies. If the sampling frequency is 100 kHz and the system bandwidth is 1 Hz, only frequencies in the range of 99 kHz to 101 kHz will cause aliasing within the system bandwidth.Noise within the system bandwidth will also cause problems, but if the system bandwidth is very low, the noise within that bandwidth will also be very low.

author: azeeman
author_rank: Regular Contributor
timestamp: October 13, 2025, 01:51:14 pm
content: I'm creating a measurement system almost purely in the digital domain. The only analog components are the op-amp and DAC. The op-amp is acting as a single bit analog to digital converter and after that point everything is digital. The feedback value is derived digitally and then fed to the DAC and from the DAC to the op-amp input. There will be significant noise at the op-amp input, but there is no attempt to null out the noise, only the DC level. The reading is derived from the DAC setting which is determined digitally and is essentially noise free other than for quantization errors caused by the finite resolution of floating point numbers. With 64 bit computers, quantization noise is infinitesimal.At this point, philosophy intrudes. What is DC? To prove a voltage is DC requires an infinite amount of time which is obviously impractical. Instead, there has to be some time interval over which the voltage is measured. This determines the system bandwidth and in turn the probability of a noise event. If the interval is only 1 ns the likelihood of even 1 uV noise pulse is extremely low. If the time interval is centuries, there's a very high likelihood of lightning strikes, cosmic rays and any number of other noise sources.In the digital domain, noise is not a factor other than in dynamic memory where error correcting techniques are used.https://www.synopsys.com/articles/ecc-memory-error-correction.htmlThis is what Von Neumann proved, once something is in the digital domain, infinite perfect replication is possible.

author: MariuszD
author_rank: Regular Contributor
timestamp: October 13, 2025, 02:27:48 pm
content: QuoteCool things to read and watch, but it's hard to find practical applications in the 21st century. Beside, notice that in the original, some component had to be precise. A precise divider and an inaccurate but sensitive zero indicator were used. I don't see a single precision component in your system.QuoteIt matters whether you have 1nV or 5V. Electronic components have 1/f noise. Nanovolts AC probably can be measured with a lock-in amplifier, but not in DC. The thermoelectric voltage generated at the junction of two different metals is at the microvolt level.QuoteUse higher-order filters and make sure the filter's cutoff frequency is much lower than the PWM frequency.QuoteIf the interference is produced by a switching power supply operating at 50kHz (period of 20us) and you sample every 200.001us, you will also observe aliasing. even tho the frequencies are not close. Pay attention to the harmonics.

author: azeeman
author_rank: Regular Contributor
timestamp: October 13, 2025, 04:45:21 pm
content: Precision is not required when determining a null which is what the low precision components are doing. If measuring the difference between 10.00001 and 10.000011, how precise does the difference voltage measurement need to be? What's important is resolution to be able to detect the .000001 difference. An error in the difference measurement of even 10% is not a problem.Of course, precision is required, but because of expense, it must be used only where necessary. The nulling can be low precision, but the final measurement must be done with a high precision reference and high precision voltage divider. The null detection is only one component, but a very important component, of a measuring system.As for aliasing, harmonics are important, but by definition, harmonics are multiples of the fundamental frequency and if the inherent system bandwidth is low, the energy in the harmonics will be negligible because of significant losses at higher frequencies.As for the PWM filter, to eliminate offset issues only passive filters can be used because active, higher order filters will introduce DC offsets and noise. Also, for 20 bit resolution and high speed voltage generation, the filter response will still be far too slow unless the filter is realized using digital techniques. It's also difficult to create very high order filters without using high precision and high cost parts. The goal is to use cheap digital electronics and software as much as possible to keep costs as low as possible. This is a challenging intellectual problem which ideally should require very little expense to engage in finding a solution. I don't care if the result is useless or not, I'm far more interested in the process than the product.The current state of the art is the sigma-delta technique which is an engineering marvel, but is much more a marketing success. A so called 24 bit ADC as used in a sound card has only about 14 bits of usable resolution. For what it's designed for, it is truly a work of art, but it doesn't match the CD standard of 16 bits of resolution.The problem is that the algorithm is fundamentally based on analog techniques with filtering limited to about four poles. It's like looking for buried treasure by first using shovels and then upgrading to hydraulic excavators to dig the hole deeper and faster. It's still the same hole. Instead, try digging somewhere else and take advantage of the tools that the digital domain provides.Of course there's not as well a developed mathematical foundation for probabilistic feedback techniques as there is for analog techniques, but that makes the problem more interesting.Faraday was probably the most prolific physicist in terms of discoveries, but it required Maxwell to build the mathematical foundations for Faraday's discoveries because Faraday had limited mathematical skillshttps://www.gutenberg.org/ebooks/65735.Maxwell's work also languished because his original formulas were far too complex to be useful and it was up to Oliver Heavyside to distill Maxwell's work into a more usable form.https://en.wikipedia.org/wiki/Oliver_Heavyside.My belief is that by trying a completely different technique it may be possible to come up with a new direction of research and start digging holes in lots of new places instead of trying to dig the same hole a little bit deeper. I'm certain there are lots of people on this forum with with those type of skills. Unfortunately, I'm not one of them, but I can still participate and stir up some trouble.

author: azeeman
author_rank: Regular Contributor
timestamp: October 13, 2025, 07:27:25 pm
content: I forgot to mention one more way to combat noise. Instead of a two state solution, a three state solution is also possible. One state is to increase the DAC output when it is certain that the output is low. A second state is to decrease the DAC output when it is certain that the output is high and the third state is do nothing and keep the DAC output unchanged when the uncertainty is too high to make a decision.The main problem with this method is output paralysis in that the DAC setting will null at the point where uncertainty reaches a threshold. This point can be above or below the null point. The DAC output will be perfectly stable and for a lot of applications where very high resolution is not required this could be sufficient. In practice this will be in the microvolt range consistent with typical op-amp noise specifications.This is also why AC nulling cannot reach ultra low levels, when uncertainty gets too high, measurement is not possible without long averaging to increase certainty. If volatile memory like a capacitor is used to hold the feedback voltage, the long term averaging is not possible. By using digital techniques, memory becomes non-volatile and an offset voltage can be held and tested over long periods of time to gain certainty that the voltage is correct. Sigma-delta converters exploit this method by using digital integration and filtering. The main drawback with sigma-delta is that the feedback voltage generation method is extremely noisy requiring extensive filtering.Noise can be moved up to higher frequencies by maximizing the number of transitions in the feedback signal which pushes more energy into the higher harmonics. To test the effectiveness of this, I tested the harmonic energy of a single transition PWM signal with a signal made with the maximum possible number of transitions for the same DC level. This shifted a lot of energy to the higher harmonics, but the loss of energy in the lowest harmonics was only about 3 dB. There is some process gain but at quite an expense.I think the reason that a lot of audiophiles prefer analog type media is because even though there are a lot of poseurs, there are also many who actually have golden ears and can easily distinguish between digital quantization noise caused by low bit conversion of a typical digital audio player and the more random analog type noise caused by the media such as vinyl records.