Friday, September 18, 2009

QPID Software Is Now Open Source!

I've had several requests for the QPID source code and finally had some time to clean things up a bit and set up a code repository. So in case you're curious how QPID works or could borrow a code snippet for your own Arduino project, you can now access the source code on GitHub. Note that this repository only contains the QPID-specific code; the WiServer code is hosted separately in the Async Labs repo.

4 comments:

  1. That's great, Mark - Thanks!

    I think all in all it's pretty elegant and will definitely use some ideas from it. One thing I do differently is I computed the A, B, and C thermister coefficients and calculate the temp on the fly using the Steinhart-Hart equation. Yah it's a lot more cycles, but I don't want that Arduino getting lazy!

    Hey, don't you need to rename it QPD? :-)

    ReplyDelete
  2. Glad you find it useful.

    Having worked in the mobile/embedded space for many years, I have a phobia of floating point math and a love for lookup tables. ;-) I may end up expanding the table and list all 1024 values since I have some flash space left. If you update the code in table.c/h to use the S-H equation, I'd appreciate you sharing it (maybe we can include both with an #ifdef?)

    QPD? LOL, yeah, let's just pretend it's a silent 'I' since the integral coefficient is effectively 0... :-)

    ReplyDelete
  3. This will likely not look right in the formatting....but here is a quick paste. One cool thing is that the voltage is not needed since it is just a ratio. This also assumes the probe is connected to VCC and then to the voltage divider resistor to ground.

    I have not yet physically run this through the full temperature range, but I have modeled it and the curve looks good for the range we'd be using.


    int thermister_temp(int aval) {
    double R, T;

    // These were calculated from the thermister data sheet
    // A = 2.3067434E-4;
    // B = 2.3696596E-4;
    // C = 1.2636414E-7;
    //
    // This is the value of the other half of the voltage divider
    // Rknown = 29700;

    // Do the log once so as not to do it 4 times in the equation
    R = log(((1024/(double)aval)-1)*(double)29700);

    // Compute degrees C
    T = (1 / ((2.3067434E-4) + (2.3696596E-4)*R + (1.2636414E-7)*R*R*R)) - 273.25;
    // return degrees F
    return((int)((T * 9.0)/ 5.0 + 32.0));
    }

    ReplyDelete
  4. Nice work Mark. Just got your code running on my Wishield and hope to connect it into a bradley smoker soon

    ReplyDelete