Shop OBEX P1 Docs P2 Docs Learn Events
Measuring output from a load cell — Parallax Forums

Measuring output from a load cell

RichardFRichardF Posts: 168
edited 2009-05-11 09:27 in BASIC Stamp
What is the best way to interface the Basic Stamp 2 to a load cell and read changes in output voltage (millivolt range)? The particular load cell I want to use will have 12 volts excitation and a 2 mv/v or 24 mv output. I guess we can generalize this question and ask what is the best way to interface the ouput of a Wheatstone bridge to the Stamp? An A/D converter comes to mind but not sure if that will work in the millivolt range.

Thanks,
Richard

Comments

  • FranklinFranklin Posts: 4,747
    edited 2007-10-13 23:28
    Since your question is not really about the stamp and more about the interface you might get more answers if you delete this post and repost in the sandbox.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • FranklinFranklin Posts: 4,747
    edited 2007-10-13 23:52
    Red X in upper right corner.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • RichardFRichardF Posts: 168
    edited 2007-10-14 13:39
    There is no "Red X" in the upper right corner of my original post, only an edit icon. There is no place on the edit page to delete the post.
  • D. AbramD. Abram Posts: 20
    edited 2007-10-14 14:58
    I asked this same questions about a year ago but cannot find the thread.· Anyway...I was pointed in the direction of an instrumentation amplifier.· I never did complete the project.· Still have two load cells sitting here that i would like to get working.·Would be interested in sharing code/tips.

    Many types of instrumentation amplifiers are·available from digikey.com or jameco.com·

    ·
  • Martin HebelMartin Hebel Posts: 1,239
    edited 2007-10-14 15:41
    These days I try to purchase load cells with the built-in signal conditioning and 0 to 5V output, which can be fed directly to an ADC, such as the 0831. If you have a bridge output, you need to first use an instrumentation amplifier to amplify the millivolts and get rid of the noise. Spec wise, the gain can be in the thousands with very high noise rejection (CMRR). One I've used recently that only needs a single supply (not a negative supply) is the LT1101.

    http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail?name=LT1101CN8-ND

    After this, it can be fed to an ADC and read by the BS2.

    As mentioned, many newer load cells have the instrumentation amplifier built in and are designed for 0 to 5V (or 0.5 to 4.5V) output.
    -Martin

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    StampPlot - GUI and Plotting Software
    Southern Illinois University Carbondale, Electronic Systems Technologies
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2007-10-15 02:11
    I wonder if the chip (DS2760) used with Parallax's thermocouple kit would work. It's designed for monitoring Li+ battery charging, but it has differential inputs and plenty of sensitivity (down to 15uV, IIRC).

    -Phil
  • Mohamed RefkyMohamed Refky Posts: 47
    edited 2007-10-15 09:12
    The AD7730 is a complete bridge transducer ADC connected directly to the load cell and outputs a serial word and easy interface to BS2.
    Code for AD7730
    ADdata· var· WORD ·'variable to hold 16 bit result.
    DATAin· con ·2 ·'AD data input pin.
    DATAout ·con ·3· 'AD data output pin.
    SCKL ·con· 4· 'clock to AD.
    RDY· con· 5· 'RDY input .
    INPUT 5
    INITIAL:
    SHIFTOUT DATAin, SCLK, MSBFIRST, [noparse][[/noparse]$FFFF\16,$FFFF\16] 'write 32 ones will reset the AD7730 to the default state
    SHIFTOUT DATAin, SCLK, MSBFIRST, [noparse][[/noparse]$02] 'write to communication register setting next operation as write to mode register.
    SHIFTOUT DATAin, SCLK, MSBFIRST, [noparse][[/noparse]$B0B0\16]'write to mode register initiating internal full scale calibration
    pause 500
    SHIFTOUT DATAin, SCLK, MSBFIRST, [noparse][[/noparse]$02]
    SHIFTOUT DATAin, SCLK, MSBFIRST, [noparse][[/noparse]$B0B0\16]'write to mode register initiating system zero scale calibration
    pause 500
    SHIFTOUT DATAin, SCLK, MSBFIRST, [noparse][[/noparse]$3080\16] 'write to mode register starting continuous conversion for 10mV input range,unipolar,16 bit data word and 5V reference.
    SHIFTOUT DATAin, SCLK, MSBFIRST, [noparse][[/noparse]$21] 'write to communication register setting next operation as continuous read from data register.
    LOW 2 ' set DIN line low to insure part is not reset while in continuous read mode.
    ReadData:
    waitRDY:
    IF RDY = 1 THEN waitRDY 'wait for RDY to go low to indicate output update.
    SHIFTIN DATAout, SCLK, MSBPOST, [noparse][[/noparse]ADdata\16] 'read conversion result from data register.
    DEBUG DEC ADdata, CR 'display data in decimal.
    PAUSE 500 'wait 0.5 second between reading.
    GOTO ReadData
  • RichardFRichardF Posts: 168
    edited 2007-10-15 11:33
    I couldn't find the AD7730 on either JAMECO or Mouser web sites. JAMECO stocks an LTC 1100 Linear Instrumentation amp fo 5 volts that looks like it would work nicely with a strain gauge/load cell. I would still have to do the A/D conversion though.

    Mohamed, if you can lead me to the source for an AD7730, or equivalent, I would appreciate it. Thanks for the code.

    Richard
  • RichardFRichardF Posts: 168
    edited 2007-10-15 11:37
    Martin, I realize you had already put out the information about the LT1101 at digikey. I just wanted to see what JAMECO or Mouser had to offer. I have had very good luck with those companies, does Digikey do as well?

    Richard
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2007-10-15 13:59
    Richard -

    The following search engine is usually your best bet for sourcing chips:
    http://www.findchips.com/

    Based on the results of that search engine, it appears that Jameco does have the AD7730.

    Regards,

    Bruce Bates
  • RichardFRichardF Posts: 168
    edited 2007-10-15 15:59
    Bruce,
    Your correct, JAMECO does carry the AD7730 for $21. That's a bargain, especially with already having the code that Mohamed gave us.

    Thanks
  • RichardFRichardF Posts: 168
    edited 2007-10-15 16:15
    Going to omega.com's web site and pricing pressure transducers, I found that 5 volt analog output devices were about the same price as millivolt output devices. So now we have a broad range of choices for reading pressure with our basic stamp. The pure hobbiest (me) will probably go for a millivolt output, add an instrument DC amp and an A/D converter, because this gives vesatility in reading any small signal analog device (bridge outputs). If this is a specific application for a pressure reading, then clearly the all-in-one transducer with the 0-5V out is the way to go, isn't it. Thats the fun of this hobby. Thanks for all of the inputs, everyone.

    Richard
  • Brian SmithBrian Smith Posts: 44
    edited 2007-10-17 04:44
    I guess it’s been a few months since I’ve worked on it, but I used Mohamed's code, and couldn’t get any results. I’m sure it has to do with improper wiring because I am a bit unsure what exactly I need (do I need a crystal). If someone could help me out with all the connections needed to use this code to interface a full bridge to the BS2 It would really help with these headaches... By the way I’m using the BS2px
    ·I am using the BS2px. Does any of the code need to be changed?
  • Mohamed RefkyMohamed Refky Posts: 47
    edited 2007-10-17 19:51
    (1) Connect the load cell as figure 23 of AD7730 data sheet.

    (2) Connect·POL(pin4)·and CS(pin19) to GND·.
    ················ SYNC(pin5),RESET(pin6) and STANDBY(pin18) to +5V
    ··
    (3) Connection between AD7730 & BS2:

    AD7730················BS2

    (DIN) pin22
    pin7 (2)
    (DOUT) pin21
    pin8 (3)
    (SCLK)·pin1
    pin9·(4)
    (RDY) pin20
    pin10 (5)
  • Brian SmithBrian Smith Posts: 44
    edited 2007-10-19 13:52
    Thanks for the help. I believe I have it hooked up the way you say, but all I get in the debug terminal are 0's. It’s like the chip isn’t even there. I have another 7730 but am afraid to hook it up before someone looks over my connections first.·There is a link to pictures of my Board Of Education at the bottom. I also tried connecting a crystal (the one·that came with my propeller education kit)·and the 2 capacitors. I am still unsure if I need them. The four wires with a knot are the bridge wires. I am running a full bridge (four strain gauges no plain resistors). I am using the boards regulated 5v for power and bridge excitation.
    ·
    http://tntech.facebook.com/album.php?aid=2038081&l=11ba0&id=52701181
  • Mohamed RefkyMohamed Refky Posts: 47
    edited 2007-10-23 18:28
    The AD7730 requires a 4.9152 MHz crystal connected across the MCLK IN and MCLK OUT pins.

    About the code:

    After : SHIFTOUT DATAin, SCLK, MSBFIRST, [noparse][[/noparse]$FFFF\16,$FFFF\16]

    Add this :

    SHIFTOUT DATAin, SCLK, MSBFIRST, [noparse][[/noparse]$03]'write to communication register setting next operation as write to Filter Register.

    SHIFTOUT DATAin, SCLK, MSBFIRST, [noparse][[/noparse]$7040,$10]'output rate for 50Hz line frequency in CHOP mode and DC excitation

    Correct this:

    nono.gif·SHIFTOUT DATAin, SCLK, MSBFIRST, [noparse][[/noparse]$B0B0\16]'write to mode register initiating system zero scale calibration.

    yeah.gif·SHIFTOUT DATAin, SCLK, MSBFIRST, [noparse][[/noparse]$D080\16]


    Before :SHIFTOUT DATAin, SCLK, MSBFIRST, [noparse][[/noparse]$3080\16]

    Add :

    SHIFTOUT DATAin, SCLK, MSBFIRST, [noparse][[/noparse]$02]

    ******************************************

    You may write the initial code like this:

    SHIFTOUT DATAin, SCLK, MSBFIRST, [noparse][[/noparse]$FFFF\16,$FFFF\16]
    SHIFTOUT DATAin, SCLK, MSBFIRST, [noparse][[/noparse]$03,$7040\$10]
    SHIFTOUT DATAin, SCLK, MSBFIRST, [noparse][[/noparse]$02,$B0B0\16]
    pause 500
    SHIFTOUT DATAin, SCLK, MSBFIRST, [noparse][[/noparse]$02,$D080\16]
    pause 500
    SHIFTOUT DATAin, SCLK, MSBFIRST, [noparse][[/noparse]$02,$3080\16]
    SHIFTOUT DATAin, SCLK, MSBFIRST, [noparse][[/noparse]$21]
    LOW 2




    ·
  • MerfMerf Posts: 10
    edited 2008-03-24 15:40
    Brian Smith: Did you try connceting the crystal suggested by Mohamed to see if that works? Like you, I could only get a string of "0s" [noparse][[/noparse]zeros] connecting the AD7730 this way and using Mohamed's code. Something is wrong or missing here. Let us know if you solved the problem. Merf
  • MSDTechMSDTech Posts: 342
    edited 2008-03-24 20:44
    If you're looking for the AD7730, it can be purchased from Newark at $13.88. I should point out that this is a 24bit ADC, so you will loose 1/3 of the output reading it into a 16bit word.·I'm using a similar decoder the AD7705, this unit is 16 bit and a little easier to work with the output on a BS2. It is also available from Newark for $8.60. I couldn't find the 4.9152 MHz chip locally, but have it working with a 2 MHz crystal, which is still in the allowed range for the AD7705.

    Post Edited (MSDTech) : 3/24/2008 9:50:01 PM GMT
  • Tracy AllenTracy Allen Posts: 6,662
    edited 2008-03-25 17:09
    I'm keen on the ADS1100 family from TI and the MCP3421 from Microchip.
    These are 16 and 18 bit converters with built in PGA (programmable gain amplifier) with differential gain of x8 which effectively increases the differential resolution to 19 or 21 bits.
    --Tiny SO23 package, 6 pins, that can be placed right at the measurement point. (adapter pcb necessary for prototyping)
    --Sngle channel sigma-delta, slow (8 SPS) but programmable tradeoff between speed and resolution.
    --I2C interface can string several on one buss,
    --relatively cheap at around $3 ea.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • Mohamed RefkyMohamed Refky Posts: 47
    edited 2008-03-29 19:26
    User selects 16 bit or 24 bit mode of operation in the AD7730 Mode Register.
  • Brian SmithBrian Smith Posts: 44
    edited 2008-06-26 20:04
    Well I installed a 4.9152 crystal grounded through "104" caps. But I still get only 0's. I have connected the bridge as in Figure 23 page 40 on the 7730·data sheet. I used Mohammed's code with the changes he suggested and change SCKL to SCLK at the top. ·Could someone who has·got the 7730 working on a stamp,·post the full code and full schematic. Im beating my head against the wall now... Do I need to change the code·to work with the BS2px24????
  • Mohamed RefkyMohamed Refky Posts: 47
    edited 2008-06-29 14:24
    Brian Smith,
    it is better first check check that·communication between BS2 and AD7730 is right.

    View the code at:

    http://forums.parallax.com/showthread.php?p=717653
  • stuermstuerm Posts: 3
    edited 2008-07-18 16:04
    Hi Brian,

    Make sure that all pins get a difined input. When the pin RDYinv sends all the time a 1 (not ready) there is quite sure a input error. Connect the pins as follows (Mohamed's code).:

    AD7730->BS2
    sclk->Pin4
    MCLKin/out->cristall 4.9152MHz
    POL-> 0(low)
    SYNCinv->1(high)
    RESETinv->1
    AGND->GND
    AVdd->5V
    Ain(+/-)->load cell
    REF(+/-)->load cell
    STANDBYinv->1
    CSinv->0
    RDYin->pin5 (change in the program rdy to IN5)
    Dout/in->PIN3/2
    DVdd->5V
    DGND->GND

    Good luck Thomas
  • ohararpohararp Posts: 24
    edited 2009-05-10 19:53
    @Tracy, just wondering if you ever had any luck getting the MCP3421 up and running?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Regards, Ryan O'Hara


    Check out our $25 SMT Stencils!!!

    www.ohararp.com/Stencils.html
  • Tracy AllenTracy Allen Posts: 6,662
    edited 2009-05-11 09:27
    Hi Ryan,

    I've used the ADS1100 in several projects, but not the MCP3421. They are similar, but I needed the ratiometric reference scheme of the ADS1100. Attached is demo code that configures the ADS1100 with a PGA gain of x8 so that the lsb is about 11 microvolts over a differential span of 0.375 volts.

    ' {$STAMP BS2pe}
    ' {$PBASIC 2.5}
    ' Tracy Allen, EME Systems
    ' demo for ADS1100 on a 3.0 volt power supply
    ' Note that the I2C i/o to the Stamp is 5V tolerant, even tho the ADS operates on 3V
    ' ADS1100 conversion is always ratiometric, the power supply is the reference.
    ' In this example, the PGA gain is set to x8
    ' and with a 3.0 volt power supply, the full scale range is 0.375V = 3/8
    ' And there are 32768 steps across that range, bit 15 is the sign (bipolar)
    ' That is about 11 microvolts per bit (11.47561)
    
    wx VAR WORD   ' variable for data
    status VAR BYTE    ' status byte returned by ADS1100
    i2cticks   VAR BYTE   ' for i2c timeout counter
    
    ADSp PIN 0      ' must be 0 or 8 for i2c
    
    my_adr CON %10011000 
                           ' aaaabbb0   bits as follows:
                ' aaaa=%1001 device type for ADS1100
                           ' bbb= %100 = 4 device address here, but addresses 0 to 7 available from TI
                           ' 0 for write, 1 for read
    my_pga CON 3       ' pga gain 3=x8 here, but 2=x4, 1=x2, 0=x1 gain also available
    
    DEBUG CR,CR,"top",CR
    
    main:
      '----- read mV -----
      I2COUT 0,my_adr,[noparse][[/noparse]%10011100 + my_pga]  ' single conversion, PGA gain
      ' %S00CDDPP
      ' S=1 to start single shot conversion, status.bit7 will read =0 when complete
      ' C=1 FOR single shot,
      ' DD=11 for 16 bit 8 SPS
      ' PP is my_pga, pga gain, 00=x1, 01=x2, 10=x4 and 11=x8
     status.BIT7=1
     i2cticks=255   ' timeout limit
      DO WHILE status.BIT7*i2cticks  ' loop until data is ready, or timeout
       I2CIN 0,my_adr,[noparse][[/noparse]wx.BYTE1, wx.BYTE0, status]  ' get data word and status from chosen channel
        i2cticks=i2cticks-1   ' timing down
        ' word result is signed bipolar differential +/- Vdd/PGA
      LOOP
      IF i2cticks=0 THEN DEBUG CR,"timeout" : GOTO main
      wx=ABS wx *2 ** 37500 ^ -wx.BIT15 + wx.BIT15  ' convert reading to millivolts*100, pga gain=x8
      ' this math comes out to wx=37500 when Vin=+375.00 millivolts
      ' ratiometric to 3.0 volt power supply
      DEBUG CR,REP "-"\wx.BIT15, DEC ABS wx/100, ".", DEC2 ABS wx
      NAP 6
    GOTO main
    

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com

    Post Edited (Tracy Allen) : 5/11/2009 9:32:24 AM GMT
Sign In or Register to comment.