Shop OBEX P1 Docs P2 Docs Learn Events
Strain Gage — Parallax Forums

Strain Gage

ArchiverArchiver Posts: 46,084
edited 2002-05-17 02:43 in General Discussion
I plan I using a cirrus, CD5532, 24 bit a/d to read my omega 3/350-ly43 strain
gage, I just thought that I would be able to see a change of resistance on my
meter. Im very fortunate that parallax has did some of the work for me with the
code listed below. Im sure I will have to change the code to read a 250lb load
cell that Im trying to build plus Im planning on using a 2 * 16 Scott Edwards
backpack. Im not really sure what size of resistor to use in my full wheatstone
bridge.Any suggestion would be great Thanks to all of you for your input to this
project.



Link to Cirrus CD5532 a/d
http://www.cirrus.com/design/applications/detail.cfm?d=7

Link to Omega sg-3/350-LY43
http://www.omega.com/toc_asp/frameset.html?book=Pressure&file=STRAIN_GAGES Page
E-9



'Program used to measure voltage analog data using a CIRRUS LOGIC
CS5532, 24
bit ADC chip
'PARALLAX BS2p24 reads I/O data from the CS5532 connected to a MUSE
M1101-20#
beam sensor
'See Crystal CS5531/32/33/34 Datatasheet (Oct '99) page 38, figure 16,
for
connection setup
'4/27/01

dathi var word '16 bit high address
datlo var word '16 bit low address
x var word 'computed data value
y var word
y1 var nib
y2 var nib
y3 var nib
y4 var nib

SCLK con 15 ' ADC Clock
SDO con 14 ' ADC Data output
SDI con 13 ' ADC Data input
CS con 12 ' Chip select
p con 0

high CS
pause 50 'delay for crystal oscillator power
up
low CS
gosub RESET
gosub LCDINIT
gosub CHIPINFO
shiftout SDI,SCLK,1,[noparse][[/noparse]%00001011] 'read configuration register 1
shiftin SDO,SCLK,0,[noparse][[/noparse]dathi\16,datlo\16]
' debug " CONFIG:",cr,"bits 31 to 16 ",bin16 dathi,cr,"bits 15 to 0
",bin16
datlo,cr,cr

dathi=%0000000000000000 'write channel setup register 1
datlo=%0000000000000000
shiftout SDI,SCLK,1,[noparse][[/noparse]%00000101,dathi\16,datlo\16]

dathi=%0000000000000000 'write offset register 1
datlo=%0000000000000000
shiftout SDI,SCLK,1,[noparse][[/noparse]%00000001,dathi\16,datlo\16]

dathi=%0000010000000000 'write gain register 1
datlo=%0000000000000000
shiftout SDI,SCLK,1,[noparse][[/noparse]%00000010,dathi\16,datlo\16]

shiftout SDI,SCLK,1,[noparse][[/noparse]%00001101] 'read setup register 1
shiftin SDO,SCLK,0,[noparse][[/noparse]dathi\16,datlo\16]
' debug " SETUP:",cr,"bits 31 to 16 ",bin16 dathi,cr,"bits 15 to 0
",bin16
datlo,cr,cr

shiftout SDI,SCLK,1,[noparse][[/noparse]%00001010] 'read gain register 1
shiftin SDO,SCLK,0,[noparse][[/noparse]dathi\16,datlo\16]
' debug " GAIN:",cr,"bits 31 to 16 ",bin16 dathi,cr,"bits 15 to 0
",bin16
datlo,cr,cr

shiftout SDI,SCLK,1,[noparse][[/noparse]%11000000] 'contineous data conversion
lcdout p,1,[noparse][[/noparse]"CIRRUS CS5532"]

REPEAT
shiftout SDI,SCLK,1,[noparse][[/noparse]%00000000]
shiftin SDO,SCLK,0,[noparse][[/noparse]dathi\16,datlo\16]

' debug " DATA:",cr,"bits 31 to 0 ",bin16 dathi,cr,"bits 15 to 0
",bin16
datlo,cr
dathi=dathi<<8 'select bits 23 to 8 for
measurement
datlo=datlo>>8
x=dathi+datlo
debug " Voltage ",dec x," counts (bits 23/8)",cr,cr
if x<38600 then over
x=38600
over:
y=((38600-x)*2)/33 'convert to pounds
x=y
x=y/100
y=(y-(x*100))
lcdout p,192,[noparse][[/noparse]dec x,".",dec1 y," pounds "]
pause 500
goto REPEAT

RESET 'initialize CS5532
shiftout
SDI,SCLK,1,[noparse][[/noparse]$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FE]
dathi=%0010000000000000 'activate reset in
configuration
register
datlo=%0000000000000000
shiftout SDI,SCLK,1,[noparse][[/noparse]%00000011,dathi\16,datlo\16]
return

