hi all......am trying to generate sinusoidal pulse width modulation using arduino-simulink for my inverter board....I simulated the SPWM logic in simulink, then installed the required support package for arduino-simulink.....but i am facing some problems......I started from basic...like linking arduino and PWM block.. I checked the output of Arduino pin11 from CRO and it was working fine…. Now I compared sinusoidal and triangular wave in simulink and connected the outout to arduino bloack When I checked the output from CRO…..it was distorted…literally I didn’t get any SPWM wave… Help me out with this problem… My Simulink configurations are Solver: fixed step size Step size:1e-5 Triangle wave frequency is 8KHz and sine wave is 50Hz…

I'd think that you should not expect high speed from such a configuration. Every output change must be transmitted to the Arduino (what baudrate?) and decoded there, before an output can be changed. Perhaps your triangle frequency is too high, so that changes get lost?

What happens when you reduce the triangle frequency?

hi....i got the required output... i changed the sampling time of MATLAB...but am not getting the required frequency.. i mean desired frequency is 50Hz but the output spwm frequency is varying from 40 to 80 Hz in DSO

DSO? Of course the output frequency must be higher than 50Hz, with the duty cycle forming the sine wave. You'll see the sine when you add a RC low pass filter to the output.

You can calculate the time intervals of the output signal, using the 8kHz triangle and 50Hz sine (320 intervals). Then copy that array into an Arduino sketch, and let the Arduino generate the signal.

how to change the simulink time of matlab . i also got the same problem.