BX24 & ADXL202EB

Started by kjellosan January 5, 2005

Hi There

I am trying to learn how to do some ADC conversions, but nothing of
what I try seems to work.

Today I got an ADXL202EB (Analog Devices Accelerometer Evaluation
Board) which I try to connect to my BX24. There are two example
programs (DisplayAcceleration and DisplayAngle) that comes with the
BX24, so I thought this would be straight forward.

However, I have connected it as described in the documentation (
Ground to Pin23, +5V to pin21, X axis to 16 and Y axis to 15 ) and in
the example program, but when I run the displayangle program I get
one reading (225) whichever way I tilt the accelerometer. When I run
the displayacceleration program I get the value -3924 on both axis
whichever way I tilt it. I hope there are someone out there that can
help me or tell me what I am doing wrong.

Thank you

Kjellosan



It may be possible that in addition to "DisplayAcceleration.bas",
"DisplayAngle.bas" and "SerialPort.bas" programs, the programs
"Accelerometer.bas" and "MathUtilities.bas" be listed in the
"project files" of the Project menu" of the editor.
Check and see if they are there. If not, add them and re-compile.
I hope it is something as simple as that.

Best Regards, Eric

----- Original Message -----
From: kjellosan
To:
Sent: Wednesday, January 05, 2005 11:48 AM
Subject: [BasicX] BX24 & ADXL202EB

Hi There

I am trying to learn how to do some ADC conversions, but nothing of
what I try seems to work.

Today I got an ADXL202EB (Analog Devices Accelerometer Evaluation
Board) which I try to connect to my BX24. There are two example
programs (DisplayAcceleration and DisplayAngle) that comes with the
BX24, so I thought this would be straight forward.

However, I have connected it as described in the documentation (
Ground to Pin23, +5V to pin21, X axis to 16 and Y axis to 15 ) and in
the example program, but when I run the displayangle program I get
one reading (225) whichever way I tilt the accelerometer. When I run
the displayacceleration program I get the value -3924 on both axis
whichever way I tilt it. I hope there are someone out there that can
help me or tell me what I am doing wrong.

Thank you

Kjellosan



kjellosan wrote:

>Hi There
>
>I am trying to learn how to do some ADC conversions, but nothing of
>what I try seems to work.
>
>Today I got an ADXL202EB (Analog Devices Accelerometer Evaluation
>Board) which I try to connect to my BX24. There are two example
>programs (DisplayAcceleration and DisplayAngle) that comes with the
>BX24, so I thought this would be straight forward.
>
>However, I have connected it as described in the documentation (
>Ground to Pin23, +5V to pin21, X axis to 16 and Y axis to 15 ) and in
>the example program, but when I run the displayangle program I get
>one reading (225) whichever way I tilt the accelerometer. When I run
>the displayacceleration program I get the value -3924 on both axis
>whichever way I tilt it. I hope there are someone out there that can
>help me or tell me what I am doing wrong.
>
>Thank you
>
>Kjellosanb
How about simply testing with a voltmeter first? BX24 is expecting a
voltage between 0 and 5V. Also hook up a adjustable voltage divider and
see if you get the right kind of results using a simple program such as

Private Const PotPin As Byte = 13
Private Const WaitForHuman as Single = 0.5
Public Sub Main()
Do
Debug.Print CStr(GetAdc(PotPin))
Sleep(WaitForHuman)
Loop
End Sub

You should get an integer between 0 and 1023 that represents the
position of the potentiometer i.e. the voltage across pin 13.


Hi Mike,

