This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

PGA309 - Arduino + Communicaton over bluetooth with Android phone

Other Parts Discussed in Thread: PGA309, PGA309EVM-USB, PGA308

Hello,

I'm in the process of creating application that will sense the tension changes on the piece of metal using tensometers (strain gauge?). I have created out of them a bridge. I've managed to make Funduino Mega 2560 r3 communicate with the PGA309 over 2-wire interface. I've been able to write to and read from PGA309 registers. I have used the provided here www.ti.com/.../slvc073 calculator to calculate needed values.

My code is available here: github.com/.../pga309-blutooth-android-tensometer the main ino code is here: github.com/.../testPin_I2C and the Eagle schematics are here: github.com/.../eagle

The problem I'm facing now is that I'd like to implement calculator like that in my android Application. I've read the manual many times and I cannot understand how to make all the needed calculations or I just simply cannot find them. I've been able to just use the calculator and write the data to the first part of EEPROM with correct checksum1 but it's not what I need. I want to make the needed calculations on phone, calibrate the pga309 there. Later the calibrated data need to be written to the EEPROM. The first part isn't a problem but I don't understand how to create the 2nd part (temperature look up table according to DAC settings). Again the calculations for that are not clear.

I'd really appreciate any help I can get. Algorithms, equations or anything useful is highly welcome. If you have any further questions about my project then please ask.

