File Exchange

image thumbnail

Speed Control of a DC Motor

version 1.1 (17.5 KB) by

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



View License

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.

Comments and Ratings (2)

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



Updated the zip file.

MATLAB Release
MATLAB 7.5 (R2007b)

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

» Watch video

Win prizes and improve your MATLAB skills

Play today