Sine wave generation

Ian0

Joined Aug 7, 2020
4,119
Presumably, at 625Hz, you will be using a custom-made transformer.
Drive the transformer primary directly with the PWM pulse-train - you'll need some form of power driver - a MOSFET gate-driver IC might do the job (it depends on your supply voltage)
Then measure the leakage inductance referred to the secondary (short out the primary and measure the inductance at the secondary terminals).
Then use the transformer as the filter by connecting a capacitor across the secondary
\(C= \frac{1}{(2 \pi f)^2 L_{leak}}\)
where f is the cutoff frequency of the filter.
Choose
\(f=\sqrt{f_{PWM}\cdot f_{out}}\)
because there's nothing happening at that frequency, so changes in the output load which affect the Q won't excite the LC resonance.
If it's a custom transformer, you can get it made with just the right amount of leakage inductance.
 

Thread Starter

bug13

Joined Feb 13, 2012
2,002
Presumably, at 625Hz, you will be using a custom-made transformer.
Drive the transformer primary directly with the PWM pulse-train - you'll need some form of power driver - a MOSFET gate-driver IC might do the job (it depends on your supply voltage)
Then measure the leakage inductance referred to the secondary (short out the primary and measure the inductance at the secondary terminals).
Then use the transformer as the filter by connecting a capacitor across the secondary
\(C= \frac{1}{(2 \pi f)^2 L_{leak}}\)
where f is the cutoff frequency of the filter.
Choose
\(f=\sqrt{f_{PWM}\cdot f_{out}}\)
because there's nothing happening at that frequency, so changes in the output load which affect the Q won't excite the LC resonance.
If it's a custom transformer, you can get it made with just the right amount of leakage inductance.
Oooops, that's outside my analog knowledge. I sort of understand what you mean by using the transformer as filter, and MOSFET gate-driver stuff. But that's about it.

Is there a way to calculate an ideal transformers leakage inductance so I can simulate it on LTSpice? I googled, but all they talk about are how to MEASURE it, not calculate it.

Edit:
Base on my experience of dc/dc converter, I got a feeling that for this low frequency, my output cap need to be very very very big to filter out to make it looks like a sine wave?
 
Last edited:

Ian0

Joined Aug 7, 2020
4,119
Is there a way to calculate an ideal transformers leakage inductance so I can simulate it on LTSpice? I googled, but all they talk about are how to MEASURE it, not calculate it.
Unfortunately not. I can take a guess at what it would be for a split-bobbin mains transformer, but that's no help to you!
It's very much geometry dependent.
(if I assume correctly) you'll be using a custom transformer to do 625Hz, as I can't think of much off-the-shelf that would do that efficiently and not cost a fortune, I don't think I could hazard a guess.
Base on my experience of dc/dc converter, I got a feeling that for this low frequency, my output cap need to be very very very big to filter out to make it looks like a sine wave?
The technique is used extensively on pure sinewave inverters. For a 3kW inverter the -3dB frequency of the filter is 900Hz and the capacitor is around 3.3uF. You will have a higher frequency, so that would make it smaller, but a lower voltage, with fewer transformer turns so that would tend to make it bigger. I'd guess it would be around a microfarad.
You haven't even said what the output voltage will be!
It's probably worth pursuing, because it's efficient and requires very few components, but it does require a bit of transformer knowledge.
DC-DC converters tend to have rather less inductance on the output, so rather more capacitance.
 

Thread Starter

bug13

Joined Feb 13, 2012
2,002
You haven't even said what the output voltage will be!
5V is what I am aiming for.
It's probably worth pursuing, because it's efficient and requires very few components, but it does require a bit of transformer knowledge.
Unfortunately, transformer knowledge is what I don't have. (I do know a bit magnetic stuff, left hand rules and right hand rules something basic)
 

MrChips

Joined Oct 2, 2009
25,036
Let's assume that you have selected a PIC16F15243, datasheet.

PIC16F152xx family has ADC, PWM but no DAC.

Here is something I would try but have not done before. I would implement a 1-bit delta modulation algorithm. All it takes is one digital output pin and one analog input pin.