Regards,
Lucas

  • Hello Lucas,

    Here is the calibration algorithm which gives the equations for calculating the coefficients of the lookup table: PGA309 Calibration Algorithm.pdf

    I also recommend reading section 3.2 of the PGA309 User's Guide. This section describes the EEPROM contents in detail and provides several example calculations which are extremely helpful.

    These are some of the most frequently misunderstood aspects of the lookup table:

    • T0 through T16 are the calibration temperature points, and may or may not be evenly spaced. You may use as many or as few temperature points as you like, however, you get higher resolution with the maximum number of points (17).
    • Initial values G0 and Z0 are "real" values which correspond to gain DAC (GD) and zero DAC (ZD) settings
    • Subsequent values GM1, ZM1, ... GM16, ZM16 are slopes which are used to calculate the value at any point after G0 and Z0

    Best regards,

    Ian Williams
    Linear Applications Engineer
    Precision Analog - Op Amps

  • Thanks for the reply, Ian.

    I had that PDF with calibration algorithm from one of my previous searches on these forums. As I was looking through it it seemed that it's sort of guessing game whereas calculator just needed from me some values to start with and it was calculating the proper settings. I'll give it another look though.

    I've read the whole manual few times and all of it as for the beginner is really confusing. I've been reading the aforementioned by you chapter before writing the OP. I'm still confused as to how many of these I have to calcualte on my own. I thought that PGA309 just needs some initial values and then it calculates itself the 2nd part of the eeprom.

    Do you think that trying to open the latest calculator created in LabView would show me the step by step calculations needed? Which VIs could help me?

    I'm sorry that I'm asking a lot of questions but I've spent on this project already over a month and I'm getting frustrated with it. I'm kind of in infinite loop, re-reading docs over and over again.
  • Hello Lucas,

    Thank you for searching the forum and looking for resources before posting! We really appreciate you making use of that functionality.

    I'll admit that the process is complex and the documentation doesn't do a great job of simplifying it. If you have access to the developer version of LabVIEW, take a look at this attached .VI. It is a part of the PGA309EVM-USB source code. This subVI performs the task of creating the EEPROM lookup table based on over-temperature calibration measurements.

    build_ee_table.vi

    Best regards,

    Ian Williams

  • Hello Ian,

    Thanks for your help. I really appreciate it. This VI will come handy. I've just opened it (it had some dependency problems) and it seems that this will help me a lot. I've only glanced at it so far as it's really late here already.

    Is there another VI that shows how to calculate - knowing resistance of the bridge, its FSS, Vexc and other parameters - the gains, coarse ofset and Zero/Gain DACs? Pretty much what that simple calculator was doing? If you could provide me with such thing I would be really grateful. It would allow me jump tomorrow morning straight to work, and actually productive one!


    EDIT: I still don't get the idea of the temperature in that look up table. What T0 should I choose? How that corresponds to the G0 and Z0? I'm not really measuring temperature on my sensor (strain gauge sensor). What if I don't care about the temperature changes? How to write that to eeprom?

    Best regards,
    Lucas
  • Hello Lucas,

    All of the calculations during the calibration process are included in the PGA309EVM-USB Source Code. For example:

    • Compute_Input.vi - back-calculates differential input voltage based on measured output voltage and register settings
    • Find_Gain_Offset.vi - calculates gain and offset based on input voltage
    • Calibrate_Output.vi - calibrates register settings for maximum output voltage
    • Calibrate_Output_min.vi - calibrates register settings for minimum output voltage

    ...and so on. If you step through the different states of the main VI, you will see the key subVIs which perform all the fundamental calculations and the equations and steps which are used. 

    Just remember, you need actual voltage/current measurements in order to do this.

    Best regards,

    Ian Williams

  • Hello Ian,

    Yet again thanks for your support.

    You seem to have missed my edit. I'm not sure how to understand the T0 concept. Since the temperatures have to go from the lowest temperature to the highest and let's say that I want to start my look up table from the temperatures below 0 - how that corresponds to G0 and Z0? If these are the "real" values (which work well for me in the +20°C), how can I use them for the T0 with minus temperature? If I start the calculations for more points the Gx and Zx will change and for the room temperatrue I will have different Gain and Zero DAC settings, right? Or am I missing something here?

    Best regards,
    Lucas

    PS Congratulations on being promoted to Mastermind! :)
  • Hello Lucas,

    Thank you! I feel smarter already. ;)

    Let's back up for a moment. You say in your edit that you don't care about temperature changes. The whole point of the EEPROM lookup table is to calibrate out error in the bridge sensor over temperature, on top of the normal sensor nonlinearity over pressure (or whatever it measures).

    If you are only concerned with one temperature point, the PGA309 is overkill. You can instead use the PGA308, which is essentially the same device except without temperature compensation. With the PGA308, you calibrate the offset and gain scaling at one temperature and then write the values to on-chip memory.

    Do I understanding your application needs correctly, or have I still missed the point?

    Best regards,

    Ian Williams

  • Hello Ian,

    I think you get it right.

    I'm not really even using the linearisation circuit because I'm using PGA309 in 3-wire mode and in manual it was written that I shouldn't use the linearisation circuit if I do use 3-wire mode (Vout shorted to PRG pin). I'm not sure if I should have done it at all for my application.

    file.furai.pl/2015-03-26_23-05-36.png << this is how my strain gauge is connected. There is no temperature sensor on it. So is there still a point for using the temperature compensation? How do you set it up correctly for given temperature range?

    I'm trying to give you as much information on my project as I'm able to.

    Regards,
    Lucas
  • Hello Ian,

    I still haven't really figured out what should I do with questions I've asked in my previous post.

    I don't know if I should make another thread for that or just ask here. I think I'll just ask here.

    Now I'm trying to calculate values for the internal PGA309 registers, e.g. "Decimal # Counts = (VZERO DAC/VREF)(65536)". I'm using internal Vref 4.096V and Vexc for sensor excitation (which is set to 3.4V). Is that Vref in this equation the same as internal Vref? Or that Vref = Vexc?

    I think that in some cases Vref equalled to Vexc like in the example 2-1 from the manual.

    Could you help me clarify that?

    Regards,
    Lucas
  • Hello Lucas,

    "I'm not really even using the linearisation circuit because I'm using PGA309 in 3-wire mode and in manual it was written that I shouldn't use the linearisation circuit if I do use 3-wire mode (Vout shorted to PRG pin). I'm not sure if I should have done it at all for my application."

    This is not the case. The linearization circuitry works and should be used in any mode, whether 3-wire or 4-wire. Can you show me where in the documentation you saw information different from this?

    "file.furai.pl/2015-03-26_23-05-36.png << this is how my strain gauge is connected. There is no temperature sensor on it. So is there still a point for using the temperature compensation? How do you set it up correctly for given temperature range? "

    It looks like you are connecting the strain gauge in the typical way. If your gauge is close to the location of the PGA309, you can use the internal temperature sensor of the PGA309 to perform your temperature compensation. If the gauge is far away, then the temperature will be different and temperature compensation should not be used, and you should simply use the PGA308, which is roughly half the price of the PGA309.

    "Now I'm trying to calculate values for the internal PGA309 registers, e.g. "Decimal # Counts = (VZERO DAC/VREF)(65536)". I'm using internal Vref 4.096V and Vexc for sensor excitation (which is set to 3.4V). Is that Vref in this equation the same as internal Vref? Or that Vref = Vexc?

    I think that in some cases Vref equalled to Vexc like in the example 2-1 from the manual."

    Vref and Vexc are not equal. Vref is either 2.5V or 4.096V, set by an internal band gap reference. Vref may also be an externally-applied reference up to a voltage of Vsa. Vref is used as the reference voltage for the different gain, offset, and linearization DACs inside the device. All the scaling of these DAC voltages is relative to Vref.

    Vexc is a scaled version of Vref. Usually you set Vexc to an initial value of 3.3V (when Vref = 4.096V), and then the linearization calibration scales Vexc as the output (and therefore the feedback voltage) changes in order to reduce nonlinearity of the strain gauge over applied pressure. This should be more clear after looking at the block diagram below.

    Example 2-1 actually uses an external reference of +5V. Take care when reading examples to note if the internal reference or an external reference are being applied.

    Best regards,

    Ian Williams

  • Hello Ian,

    I have read about disabling LinDAC at the top of the p. 31 of the manual. I was wrong about the 3-wire part:

    "For systems that use the PGA309 internal reference, it is recommended that VEXC be used for sensor excitation, and Lin DAC be set to zero. The reason for this is to minimize any large current draws from the REFIN/REFOUT pin that could affect the internal VREF value used by the internal circuits."

    I didn't mean Vref and Vexc being equal in value. Just usage of them in equations. In the example 2-1 it seems like Vref is at the same time used for sensor excitation thus it becomes "kind of" Vexc. Maybe I'm just misinterpreting the whole idea of Vref.

    I'm just asking about the equations examples, showing how to compute values. I'm using internal Vref (like I have mentioned before). Vref in example 2-1 is the same as Vexc so I assumed that if I want to calculate similar thing in my setup - I need to use Vexc there not internal Vref value unless I don't understand it which it might be the case.

    I don't think I'll be able to get PGA308. I'll just stick to what I have. Thanks for the tip, though.

    Thank you for your patience.

    Best regards,
    Lucas

    PS I'm sorry if I sound rude sometimes. English isn't my native language...
  • Hello Lucas,

    Do not worry - you are not sounding rude at all, and your English is excellent!

    One thing that may be very helpful, instead of going through the User's Guide again and again, is working with the PGA309EVM-USB to perform a calibration yourself using the EVM software. Since you have the developer version of LabVIEW, you can step through each node and see the steps and calculations done in order to correctly scale the gain and offset.

    Are you interested in this approach? I can send you an EVM within a few business days if you provide me with your shipping address. If you want to do this, send me an e-mail at ian@ti.com with your shipping information and phone number.

    Best regards,

    Ian Williams

  • Hello Ian,

    That's sounds really good. I'll contact you over E-mail.

    Best Regards,
    Lucas