Go Down

Topic: An adventure with ADXL325 sensor  (Read 305 times) previous topic - next topic

lajt

Hello everyone!

A few days ago I received a project/task from the university based on the ADXL325 as in the title. 
My first goal is to connect and run it, to get some (or any) output information.
I have tried to follow the instructions on: ADXL3xx, but with miserable effects (code below). The output is 695 for every axis.
I will appreciate every help and clues on how to get it working properly.
Thanks for any replies!

Code: [Select]
const int xpin = A3;                 
const int ypin = A2;                 
const int zpin = A1;                 

void setup() {
  // initialize the serial communications:
  Serial.begin(9600);
}

void loop() {
  // print the sensor values:
  Serial.print(analogRead(xpin));
  // print a tab between values:
  Serial.print("\t");
  Serial.print(analogRead(ypin));
  // print a tab between values:
  Serial.print("\t");
  Serial.print(analogRead(zpin));
  Serial.println();
  // delay before next reading:
  delay(500);
}

rtek1000

Did you notice that the example feeds the module through 2 arduino pins?

How is the module being fed?
Please avoid private messages, your question may be someone's answer in the future!

lajt

I did not notice that.
if this is what you are asking about, it's being fed by 3.3V.

jremington

#3
Oct 22, 2019, 03:56 pm Last Edit: Oct 22, 2019, 03:58 pm by jremington
You picked one of the worst possible tutorials, which suggests using a port pin as an analog ground. Really stupid idea!

Connect the real grounds instead.

You forgot to mention which Arduino you are using, but assuming it is a 5V Uno, "695 on every axis" means that the sensor analog outputs are all presenting about 3.3V.

lajt

I followed this tutorial as there is none about this sensor on the internet. Also that is why i am looking for help.
You are correct, i am using Uno 5V.
What about ground when this sensor does not have GND pin as the other ones?

jremington

#5
Oct 23, 2019, 12:12 am Last Edit: Oct 23, 2019, 12:14 am by jremington
The pins labeled COM are all ground (GND). Connect ST (self test) to GND and apply 3.3V power to the Vs pins.

If you are using a module with the sensor mounted, post a link to it.

If you are using the naked chip, I hope you have very carefully soldered all the connections, with no solder bridges or bad joints. You need a decoupling capacitor (typically 0.1 uF) between Vs and COM/GND, as close as possible to the chip.

lajt

Thanks for the info with GND.
I have such sensor as in the attachment.

jremington

#7
Oct 23, 2019, 05:51 pm Last Edit: Oct 23, 2019, 05:52 pm by jremington
Connect it correctly and let us know what happens.

If you run into trouble, make and post a hand-drawn wiring diagram of your setup.

lajt

#8
Nov 03, 2019, 10:05 pm Last Edit: Nov 03, 2019, 10:06 pm by lajt
Hi again after short break. I connected everything as adviced, analog reads of X Y Z axis are as follows: 391.00   390.00   357.00 (it changes a little bit, while tilting the sensor). Are these values correct? If yes, what should i do to procces this data ?

jremington

#9
Nov 04, 2019, 01:39 am Last Edit: Nov 04, 2019, 01:40 am by jremington
Sounds like it is working.

There are a number of tutorials on line showing how to use ADXL accelerometers with analog output.

Go Up