Referring to the datasheet for the device at:
http://www.analog.com/UploadedFiles/Data_Sheets/53728567227477ADXL202E_a.pdf
and the datasheet for the test board at:
http://www.analog.com/UploadedFiles/Evaluation_Boards/Tools/246132389ADXL202EB_a.pdf
it is my understanding that the even though made by a company
called "Analog Devices", the device outputs its signals as
"digital" in PWM at logic voltage levels, so I don't think
that your suggestion to kjellosan to use BX-24 I/O pins in
A to D Converter (analog) mode will work. His question was
slightly confused by the mention of "ADC conversions" but
the app notes and .bas files are well commented. I think
he will be able to figure it out. It's not an easy device
to work with, but it can be done.

Best Regards, Eric
----- Original Message -----
From: Mike Perks
To:
Sent: Wednesday, January 05, 2005 7:17 PM
Subject: Re: [BasicX] BX24 & ADXL202EB kjellosan wrote:

>Hi There
>
>I am trying to learn how to do some ADC conversions, but nothing of
>what I try seems to work.
>
>Today I got an ADXL202EB (Analog Devices Accelerometer Evaluation
>Board) which I try to connect to my BX24. There are two example
>programs (DisplayAcceleration and DisplayAngle) that comes with the
>BX24, so I thought this would be straight forward.
>
>However, I have connected it as described in the documentation (
>Ground to Pin23, +5V to pin21, X axis to 16 and Y axis to 15 ) and in
>the example program, but when I run the displayangle program I get
>one reading (225) whichever way I tilt the accelerometer. When I run
>the displayacceleration program I get the value -3924 on both axis
>whichever way I tilt it. I hope there are someone out there that can
>help me or tell me what I am doing wrong.
>
>Thank you
>
>Kjellosanb

How about simply testing with a voltmeter first? BX24 is expecting a
voltage between 0 and 5V. Also hook up a adjustable voltage divider and
see if you get the right kind of results using a simple program such as

Private Const PotPin As Byte = 13
Private Const WaitForHuman as Single = 0.5
Public Sub Main()
Do
Debug.Print CStr(GetAdc(PotPin))
Sleep(WaitForHuman)
Loop
End Sub

You should get an integer between 0 and 1023 that represents the
position of the potentiometer i.e. the voltage across pin 13.




You are correct Eric - apologies my bad.

There are analog outputs on the device but the spec doesn't really
recommend using them.

I should have remembered that I even used the example code a few weeks
back as the basis of a simple frequency counter (I needed to check I
was getting 38KHz for IR). Here is my code to calculate the period
(1/frequency) of a signal based very heavily on the NetMedia sample code.

Public Function GetPeriod(ByVal PinX as Byte, ByVal NSamples as
Integer) as Single

' This function determines the average period
'
'
' <------ Period ----->
' +--------+ +----
' | | |
' ---+ +------------+
' <--T1--> <--- T3 --->

Dim SumT1 As Single, SumT3 As Single
Dim T1 As Single, T3 As Single, i As Integer
Dim AvgT1 As Single, AvgT3 As Single

SumT1 = 0.0
SumT3 = 0.0
For i = 1 to NSamples
Call PulseIn(PinX, 1, T1)
Call PulseIn(PinX, 0, T3)

SumT1 = SumT1 + T1
SumT3 = SumT3 + T3
Next
GetPeriod = (SumT1 +SumT3)/CSng(NSamples)

End Function
--- In , "eserdahl@" <eserdahl@p...> wrote:
> Hi Mike,
>
> Referring to the datasheet for the device at:
>
http://www.analog.com/UploadedFiles/Data_Sheets/53728567227477ADXL202E_a.pdf
> and the datasheet for the test board at:
>
http://www.analog.com/UploadedFiles/Evaluation_Boards/Tools/246132389ADXL202EB_a.pdf
> it is my understanding that the even though made by a company
> called "Analog Devices", the device outputs its signals as
> "digital" in PWM at logic voltage levels, so I don't think
> that your suggestion to kjellosan to use BX-24 I/O pins in
> A to D Converter (analog) mode will work. His question was
> slightly confused by the mention of "ADC conversions" but
> the app notes and .bas files are well commented. I think
> he will be able to figure it out. It's not an easy device
> to work with, but it can be done.
>
> Best Regards, Eric




