# Help with waveform control: frequency, phase and amplitude

artis
Hello, I am looking for a controller whether programmable or otherwise that could function as a drive and control circuit which would monitor a transformer output connected to a load and then drive an amplifier with a signal that is proportional to the needed one in order to control the output accordingly.

The idea is as follows, I set in certain parameters in the controller, like for example
1)waveform= sine
2) phase angle between U and I = 0
3) amplitude =100v
4)frequency = 50hz

Then the controller inputs a signal that is proportional to this (except for voltage ofcourse) into the amplifier and the amplifier drives a transformer , the output of the transformer is connected to a load , the controller monitors this output and tries to keep the output to match the parameters that I have set for the controller, if some parameters start to deviate from the setpoint then the controller adjusts the amplifier input accordingly until given parameters are again restored.
I suppose that in order to attain good stability the controller sample rate would have to be high enough so that the changes don't start oscillations etc

I have attached a block diagram of my envisioned setup,
could you please give me any ideas in which direction to look for such circuits and IC's or maybe there is already a product on the market that does exactly this?

PS. maybe the amplifier could be a class D amp without the analog input and the controller could drive it directly with a high frequency modulated signal which would be demodulated by the transformer in the output to get a sine of lower frequency?

Staff Emeritus
It's not clear what you are trying to control. Is is just amplitude, or amplitude and frequency and waveform and phase? If you watch both U and I at the output, what is the load applied to the output of this device?

Would you describe this device as a signal generator?

You ask about components to buy, but in good design it is best to be 100% clear on what you are trying to accomplish before asking the question "how to do it?"

sophiecentaur
It seems you are building a high power calibrator, and want to eliminate the gain and phase error of the power amplifier while output load changes.
What range of frequency does it need to cover ?

To correct the phase you need a master phase reference input signal. Then use a Phase Locked Loop to adjust the input oscillator frequency, so output phase is corrected.
What are the U and I signals ?

To correct the amplitude you will need an output amplitude detector and integrator, or a true RMS circuit to provide an estimate of the output. Compare that estimate with the required output and change the amplitude of the source, or the gain of the amplifier to correct the error.

sprog

Hi, since your system is both generating and also monitoring signals I would suggest that you look in the direction of digital signal processing. There are many processors to choose from but I think that you should look for some 'canned' solutions that are pretty much all in one chip or board.
Check out Analog Devices Sigma Studio for such. Also, a company called miniDSP supplies premade modules that offer a wide variety of features like signal generation, filtering, integration etc. These are intended for audio applications so the bandwidth is up to 20kHz, I imagine that your requirements would be in the frequency range spanned by audio so this is a good place to start looking.

Last edited by a moderator:
artis
The idea is mostly to have a power source with which I can test different inductive/reactive loads across a frequency range but at the same time keep my output constant in amplitude, phase shift etc.

For example let's just say that I want precisely 100v in my output at 50hz and phase shift should be 0, now let's say I drive a resistive load with my output and then suddenly switch on an inductive load parallel to my resistive one , ideally I would want for my output to have as little of a "hiccup" as possible while at the same time the output should adjust so that the set initial conditions are met.

Surely I could do this by hand adjusting frequency generator and function generator outputs which would be the amplifier inputs but that takes time and is inconvenient it would be much better if I could have a DSP chip or something similar which would do all this for me.

@anorlunda well you could label it as a signal generator (if one accepts that a signal generator can also output powerful signals)

@Baluncore the frequency range I would probably need to divide into categories where one would have 1-20kHz and then another device for higher frequencies but the essential function is the same so we might as well for now just cover 1-20/25Khz.

Could it be that what @sprog said is the best way to look for? because as far as I know these days such functions should be available in microprocessors and Ic's aka ready plug n play boards or one that I could make myself although I guess due to the smd components and complexity in making boards for chips (I have mostly made larger ones for discrete components) it would be more convenient to buy a ready solution and adapt it to my needs.

I guess for simplicity I would love to start this with using a simple AB amplifier and maybe later move on to class D, so I guess I would need the controller then to put out the signal in analog forms , in class D I imagined that maybe there could be a controller that could put out the waveform already modulated and so I could bypass the amplifiers input analog to digital converter but I guess having an AB amp and analog signal would be easier for starters.

