I am writing in this group to seek some help with sending PWM signal to Arudino over serial via Simulink
Problem description :
I am working on a personal project which involves building closed loop PID control loop, where I need to send PWM signals to fan, in order to control the position of a ball at a fixed height. The feedback signal is generated via a USB camera, which detects the position of the ball.
Since Arduino can't process the image, I am running my model in Simulink and sending the signal via serial to Arduino. But, the signal somehow doesn't reach or gets processed by the board.
Here is a step by step information on the process I followed to test debug
1. I upload a serial recieve model on the Arduino. It probes the serial port for the data. Once data is found, it is routed to the pin 9 as shown in the image
2. In the simulink environment, to debug, I configured a serial send port (from instrument control toolbox) to transfer the desired PWM signal. However, this does not work. I tried debugging the pin 9, but no Voltage signal was received.
3. In the model above, I added a serial recieve block from the instrument control toolbox. This somehow slowed down the simulation. Each time step was being executed with some delay, but the PWM signals were getting transferred. The blower speed could be changed in accordance with the PWM signal. However this method is too slow for my control loop to work with
Can someone please help me point out the possible error that I am making. I am very curious to find a workaround