Motor Driver Block using Soft PWM of WiringPi Library.
This block controls both the magnitude and direction of a DC motor with an H-bridge such as the DRV8833 or the SN754410 using Soft PWM of the WiringPi library.
The reference zero speed is set with high voltage at both motor terminals (both PWM signals at full duty cycle). For the DRV8833 driver this creates a highly linear response and eliminates the typical dead band around zero speed. This increases motor response but may have a larger power draw (this has not been measured).
More information can be found at our website, along with other device drivers:
A complete Arduino library and curriculum is available here:
Other driver blocks on the way:
- Quadrature encoder
This development is part of the Mechatronics curriculum at Rensselaer Polytechnic University
Joshua Hurst (2021). Raspberry Pi DC Motor H-Bridge Driver Block SFunction (https://www.mathworks.com/matlabcentral/fileexchange/41528-raspberry-pi-dc-motor-h-bridge-driver-block-sfunction), MATLAB Central File Exchange. Retrieved .
@Marco: The H-bridge driver is looking for an installation of wiringPi library under /home/pi/wiringPi directory. The wiringPi installation has been moved to /opt/wiringPi directory in the latest Linux image for Raspberry Pi. Create a symbolic link to /opt/wiringPi library by executing the following on your Raspberry Pi:
# ln -s /opt/wiringPi /home/pi/wiringPi
This should resolve the build issue.
when I try to download the model to raspberry I receive this error:
The call to realtime_make_rtw_hook, during the after_make hook generated the following error:
Error executing SSH command: make: Entering directory `/home/pi/DC_Motor_Driver_Block_RPi_rtt'
fatal error: /home/pi/wiringPi/wiringPi/gertboard.h: No such file or directory
What am I missing?
James - did you press build in the s-function windows?
I receive the following error when I try to run the Simulink model:
Error in S-function 'DC_Motor_Driver_Block_RPi/Volts To RPi PWM 754410 or DRV8833 PWM High is zero speed/Include WiringPi Libraries': S-Function 'Include_WiringPi' does not exist
I am using R2013b and applied the bug fix that is described in the Device Drivers article by Giampero Campa. Thanks in advance for your help.
Just what I have been searching for. Good job.
Inspired by: Device Drivers
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!