• Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

How to implement a physical control system? Full description below.

Thread starter #1
Good evening people from Electro-Tech-Online.com:

This is my first post here, I'm Marco and I'm a mechatronics engineering student. Today I would like to detail my issue on how to implement a control system in real life:

To begin with, I would like to mention an example that many beginners in control work with: the ball and beam system. I have to say at first that this is a classic example since it allows students basic concepts of control (e.g. designing PID controllers, studying frequency response, analyzing stability, among others). Its schematic appears in the image below:

Ball and beam system
This is the website that I took the example from:
The site takes an approach on working with it: modelling (i.e. finding the dynamic equations and its representations in transfer function and state space form), open-loop response, closed-loop control in MATLAB (i.e. PID controller design, root locus, frequency response, et cetera), and analyzing the block diagram as well as studying open-loop and closed-loop response in Simulink.

Now I want to implement it. Build something similar like this:
I've seen many people using elements like an Arduino board and an ultrasonic sensor that feeds the output to the Arduino, as well as a servomotor that acts as input. The thing is on how do they relate the transfer functions (or state space) to the actual physical system? I wonder this since there can be other elements with complex behaviors like h-bridges, motor drivers, filters, et cetera that were not modeled in the schematic. How do they model that? What if instead of an ultrasonic sensor they used an LVDT or a capacitive sensor to measure distance, how do they model that if it was not on the schematic that I have previously shown? Would that change the maths?. What are the steps that as an engineer one must take in order to implement closed loop control on a real system? I know that the PID control is being run as code on the Arduino board (it could also be implemented using opamps or any other microcontroller).

I say this because the ball and beam system is not the only dynamic system, there are many other systems to control like the inverted pendulum, servovalves, planar mechanisms (e.g. robotic manipulators), liquid level systems, or many many others. Obviously the materials involved would change, but how to relate the maths of MATLAB and Simulink to real life? I wonder this because there are plenty of documentation in the internet yet they never go on the building of the real example (i.e. they just work with MATLAB and Simulink) and I don't want just to copy others' ideas on how to implement the system (what if I didn't have an ultrasonic sensor and instead I had to use other type like an encoder or something similar?). I would appreciate your answers, thanks.

PD. I know that the basic structure of a closed-loop system is:
The controller would be the Arduino, the plant is the ball and beam system (including motor), the feedback elements would be the ultrasonic sensor and the error detector would be part of the Arduino. Where do other elements like signal conditioning circuit for the sensor, the h bridge (or any other driver) of the motor fit in?
 
Last edited:

dknguyen

Well-Known Member
#2
The controller would be the Arduino, the plant is the ball and beam system (including motor), the feedback elements would be the ultrasonic sensor and the error detector would be part of the Arduino. Where do other elements like signal conditioning circuit for the sensor, the h bridge (or any other driver) of the motor fit in?
The plant includes anything "that does the thing" that you're trying to do. So the h-bridge is part of the plant along with the motor.

The feedback is anything that lets you measure what you're doing so the sensors and signal conditioning are part of that.

The controller is everything that does the decision making and control.

The thing is on how do they relate the transfer functions (or state space) to the actual physical system?
From what I remember in my control classes, the way you relate the physical system to state space is with all the equations and free-body diagram stuff you learn from your mechanical courses. After you have those you stick them into state space form.


How do they model that? What if instead of an ultrasonic sensor they used an LVDT or a capacitive sensor to measure distance, how do they model that if it was not on the schematic that I have previously shown? Would that change the maths?. What are the steps that as an engineer one must take in order to implement closed loop control on a real system? I know that the PID control is being run as code on the Arduino board (it could also be implemented using opamps or any other microcontroller).
Welcome to real life. You don't model every aspect in a system or else you would run out of time investigating every aspect of every sub-system, run out of computing power, or mathematical tools. Remember that it's a MODEL, not the actual thing. All models make simplifications, assumptions, and neglect certain factors.

If you linearize anywhere in your model? Bam. You just made an assumption. Are you planning to just ignore the flex in the ball or beams? Are you going to measure and take into account the friction of the joints? I doubt it. More assumptions.

In other cases, you use lumped models where you don't really care what the H-bridge does or what the motor does independently. All you really care about is how they work together. You don't need to know how fast the H-bridge's output can respond to an input and then how fast the motor can respond to the H-bridge's output. All you really need to know is how fast the motor will respond to an input on the H-bridge.

Do you really care about the response of the sensor element alone? Do you really care about the response of the signal conditioning circuit on it's own? What about the front-end of the signal conditioning circuit? What about the back end? You probably don't care about any of these things. What you really care about is how the output of the amplifier responds to a change at the sensor element when two are connected together. So you apply an impulse or step input to the sensor element and record the response at the amplifier output and ignore all the details in between.

Just think of a model bridge compared to a real bridge. The model bridge isn't just a tiny version of the real bridge. It's simpler but representative.

Such an assumption might be that you just assume the sensor feedback is fast enough compared to the system response so you can just ignore the fact its speed is finite.

Has your class done any lab work yet? The only time I ever needed to actually do this was in my lab for one of my controls courses and I didn't really know what was going on at the time (and I guess I still don't), but one thing I remember was we were just told a bunch of random-ass numbers and variables we just ignored in the equations which I now understand were assumptions and simplifications.

