GY-85 - A quick datasheet study - ADXL345 How it Works

Ғылым және технология

Let's show you how to code with arduino this fabulous board.
This time we focus on the accelerometer: ADXL345.
Take this twelve step by step! Welcome!
Let's connect it!
First Step) Go to arduino pinout and look for I2C pins:
SDA brown wire ARDUINO PIN A4
SCL green wire ARDUINO PIN A5
Second Step) And power pins:
3v3 red wire
GND white wire
Here is a fritzing schematic !
Third Step) Now open the ADXL345 datasheet for answer the following questions:
1 - Which device (address) are you interest in ? 2 - Which Register do you want to talk to ?
3 - What do you want the register to transmit? 4 - What do you want to ask about the specific register continuously ?
5 - Now wait for the data looping in a while …6 - Now how do you want the configuration of the three axes numbers?
The first three questions is going to be implement in the setup and the others in the loop. See:
Forth Step) Now Go towards the Register Map on ADXL345 datasheet and ...
...copy and paste from hexadecimal 33 to 37...
... in the code header; Cool!
Comment, logically!
Also put the register of interest: Power-saving features control. We deal with this register because the chip must be awoke!
This will be our guide to the x-axis.
The other axes (y and z) will be easy. You will only need
to repeat the following procedure. It’s easy, see!
Fifth Step) To work with the i2c protocol let's use the official arduino library: wire.
#include Wire.h on top.
Take the opportunity to initialize it along with the serial interface. Do not forget a delay, okay? Cool!
Sixth step) Now let's define the registers and the returned axes;
Also add the variables to work with the x-axis, two for the returned data and one to compose a float number.
Seventh Step) Now this is the question two - Which Register do you want to talk to ? template from now on: (Once in setup and others for each axis, x, y, and z)
In our example, let's shorten and implement only the x-axis, okay?
And on loop too:
Eight Step) Beauty, we're almost done ... in the setup implement the first three questions:
1 - Which device address are you interest in ?
2 - Which Register do you want to talk to ?
3 - What do you want to transmit?
Ninth Step) in the loop, The question number four:
What do you want to ask about the specific register continuously ?
Tenth Step) The question number five:
Now ask and wait for the data looping in a while ...
Eleventh Step) And finally, the last question:
6 - Now how do you want the configuration of the three axes numbers ?
Twelfth Step) Ready, now just print on the serial, for now ....
The loop procedure is repeated for each axis. Now it's your turn, I'll leave it to you. In my github you can compare the your complete code with mine!
See now, the program running on arduino ....

Пікірлер: 6

  • @starlingwatch3921
    @starlingwatch39215 жыл бұрын

    Thank you for the good tutorial! -Frank

  • @j3_

    @j3_

    5 жыл бұрын

    Hi, STARLING Watch o/ You are welcome!

  • @juprianusrusman2428
    @juprianusrusman24284 жыл бұрын

    Dear Sir,, I'm new to use ADXL345 and i found very nice tutorial like this... However, i want to ask.? "x = DataModified_x_out / 256.0;" what is the meaning of 256.0 ? Thanks...

  • @j3_

    @j3_

    4 жыл бұрын

    Hi, @Juprianus Rusman , It is the sensitivity of ADXL345 output that is typically 256 LSB/g. see details: medium.com/jungletronics/gy-85-a-quick-datasheet-study-79019bb36fbf

  • @abangpoyo8935
    @abangpoyo89356 жыл бұрын

    I think i have hear ur voice from somewhere, I think in the Game like Csgo or Pubg ... It is?

  • @j3_

    @j3_

    6 жыл бұрын

    I really like csgo and Pubg! They are cutting-edge rendering & awesome 3d-experience. Can you say from what player my voice looks like?

Келесі