Shop OBEX P1 Docs P2 Docs Learn Events
ADXL202eb Revisited — Parallax Forums

ADXL202eb Revisited

ArchiverArchiver Posts: 46,084
edited 2001-05-31 17:51 in General Discussion
Should the adxl202 be able to measure gravitational tilt in a stationary
application?

I just received my evaluation board and wired it according to the basic
stamp app notes from Analog device, with the exception of using the vdd and
ground pins of the stamp to power the device instead of using a high and low
pin like their notes suggest. I wouldn't think this would make a difference.
The only way I can get any type of reading at all is when I gently tap the
sensor. I would like to use this device as a tilt sensor in a dynamic
leveling device. (controlling hydraulic solenoids through the stamp and some
relays) I have a little confusion about part of the code on the app notes
concerning the line that reads "count 8,1,freq". My x and y axis inputs
are connected to pin 13 and 14 respectively and I suspect that I should be
counting the number of pulses coming from either one of those inputs. The
App notes have the x and y outputs of the 202 connected to pins 5 and 4 on
the stamp. Help! Do I need to change the values of the capacitors?

Thank in Advance,

Jeff

freq var word
t1x var word
t1y var word
t2 var word

input 13
input 14
low 15

count 8,500,freq

t2=25000/(freq/20)

t1_loop:
pulsin 14,1,t1y
t1y=2*t1y
pulsin 13,1,t1x
t1x=2*t1x
pause 100
debug ? t1x, cr,cr
debug ? t1y, cr,cr
goto t1_loop

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2001-05-30 17:11
    OK so I was brain dead for a moment....

    I forgot to add the r1 resistor to the chip. D'oh

    Now the problem is totally erratic numbers. I assume this is just noise.
    How should I go about filtering the results from this device?

    Any and all advise will be appreciated.

    Thanks again.
  • ArchiverArchiver Posts: 46,084
    edited 2001-05-30 17:42
    Try this:

    T1x var byte
    T1y var byte
    T2 var byte
    Xaxis con 3
    Yaxis con 2

    pulsin Xaxis,1,T1x
    pulsin Yaxis,1,T1y
    T1x = 8 * T1x / T2
    T1y = 8 * T1y / T2
    debug dec T1x, tab, dec T1y, cr

    This will work as a tilt sensor.

    I hope this helps.

    - Brice


    > Should the adxl202 be able to measure gravitational tilt in a
    stationary
    > application?
    >
    > I just received my evaluation board and wired it according to the
    basic
    > stamp app notes from Analog device, with the exception of using the
    vdd and
    > ground pins of the stamp to power the device instead of using a
    high and low
    > pin like their notes suggest. I wouldn't think this would make a
    difference.
    > The only way I can get any type of reading at all is when I gently
    tap the
    > sensor. I would like to use this device as a tilt sensor in a
    dynamic
    > leveling device. (controlling hydraulic solenoids through the stamp
    and some
    > relays) I have a little confusion about part of the code on the
    app notes
    > concerning the line that reads "count 8,1,freq". My x and y axis
    inputs
    > are connected to pin 13 and 14 respectively and I suspect that I
    should be
    > counting the number of pulses coming from either one of those
    inputs. The
    > App notes have the x and y outputs of the 202 connected to pins 5
    and 4 on
    > the stamp. Help! Do I need to change the values of the capacitors?
    >
    > Thank in Advance,
    >
    > Jeff
    >
    > freq var word
    > t1x var word
    > t1y var word
    > t2 var word
    >
    > input 13
    > input 14
    > low 15
    >
    > count 8,500,freq
    >
    > t2%000/(freq/20)
    >
    > t1_loop:
    > pulsin 14,1,t1y
    > t1y=2*t1y
    > pulsin 13,1,t1x
    > t1x=2*t1x
    > pause 100
    > debug ? t1x, cr,cr
    > debug ? t1y, cr,cr
    > goto t1_loop
    >
    >
    >
    >
    > To UNSUBSCRIBE, just send mail to:
    > basicstamps-unsubscribe@yahoogroups.com
    > from the same email address that you subscribed with. 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 2001-05-30 19:15
    Thanks for the code Brice.

    In your example, where does T2 get it's value?



    Jeff


    Original Message
    From: Brice D. Hornback <bdh@c...>
    To: <basicstamps@yahoogroups.com>
    Sent: Wednesday, May 30, 2001 12:42 PM
    Subject: Re: [noparse][[/noparse]basicstamps] ADXL202eb Revisited


    > Try this:
    >
    > T1x var byte
    > T1y var byte
    > T2 var byte
    > Xaxis con 3
    > Yaxis con 2
    >
    > pulsin Xaxis,1,T1x
    > pulsin Yaxis,1,T1y
    > T1x = 8 * T1x / T2
    > T1y = 8 * T1y / T2
    > debug dec T1x, tab, dec T1y, cr
    >
    > This will work as a tilt sensor.
    >
    > I hope this helps.
    >
    > - Brice
    >
    >
    > > Should the adxl202 be able to measure gravitational tilt in a
    > stationary
    > > application?
    > >
    > > I just received my evaluation board and wired it according to the
    > basic
    > > stamp app notes from Analog device, with the exception of using the
    > vdd and
    > > ground pins of the stamp to power the device instead of using a
    > high and low
    > > pin like their notes suggest. I wouldn't think this would make a
    > difference.
    > > The only way I can get any type of reading at all is when I gently
    > tap the
    > > sensor. I would like to use this device as a tilt sensor in a
    > dynamic
    > > leveling device. (controlling hydraulic solenoids through the stamp
    > and some
    > > relays) I have a little confusion about part of the code on the
    > app notes
    > > concerning the line that reads "count 8,1,freq". My x and y axis
    > inputs
    > > are connected to pin 13 and 14 respectively and I suspect that I
    > should be
    > > counting the number of pulses coming from either one of those
    > inputs. The
    > > App notes have the x and y outputs of the 202 connected to pins 5
    > and 4 on
    > > the stamp. Help! Do I need to change the values of the capacitors?
    > >
    > > Thank in Advance,
    > >
    > > Jeff
    > >
    > > freq var word
    > > t1x var word
    > > t1y var word
    > > t2 var word
    > >
    > > input 13
    > > input 14
    > > low 15
    > >
    > > count 8,500,freq
    > >
    > > t2%000/(freq/20)
    > >
    > > t1_loop:
    > > pulsin 14,1,t1y
    > > t1y=2*t1y
    > > pulsin 13,1,t1x
    > > t1x=2*t1x
    > > pause 100
    > > debug ? t1x, cr,cr
    > > debug ? t1y, cr,cr
    > > goto t1_loop
    > >
    > >
    > >
    > >
    > > To UNSUBSCRIBE, just send mail to:
    > > basicstamps-unsubscribe@yahoogroups.com
    > > from the same email address that you subscribed with. 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 with. 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 2001-05-30 19:39
    Ooops... sorry... I cut out a bunch of stuff for my LCD display and
    RF Transmitter and missed that part. Here it is again:

    ************************
    '{$Stamp BS2}
    ' ADXL202 TEST
    ************************

    T1x var byte
    T1y var byte
    T2 var byte
    Xaxis con 3
    Yaxis con 2

    Count 3, 250, T2
    T2=250/(T2/5)

    MAIN:
    debug cls
    pulsin Xaxis,1,T1x
    pulsin Yaxis,1,T1y
    T1x = 8 * T1x / T2
    T1y = 8 * T1y / T2
    debug dec T1x, tab, dec T1y, cr
    pause 100
    goto MAIN
    ************************

    Try that. If it doesn't work, I'll rewrite it and TEST it when I get
    home from work. Please let me know...

    Later,
    Brice

    > Thanks for the code Brice.
    >
    > In your example, where does T2 get it's value?
    >
    >
    >
    > Jeff
    >
    >
    >
    Original Message
    > From: Brice D. Hornback <bdh@c...>
    > To: <basicstamps@yahoogroups.com>
    > Sent: Wednesday, May 30, 2001 12:42 PM
    > Subject: Re: [noparse][[/noparse]basicstamps] ADXL202eb Revisited
    >
    >
    > > Try this:
    > >
    > > T1x var byte
    > > T1y var byte
    > > T2 var byte
    > > Xaxis con 3
    > > Yaxis con 2
    > >
    > > pulsin Xaxis,1,T1x
    > > pulsin Yaxis,1,T1y
    > > T1x = 8 * T1x / T2
    > > T1y = 8 * T1y / T2
    > > debug dec T1x, tab, dec T1y, cr
    > >
    > > This will work as a tilt sensor.
    > >
    > > I hope this helps.
    > >
    > > - Brice
    > >
    > >
    > > > Should the adxl202 be able to measure gravitational tilt in a
    > > stationary
    > > > application?
    > > >
    > > > I just received my evaluation board and wired it according to
    the
    > > basic
    > > > stamp app notes from Analog device, with the exception of using
    the
    > > vdd and
    > > > ground pins of the stamp to power the device instead of using a
    > > high and low
    > > > pin like their notes suggest. I wouldn't think this would make a
    > > difference.
    > > > The only way I can get any type of reading at all is when I
    gently
    > > tap the
    > > > sensor. I would like to use this device as a tilt sensor in a
    > > dynamic
    > > > leveling device. (controlling hydraulic solenoids through the
    stamp
    > > and some
    > > > relays) I have a little confusion about part of the code on the
    > > app notes
    > > > concerning the line that reads "count 8,1,freq". My x and y
    axis
    > > inputs
    > > > are connected to pin 13 and 14 respectively and I suspect that I
    > > should be
    > > > counting the number of pulses coming from either one of those
    > > inputs. The
    > > > App notes have the x and y outputs of the 202 connected to pins
    5
    > > and 4 on
    > > > the stamp. Help! Do I need to change the values of the
    capacitors?
    > > >
    > > > Thank in Advance,
    > > >
    > > > Jeff
    > > >
    > > > freq var word
    > > > t1x var word
    > > > t1y var word
    > > > t2 var word
    > > >
    > > > input 13
    > > > input 14
    > > > low 15
    > > >
    > > > count 8,500,freq
    > > >
    > > > t2%000/(freq/20)
    > > >
    > > > t1_loop:
    > > > pulsin 14,1,t1y
    > > > t1y=2*t1y
    > > > pulsin 13,1,t1x
    > > > t1x=2*t1x
    > > > pause 100
    > > > debug ? t1x, cr,cr
    > > > debug ? t1y, cr,cr
    > > > goto t1_loop
    > > >
    > > >
    > > >
    > > >
    > > > To UNSUBSCRIBE, just send mail to:
    > > > basicstamps-unsubscribe@yahoogroups.com
    > > > from the same email address that you subscribed with. 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 with. 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 with. 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 2001-05-31 06:25
    Did that work for you?

    - Brice

    Original Message
    From: Brice D. Hornback <bdh@c...>
    To: <basicstamps@yahoogroups.com>
    Sent: Wednesday, May 30, 2001 1:39 PM
    Subject: Re: [noparse][[/noparse]basicstamps] ADXL202eb Revisited


    Ooops... sorry... I cut out a bunch of stuff for my LCD display and
    RF Transmitter and missed that part. Here it is again:

    ************************
    '{$Stamp BS2}
    ' ADXL202 TEST
    ************************

    T1x var byte
    T1y var byte
    T2 var byte
    Xaxis con 3
    Yaxis con 2

    Count 3, 250, T2
    T2=250/(T2/5)

    MAIN:
    debug cls
    pulsin Xaxis,1,T1x
    pulsin Yaxis,1,T1y
    T1x = 8 * T1x / T2
    T1y = 8 * T1y / T2
    debug dec T1x, tab, dec T1y, cr
    pause 100
    goto MAIN
    ************************

    Try that. If it doesn't work, I'll rewrite it and TEST it when I get
    home from work. Please let me know...

    Later,
    Brice

    > Thanks for the code Brice.
    >
    > In your example, where does T2 get it's value?
    >
    >
    >
    > Jeff
    >
    >
    >
    Original Message
    > From: Brice D. Hornback <bdh@c...>
    > To: <basicstamps@yahoogroups.com>
    > Sent: Wednesday, May 30, 2001 12:42 PM
    > Subject: Re: [noparse][[/noparse]basicstamps] ADXL202eb Revisited
    >
    >
    > > Try this:
    > >
    > > T1x var byte
    > > T1y var byte
    > > T2 var byte
    > > Xaxis con 3
    > > Yaxis con 2
    > >
    > > pulsin Xaxis,1,T1x
    > > pulsin Yaxis,1,T1y
    > > T1x = 8 * T1x / T2
    > > T1y = 8 * T1y / T2
    > > debug dec T1x, tab, dec T1y, cr
    > >
    > > This will work as a tilt sensor.
    > >
    > > I hope this helps.
    > >
    > > - Brice
    > >
    > >
    > > > Should the adxl202 be able to measure gravitational tilt in a
    > > stationary
    > > > application?
    > > >
    > > > I just received my evaluation board and wired it according to
    the
    > > basic
    > > > stamp app notes from Analog device, with the exception of using
    the
    > > vdd and
    > > > ground pins of the stamp to power the device instead of using a
    > > high and low
    > > > pin like their notes suggest. I wouldn't think this would make a
    > > difference.
    > > > The only way I can get any type of reading at all is when I
    gently
    > > tap the
    > > > sensor. I would like to use this device as a tilt sensor in a
    > > dynamic
    > > > leveling device. (controlling hydraulic solenoids through the
    stamp
    > > and some
    > > > relays) I have a little confusion about part of the code on the
    > > app notes
    > > > concerning the line that reads "count 8,1,freq". My x and y
    axis
    > > inputs
    > > > are connected to pin 13 and 14 respectively and I suspect that I
    > > should be
    > > > counting the number of pulses coming from either one of those
    > > inputs. The
    > > > App notes have the x and y outputs of the 202 connected to pins
    5
    > > and 4 on
    > > > the stamp. Help! Do I need to change the values of the
    capacitors?
    > > >
    > > > Thank in Advance,
    > > >
    > > > Jeff
    > > >
    > > > freq var word
    > > > t1x var word
    > > > t1y var word
    > > > t2 var word
    > > >
    > > > input 13
    > > > input 14
    > > > low 15
    > > >
    > > > count 8,500,freq
    > > >
    > > > t2%000/(freq/20)
    > > >
    > > > t1_loop:
    > > > pulsin 14,1,t1y
    > > > t1y=2*t1y
    > > > pulsin 13,1,t1x
    > > > t1x=2*t1x
    > > > pause 100
    > > > debug ? t1x, cr,cr
    > > > debug ? t1y, cr,cr
    > > > goto t1_loop
    > > >
    > > >
    > > >
    > > >
    > > > To UNSUBSCRIBE, just send mail to:
    > > > basicstamps-unsubscribe@yahoogroups.com
    > > > from the same email address that you subscribed with. 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 with. 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 with. 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 with. 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 2001-05-31 17:51
    Thanks Brice. The code worked fine and when I added the appropriate
    capacitors the readings settled down nicely. As a matter of fact the code
    works well enough for my purposes without the T2 section; I was just curious
    where you were getting duty cycle info from. Thanks again.

    Jeff
    Original Message
    From: Brice D. Hornback <bdh@c...>
    To: <basicstamps@yahoogroups.com>
    Sent: Thursday, May 31, 2001 1:25 AM
    Subject: Re: [noparse][[/noparse]basicstamps] ADXL202eb Revisited


    > Did that work for you?
    >
    > - Brice
    >
    >
    Original Message
    > From: Brice D. Hornback <bdh@c...>
    > To: <basicstamps@yahoogroups.com>
    > Sent: Wednesday, May 30, 2001 1:39 PM
    > Subject: Re: [noparse][[/noparse]basicstamps] ADXL202eb Revisited
    >
    >
    > Ooops... sorry... I cut out a bunch of stuff for my LCD display and
    > RF Transmitter and missed that part. Here it is again:
    >
    > ************************
    > '{$Stamp BS2}
    > ' ADXL202 TEST
    > ************************
    >
    > T1x var byte
    > T1y var byte
    > T2 var byte
    > Xaxis con 3
    > Yaxis con 2
    >
    > Count 3, 250, T2
    > T2=250/(T2/5)
    >
    > MAIN:
    > debug cls
    > pulsin Xaxis,1,T1x
    > pulsin Yaxis,1,T1y
    > T1x = 8 * T1x / T2
    > T1y = 8 * T1y / T2
    > debug dec T1x, tab, dec T1y, cr
    > pause 100
    > goto MAIN
    > ************************
    >
    > Try that. If it doesn't work, I'll rewrite it and TEST it when I get
    > home from work. Please let me know...
    >
    > Later,
    > Brice
    >
    > > Thanks for the code Brice.
    > >
    > > In your example, where does T2 get it's value?
    > >
    > >
    > >
    > > Jeff
    > >
    > >
    > >
    Original Message
    > > From: Brice D. Hornback <bdh@c...>
    > > To: <basicstamps@yahoogroups.com>
    > > Sent: Wednesday, May 30, 2001 12:42 PM
    > > Subject: Re: [noparse][[/noparse]basicstamps] ADXL202eb Revisited
    > >
    > >
    > > > Try this:
    > > >
    > > > T1x var byte
    > > > T1y var byte
    > > > T2 var byte
    > > > Xaxis con 3
    > > > Yaxis con 2
    > > >
    > > > pulsin Xaxis,1,T1x
    > > > pulsin Yaxis,1,T1y
    > > > T1x = 8 * T1x / T2
    > > > T1y = 8 * T1y / T2
    > > > debug dec T1x, tab, dec T1y, cr
    > > >
    > > > This will work as a tilt sensor.
    > > >
    > > > I hope this helps.
    > > >
    > > > - Brice
    > > >
    > > >
    > > > > Should the adxl202 be able to measure gravitational tilt in a
    > > > stationary
    > > > > application?
    > > > >
    > > > > I just received my evaluation board and wired it according to
    > the
    > > > basic
    > > > > stamp app notes from Analog device, with the exception of using
    > the
    > > > vdd and
    > > > > ground pins of the stamp to power the device instead of using a
    > > > high and low
    > > > > pin like their notes suggest. I wouldn't think this would make a
    > > > difference.
    > > > > The only way I can get any type of reading at all is when I
    > gently
    > > > tap the
    > > > > sensor. I would like to use this device as a tilt sensor in a
    > > > dynamic
    > > > > leveling device. (controlling hydraulic solenoids through the
    > stamp
    > > > and some
    > > > > relays) I have a little confusion about part of the code on the
    > > > app notes
    > > > > concerning the line that reads "count 8,1,freq". My x and y
    > axis
    > > > inputs
    > > > > are connected to pin 13 and 14 respectively and I suspect that I
    > > > should be
    > > > > counting the number of pulses coming from either one of those
    > > > inputs. The
    > > > > App notes have the x and y outputs of the 202 connected to pins
    > 5
    > > > and 4 on
    > > > > the stamp. Help! Do I need to change the values of the
    > capacitors?
    > > > >
    > > > > Thank in Advance,
    > > > >
    > > > > Jeff
    > > > >
    > > > > freq var word
    > > > > t1x var word
    > > > > t1y var word
    > > > > t2 var word
    > > > >
    > > > > input 13
    > > > > input 14
    > > > > low 15
    > > > >
    > > > > count 8,500,freq
    > > > >
    > > > > t2%000/(freq/20)
    > > > >
    > > > > t1_loop:
    > > > > pulsin 14,1,t1y
    > > > > t1y=2*t1y
    > > > > pulsin 13,1,t1x
    > > > > t1x=2*t1x
    > > > > pause 100
    > > > > debug ? t1x, cr,cr
    > > > > debug ? t1y, cr,cr
    > > > > goto t1_loop
    > > > >
    > > > >
    > > > >
    > > > >
    > > > > To UNSUBSCRIBE, just send mail to:
    > > > > basicstamps-unsubscribe@yahoogroups.com
    > > > > from the same email address that you subscribed with. 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 with. 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 with. 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 with. 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 with. 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/
    >
    >
Sign In or Register to comment.