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. ...
Juraj's user avatar
  • 17.9k
4 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) { //...
Delta_G's user avatar
  • 3,241
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 ...
Majenko's user avatar
  • 105k
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 ...
JimJtron's user avatar
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 ...
BrettAM's user avatar
  • 4,431
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 ...
Paul's user avatar
  • 2,695
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 ...
Dave X's user avatar
  • 2,332
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()...
Edgar Bonet's user avatar
  • 42.7k
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, ...
Dave X's user avatar
  • 2,332
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,...
slightlynybbled's user avatar
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 ...
BrettAM's user avatar
  • 4,431
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 ...
Nick Gammon's user avatar
  • 38.1k
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 ...
Dave X's user avatar
  • 2,332
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 ...
Mikael Patel's user avatar
  • 7,959
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 (...
KennetRunner's user avatar
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 ...
Eliott W's user avatar
  • 131
2 votes

Quadcopter oscillation using PID

I'd suggest setting Kd to zero, Kp to a minimal value and letting the integral alone function as the controller. Any response to an error might be slow but the integrator alone will control a process ...
Jonathan Lambert's user avatar
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 ...
chrisl's user avatar
  • 16.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 ...
starship15's user avatar
2 votes

Confusion regarding PID library?

Open the Library Manager and search for the library you want. You will see a list of libraries matching your query. Under the name of each of those libraries, you will see a line showing the author ...
Edgar Bonet's user avatar
  • 42.7k
2 votes

Error coming from specified code

The error message is quite clear about the problem (extracted and formatted for clarity): no matching function for call to PID::PID(int*, int*, double*, double&, double&, double&, int) [.....
the busybee's user avatar
  • 1,991
1 vote

Switch Control Between Two Different Techniques

the PID is looking at the RPMs and giving an output but that output is being ignored because another operation has servo control. PID is not something, that happens somewhere in the background ...
chrisl's user avatar
  • 16.1k
1 vote

How to stabilize magnetic levitation system?

The answer to the solution was quite simple. I just had to comment out all serial port reading and Arduino processing became 60 times faster which helped to levitate the magnet. Thanks to everyone who ...
suu's user avatar
  • 85
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 ...
RJPlog's user avatar
  • 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 ...
RJPlog's user avatar
  • 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 ...
Nick Gammon's user avatar
  • 38.1k
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 ...
Majenko's user avatar
  • 105k
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&...
Code Gorilla's user avatar
  • 5,637
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 ...
Ember's user avatar
  • 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 ...
Dave X's user avatar
  • 2,332

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