Using electronic sensors to control motors using matlab/simulink; possible?

7 views (last 30 days)
Hey, got a general question regarding MATLAB and/or simulink which I'm hoping someone here will be able to help me with. (I'll say here I THINK I know the answer from reading the help files and web searches but I'm planning to make it the basis of my 3rd year project at University and so kind of need a clear cut answer, hence I've come here in the hopes that someone might be anble to decyper what I mean and help me).
One of the troubles I'm having (in terms of trying to find an answer) is trying to explain it in a short, simple way, so I'll give a short example of a problem I would like to know if MATLAB could work in;
Let's say I have a bath. Now I put a thermal sensor in the bath to give me (via a computer) the real time temperature of the bath water. Now I could sit there and manually turn the hot and cold taps on and off as and when the temperature reading from my thermal sensor goes above or below what I want it to be. However that's a lot of work, so I install a motor on each tap which can be controlled by my computer. So now I can remotely monitor and control the temperature. However I want to know if I could create say an m-file that say every second (it doesn't have to be a set time though; just regularly) takes a 'sample' from that continuous thermal reading and runs it through a function which then calculates how much cold and/or hot water should be released into the bath. It does this until I stop it (or in future perhaps there's another sensor which measures the volume of the bath water and if it reaches the full limit it stops the program and shuts the taps).
So broken down the things I'd like to know if matlab can do is; 1 - Take data from an external source in real time 2 - Use that data to calculate an output 3 - Output that data to an external source for use (by say a motor, etc.) in real time
Would this be doable? If so would I do it via a m-file or would I make a simulink model (or perhaps both; I read something about having an s-file which appears to be basically an m-file but in a simulink model).
Sorry I'm not able to be more clear, and also if it's an obvious problem, as I say I have tried finding an answer myself but haven't found anything that gives me a firm answer either way.
Help, as always, is much appretiated and I'd be happy to answer any follow up questions.

Accepted Answer

Albert Yam
Albert Yam on 13 Jul 2012
  1 Comment
Stephen
Stephen on 13 Jul 2012
Very helpful, thank you :)
Now that I know it's possible I can seriously consider using the general idea as the basis of my project. Just have to work out how hard it would be to do what I wanted to do! :D
Thanks again!

Sign in to comment.

More Answers (0)

Communities

More Answers in the  Power Electronics Control

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!