Show Posts
Pages: [1] 2 3 ... 7
1  Development / Other Software Development / Re: Arduino PID Library: Out of Beta on: April 16, 2011, 08:39:15 am
Quote
I think DIRECT implies other things but i can't think of anything to change it to
  agreed.  when there's a question about naming I fall back to industrial standards.  I did the same thing with "sample time"

Quote
Perhaps you want to mention the point that double is acting with the same precision as a float but presumably is there in case double is added with full precision in the future.
  yes!  can't believe I forgot to do that.  True double-precision is WAY overkill for PID.  Now I just need to figure out where to put it...
2  Development / Other Software Development / Re: Arduino PID Library: Out of Beta on: April 16, 2011, 06:54:35 am
@Coding Badly.  Excellent, thank you.  responded.
@mowcius, @Graynomad  I'm not the biggest fan of the work involved in doing a writeup.  The fact that it's useful to you makes all the difference.  thanks.
3  Development / Other Software Development / Re: Arduino PID Library: Out of Beta on: April 15, 2011, 08:01:41 pm
Quote
are you interested in specific technical comments?
Yeah absolutely.  If it pertains to something addressed in one the blog posts, it probably makes the most sense to post there, so I can respond in context.  For more general stuff, here probably makes more sense.  But no huge deal. I'm more interested in the feedback than where it's delivered.
4  Development / Other Software Development / Arduino PID Library: Out of Beta on: April 15, 2011, 03:02:06 pm
After being in Beta for way too long, the Arduino PID Library is ready (I think) for prime time. The new and improved PID_v1 can be downloaded here.

I made some major changes to the internal code, but what I hope the end-user notices most is that I tried to simplify things.  The two biggest examples of this:
  
  • I switched to the Kp, Ki, Kd form of the PID.  I still like the other version better, but this is what everyone is expecting, and it isn't really about what I want.
  • There are significantly fewer functions.  All that's left is what's absolutely necessary to make the pid work well.

The biggest improvement this time around, and by far the most difficult, is that I've explained myself.  In excruciating detail.  If you want to know how and why I did things in the code, it's all there.

As always, questions and comments are greatly appreciated.

-Brett

Update: the previous PID thread became a rather unwieldy place for Q&A.  In an attempt to have things be a little more organized, I've created a google group.   
5  Forum 2005-2010 (read only) / Troubleshooting / Re: How to pass Multi_byte values between two Arduinos on: August 10, 2009, 07:58:09 am
You could use a union on each side.  Convert the int to a byte array on the send side, then convert that array back on the receive side.

This post (and the replies that follow) should get you there.  They're converting floats, but it will work with ints as well.  http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1207242838

-Brett
6  Forum 2005-2010 (read only) / Syntax & Programs / Re: Adding ON/OFF control & temp display to PID SCRIPT on: July 03, 2009, 06:53:55 pm
Brian:
Quote
When in MANUAL mode, is there a way to change the OUTPUT through your algorithm?

currently there is not.  when in manual, it's essentially as though the pid isn't there.  you make a fair point about the output limits thought. I'm not sure what the answer is.  I could throw in another function, but I think that would be confusing to most users.
7  Forum 2005-2010 (read only) / Syntax & Programs / Re: Adding ON/OFF control & temp display to PID SCRIPT on: July 03, 2009, 01:19:01 pm
Quote
I've been tinkering with it in "MANUAL" mode and it still sends an output signal to the heater. It doesn't seem to do any calculations in manual mode, but it still just keeps the output going.?

odd.  as soon as it gets set to manual the pid should stop writing to the output variable.  it won't make it 0, or anything really.  if you want the output to go to 0 and stay there, use SetMode(MANUAL); followed by  Output=0;

if you've done this and the pid is still changing the output, I'm going to have to take a look at the library source.  it should not do that.

Brett
8  Forum 2005-2010 (read only) / Syntax & Programs / Re: Adding ON/OFF control & temp display to PID SCRIPT on: July 01, 2009, 07:28:35 pm
Quote
MANUAL mode is OFF?

