Hot answers tagged

7 votes
Accepted

Frequent ON OFF in SSR

You need to implement hysteresis. Set two temperature points around set_temp. One a little higher to be a limit for turning the heater off and a one a little lower then set_temp to turn the heater on. ...
  • 17k
3 votes
Accepted

Can removing lines of code destroy a motor driver and make it catch fire?

It all depends on how the circuit works and how it is controlled. A basic H-bridge looks like this: Normally you have one MOSFET from each side turned on and one turned off - so for example Q1 and ...
  • 104k
3 votes

How to calibrate a PID?

Gidday! First response as a new member. PID control is not an easy subject to grasp for starters but here is a link to a site that does explain it: http://www.csimn.com/CSI_pages/PIDforDummies.html ...
3 votes
Accepted

What is the proper way to implement PID?

Each unique variable you want control over should have a single pid loop, and each loop should only ever stretch across one "order" of time. For example, to control the craft's roll rate, you should ...
  • 4,360
3 votes
Accepted

How does the PID controller actually work?

I, also, didn't get the idea behind PID from just reading Wikipedia. After some videos/tutorials, I believe the best way to explain it is: What is PID PID is an algorithm. It involves three factors ...
  • 2,702
3 votes

How does the PID controller actually work?

How a PID controller works depends on the particular implementation. There is a algorithm/library for PID on the Arduino: http://playground.arduino.cc/Code/PIDLibrary and an excellent explanation of ...
  • 2,322
3 votes
Accepted

Speed control of BLDC with an integrated controller (Hall out, PWM in)

This is only a partial answer, about measuring pulse period or duration. For best accuracy, I would recommend using the “input capture” feature of a 16-bit timer. This is not as easy as using pulseIn()...
  • 39.2k
3 votes
Accepted

Arduino timer interrupts for PID

Just use a single 1ms timer interrupt and count them. Every 10 interrupts do both things. void interruptHandler() { counter++; // do things that happen every 1ms if(counter == 10) { //...
  • 2,627
2 votes
Accepted

Is there any realy working setup for multicopter with codes

I've not used the (unmaintained) code you reference, but if a PID is responding much too fast in a new system, cut the parameters down significantly, first focusing on P and later I. Turn off the D, ...
  • 2,322
2 votes
Accepted

Regulation of the temperature using PID

A PID only has one input and one output. In your case, the input will be the temperature. The use of the arduino would be to process the raw data of the temperature sensor and relay the temperature to ...
  • 146
2 votes

MPU 6050 stuck on same values

Let's deconstruct this down to a simple example which we can test without the MPU6050: #include <PID_v1.h> double Setpoint, Input, Output; //Specify the links and initial tuning parameters ...
  • 35.7k
2 votes
Accepted

PID not working correctly

How fast is your system compared to the loop() sampling time? Does (100-map((ax+10900),-1300,1300,0,1024)) change appreciably during the sub-millisecond loop()? With kI=5, an error of only 10 will ...
  • 2,322
2 votes

PID not working correctly

Please respect others by presenting code that is readable. By doing that you may also find obvious errors in your code. Let me clean up the loop() and you will see what I mean. void loop() { int ...
  • 7,919
2 votes

Control Speed of DC FAN Using Arduino PID Library

Two thing that may be helpful. First make sure you have a common ground. For instance for you transistor you are using separate power from the arduino and 12 volt source. Connecting the two ground of ...
2 votes

PID control arduino

Ensure that your period for the PID execution routine is reasonable for your system. I generally like to execute my PID loops at 5 to 20 times the system impulse response. For instance, with a motor,...
2 votes

QuadCopter PID using MPU6050

Quadcopters usually use 2-PID loops per axis, a rate loop and an angle loop. Your quadcopter needs to be very aggressive about its rate of rotation but relatively relaxed about how quickly it returns ...
  • 4,360
2 votes

Need help modelling and coding a feedback scenario

Well, (very) simply you could slowly increase/decrease the PWM value driving M2 until the voltage at A1 equals that of A2. If you make the time between adjustments long enough you should not get any (...
2 votes
Accepted

Float to integer conversion for control program crashes arduino

I actually solved this issue and noticed a few things for those interested: the printNumI() function was making the arduino crash as it was badly initiated with an extra argument. Once I solved this ...
  • 131
2 votes

Passing variables for a PID in an interrupt

Short answer: Yes, it is possible to update global variables from interrupt routines, but it comes also with problems. Long answer: First you have to understand, how interrupts work. You are using a ...
  • 15.1k
2 votes

Making a PID Controller for BAR 30 pressure sensor

A PID controller should be a good match for your application, but it appears that your code doesn't take advantage of the PID_v1 library at all; a PID_v1 object is never declared, and it appears you ...
1 vote

How to Simulate and Tune a PID

I do not have your PID_v1.h, but I made a simple experiment trying to control your example with a simple P-Controller instead of the PID lib. I made the following changes to your code: ... double K_P ...
  • 307
1 vote

Cascaded Control loop Arduino

This is not an Arduino specific topic, but here is just a pragmatic answer: Use the output of the PID controller directly as your reference velocity, subtract your actual velocity and use it as ...
  • 307
1 vote

SIlly PID question using the PID library

See PID Library - SetOutputLimits() - you can change the limits. For a meaningful result you need to make the output do something reasonable to the speed. Since your detected speed is lower than the ...
  • 35.7k
1 vote
Accepted

What is better approach for non blocking pid algorithm?

The main issue you have is that pulseIn() is completely blocking - and your while loop doesn't help much either. The "proper" (or what I would consider the "proper") way of dealing with this is to ...
  • 104k
1 vote

P I D AND GY80 10 DOF

I am sorry, but I may not have understood your post, but I think the problem is your code doesn't work and you don't know why. I think the problem is with this line: if(val.m_y,2 >2 ||val.m_y,2&...
  • 5,617
1 vote
Accepted

How can an Arduino-Quadcopter be stabilized?

To help solve this problem, I wrote a program in Processing that graphs all the data from the quadcopter, including roll rate, roll angle, thrust, etc... After doing so I realized that the problem was ...
  • 83
1 vote

How can an Arduino-Quadcopter be stabilized?

For stability and tuning you need to make the adjustment cycle time compatible with the physical system. How fast does this adjustment code get called relative to how fast the physical system ...
  • 2,322
1 vote

Need help modelling and coding a feedback scenario

PID loops are a good way to go for something like this, but, you don't need to implement all three parts. I have done industrial control using just the P and I. Start by implementing just the ...
1 vote

How can I convert PID correction values to an PWM brushless command?

How can I convert PID correction values to an PWM brushless command? you have to do that yourself. you have to figure out first how to correct a pid value directionally. for example, should you ...
  • 2,706
1 vote

What is the proper way to implement PID?

I will give a generic C-answer to it: 1) figure out what parameters / variables involved in a PID control loop; 2) structure those parameters / variables into a struct; 3) pass that struct to a ...
  • 2,706

Only top scored, non community-wiki answers of a minimum length are eligible