Anyway as I said I need not just voltage/amplitude adjustment I also need frequency and phase shift control capability, otherwise the phase shift would change with load at output and so would frequency a little and probably voltage amplitude also.
The only thing I don't need to worry about is current as that would be determined by the load given a constant voltage/frequency and phase shift is maintained.

artis
In theory I could do without the transformer at the amplifier output but it serves mostly two purposes, firstly as a safety device for the amplifier/load and also mostly as an impedance matching and voltage step up device, because many loads require higher voltages and building an amplifier that works in high volt DC rails makes the amplifier more likely to fail as well as the choice for parts like output transistors becomes harder as most transistor SOA is limited to about 200/250volts. (for bipolar ones)

In class D case maybe I could use high voltage switches like IGBT's but then I'm not sure about how "clean" the output to my load would be and would it not have to have complicated filtering in order to not have harmonics at the output.

Anyway the amplifier part is not a problem I have built many amp modules over the years an d just have to chose a better suited one, my main concern is with the signal control capability aka the controller as I don't have such a thing and for now am not sure where/how to get one

artis
ps. could there be any software based solutions for this out there, maybe for starters I could make a resistor voltage divider to decrease the output signal to a safe level and then feed it into a pc sound card , then have the software analyze the signal. compare it to my set values and adjust the output signal as necessary then I simply feed the output of my pc sound card to my amplifier input ?

@sprog I'm looking at the sigma studio now , will have to read up a bit

sprog
I think Sigma Studio could work very well for your intent, the power stage would be all that is required. On real-time audio DSP systems there is frequently an I2S output port - this can be connected to a class-D audio amplifier module, there are a number of manufactureres of pre made amplifiers. The output transformer can be used to obtain the right output voltage range for your application

sprog
A p.c. based solution is also possible but you would need to write signal processing code in that environment. There are some PC based tools worth looking at in that regard, like audiomulch that might work, but it's been a long time since I used any of that stuff.

Staff Emeritus
Don't forget the phase difference between voltage and current is determined by the load, not the supply. If you switch out a resistor and switch in an inductor at constant voltage phase, then the current shifts by 90 degrees.

Klystron and zoki85
As anorlunda explained, a calibrator must be set to regulate either current or voltage output.

You are building a “calibrator” similar to a Fluke model 5100, or 5200, but have not specified the precision you require.

artis
@anorlunda yes correct in pointing that out, I should have specified aka made more clear that the intention of the feedback is not to stop phase shift as that cannot be entirely done since it is determined by the physical characteristics of load but instead watch the output of the amplifier and adjust accordingly , sort of similar to how a grid connected power plant would do , say the inductive load in the grid becomes too large so the grid operator switches on capacitor banks to adjust or vice versa switching on shunt reactors to adjust for a current leading voltage situation.

Although unlike in a grid here I could shape the output with the help of my input waveform in the amplifier, like if the output is getting very inductive and current lags voltage then I could shape the input waveform accordingly to compensate , as far as I know this should be doable , right?

Staff Emeritus
Although unlike in a grid here I could shape the output with the help of my input waveform in the amplifier, like if the output is getting very inductive and current lags voltage then I could shape the input waveform accordingly to compensate , as far as I know this should be doable , right?
Your descriptions still confuse me. That sounds like you are trying to make a power grid simulator. @Baluncore thinks you are trying to create a calibrator. But both interpretations presume sinusoidal waveforms, not arbitrary waveforms.

Perhaps we have a language problem. What do you mean by "shape the waveform?"

artis
Well it's not exactly a grid simulator , it's simply an amplifier with a controllable output.
just to give an example, say I want to build a small ferrite transformer for high frequency, I want to test it's capability and see the optimum frequency etc, I hook it up to this device and just sweep across a certain frequency range and load the transformer and watch it's performance on a scope.

Sure I could just get myself a frequency generator and connect it with my amplifier but the output voltage amplitude would change across a wider frequency range as well as I would love to have the capability to also generate sawtooth or square waves so i guess I need a function generator but then there is just one more problem , ok I have the frequency and waveform capability but how to I make the output stable in amplitude over a wide frequency range.

I'm certain all this is possible I'm just thinking how and which is the optimal option in terms of price/usability.
I think right now I'm looking at either a software solution or a programmable microcontroller , something like an arduino or something

