4.0
4.0 | 3 ratings Rate this file 57 Downloads (last 30 days) File Size: 19.2 KB File ID: #41528 Version: 1.1
image thumbnail

Raspberry Pi DC Motor H-Bridge Driver Block SFunction

by

 

29 Apr 2013 (Updated )

DC Motor Driver Block using Soft PWM of WiringPi Library

Editor's Notes:

This file was selected as MATLAB Central Pick of the Week

| Watch this File

File Information
Description

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

Acknowledgements

Device Drivers inspired this file.

Required Products Simulink
Target Support Package
MATLAB
MATLAB release MATLAB 8.1 (R2013a)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (7)
17 May 2015 Arnaud Villeneuve  
16 Apr 2015 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.

Comment only
09 Jul 2014 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

Comment only
06 Apr 2014 Leo

Leo (view profile)

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

Comment only
26 Mar 2014 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.

Comment only
03 Jul 2013 Paul Kassebaum  
10 May 2013 Michael Lundgren

Just what I have been searching for. Good job.

Updates
22 Aug 2014 1.1

updated links

Contact us