To run the code two external libraries are needed. How the parts will be assembled is shown in the next pictures. All information how the parts should be printed is written on Thingiverse. If you don’t have a 3D Printer please feel free to build a similar frame of wood or something else. To get all needed electrical componens i recomend a arduino starter kit like this: In the next section, I will show you how the test rig is assembled, how the sensor works and how we implement a PID controller in the Arduino.Īll parts of the frame are 3D printed and can be downloaded here: voltage = P * error + I * Integral(error)+ D * Derivative (error).įor a much better description of the PID controller please take a look at Wiki The whole PID controller is given by the equation This can help if the system tends to oscillate. By applying this part to the controller it is possible to add damping to the system. The derivative of the error indicates how fast it changes. Therefore this part of the controller is well to handle situations where the error is small but over a long period of time. To integrate the error over time means to calculate the sum over time. The PID controller also takes into account the integral (I) and the derivative (D) of the error. This is a so-called P controller since the control value (voltage) is proportional to the error wich is (Setpoint-rpm). If "rpm" is smaller than "Setpoint" the voltage has to be higher and if "rpm" is higher than "Setpoint" the voltage has to be lower. Since we know that an increase of the voltage results in an increase of the actual speed the solution can look like this. Now we have to think about how it is possible that the actual speed becomes the target speed. After this, we can define the target speed which we call "Setpoint". Let us do this in rounds per minute and we call this value "rpm". If we want to control the speed of a DC motor the first we have to do is measure the actual speed. Everyone who ever drives a bicycle knows this. In the case of a changing slope, the voltage also has to be changed to guarantee constant speed. If for example, the voltage of a DC engine of an electric car is constant the velocity will also be constant as long as no mountain appears. This is true, but the problem is that the voltage does not define the speed. So if I want to increase the speed I just have to increase the voltage. Maybe you think that this is not a big deal since the speed of a DC engine can be influenced by the voltage. The main idea behind this project is to control the rotational speed of a DC motor by using a PID controller.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |