Shop OBEX P1 Docs P2 Docs Learn Events
how to read the gforce from an accelerometer — Parallax Forums

how to read the gforce from an accelerometer

A12A12 Posts: 17
edited 2006-11-25 07:33 in BASIC Stamp
I am using the BS2p and have done a circuit for the ADC0834 to convert analog signals from the ADXL330 accelerometer to digital signals. The values are output to my computer screen directly (without any conversion) and these values, I presume, are the voltage sent out by the BS2p. Is this in mVolts?

These values keep jumping even when the accelerometer is stationary and the values do not make sense. does anyone know how to convert the volts to gforce. there doesn't seems to be a formula for this chip unlike the H4C3.

I tried moving the accelerometer to see how the values react, doesn't seems to have any pattern. My objective is to get the accelerometer to sense zero gforce (-9.81m/s^2) and the specifications for the ADXL330 says it is 1.5V for 0g. If thats the case, what will the output on my computer be?

Post Edited (A12) : 11/23/2006 11:07:54 AM GMT

Comments

  • FranklinFranklin Posts: 4,747
    edited 2006-11-23 17:54
    Show us you circuit and program code and we may be able to help.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • Roger PiersonRoger Pierson Posts: 62
    edited 2006-11-24 01:11
    Read this thread about the ADC0834:

    http://forums.parallax.com/showthread.php?p=613744

    I'm not sure what values you mean that are being sent to your screen, but if you are talking about the ADC then those values should be between 0 and 255 and they indicate the number of "units" the ADC is reading. With a 5 volt reference each unit is worth 19.5mv. (5v / 255 units).

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Roger Pierson
    Senior Electronics Technicain
    DTI Assoicates
  • A12A12 Posts: 17
    edited 2006-11-25 04:17


    HIGH CS
    DO
    GOSUB Acc
    LOOP···········································
    END

    Acc:

    · Channel=12
    · LOW CS
    · SHIFTOUT Din, CLK, MSBFIRST, [noparse][[/noparse]Channel\4]
    · Hold0:
    · IF IN2 = 0 THEN Hold0
    · SHIFTIN Dout, CLK, MSBPOST, [noparse][[/noparse]X_acc\8]
    · HIGH CS
    · PAUSE 200

    · Channel=14
    · LOW CS
    · SHIFTOUT Din, CLK, MSBFIRST, [noparse][[/noparse]Channel\4]
    · Hold1:
    · IF IN2 = 0 THEN Hold1
    · SHIFTIN Dout, CLK, MSBPOST, [noparse][[/noparse]Y_acc\8]
    · HIGH CS
    · PAUSE 200

    · Channel=13
    · LOW CS
    · SHIFTOUT Din, CLK, MSBFIRST, [noparse][[/noparse]Channel\4]
    · Hold2:
    · IF IN2 = 0 THEN Hold2
    · SHIFTIN Dout, CLK, MSBPOST, [noparse][[/noparse]Z_acc\8]
    · HIGH CS
    · PAUSE 200

    · X_acc = X_acc*195/10
    · Y_acc = Y_acc*195/10
    · Z_acc = Z_acc*195/10
    · DEBUG "X = ", DEC X_acc, CR, "Y = ", DEC Y_acc, CR, "Z = ", DEC Z_acc, CR, CR

    this is my program. my circuit is:
    Agnd, Dgnd, Vss, Channel 4·to common GND
    V+ (NC)
    Vdd and Vref to 5V
    CS, CLK, SARS, Din, Dout to 5 I/O pins on the basic stamp
    Channel 1,2,3 to ADXL330 axis X, Y, Z


    Ok, so lets say I convert the ADC readings by multiplying by 19.5mV, I will get the actual voltage (reading). and if it is 1.5V, that means 0g right?
    I still don't understand the readings output on my computer.
    the output from my program is (when the accelerometer is stationary):
    X = 58
    Y = 0
    Z = 0

    X = 78
    Y = 0
    Z = 19

    X = 58
    Y = 0
    Z = 0

    X = 78
    Y = 0
    Z = 19

    X = 58
    Y = 0
    Z = 0
  • Bill HenningBill Henning Posts: 6,445
    edited 2006-11-25 07:33
    A/D converters least significant bit is not reliable... you are probably looking at values "fluttering" right on the edge between two values. Keep a running average of the say last 4 readings, it will help.
Sign In or Register to comment.