When I was first starting with pid, the way I used to keep track was by thinking of it as "Manual Override."

in manual mode, you get to set the output to whatever you want.  in automatic, the pid controller does the work.  automatically.

I'm open to changing this.  Any suggestions on a better naming convention?  Something that's easier for the beginners, but is still understood by the old salts?
9  Forum 2005-2010 (read only) / Syntax & Programs / Re: Adding ON/OFF control & temp display to PID SCRIPT on: June 30, 2009, 05:12:30 pm
Quote
That code could still trigger multiple events due to contact bouncing

That's a good point goose.  I like your way better.

Brett
10  Forum 2005-2010 (read only) / Syntax & Programs / Re: Adding ON/OFF control & temp display to PID SC on: June 30, 2009, 03:08:37 pm
the basic way to increase the setpoint would be

Code:
if(digitalRead(buttonPin2)==HIGH)
{
   Setpoint+=1;
}
the problem with this is that since loop excecutes so quickly, this code may be hit several times in the time it takes to press and release the button.

what I have done in similar situations is instead of looking at the current state of the button, I looked for a CHANGE in the state of the button.  so something like:

Code:
int lastState = LOW;
void loop()
{
   int currentState = digitalRead(buttonPin2);
  if(currentState == HIGH && lastState ==LOW)  //only go in if we were off last time, and on this time
  {
    Setpoint+=1;  //increment the setpoint
  }
  lastState = currentState;  //remember the button state for next time
}

Hope that helps.  Brett
11  Forum 2005-2010 (read only) / Syntax & Programs / Re: Adding ON/OFF control & temp display to PID SC on: June 25, 2009, 11:55:38 am
coding badly is correct.  (that is a sentence I never thought I'd write!)
that is to say, Brian is correct.

you can have your on/off button toggle the Auto/Manual state of the pid using the SetMode(..) function.  when in manual mode, the pid will stay out of things, and you can write whatever you want to the output variable.

for ease of coding you're still free to all Call myPID.Compute().  it will see that the current mode is manual and will immediately return without calculating.

glad to hear that the library is working for you!

Brett
12  Forum 2005-2010 (read only) / Interfacing / Re: Sending multiple variables via serial connection on: July 08, 2009, 01:40:40 pm
if you're trying to send ints, you should be able to use the messenger library: http://www.arduino.cc/playground/Code/Messenger

Also, I'm pretty sure (and therefor think it's important to note,) that a processing "int" isn't the same as an arduino "int",  with one being 32 bit and the other 16.  so a processing "int" is an arduino "long"

luckilly, it looks like the messenger library can read longs.

Brett
13  Forum 2005-2010 (read only) / Interfacing / Re: C# GUI reading serial from Arduino? on: April 03, 2009, 06:09:16 pm
Subscribing to the serial event and then invoking a delegate is definitely the most elegant and "correct" way to do this.  but conceptually it's a bit of a hurdle for a beginner.

what I'd suggest is:  
  • on the design view, drag a timer out onto the form.
  • rightclick on it and select "properties"
  • set the "enabled" property to "true"
  • set the "interval" property to however often (in milliseconds) you want the program to check the serial port
  • next doubleclick on the timer.  that will automatically create a function in your code called "timername_tick(...)"    which will get excecuted every time the timer's interval is up.
  • put the code you want executed over and over in that function  (leave the com1 initialization code where it is though)

14  Forum 2005-2010 (read only) / Interfacing / Re: C# GUI reading serial from Arduino? on: April 03, 2009, 10:33:43 am
you could try putting Application.DoEvents(); in your while loop, after the arduino stuff.

if that doesn't work you could use a timer object and put the arduino call in it's "tick" event.

both of these approaches should free up the GUI to update on a separate thread.
15  Forum 2005-2010 (read only) / Development / Re: .net based Arduino Sketch Editor on: May 21, 2009, 07:31:52 am
intellisense is a fantastic feature!  the one that would put it over the top for me would be step-through debugging.  I can see all kinds of problems implementing that though.
Pages: [1] 2 3 ... 7