LCDINIT 'initialize LCD
lcdcmd p,48 'set function
pause 5
lcdcmd p,48
pause 1
lcdcmd p,48
pause 1
lcdcmd p,32
pause 1
lcdcmd p,44
pause 1
lcdcmd p,8 'display off
lcdcmd p,12 'display on
lcdcmd p,6 'set mode
return

CHIPINFO
lcdcmd p,1
lcdout p,128,[noparse][[/noparse]" BASIC Stamp2P reads Cirrus Logic CS5532 "]
for x=1 to 24
pause 200
lcdcmd p,24
next
pause 1000
lcdcmd p,1
return



Do You Yahoo!?
LAUNCH - Your Yahoo! Music Experience

[noparse][[/noparse]Non-text portions of this message have been removed]

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2002-05-16 20:03
    Jim,

    Have you located a wiring schematic for this example?

    Original Message
    From: Jim Gorbet [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=oMeK7vkFZ5L3HpYUUlH145nbJ8I-O5dOHsZrGJZR2oy1mN0H5EsFYbPcwxJB4_aTk--gdc6y80B5poXh6Q]jimgorbet@y...[/url
    Sent: Monday, May 13, 2002 7:06 PM
    To: basicstamps@yahoogroups.com
    Subject: [noparse][[/noparse]basicstamps] Strain Gage
    Importance: High



    I plan I using a cirrus, CD5532, 24 bit a/d to read my omega 3/350-ly43
    strain gage, I just thought that I would be able to see a change of
    resistance on my meter. Im very fortunate that parallax has did some of the
    work for me with the code listed below. Im sure I will have to change the
    code to read a 250lb load cell that Im trying to build plus Im planning on
    using a 2 * 16 Scott Edwards backpack. Im not really sure what size of
    resistor to use in my full wheatstone bridge.Any suggestion would be great
    Thanks to all of you for your input to this project.



    Link to Cirrus CD5532 a/d
    http://www.cirrus.com/design/applications/detail.cfm?d=7

    Link to Omega sg-3/350-LY43
    http://www.omega.com/toc_asp/frameset.html?book=Pressure&file=STRAIN_GAGES
    Page E-9



    'Program used to measure voltage analog data using a CIRRUS LOGIC
    CS5532, 24
    bit ADC chip
    'PARALLAX BS2p24 reads I/O data from the CS5532 connected to a MUSE
    M1101-20#
    beam sensor
    'See Crystal CS5531/32/33/34 Datatasheet (Oct '99) page 38, figure 16,
    for
    connection setup
    '4/27/01

    dathi var word '16 bit high address
    datlo var word '16 bit low address
    x var word 'computed data value
    y var word
    y1 var nib
    y2 var nib
    y3 var nib
    y4 var nib

    SCLK con 15 ' ADC Clock
    SDO con 14 ' ADC Data output
    SDI con 13 ' ADC Data input
    CS con 12 ' Chip select
    p con 0

    high CS
    pause 50 'delay for crystal oscillator power
    up
    low CS
    gosub RESET
    gosub LCDINIT
    gosub CHIPINFO
    shiftout SDI,SCLK,1,[noparse][[/noparse]%00001011] 'read configuration register 1
    shiftin SDO,SCLK,0,[noparse][[/noparse]dathi\16,datlo\16]
    ' debug " CONFIG:",cr,"bits 31 to 16 ",bin16 dathi,cr,"bits 15 to 0
    ",bin16
    datlo,cr,cr

    dathi=%0000000000000000 'write channel setup register 1
    datlo=%0000000000000000
    shiftout SDI,SCLK,1,[noparse][[/noparse]%00000101,dathi\16,datlo\16]

    dathi=%0000000000000000 'write offset register 1
    datlo=%0000000000000000
    shiftout SDI,SCLK,1,[noparse][[/noparse]%00000001,dathi\16,datlo\16]

    dathi=%0000010000000000 'write gain register 1
    datlo=%0000000000000000
    shiftout SDI,SCLK,1,[noparse][[/noparse]%00000010,dathi\16,datlo\16]

    shiftout SDI,SCLK,1,[noparse][[/noparse]%00001101] 'read setup register 1
    shiftin SDO,SCLK,0,[noparse][[/noparse]dathi\16,datlo\16]
    ' debug " SETUP:",cr,"bits 31 to 16 ",bin16 dathi,cr,"bits 15 to 0
    ",bin16
    datlo,cr,cr

    shiftout SDI,SCLK,1,[noparse][[/noparse]%00001010] 'read gain register 1
    shiftin SDO,SCLK,0,[noparse][[/noparse]dathi\16,datlo\16]
    ' debug " GAIN:",cr,"bits 31 to 16 ",bin16 dathi,cr,"bits 15 to 0
    ",bin16
    datlo,cr,cr

    shiftout SDI,SCLK,1,[noparse][[/noparse]%11000000] 'contineous data conversion
    lcdout p,1,[noparse][[/noparse]"CIRRUS CS5532"]

    REPEAT
    shiftout SDI,SCLK,1,[noparse][[/noparse]%00000000]
    shiftin SDO,SCLK,0,[noparse][[/noparse]dathi\16,datlo\16]

    ' debug " DATA:",cr,"bits 31 to 0 ",bin16 dathi,cr,"bits 15 to 0
    ",bin16
    datlo,cr
    dathi=dathi<<8 'select bits 23 to 8 for
    measurement
    datlo=datlo>>8
    x=dathi+datlo
    debug " Voltage ",dec x," counts (bits 23/8)",cr,cr
    if x<38600 then over
    x=38600
    over:
    y=((38600-x)*2)/33 'convert to pounds
    x=y
    x=y/100
    y=(y-(x*100))
    lcdout p,192,[noparse][[/noparse]dec x,".",dec1 y," pounds "]
    pause 500
    goto REPEAT

    RESET 'initialize CS5532
    shiftout
    SDI,SCLK,1,[noparse][[/noparse]$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FE]
    dathi=%0010000000000000 'activate reset in
    configuration
    register
    datlo=%0000000000000000
    shiftout SDI,SCLK,1,[noparse][[/noparse]%00000011,dathi\16,datlo\16]
    return

    LCDINIT 'initialize LCD
    lcdcmd p,48 'set function
    pause 5
    lcdcmd p,48
    pause 1
    lcdcmd p,48
    pause 1
    lcdcmd p,32
    pause 1
    lcdcmd p,44
    pause 1
    lcdcmd p,8 'display off
    lcdcmd p,12 'display on
    lcdcmd p,6 'set mode
    return

    CHIPINFO
    lcdcmd p,1
    lcdout p,128,[noparse][[/noparse]" BASIC Stamp2P reads Cirrus Logic CS5532 "]
    for x=1 to 24
    pause 200
    lcdcmd p,24
    next
    pause 1000
    lcdcmd p,1
    return



    Do You Yahoo!?
    LAUNCH - Your Yahoo! Music Experience

    [noparse][[/noparse]Non-text portions of this message have been removed]


    To UNSUBSCRIBE, just send mail to:
    basicstamps-unsubscribe@yahoogroups.com
    from the same email address that you subscribed. Text in the Subject and
    Body of the message will be ignored.


    Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
  • ArchiverArchiver Posts: 46,084
    edited 2002-05-17 02:43
    Fred,
    You can find the schematic on page 42 of application sheet.
    http://www.cirrus.com/pubs/cs5531-5.pdf?DocumentID=828
    Fred Darnell <fdarnell@c...> wrote: Jim,

    Have you located a wiring schematic for this example?

    Original Message
    From: Jim Gorbet [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=2nMo77Y1171yGT_Kb52TVNJqqW3h7GEOJrF3KfXlu88DGmjoE1daYYlkwVO7OEgkNdQ64_4YeGV7JbDbBA]jimgorbet@y...[/url
    Sent: Monday, May 13, 2002 7:06 PM
    To: basicstamps@yahoogroups.com
    Subject: [noparse][[/noparse]basicstamps] Strain Gage
    Importance: High



    I plan I using a cirrus, CD5532, 24 bit a/d to read my omega 3/350-ly43
    strain gage, I just thought that I would be able to see a change of
    resistance on my meter. Im very fortunate that parallax has did some of the
    work for me with the code listed below. Im sure I will have to change the
    code to read a 250lb load cell that Im trying to build plus Im planning on
    using a 2 * 16 Scott Edwards backpack. Im not really sure what size of
    resistor to use in my full wheatstone bridge.Any suggestion would be great
    Thanks to all of you for your input to this project.



    Link to Cirrus CD5532 a/d
    http://www.cirrus.com/design/applications/detail.cfm?d=7

    Link to Omega sg-3/350-LY43
    http://www.omega.com/toc_asp/frameset.html?book=Pressure&file=STRAIN_GAGES
    Page E-9



    'Program used to measure voltage analog data using a CIRRUS LOGIC
    CS5532, 24
    bit ADC chip
    'PARALLAX BS2p24 reads I/O data from the CS5532 connected to a MUSE
    M1101-20#
    beam sensor
    'See Crystal CS5531/32/33/34 Datatasheet (Oct '99) page 38, figure 16,
    for
    connection setup
    '4/27/01

    dathi var word '16 bit high address
    datlo var word '16 bit low address
    x var word 'computed data value
    y var word
    y1 var nib
    y2 var nib
    y3 var nib
    y4 var nib

    SCLK con 15 ' ADC Clock
    SDO con 14 ' ADC Data output
    SDI con 13 ' ADC Data input
    CS con 12 ' Chip select
    p con 0

    high CS
    pause 50 'delay for crystal oscillator power
    up
    low CS
    gosub RESET
    gosub LCDINIT
    gosub CHIPINFO
    shiftout SDI,SCLK,1,[noparse][[/noparse]%00001011] 'read configuration register 1
    shiftin SDO,SCLK,0,[noparse][[/noparse]dathi\16,datlo\16]
    ' debug " CONFIG:",cr,"bits 31 to 16 ",bin16 dathi,cr,"bits 15 to 0
    ",bin16
    datlo,cr,cr

    dathi=%0000000000000000 'write channel setup register 1
    datlo=%0000000000000000
    shiftout SDI,SCLK,1,[noparse][[/noparse]%00000101,dathi\16,datlo\16]

    dathi=%0000000000000000 'write offset register 1
    datlo=%0000000000000000
    shiftout SDI,SCLK,1,[noparse][[/noparse]%00000001,dathi\16,datlo\16]

    dathi=%0000010000000000 'write gain register 1
    datlo=%0000000000000000
    shiftout SDI,SCLK,1,[noparse][[/noparse]%00000010,dathi\16,datlo\16]

    shiftout SDI,SCLK,1,[noparse][[/noparse]%00001101] 'read setup register 1
    shiftin SDO,SCLK,0,[noparse][[/noparse]dathi\16,datlo\16]
    ' debug " SETUP:",cr,"bits 31 to 16 ",bin16 dathi,cr,"bits 15 to 0
    ",bin16
    datlo,cr,cr

    shiftout SDI,SCLK,1,[noparse][[/noparse]%00001010] 'read gain register 1
    shiftin SDO,SCLK,0,[noparse][[/noparse]dathi\16,datlo\16]
    ' debug " GAIN:",cr,"bits 31 to 16 ",bin16 dathi,cr,"bits 15 to 0
    ",bin16
    datlo,cr,cr

    shiftout SDI,SCLK,1,[noparse][[/noparse]%11000000] 'contineous data conversion
    lcdout p,1,[noparse][[/noparse]"CIRRUS CS5532"]

    REPEAT
    shiftout SDI,SCLK,1,[noparse][[/noparse]%00000000]
    shiftin SDO,SCLK,0,[noparse][[/noparse]dathi\16,datlo\16]

    ' debug " DATA:",cr,"bits 31 to 0 ",bin16 dathi,cr,"bits 15 to 0
    ",bin16
    datlo,cr
    dathi=dathi<<8 'select bits 23 to 8 for
    measurement
    datlo=datlo>>8
    x=dathi+datlo
    debug " Voltage ",dec x," counts (bits 23/8)",cr,cr
    if x<38600 then over
    x=38600
    over:
    y=((38600-x)*2)/33 'convert to pounds
    x=y
    x=y/100
    y=(y-(x*100))
    lcdout p,192,[noparse][[/noparse]dec x,".",dec1 y," pounds "]
    pause 500
    goto REPEAT

    RESET 'initialize CS5532
    shiftout
    SDI,SCLK,1,[noparse][[/noparse]$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FE]
    dathi=%0010000000000000 'activate reset in
    configuration
    register
    datlo=%0000000000000000
    shiftout SDI,SCLK,1,[noparse][[/noparse]%00000011,dathi\16,datlo\16]
    return

    LCDINIT 'initialize LCD
    lcdcmd p,48 'set function
    pause 5
    lcdcmd p,48
    pause 1
    lcdcmd p,48
    pause 1
    lcdcmd p,32
    pause 1
    lcdcmd p,44
    pause 1
    lcdcmd p,8 'display off
    lcdcmd p,12 'display on
    lcdcmd p,6 'set mode
    return

    CHIPINFO
    lcdcmd p,1
    lcdout p,128,[noparse][[/noparse]" BASIC Stamp2P reads Cirrus Logic CS5532 "]
    for x=1 to 24
    pause 200
    lcdcmd p,24
    next
    pause 1000
    lcdcmd p,1
    return



    Do You Yahoo!?
    LAUNCH - Your Yahoo! Music Experience

    [noparse][[/noparse]Non-text portions of this message have been removed]


    To UNSUBSCRIBE, just send mail to:
    basicstamps-unsubscribe@yahoogroups.com
    from the same email address that you subscribed. Text in the Subject and
    Body of the message will be ignored.


    Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/



    To UNSUBSCRIBE, just send mail to:
    basicstamps-unsubscribe@yahoogroups.com
    from the same email address that you subscribed. Text in the Subject and Body of
    the message will be ignored.


    Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/




    Do You Yahoo!?
    LAUNCH - Your Yahoo! Music Experience

    [noparse][[/noparse]Non-text portions of this message have been removed]
Sign In or Register to comment.