Staff Emeritus
You haven't mentioned yet the power needed. Cost will be strongly a function of that. Also the range of V I and frequency needed.

Edit and the size of your budget.

Take a look at a FeelTech FY3200S (arbitrary) function generator, which costs less than $100. Use that to drive a power amplifier, attenuate the output and feed it back to the front-end error amplifier. You might think you really need something, and will paralysed without it, but most of the time a little creativity will eliminate the problem. artis @anorlunda I think I've mentioned but just in case , for start I would want 1hz-25kHz for this I have some amplifiers to choose from so that doesn't factor in the budget, the power in this case would be limited by the capabilities of my amplifier so let's just say something along 1kW, The voltage would be defined by the transformer , ofcourse I can control the voltage within a certain range with the amplifier so in any case I will make the transformer ratio such that I can achieve anything from a few volts to about 230v at my output. The maximum available current I would need to calculate from the maximum amplifier output and transformer turns ratio but I haven't done that at the moment. I think 5-10A depending on the voltage would be reasonable. But as I said it's not so much about the maximum power available etc as that is just a matter of amplifier/transformer but more about how to control the output which is the hard part, so I'm mainly focused at that, at first I would use a 100w amp board that I have and once I would be able to control all the necessary parameters then I would think about higher power. my budget is rather tight now, couple hundred bucks no more. @Baluncore well as far as I've looked I only see the input on that generator used as frequency counter, you say it's also a feedback error amp to correct it's own output? sprog Check out LabVIEW Science Advisor Gold Member Just thought I'd throw this out there, but most quality signal generators control the output level by some type of feedback. They sample the output and compare it against a reference. A dumbed down way to describe it would be as a glorified opamp. eq1 for start I would want 1hz-25kHz the power in this case ... so let's just say something along 1kW, my budget is rather tight now, couple hundred bucks no more. I think you're looking to build a programmable AC power source. Something like what Chroma sells, no? https://www.chromausa.com/product/low-power-programmable-ac-source-61600/ Chroma is mostly interested in emulating wall outlets, and their various non-idealities & faults, so I don't think they have anything that matches your specs. A supply able to track a 25KHz reference while sourcing 1KW for low$100s is going to be a tough project.
If you can pull it off then you should sell it. I know people who would buy it.
And what's going to power your amplifier? You might want to plan on a good amount of PSRR. :)

Maybe you can find a used AC power source on Ebay or something.

If it were me, and I had to do something custom, I would probably start with a PFC controller IC (like LT3798), and see if I could modify the default application by clever use of the Vin_sense and FB pins. That would be a pretty cheap way to go but it won't achieve tracking from REF->Vout @ 25KHz.

Please do let us know what you come up with. I'd be very interested in the solution.

well as far as I've looked I only see the input on that generator used as frequency counter, you say it's also a feedback error amp to correct it's own output?
No. The unloaded output of the signal generator is correct.
A power amplifier will have an error amplifier at it's input. You do not need a transformer in your power amplifier if you use a half bridge digital output.

artis

@eq1 Well why do you think the power is the main difficulty here ? In theory I can have any power as long as the amplifier used and it's power supply can handle it, I think the difficulty is to have the ability to hold a certain waveform within a certain amplitude and frequency and hold those steady so that is the reason I am thinking about the possible control circuitry.

The Chroma device you linked to seems like something similar to what I am trying to do, only I am not sure whether it has the capability to control the waveform and switch between sine and square etc.

In what way?
You need to ask specific questions that identify the field you do not understand.

artis
you post wasn't so long as for me to be more specific , is the half bridge you referred to meant to be the amplifier output stage topology? also as for the error amplifier were you talking about the signal generator input ?

is the half bridge you referred to meant to be the amplifier output stage topology?
Yes.
also as for the error amplifier were you talking about the signal generator input ?
No.
An accurate power amplifier will be built like an op-amp, with an error amplifier that compares the input with the attenuated output.

hutchphd
artis
Well then I would need two feedbacks, one built into the amplifier that compares the amp output with the input and the other being a more "global" feedback comparing the power going into my load with the waveform coming out of my function generator into my amplifier.

I think having an amplifier with opamp in it's input is not a big deal and can be done easily.

