File Exchange

image thumbnail

Raspberry Pi DC Motor H-Bridge Driver Block SFunction

version 1.1 (19.2 KB) by

DC Motor Driver Block using Soft PWM of WiringPi Library

29 Downloads

Updated

View License

Editor's Note: This file was selected as MATLAB Central Pick of the Week

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:

http://minseg.webs.com/downloads

A complete Arduino library and curriculum is available here:
http://minseg.com/pages/downloads

Other driver blocks on the way:
- Quadrature encoder
- MPU6050

Stay tuned!

This development is part of the Mechatronics curriculum at Rensselaer Polytechnic University

Comments and Ratings (7)

Murat Belge

@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.

Marco

Marco (view profile)

Hi Joshua,

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'
"gcc" -I"

[...blablabla...]

 fatal error: /home/pi/wiringPi/wiringPi/gertboard.h: No such file or directory

What am I missing?

Thanks,

Marco

Leo

Leo (view profile)

James - did you press build in the s-function windows?

James

James (view profile)

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.

Updates

1.1

updated links

MATLAB Release
MATLAB 8.1 (R2013a)
Acknowledgements

Inspired by: Device Drivers

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video