The output pin goes to an op-amp integrator circuit. The ADC reads the voltage output of the integrator.
The software has a sine wave in a look-up table and loops through each entry of the table. Each value is compared with the ADC reading. The GPIO pin is set high or low in order to reduce the error.

1626402082584.png

The alternative is to go the PWM route which does not need the ADC feedback.
 

Thread Starter

bug13

Joined Feb 13, 2012
2,002
Let's assume that you have selected a PIC16F15243, datasheet.

PIC16F152xx family has ADC, PWM but no DAC.

Here is something I would try but have not done before. I would implement a 1-bit delta modulation algorithm. All it takes is one digital output pin and one analog input pin.

The output pin goes to an op-amp integrator circuit. The ADC reads the voltage output of the integrator.
The software has a sine wave in a look-up table and loops through each entry of the table. Each value is compared with the ADC reading. The GPIO pin is set high or low in order to reduce the error.

View attachment 243675

The alternative is to go the PWM route which does not need the ADC feedback.
What's the advantage of this over DDS with PWM DAC? I can see it doesn't need a PWM, but require a fast ADC I guess.
 

MrChips

Joined Oct 2, 2009
25,036
I don't have an answer.

One solution uses ADC module. It does not have to be fast. 625Hz is slow, 1.6ms period. 16 samples per cycle requires a sample every 100μs which is slow for an ADC.

The other solution uses PWM module.
 

Thread Starter

bug13

Joined Feb 13, 2012
2,002
I don't have an answer.

One solution uses ADC module. It does not have to be fast. 625Hz is slow, 1.6ms period. 16 samples per cycle requires a sample every 100μs which is a slow for an ADC.

The other solution uses PWM module.
It will be handy if I don't have a PWM module and ADC only
 

Ian0

Joined Aug 7, 2020
4,119
Unfortunately, transformer knowledge is what I don't have. (I do know a bit magnetic stuff, left hand rules and right hand rules something basic)
If you need an output transformer, then you're going to have to acquire some transformer knowledge anyway, because it's a weird frequency, whatever method you use to generate the sinewave.
 

Thread Starter

bug13

Joined Feb 13, 2012
2,002
If you need an output transformer, then you're going to have to acquire some transformer knowledge anyway, because it's a weird frequency, whatever method you use to generate the sinewave.
Yes you are correct, I guess I will have no choice.
 

Ian0

Joined Aug 7, 2020
4,119
I would implement a 1-bit delta modulation algorithm.
If you calculate the waveform beforehand and store it in memory, you can output it using the SPI peripheral. Some will even do 16 bits at a time.
Unfortunately, it needs quite a bit more data than storing PCM for the PWM to output, but it can be handy if you have SPI but not PWM and memory isn't at a premium.
 

Ian0

Joined Aug 7, 2020
4,119
Yes you are correct, I guess I will have no choice.
I found a couple of transformers in the shed, both were 18V output, so I worked it back to 5V
#1 was a Novotem Telema 10VA toroid - It had a leakage inductance of 150uH. That's too small - it needs 47uF on the output.
#2 was a Vigortronix split-bobbin 3VA mains transformer. That worked out at 1mH - that needs 2.2uF and it is about perfect.
It had a frequency response up to 8kHz - it won't be efficient at 625Hz, but it will work.
You'll need the next size up for 5Watts output.
Now your problem is the primary voltage! As you probably won't be driving it with 230V (or even 115V), you'll have to have one made, but it can probably be done with stock parts.

By the way - is this thing you are making battery powered?
 

Deleted member 115935

Joined Dec 31, 1969
0
That is way too powerful for what I need :)
At that price, ( USD 20 )
its cheaper than less powerfull boards,
unless you are using your own PIC chip,
and the development is much easier as it has the systems already around it.

just a thought,
 

dcbingaman

Joined Jun 30, 2021
505
I am not sure, that's the spec I was given. I am guessing it's a transformer isolated output, the input side of the transformer need to be constantly changing for the transformer to work the best?
How much of a load is on the transformer? You will need to drive the transformer sufficiently based on the load. What peak to peak voltage do you want? Also, for transformer make sure you have no DC offset. I think after you send it through the LPF you will need to send it also through a HPF with cutoff of say 10Hz so the transformer does not see any DC offset, which will driver more current into the transformer. What is the DC resistance of the transformer?
 
Top