Send pulses from Simulink to the Arduino PWM pins | applied electronics engineering

Latest

Send pulses from Simulink to the Arduino PWM pins

By Applied Electronics - Friday, February 24, 2017 No Comments
As you perhaps know you can co-simulate Arduino with Simulink. By connecting various blocks in the simulink such as sine wave, square wave, mathematical operators and so on to arduino hardware blocks such as PWM output blocks or digital output blocks or input blocks we can perform signal analysis, send various kinds of signals to the arduino hardware. We showed earlier how to do Arduino Simulink Digital Input example.

In this arduino simulink tutorial, we wanted to show how to send signal like pulses from Simulink to the Arduino PWM pins. By sending pulses from simulink a LED connected to the Arduino board will blink at the rate specified by the sample time in the pulse generator in the simulink. On the hardware side, we connect a LED to the PWM pin 5. Note that the pin is grounded using 220Ohm resistor. Below is the hardware setup picture.



Now in simulink we use the pulse generator block from the simulink sources library and use the PWM block.

Send pulses from Simulink to the Arduino PWM pins

In this setup, the pin 5 PWM pin on the Arduino board was used. The PWM block is available in the common section or Simulink Support for Arduino Hardware.


Also we have connected a Scope to view the output from the Pulse Generator. The following shows the pulses sent to the Arduino.


Now by connecting the Arduino board to the computer and running simulation you should see the LED blinking on and off. The pulses were sent from simulink to the Arduino.

So in this way you can send pulses from simulink to the Arduino PWM pins. See also other arduino tutorials-

No Comment to " Send pulses from Simulink to the Arduino PWM pins "