Measuring output from a load cell
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
Thanks,
Richard
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen
Many types of instrumentation amplifiers are·available from digikey.com or jameco.com·
·
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
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
Mohamed, if you can lead me to the source for an AD7730, or equivalent, I would appreciate it. Thanks for the code.
Richard
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
Your correct, JAMECO does carry the AD7730 for $21. That's a bargain, especially with already having the code that Mohamed gave us.
Thanks
Richard
·I am using the BS2px. Does any of the code need to be changed?
(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)
·
http://tntech.facebook.com/album.php?aid=2038081&l=11ba0&id=52701181
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:
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
·
Post Edited (MSDTech) : 3/24/2008 9:50:01 PM GMT
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
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
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
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Regards, Ryan O'Hara
Check out our $25 SMT Stencils!!!
www.ohararp.com/Stencils.html
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