--- In , "kjellosan" <basicX@j...> wrote:
>
> Hi There
>
> I am trying to learn how to do some ADC conversions, but nothing of
> what I try seems to work.
>
> Today I got an ADXL202EB (Analog Devices Accelerometer Evaluation
> Board) which I try to connect to my BX24. There are two example
> programs (DisplayAcceleration and DisplayAngle) that comes with the
> BX24, so I thought this would be straight forward.
>
> However, I have connected it as described in the documentation (
> Ground to Pin23, +5V to pin21, X axis to 16 and Y axis to 15 ) and
in
> the example program, but when I run the displayangle program I get
> one reading (225) whichever way I tilt the accelerometer. When I
run
> the displayacceleration program I get the value -3924 on both axis
> whichever way I tilt it. I hope there are someone out there that
can
> help me or tell me what I am doing wrong.
>
> Thank you
>
> Kjellosan




--- In , "kjellosan" <basicX@j...> wrote:
>
> Hi There
>
> I am trying to learn how to do some ADC conversions, but nothing of
> what I try seems to work.
>
> Today I got an ADXL202EB (Analog Devices Accelerometer Evaluation
> Board) which I try to connect to my BX24. There are two example
> programs (DisplayAcceleration and DisplayAngle) that comes with the
> BX24, so I thought this would be straight forward.
>
> However, I have connected it as described in the documentation (
> Ground to Pin23, +5V to pin21, X axis to 16 and Y axis to 15 ) and
in
> the example program, but when I run the displayangle program I get
> one reading (225) whichever way I tilt the accelerometer. When I
run
> the displayacceleration program I get the value -3924 on both axis
> whichever way I tilt it. I hope there are someone out there that
can
> help me or tell me what I am doing wrong.
>
> Thank you
>
> Kjellosan

Hi again

I still have problems getting this stuff to work. I am sorry but
after searching this forum thoroughly for adxl202( I am new to this
so I should have done this better in the first time).

I found out that to get analog signals I needed a 120K Ohm resistor
and two 0.10uF capacitors in place. After soldering in these I tried
again but it seems that I still get no variation in the signals.

The GetAdc() function now returns 1023 whichever way I tilt the board.

I have tried with a voltmeter, and from the X and Y pin (Pin D & C on
the EB) can read 3.9 Volt. It does not change when I tilt the board.

Have I burned the board ? Or does anybody have some clues ?

Thank you.
Kjellosan.




Kjellosan,

I understand the problem now. The C and D outputs from the ADXL202EB
are not analog voltages but are digital pulses. That means you need to
use PulseIn rather than GetADC to read from this device.

There is a very good example of how to use this device in the
documentation that comes with the BX-24. Look in the subdirectory
BX24_Docs\App_Notes for the file ADXL202_App_Note.pdf. Note that the C
and D outputs are directly connected to pins 16 and 17 on the BX-24.

There is also the program Accelerometer.bas in the Examples
subdirectory that is referenced by the application note. You should be
able to get this wokring in very quickly.

