Need to generate two complementery spwm with carrier frequency of 25khz and modulation frequency of 50hz also two pwm such that one pwm is active during positive half cycle on second is active during negative half cycle there is also some dead time between the two spwm.
Also the spwm is a function of analog input that to read the Dc voltage to regulate the output voltage. By using esp32_wroom32
Thanks for letting us know. Sounds like a challenging project. Do you have a question?
What about the project can you do it
on what hardware?
What percent of modulation does your project require? And is it amplitude modulation, frequency modulation or phase modulation?
No, it's your project. Post the code you have along with schematics, along with information requested by @gcjr and @Paul_KD7HB.
is the spwm 25kHz carrier a triangular wave?
use a AD9833_DDS_Waveform_Generator to generate the triangular wave modulate it using a digital potentiometer?
i had never heard of SPWM
a google search provide the image below which looks like a PWM added to a 4-level (-2, -1, 0, 1) base analog level. Another image and description desribed it as PWM signal added to a sinusoidal power line voltage. It would be interesting to learn more
it's not clear to me what the OP is describing. Is it a 25 kHz sinusoid on top of a 50 Hz sinusoid plus a PWM or is it a PWM on top of a 25 kHz sinusoid with 2 different PWM signals, one every 10 msec with a gap in between, occuring 50 times a sec (i.e. 50 Hz)
is the PWM relatively constant during each half cycle and what is its frequency?
is the processor intended to generate the output signal or is it synchronized to the 25 kHz and just generates the PWM which is added to the 15 kHz carrier
i'm curious how it's demodulated
not doing the ‘project’ for you
10s google search
now go and adjust it as per your requirement.
good luck!
My need to generate two complementery spwm positive half cycle on one pin and negative half cycle on second pin with carrier frequency of 25khz and modulation frequency of 50hz also two pwm has frequency of 50hz and duty cycle of 50% one pwm is active during positive half cycle and second pwm is is active during negative half cycle there is also dead time between the spwm and the modulation of duty cycle for the purpose to regulate output voltage
Yes my requirement is four signals generating two spwm and two pwm the pwm has frequency of 50hz and duty cycle of 50% and the spwm has carrier frequency of 25khz and modulation frequency of 50hz such that one pwm is active during positive half cycle and second pwm is active during negative half cycle also the spwm is a function of analog input to regulate output voltage and some dead time between the spwm
this is mostly a repeat of what you've already posted.
would you mind specifically addressing by questions/guesses from post #8?
does this mean the PWM frequency is 50 Hz?
if the PWM duty cycle is always 50% , what information does it carry?
what does this mean? the 25 kHz is modulated by 50Hz as illustrated below?
Yes definitely according to the wave form
Thanks but I am using esp32
it's not clear what you're trying to do?
can you provide an example of the waveform?
Yes need Amplitude modulation
Then you need to include an amplifier with a variable gain that is controlled by your modulation signal.
ESP32 using a AD9833_DDS_Waveform_Generator to generate the triangular wave modulated using a X9C103S digital potentiometer
// ESP32 AD9833 DDS module and a X9C103S Digital Potentiometer
// 20 kHz carrier modulated at 50Hz
// note: output of AD9833 DDS requires a capacitor to X9C103S input to give +/- sine wave
// AD9833 library https://github.com/MajicDesigns/MD_AD9833
// X9C103S library https://github.com/minhaj6/DigiPotX9Cxxx/tree/main
#include <SPI.h>
#include <MD_AD9833.h>
#include <DigiPotX9Cxxx.h>
// ESP32 pins for X9C103S Digital Potentiometer
DigiPot pot(16, 17, 15); // INC, U/D and CS
// ESP32 AD9833 DDS IC Pins for SPI
#define DATA 19 ///< SPI MOSI AD9833 SDATA pin
#define CLK 18 ///< SPI SCK AD9833 SCLK Clock pin
#define FSYNC 5 ///< SPI SS AD9833 FSYNC Load pin
MD_AD9833 AD(DATA, CLK, FSYNC); // AD9833 setup SPI pins
// Sine LookUpTable & Index Variable for 50Hz modulation
uint8_t SampleIdx = 0;
const uint8_t sineLookupTable[] = {
128, 136, 143, 151, 159, 167, 174, 182,
189, 196, 202, 209, 215, 220, 226, 231,
235, 239, 243, 246, 249, 251, 253, 254,
255, 255, 255, 254, 253, 251, 249, 246,
243, 239, 235, 231, 226, 220, 215, 209,
202, 196, 189, 182, 174, 167, 159, 151,
143, 136, 128, 119, 112, 104, 96, 88,
81, 73, 66, 59, 53, 46, 40, 35,
29, 24, 20, 16, 12, 9, 6, 4,
2, 1, 0, 0, 0, 1, 2, 4,
6, 9, 12, 16, 20, 24, 29, 35,
40, 46, 53, 59, 66, 73, 81, 88,
96, 104, 112, 119
};
void setup() {
Serial.begin(115200);
pinMode(4, OUTPUT);
// start the AD9833 20kHz carrier
AD.begin();
// MD_AD9833::MODE_OFF MD_AD9833::MODE_SINE MD_AD9833::MODE_TRIANGLE MD_AD9833::MODE_SQUARE1
AD.setMode(MD_AD9833::MODE_TRIANGLE);
AD.setFrequency(MD_AD9833::CHAN_0, 20000.0f); // 20KHz sine wave
}
// loop modulating 20kHz carried with 50Hz
void loop() {
pot.set(25 + sineLookupTable[SampleIdx++] * 10/100);//75 / 255); // X9C103S modulate
digitalWrite(4, LOW); // scope trig signal
yield();
if (SampleIdx >= sizeof(sineLookupTable)) { // reset to start of lookup table?
SampleIdx = 0;
digitalWrite(4, HIGH); // scope trig signal
}
// ESP32 delay 100uS 83Hz 50uS 130Hz 20uS 217Hz 10uS 325Hz (bit distorted)
delayMicroseconds(185); // 50Hz modulation
}
20kHz carrier
modulated output