Well then I would need two feedbacks, one built into the amplifier that compares the amp output with the input and the other being a more "global" feedback comparing the power going into my load with the waveform coming out of my function generator into my amplifier.
Why do you need to make it so complex with extra global feedback. You need to source a voltage waveform, rarely a current waveform. The power will be decided by the load.
I think having an amplifier with opamp in it's input is not a big deal and can be done easily.
It may be new to you, but the error amplifier is part of the negative feedback used to linearise power amplifiers. It is done all the time. The important thing is to make sure it does not cause instability.

Gold Member
@artis It may be a bit late in the thread but, as this is supposed to be about Engineering, it would be a good idea to specify and discuss the actual nature of this Load. Why would one want to control the Power Supply waveform and would Voltage or Current control be the better strategy? What is the device - or is this just a vague thought experiment which has been seized by the PF pack and chased all round the forest of ideas?
Until the actual requirement (with numbers!) is specified, there is no answer, however much fun we may be having with the question. We've each been answer our own version of the question, so far.

hutchphd
artis
@sophiecentaur a bit skeptical and critical as usual , welcome :)

Well the idea is as I said to have a power supply with which I can load different devices with a variable amplitude/frequency waveform , say I want to test the performance of an smps transformer or in another case to attach a induction heater coil and drive about 22kHz through it and heat up a pipe etc.
Building a separate supply for each case is time consuming and I see no problem why I couldn't just have a capable amplifier hooked up to a function generator and do the same and to have a great deal of tuning margin.
I was only worried about the feedback and control capability because obviously the output amplitude and frequency will change with different loads and even on the same load with change in frequency so I need a way to regulate these things like for example to keep the amplitude constant while frequency is increased where I would need to increase voltage etc.

I could do this by hand but having a control board do this is much better

Gold Member
...obviously the output amplitude and frequency will change with different loads and even on the same load with change in frequency...
Maybe I'm not getting this, but just how do you expect the load to be able to change the frequency of your function generator?

Homework Helper
2022 Award
Also never be too hasty to go down the digital path. Analog could be cheaper and easier.

For completeness I mention Mr Hewlett's wonderful master's thesis invention with the nonlinear (light bulb) feedback.

https://people.ohio.edu/postr/bapix/HP200CD.htm

For harmonic waveforms at least, an oscilloscope and a knob to turn is often a good solution

Klystron
artis
pardon , @Averagesupernova I meant that with changing frequency the output amplitude will vary with different loads and even with the same load.

Gold Member
@sophiecentaur a bit skeptical and critical as usual , welcome :)

Only critical about the lack of real direction in the thread. It seems to me that the OP is after a box with two terminals (or more?) that will provide any required volts and current to suit any load that may be chosen. Is not the normal approach for the 'consumer' appliance to present a load that can be fed from a general purpose Power Supply (usually a nominal constant Voltage)? The internal power regulator would expect to do the 'clever stuff' to deal with the peculiar requirements of any devices that it feeds inside the box. To invent the sort of device that the OP seems to be after would be needlessly hard and would be sure to fall short in some way. It would be like the marvellous medicines that are advertised on the net to sort out your arthritis, impotence, shortness of breath and dyspepsia, all in the same bottle. But you would still need another bottle to deal with your sore throat or piles. One job, done properly and efficiently, is surely the essence of good design.

Gold Member
It seems to me that the OP is after a box with two terminals (or more?) that will provide any required volts and current to suit any load that may be chosen.
It seems that way. Design experience teaches that there are trade-offs in the real world. Convenience of use and max number of applications possible do not generally occur simultaneously.

artis
you know when I come to think of it I actually just need voltage (amplitude) and phase shift feedback, because after all i am using an amplifier as my source not a mechanical generator where an increase in load results in a slight decrease in rpm/frequency which then needs to be adjusted for , in my case as long as the amplifier supply power doesn't sag my frequency should stay constant and as set by the amplifier input signal, at least I think so...?

So basically depending on the load output voltage will change , current will be then determined by the load and also will be phase shift so if I can keep voltage constant and compensate for phase shift if it gets too large then I think I'm okay.

So the logic goes like this. I set a fixed frequency and the feedback control maintains fixed voltage at that frequency , if I set a new frequency value the frequency rises and the feedback then sets the voltage again or adjusts it given that my voltage value isn't changed.