Generating SPWM using arduino-simulink environment

1 reply · 3K views · last reply
srinaath
Messages
51
Reaction score
2
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 as shown belowhttps://www.physicsforums.com/file:///C:\Users\ccbzak\AppData\Local\Temp\msohtmlclip1\01\clip_image001.png I checked the output of Arduino pin11 from CRO and it was working fine….

Now I used this blocks to generate spwm…

https://www.physicsforums.com/file:///C:\Users\ccbzak\AppData\Local\Temp\msohtmlclip1\01\clip_image002.png

When I checked the output from CRO…..it was distorted…literally I didn’t get any SPWM wave…

Help me out with problem…

My Simulink configurations are

Solver: fixed step size

Step size:1e-5

Triangle wave frequency is 8KHz and sine wave is 50Hz…
 
Last edited by a moderator:
Simulink block diagram: Repeating Sequence and Sine Wave sources feed a Relational Operator, which drives an ARDUINO Digital Output block for Pin 11; a Mux also feeds a Scope1 display.

Simulink block diagram: a Pulse Generator block connected by an arrow to an ARDUINO Digital Output block set to Pin 11.