View License

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

» Watch video

Highlights from
Speed Control of a DC Motor

Be the first to rate this file! 22 Downloads (last 30 days) File Size: 17.5 KB File ID: #27889 Version: 1.1
image thumbnail

Speed Control of a DC Motor



13 Jun 2010 (Updated )

MATLAB GUI for real-time speed control of a DC motor.

| Watch this File

File Information

The goal of this assignment was to develop a Speed control system for a DC motor. Various control methods were to be employed, both open loop and closed loop. All control methodologies are implemented using MATLAB GUI. The important feature of the system is the auto-calibrate function which provides the capability to calibrate the system at three different levels depending on the desired level of accuracy and recommend whether to use the calibration or not based on the statistics of fit. In closed loop control, on-off, differential, proportional, proportional-plus-differential and proportional-plus-integral-plus-differential are implemented. The system also has a feature to run a diagnostics in order to assess its state of health. A monitoring feature which employs a webcam to monitor the fan by the user is also present. This can be of importance in remote operation of the motor. In addition, the system also provides the feature of data logging both for calibration and for controls.

Required Products Curve Fitting Toolbox
Instrument Control Toolbox
MATLAB release MATLAB 7.5 (R2007b)
Other requirements Hardware setup, Basic Stamp Editor
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (1)
27 Mar 2011 fremond khoo

i really need some help over here..i have connected and run my stepper motor but how come i cannot control the speed of my motor?..can someone give me some hints?

below are my coding:

function text_speed_m1_Callback(hObject, eventdata, handles) sliderValue = get(handles.text_speed_m1,'String');

%convert from string to number if possible, otherwise returns empty sliderValue = str2nm(sliderValue);

%if user inputs something is not a number, or if the input is less than 0 %or greater than 100, then the slider value defaults to 0 if (isempty(sliderValue) sliderValue < 0 sliderValue > 256) set(handles.slider_speed_m1,'Value',0); set(handles.text_speed_m1,'String','0'); else set(handles.slider_speed_m1,'Value',sliderValue); end

% --- Executes during object creation, after setting all properties. function text_speed_m1_CreateFcn(hObject, eventdata, handles) if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end

% --- Executes on slider movement. function slider_speed_m1_Callback(hObject, eventdata, handles) sliderValue = get(handles.slider_speed_m1,'Value');

%puts the slider value into the edit text component set(handles.text_speed_m1,'String', num2str(sliderValue)); % Update handles structure guidata(hObject, handles);

% --- Executes on button press in pushbutton_speed_m1. function pushbutton_speed_m1_Callback(hObject, eventdata, handles) obj1 = instrfind('Type','serial','Port','COM8','Tag','');

if isempty(obj1) obj1 = serial('COM8'); else fclose(obj1); obj1 = obj1(1) end

fopen(obj1); sv2 = get(handles.text_speed_m1,'String'); fprintf(obj1,'%s','rs') fprintf(obj1,int2str(get(hObject,'Value')));

please give me some hints on what i do wrong..really need help now..thanks

Comment only
15 Jun 2010 1.1

Updated the zip file.

Contact us