Mike
--- In , "kjellosan" <basicX@j...> wrote:
>
> --- In , "kjellosan" <basicX@j...> wrote:
> >
> > Hi There
> >
> > I am trying to learn how to do some ADC conversions, but nothing of
> > what I try seems to work.
> >
> > Today I got an ADXL202EB (Analog Devices Accelerometer Evaluation
> > Board) which I try to connect to my BX24. There are two example
> > programs (DisplayAcceleration and DisplayAngle) that comes with the
> > BX24, so I thought this would be straight forward.
> >
> > However, I have connected it as described in the documentation (
> > Ground to Pin23, +5V to pin21, X axis to 16 and Y axis to 15 ) and
> in
> > the example program, but when I run the displayangle program I get
> > one reading (225) whichever way I tilt the accelerometer. When I
> run
> > the displayacceleration program I get the value -3924 on both axis
> > whichever way I tilt it. I hope there are someone out there that
> can
> > help me or tell me what I am doing wrong.
> >
> > Thank you
> >
> > Kjellosan
>
> Hi again
>
> I still have problems getting this stuff to work. I am sorry but
> after searching this forum thoroughly for adxl202( I am new to this
> so I should have done this better in the first time).
>
> I found out that to get analog signals I needed a 120K Ohm resistor
> and two 0.10uF capacitors in place. After soldering in these I tried
> again but it seems that I still get no variation in the signals.
>
> The GetAdc() function now returns 1023 whichever way I tilt the board.
>
> I have tried with a voltmeter, and from the X and Y pin (Pin D & C on
> the EB) can read 3.9 Volt. It does not change when I tilt the board.
>
> Have I burned the board ? Or does anybody have some clues ?
>
> Thank you.
> Kjellosan.






Hi Mike

I have tried what you suggest before and I tried it again now, just
to make sure I didn't miss out something. Unfortunately I still get
no other readings than X: -3924 and Y: -3924.

I am out of ideas.

Kjellosan --- In , "basicx_austin" <basicx@a...> wrote:
>
> Kjellosan,
>
> I understand the problem now. The C and D outputs from the ADXL202EB
> are not analog voltages but are digital pulses. That means you need
to
> use PulseIn rather than GetADC to read from this device.
>
> There is a very good example of how to use this device in the
> documentation that comes with the BX-24. Look in the subdirectory
> BX24_Docs\App_Notes for the file ADXL202_App_Note.pdf. Note that
the C
> and D outputs are directly connected to pins 16 and 17 on the BX-24.
>
> There is also the program Accelerometer.bas in the Examples
> subdirectory that is referenced by the application note. You should
be
> able to get this wokring in very quickly.
>
> Mike
> --- In , "kjellosan" <basicX@j...> wrote:
> >
> > --- In , "kjellosan" <basicX@j...> wrote:
> > >
> > > Hi There
> > >
> > > I am trying to learn how to do some ADC conversions, but
nothing of
> > > what I try seems to work.
> > >
> > > Today I got an ADXL202EB (Analog Devices Accelerometer
Evaluation
> > > Board) which I try to connect to my BX24. There are two example
> > > programs (DisplayAcceleration and DisplayAngle) that comes with
the
> > > BX24, so I thought this would be straight forward.
> > >
> > > However, I have connected it as described in the documentation
(
> > > Ground to Pin23, +5V to pin21, X axis to 16 and Y axis to 15 )
and
> > in
> > > the example program, but when I run the displayangle program I
get
> > > one reading (225) whichever way I tilt the accelerometer. When
I
> > run
> > > the displayacceleration program I get the value -3924 on both
axis
> > > whichever way I tilt it. I hope there are someone out there
that
> > can
> > > help me or tell me what I am doing wrong.
> > >
> > > Thank you
> > >
> > > Kjellosan
> >
> > Hi again
> >
> > I still have problems getting this stuff to work. I am sorry but
> > after searching this forum thoroughly for adxl202( I am new to
this
> > so I should have done this better in the first time).
> >
> > I found out that to get analog signals I needed a 120K Ohm
resistor
> > and two 0.10uF capacitors in place. After soldering in these I
tried
> > again but it seems that I still get no variation in the signals.
> >
> > The GetAdc() function now returns 1023 whichever way I tilt the
board.
> >
> > I have tried with a voltmeter, and from the X and Y pin (Pin D &
C on
> > the EB) can read 3.9 Volt. It does not change when I tilt the
board.
> >
> > Have I burned the board ? Or does anybody have some clues ?
> >
> > Thank you.
> > Kjellosan.



Hi Kjellosan,

