need advice on servo response

Discussion in 'The Projects Forum' started by Preety, Aug 12, 2014.

  1. Preety

    Thread Starter Member

    Apr 14, 2014
    41
    0
    hello! i am doing a closed loop control whereby i need to adjust a servo position with respect to a very rapidly varying sensor output. i have tried averaging the sensor output over a few samples and also using a low pass filter but even then the servo does not respond. any idea how to proceed in such cases please?
     
  2. MikeML

    AAC Fanatic!

    Oct 2, 2009
    5,450
    1,066
    Can you post a diagram of your setup with some relevant waveforms...
     
  3. Preety

    Thread Starter Member

    Apr 14, 2014
    41
    0
    hi. yes i have attached a very simple drawing of the set-up. the latter consists of a vertical stand to which there is a rc servo motor clamped. a rectangular piece of perspex is mounted on the servo and the purpose is to actuate the servo to a specific position with reference to the strain gauge reading. a waveform of the strain gauge amplifier output is attached and the problem is that the latter keeps deflection in both direction very quickly before the servo can respond. i have tried averaging the readings for 20 samples but nothing.
     
    Last edited: Aug 12, 2014
  4. MikeML

    AAC Fanatic!

    Oct 2, 2009
    5,450
    1,066
    So the servo is unstable (oscillating), where the rc servo motor is constantly being driven on either side (bigger angle, lesser angle) of the desired final position?

    Frankly, I am not surprised that this is unstable.

    Have you tried to write the equations that describe the strain in the arm vs the angular position of the arm?

    Have you considered the mass of the perspex plate mounted on the end of the arm?
     
    Last edited: Aug 12, 2014
  5. Preety

    Thread Starter Member

    Apr 14, 2014
    41
    0
    well the mass of the perspex plate is very small for the servo and i am trying to do the control through pid which is an integrated function in the controller i am using.
     
  6. Alec_t

    AAC Fanatic!

    Sep 17, 2013
    5,801
    1,105
    If you have a fan blowing air onto the perspex strip the turbulence created will cause oscillations of the strip, hence oscillation in the strain gauge output. Exactly what are you intending to measure with the gauge, and what is the purpose of the servo?
     
  7. djsfantasi

    AAC Fanatic!

    Apr 11, 2010
    2,809
    834
    And what are you using as a servo controller? How is the output of the strain gauge translated into the pulse width of the 50Hz control signal? Do you have a schematic you can post?

    Also, what are the specs for the servo you are using? What servo is it? Perhaps the servo speed is not fast enough for your application.
     
    Last edited: Aug 13, 2014
  8. Preety

    Thread Starter Member

    Apr 14, 2014
    41
    0
    this set-up is just to simulate a case of wind turbulence on a model wind turbine blade and to pitch the blade with reference to the readings from strain gauges positioned on the blade. i am using the rc servo mg1501.
     
  9. djsfantasi

    AAC Fanatic!

    Apr 11, 2010
    2,809
    834
    And how do you translate the strain gauges into the RC servo control signal?
     
  10. Preety

    Thread Starter Member

    Apr 14, 2014
    41
    0
    i am using a microprocessor to read the signals and based on the limits set the servo is actuated.
     
  11. djsfantasi

    AAC Fanatic!

    Apr 11, 2010
    2,809
    834
    I don't know how to say this, but I'll try. I appreciate that you're answering my questions, but I guess I was hoping for a little more detail. What microcontroller? Are you controlling the servo directly with your code or are you using a servo library? Does the servo control work in a standalone program? Are your strain gauge read routines tested and working properly. Where do you think the process is breaking down and why? How do you know the servos are not doing what you think they've been told? Did you check the MG 1501 datasheet to see if they can respond as fast as you expect (as requested earlier)?
     
  12. Preety

    Thread Starter Member

    Apr 14, 2014
    41
    0
    I apologise for the too brief answers. i am using the mbed NXP 1768 as microcontroller. i am controlling the servo directly from the codes and at present the latter just include reading the strains and writing the position of the servo accordingly. no other process is being performed within the codes. unfortunately the servo response time is not available from the datasheet.
     
  13. djsfantasi

    AAC Fanatic!

    Apr 11, 2010
    2,809
    834
    Can you post you code (use the code tags; click on the # icon)? Perhaps there is a problem in the code when writing the servo position.

    The datasheet states that the servo will take 2.7ms to move 1° at 4.8v and no load. See the datasheet. Look at operating speed. So if the changes you are attempting to capture are less than 2.7ms in length, you may not be successful.

    As I had suggested, I'd break this into smaller problems to ensure that the major components of your device are operating. Test the sensors and code independently and test servo movement separately.
     
  14. Alec_t

    AAC Fanatic!

    Sep 17, 2013
    5,801
    1,105
    Limited research, and guesses as to your strip thickness and airflow speed, suggest strip vibration as a result of vortex shedding could be at a frequency of tens or hundreds of Hz. Have you 'scoped the sensor output to find the frequency? I don't see any way you could get a servo to move fast enough to follow the vibration. If it's your aim to move the servo to minimise vibration, then IMO you could use a precision peak detector on the sensor output and use the peak value to adjust servo position.
     
  15. Preety

    Thread Starter Member

    Apr 14, 2014
    41
    0
    i am sure the codes are working since i tested them without the fan and by creating some deflections by hand. i understand that the fluctuations are too fast for the servo but i needed any idea which can allow me average the readings or sort of. any idea how all this is controlled in real wind turbines?
     
  16. Alec_t

    AAC Fanatic!

    Sep 17, 2013
    5,801
    1,105
    I don't think you want to average the readings; rather, a better measure of the amount of vibration would be the peak-to-peak or RMS value of the readings.
     
  17. Preety

    Thread Starter Member

    Apr 14, 2014
    41
    0
    Hello. Thanks for the reply. Please can i have further information about the two solutions suggested? do you mean that i add it to my codes to perform the rms or peak to peak value of the readings?
     
  18. Alec_t

    AAC Fanatic!

    Sep 17, 2013
    5,801
    1,105
    Yes. I'm no programmer, but I wouldn't think much code would be needed.
     
  19. Kermit2

    AAC Fanatic!

    Feb 5, 2010
    3,791
    945
    a form of peak holding circuit that could deliver a steady dc value to your micro based on the average strain of deflection. Drive the servo in steps and then compare old memory values of dc level with those generated by new servo position, to decide in logic whether the new position has increased or decreased average strain value. The servo must be restrained in its response to the turbulent fluctuations. The mechanical response is not capable of following the changes in real-time. A servo response in the 10 to 20 Hz range should be achievable.
     
  20. strantor

    AAC Fanatic!

    Oct 3, 2010
    4,302
    1,988
    You might consider ditching the PID in favor of a simpler Proportional-only control. PID is great for responding to predictable systems but less effective for systems with random dynamics. After all, PID is meant to "predict the future" and respond before it happens, and if the future is ever changing, you must make your PID constants into variables which are in some way tied to the cause/effect of the change.

    For example, an injection mold machine die block has a specific thermal mass and therefore a specific latent heat. By applying full heat and observing the ΔT, we can derive PID constants that will be extremely effective in always bringing our die block to the exact temp we desire with zero overshoot. However, if we radically alter the mass of the die block or ambient conditions, we may see lagging or overshooting, and we will need to figure out new PID constants. If the die block is to (for some strange reason) be regularly alternated from being submerged in ice water and then thrust into a furnace while in operation, then we could install a thermocouple to sense ambient temperature and factor this back into the PID as a variable instead of a constant, and we could (maybe) get it to behave predictably despite the ambient conditions.

    For your situation, I don't think you can explain or measure the reason for your random feedback, so factoring it back into your PID is going to be an exercise in futility. And choosing NOT to factor it in at all, well, you see how well that works. So in my eyes, PID is out the window for you. And the next best thing is proportional control, which acts solely on the proportion of position error, instantaneously. So it will likely oscillate badly, as your feedback oscillates badly, but at least it will do something.

    As you have seen, averaging the value of the feedback results in reaction to time-late data. perhaps it would be acceptable with proportional-only control. or if not, I would try Kermit's advice (with proportional control).
     
Loading...