A huge problem is actually having the means to measure all the required variables. It might be an even bigger problem than actually coming up with the equations. The mass and dimensions of the ball might be easy. The moment of inertia of the beams a bit trickier but still doable. But the speed, response, and bandwidth of the servo? In my lab, I think I remember they just told us to assume the servo (which on its own is servo is a motor with a driver and a control circuit too) was infinitely fast because it was fast enough for our purposes that we could ignore how slow it was. That's why a lot of PID tuning boils down to a carefully controlled trial-and-error procedure to narrow in on the desired result without having the system go haywire. It takes too much time and effort to actually come up with a model even though that would let you get an optimized response, but the model isn't much use unless you can measure the necessary system parameters.
 
Last edited:

MrAl

Well-Known Member
Most Helpful Member
#3
Good evening people from Electro-Tech-Online.com:

This is my first post here, I'm Marco and I'm a mechatronics engineering student. Today I would like to detail my issue on how to implement a control system in real life:

To begin with, I would like to mention an example that many beginners in control work with: the ball and beam system. I have to say at first that this is a classic example since it allows students basic concepts of control (e.g. designing PID controllers, studying frequency response, analyzing stability, among others). Its schematic appears in the image below:

Ball and beam system
This is the website that I took the example from:
The site takes an approach on working with it: modelling (i.e. finding the dynamic equations and its representations in transfer function and state space form), open-loop response, closed-loop control in MATLAB (i.e. PID controller design, root locus, frequency response, et cetera), and analyzing the block diagram as well as studying open-loop and closed-loop response in Simulink.

Now I want to implement it. Build something similar like this:
I've seen many people using elements like an Arduino board and an ultrasonic sensor that feeds the output to the Arduino, as well as a servomotor that acts as input. The thing is on how do they relate the transfer functions (or state space) to the actual physical system? I wonder this since there can be other elements with complex behaviors like h-bridges, motor drivers, filters, et cetera that were not modeled in the schematic. How do they model that? What if instead of an ultrasonic sensor they used an LVDT or a capacitive sensor to measure distance, how do they model that if it was not on the schematic that I have previously shown? Would that change the maths?. What are the steps that as an engineer one must take in order to implement closed loop control on a real system? I know that the PID control is being run as code on the Arduino board (it could also be implemented using opamps or any other microcontroller).

I say this because the ball and beam system is not the only dynamic system, there are many other systems to control like the inverted pendulum, servovalves, planar mechanisms (e.g. robotic manipulators), liquid level systems, or many many others. Obviously the materials involved would change, but how to relate the maths of MATLAB and Simulink to real life? I wonder this because there are plenty of documentation in the internet yet they never go on the building of the real example (i.e. they just work with MATLAB and Simulink) and I don't want just to copy others' ideas on how to implement the system (what if I didn't have an ultrasonic sensor and instead I had to use other type like an encoder or something similar?). I would appreciate your answers, thanks.

PD. I know that the basic structure of a closed-loop system is:
The controller would be the Arduino, the plant is the ball and beam system (including motor), the feedback elements would be the ultrasonic sensor and the error detector would be part of the Arduino. Where do other elements like signal conditioning circuit for the sensor, the h bridge (or any other driver) of the motor fit in?

Hello there,

Based on the questions i am seeing here i would suggest starting with a simpler problem first and learning about how to approach that problem first. For example, a cart on a railroad track with an inverted pendulum mounted to it. How do you control the motion of the cart back and forth. That is a classic problem in control theory and is simpler than the problem at hand. I would not doubt it if a complete description could be found online somewhere.
 

Latest threads

EE World Online Articles

Loading

 
Top