If the call to the float version of the procedure "PulseIn" times out,
then it returns 0.0 for "T1". If "T1" is 0.0 for all 20 calls, then
"SumX" = 0.0. If "SumX" is 0.0, then "T1X" is 0.0, because "SumX"/20 = 0.0.
If "T1X" is 0.0, then "Ax" = -0.5/0.125 = -4.0.

If "Ax" = -4.0, then "X:" = -4.0 * 981.0 = -3924 (integer) which is
what you say you are seeing from the "Debug.Print" lines.

Your "Rset" resistor should result in a duty cycle rep rate of around 1kHz
or T2 period of around 0.001 second = (1 ms)."PulseIn" times out in approx
71 ms, so the "Xout" pin may not have a signal on it. (I don't know why.)

You might take a look at using the "selftest" ST function and see if that
does anything. My only other suggestion at this point is to use an
oscilloscope to troubleshoot the circuitry.

Best Regards, Eric
----- Original Message -----
From: kjellosan
To:
Sent: Thursday, January 06, 2005 11:51 AM
Subject: [BasicX] Re: BX24 & ADXL202EB

Hi Mike

I have tried what you suggest before and I tried it again now, just
to make sure I didn't miss out something. Unfortunately I still get
no other readings than X: -3924 and Y: -3924.

I am out of ideas.

Kjellosan

--- In , "basicx_austin" <basicx@a...> wrote:
>
> Kjellosan,
>
> I understand the problem now. The C and D outputs from the ADXL202EB
> are not analog voltages but are digital pulses. That means you need
to
> use PulseIn rather than GetADC to read from this device.
>
> There is a very good example of how to use this device in the
> documentation that comes with the BX-24. Look in the subdirectory
> BX24_Docs\App_Notes for the file ADXL202_App_Note.pdf. Note that
the C
> and D outputs are directly connected to pins 16 and 17 on the BX-24.
>
> There is also the program Accelerometer.bas in the Examples
> subdirectory that is referenced by the application note. You should
be
> able to get this wokring in very quickly.
>
> Mike
> --- In , "kjellosan" <basicX@j...> wrote:
> >
> > --- In , "kjellosan" <basicX@j...> wrote:
> > >
> > > Hi There
> > >
> > > I am trying to learn how to do some ADC conversions, but
nothing of
> > > what I try seems to work.
> > >
> > > Today I got an ADXL202EB (Analog Devices Accelerometer
Evaluation
> > > Board) which I try to connect to my BX24. There are two example
> > > programs (DisplayAcceleration and DisplayAngle) that comes with
the
> > > BX24, so I thought this would be straight forward.
> > >
> > > However, I have connected it as described in the documentation
(
> > > Ground to Pin23, +5V to pin21, X axis to 16 and Y axis to 15 )
and
> > in
> > > the example program, but when I run the displayangle program I
get
> > > one reading (225) whichever way I tilt the accelerometer. When
I
> > run
> > > the displayacceleration program I get the value -3924 on both
axis
> > > whichever way I tilt it. I hope there are someone out there
that
> > can
> > > help me or tell me what I am doing wrong.
> > >
> > > Thank you
> > >
> > > Kjellosan
> >
> > Hi again
> >
> > I still have problems getting this stuff to work. I am sorry but
> > after searching this forum thoroughly for adxl202( I am new to
this
> > so I should have done this better in the first time).
> >
> > I found out that to get analog signals I needed a 120K Ohm
resistor
> > and two 0.10uF capacitors in place. After soldering in these I
tried
> > again but it seems that I still get no variation in the signals.
> >
> > The GetAdc() function now returns 1023 whichever way I tilt the
board.
> >
> > I have tried with a voltmeter, and from the X and Y pin (Pin D &
C on
> > the EB) can read 3.9 Volt. It does not change when I tilt the
board.
> >
> > Have I burned the board ? Or does anybody have some clues ?
> >
> > Thank you.
> > Kjellosan.


------
Yahoo! Groups Links

a.. To