Arduino #13 - 3 axis Accelerometer ADXL 345 - Robots, Quadcopters, etc.
Ғылым және технология
Arduino tutorial #13 - Using the triple axis ADXL345 Accelerometer Module.
In this tutorial we dive right into the Wire library through which we communicate to the ADXL345 module over the I2C protocol. I explain how to wire and how to program the module in order to get the readings from the three axis and display them over the serial port. This setup is extremely useful in modern gadgets and can be reapplied in Robotics, Quad rotors, CNS machines and other devices.
Get in touch:
Facebook: / eeenthusiast
Twitter: / ee_enthusiast
Website: eeenthusiast.com
Store Website: staticjolt.com
Personal website: vladromanov.com
Relevant Links:
Datasheet: www.analog.com/media/en/techni...
Relevant Terms:
ADXL345
ADXL345 tutorial
Accelerometer Module
ADXL Module
Arduino ADXL guide
triple axis accelerometer
3-axis accelerometer
Gyroscope
Gyro
Пікірлер: 158
I thought the video was, well thought out and implemented. It was a joy to watch, thanks.
great explanatory video, the step by step walk-through made things very clear!
Very clear detailed and focused tutorial,Thanks a lot Sir..
Well Done!! Great detail walking through the code. Thank You
Accellerometer measures force acting on the object so the z is actually pointing down and force that it measures points up when object is steady on a surface (it actually measures the static force applied by the surface). You can check by movement. X is front, y is right and z is down.
OOOOWWWWWW ! Thank you very much! Thanks to you I did not burn another device.
Great tutorial m8! Saved me a lot of time! :)
Great video, thank you.
great video buddy
Great video! Can anyone tell me why you're using 5v? All the documentation I've read for the ADXL345 tells me 3.6v is the maximum input.
can i connect the ADXL 345 to arduino uno using wireless conection?? planning to build my project and i want to use the acclerometer in my wireless controller
Thanks for posting this. I'm still trying to get mine to output anything. The SDO pin should also be pulled high (or low) according to the datasheet. The ALT ADDRESS (SDO) pin be connected to either VDD I/O or GND when using I2C.
@FlyMeAirplane
8 жыл бұрын
Turns out the first one I purchased was evidently bad because the second one worked as advertised. Thanks again for the video!
i am working with MMA 7660FC accelerometer and i got the values but not changing the axis values when moving the sensor . can help me ? what is the problem can give any suggestions?
Thanks alot! Great video! But this gives orientation and I want the XYZ forces... How can the code be modified for this??
Superb video once again. what range have we set +-16g, +-8g, +-4g or +-2g??? how can i change this range ?
Thank you
Hey sir, nice tutorial. Is it necessary to use a resistors on the diagram? What will happen if we dont use the resistor? Thanks before.
Big Like :) thanks but i want to ask some thing isn't the auto sleep bit is zero by defult ? ie:disabled by defult ?
Thank you very much great video! Maybe you can help me understand why randomly the printf (meaning all the data stream) just stops coming in?? The communication just stop and when i reset the power it sometimes restart the code sometimes not. When i pull out and and back in the SDL or SCL also sometimes helps and restart the code. I double checked the set up, i used the same resistors as you .. Hope you can help me out thanks!
Hi, i need help on how to use 2 accelerometer on a arduino mega. i tried pluck in both to the SDA and SCL ports. but their readings add up together, how do i see each accelerometer readings individually?
can it be used for vibration analysis ?
Hello, thank you for this Tuto. I need to mesure a linear acceleration from a objet that will move from a point A to point B. Do you think this sensor will fit for my needs? It seems all accelerometers I have seen so far only measures angular accelerations.
what about the ADXL345 board , is it the same setting ? is there any data sheet for this
Hello, first of all great video! I have bouth this same accelerometer yesterday and was abble to make the circuit and type the program thanks to your video. But i have the problem that i do not receive any data from it. My X Y Z axis stay at zero, do you have an idea what is cosing this? Thanks,
can u explain more why you used 16 and 8 for 0x2D?
why do you need to pull up both i2c connections? also, does it matter what resistor is used?
hey mr. how can we write 16 to toggel d3 & write 8 to go into sleep mode. it dsnt make any sense plz could u explin this ??also the output
what are the units of the values ? and the maximum range of values, in order to convert it to N/m ?
Hello! Can this Arduino with Accelerometer readings(output) be read in the Labview wave form program? Thanks!!
Write(16) is D4 not D3, Write(8) is D3, not sleep. The x,y,z calcs convert 2 8 bit bytes to a 16 bit word also btw.
@beuleamkopf
7 жыл бұрын
Depends on LSB first or MSB first.
@onurolce
6 жыл бұрын
Atmel ve PIC microcontrollers works MSB first. And that register also MSB. So Wilksey37 has right.
If you use digitalWrite instead of wire.write will the data be sent to the digital output to control an object?
i want to measure distance using this , what r the changes should i make in coding.
is there any way you can output 8 bit value from accelerometer? like from lsm303. I know the code from library will always output 16bit, but i want to lessen it to 8 bit.
sir i am getting 0 0 0 as output.......though there are no loose connections......plz help me
how to use ADXL345 to measure dynamic acceleration. I have gone through datasheet but not understanding. I'm working on accident detection. please help
Hi! Can you explain how i can transform those number in real acceleration values?
sorry, another question: how can i control servomotors with this?
Hi, could I use this on a vehicle to activate the brake light's when it senses the vehicle slowing down
Do we need to install any libraries?
my Z axis only changes values upon shifting the sensor X and Y axis remain same
Why are there figures for the x,y,z when the module is at rest? Should they not be 0,0,0?
@aleximylearanton4712
4 жыл бұрын
He hasn’t calibrated it yet
+EEEnthusiast i need some help. i have two motors that i need to control, i.e. if i move sensor towards right then it should turn right motor. i studied your values but confused to detect in which direction sensor is rotating
Great explanation! Thanks from Argentina. Can you help me? How can i change the sensibility of the accelerometer module to +-16 or +-8g?
@jeffreydijkstra3391
3 жыл бұрын
With the registers
i gone through the code but still got 0,0,0 as output can u help me
Hy EEEnthusiast! I have a bike (motorcycle) and I love doing wheelies. The thing is that at night the headlight lights up into the air and might not be seen by upcoming traffic. I thought that I can fit some COB lights underneath the bike and in any various places that will have a strobe effect and that they turn on every time the bike goes up in the air :D I bought a Digispark and this gyroscope trying to start this project, but I don't know anything about codes whatsoever. At the end of the video you are saying that if we have any questions, we shoulf post them. So my question is: are going to help me fulfill this awesome job that it will end up? :D Thank you master!
can I know the minimum and maximum tolerance I can get from these accelorometer
does it have adjustable adress? I need to connect more to same i2c bus
thanks a lot
what are the range of values that x , y & z can take??
@basedonprinciple
5 жыл бұрын
-/+ 16g
how we can set the range +-16g, +-8g, +-4g or +-2g??? how can i change this range ?
Why do you need the 20k pullup resistors on SDA and SCL? I thought they are allready pulled-up by 4.7k resistors that are surface mounted on the board. Checking other videos using this module they don't hook up any pullup resistors the way you do it
@basedonprinciple
5 жыл бұрын
Depending on the breakout board some of them have the pull-up resistors and others don't (for example the sparkfun ADXL345 doesn't have the pull-ups, whereas I think the Adafruit does.)
Which pins are known as cuz axis in it
hello guys, can you tell me what units are in the screen of monitor? it means, what i seeing? grades? mph?
Please, do you have an idea about how to connect the Arduino and accelerometer using Bluetooth connection?
can adxl345 sensor be simulated in proteus?
thanks.but how to calibrate the accelerometer ?
how to use this output as input of mouse to a desktop
I want to replace 345 with 335, but the pins are different
hello. i have done the same connections as shown in video and checked many times. Also, I have written the same code and yet it is showing zero output when uploaded. IF anyone can help, it would be great
@ EEEnthusiast May I know the values of pull up resistors you had used in here ?
@parthsachdeva120
Ай бұрын
220 ohm according to colorcode used in the diagram
can i have a link to this program ??
So, I want my robot to make controlled turns ( i.e turn to a specific angle and stop). What should I use acclerometer or gyroscope? Until now, I assumed gyro, but seeing this tut, I observed that the accelerometer is showing the angles w.r.t the axis ( i think it was that ) and wondered if this is what i need?
@jeffreydijkstra3391
3 жыл бұрын
with the accelero you can measure gravity's G force, so you can measure the angle its standing at.
Have used 3 axis gyro
Im only recieving positive values? Any clue why? If the raw data goes below 0, it jumps to 65000, but that would be 16 bits? However the resolution is 12bits maximum
Can this be made into a switch?
Can you help me In order to write code Arduino adxl 345 led for projet bad sitting posture detection
Your uno has internal pullup possibility...
Can u send me the library and the code please?? I need them urgently cz none of the existing ones on the net are working with me
How much Ohm do I need?
Hello! Nice tutorial. I wanted to ask, are this accelerometer values filtered or are they raw?
@EEEnthusiast
8 жыл бұрын
+Gyakobo Andy Thank you for the comment! They are raw values.
You could TEACH IN A CONTROL WITH CONTROLLING MPU 6050 02 ENGINES EX : WHEN THE CENTER IS THERE A MINIMUM ROTATION OF TWO ENGINES ..... IF YOU ARE IN - ( LESS ) BEGINS TURNING STRONGER A MOTOR ..... IF IN TURNS ++ STRONGER ANOTHER MOTOR
sir please reply me how can i balanced of bldc motors???? any one reply me bhai.... please
could you use the accelerometer without the arduino ?
Hey, I'm not sure what's exactly happening in it, the program seems to be working exactly fine but there is one part that's still confusing me, " xyzregister=50" here you gave a "0000000000110010" into the xyz register, then how come the sensor is outputting values for all the three axis?
@jayshah4212
7 жыл бұрын
I might be missing a very small thing hope you could clear it
Is there a one axis accelerometer?
i connect it with arduino and vb6 its supper easy
I had received this error "0x53" may not appear in macro parameter list
@jayshah4212
7 жыл бұрын
Give space between accel_module and the bracket keep it this " #define accel_module (0x53)"
Is this Analog or Digital?
I dont have cs pin but i have ado pin what should Ido could some one help me
it should be on 3.3v not 5 v?
@RobertKvsv
5 жыл бұрын
No. Documentation says 5V.
Hi please can you help me with visualizing the ADXL345 data on processing as an X-Y graph ? PLEASE :( It is very urgent...thanks in advance :(
//For those of you who are too lazyto check the site #include #define accel_module (0x53) byte values[6] ; char output[512]; void setup(){ Wire.begin(); Serial.begin(9600); Wire.beginTransmission(accel_module); Wire.write(0x2D); Wire.write(0); Wire.endTransmission(); Wire.beginTransmission(accel_module); Wire.write(0x2D); Wire.write(16); Wire.endTransmission(); Wire.beginTransmission(accel_module); Wire.write(0x2D); Wire.write(8); Wire.endTransmission(); } void loop(){ int xyzregister = 0x32; int x, y, z; Wire.beginTransmission(accel_module); Wire.write(xyzregister); Wire.endTransmission(); Wire.beginTransmission(accel_module); Wire.requestFrom(accel_module, 6); int i = 0; while(Wire.available()){ values[i] = Wire.read(); i++; } Wire.endTransmission(); x = (((int)values[1])
What is the resistance of the pull up resistor ?
@EEEnthusiast
8 жыл бұрын
+kalavathi gopalaswamy I used 20k.
@mohammadshaaban1345
8 жыл бұрын
+EEEnthusiast can we use a 10k resistor?
@EEEnthusiast
8 жыл бұрын
Mohammad Shaaban yes, 10k is fine.
Sorry do you have how to calibrate the module tutorial
@EEEnthusiast
6 жыл бұрын
I don't unfortunately. Sorry.
The arduino comes with internal pull-up resistors. Your resistors aren’t necessary
what is the unit of the output value and how to convert it to g unit ty
@rajeevudasi7464
5 жыл бұрын
Did You find
@user-gv5ut1jy3p
5 жыл бұрын
Did you find the answer ?
Hello Eeenthusiast! I wanted to ask why then are these values so accurate with no noises with the absence of a filter.
i am making an hand motion control robotic arm so which one i use? accelerometer or gyro?
@EEEnthusiast
8 жыл бұрын
+muhammad saad you would need a gyro for this. Alternatively, there are ways to measure this with a potentiometer.
@Desaad12
8 жыл бұрын
thanks
i have the problem on my output. All of them are 0. can you please tell me where is the problem? i have already copy the same code but still cant
@JakeDancel
9 жыл бұрын
Check your comnections
@ecultrara2017
8 жыл бұрын
+黃冠儒 + EEEnthusiast I'm having the same problem. I checked all the connections - is there another possible solution?
@BioSniperX
7 жыл бұрын
Read the Device ID first, it is 0xE5.
i have copied the same code but an error is coming which is 'values' was not declared in this scope what does it mean.. please help
@ArshadAli-zk5kj
6 жыл бұрын
i faced the same problem them i replaced the code with, Wire.requestFrom(accelModule,6); //Request Accel Registers (32 - 37) while(Wire.available() x = Wire.read()
Can I have the source code please?
hi! i've run your code, but unfortunately, there's an error which was 'values' was not declared in this scope how to fix this error ? thank you
@FlyMeAirplane
8 жыл бұрын
+nollynn yunos If you ran the code from his website the first line must be: #include This was on the youtube video but is wrong on his web site.
@mhmmdmzrk
8 жыл бұрын
maybe you should use this tutorial: www.sparkfun.com/tutorials/240 because for me this one worked, I thik it is about the library
can u please give the code...
@EEE any chance we could request a commission from you for our current project? We need to build a system (4-5 units in all) that will produce sound FX each time a person takes a step. Assuming the use of simple accelerometers could this be done?
Can you send me the library and code plzz
HI! is it OK to connect the ADXL 345 to 5 Volts. The datasheet says that its range is up to 3.5 Volt. ??????????????????????????
@MrGopiii
9 жыл бұрын
EL TIGRE CHINO from the document: Supply voltage range: 2.0 V to 3.6 V
@FlyMeAirplane
8 жыл бұрын
+EL TIGRE CHINO No. Get the $18 version from Adafruit and you can use 5v.
@Synthetech
7 жыл бұрын
he makes a good point since there are many 3.3v versions out there
sir can u please send me the code?
Sir,i am getting output all zeros i checked my connection many times, i connected same as you did, and also the code is same
@arjunjanardhanan3301
8 жыл бұрын
did u solder your breakout board to connector pins?
@5hayansan
7 жыл бұрын
maybe solder problem, too much solder makes the sensor broken.
can you run this with raspberry pi?
@EEEnthusiast
9 жыл бұрын
Andrei Tjutrin Of course, it is not device specific. I usually demonstrate modules on the Arduino because it is faster to code, but the same concepts apply to any other controller you may select.
My output: -109 -235 1612 -109 -236 1614 -108 -236 1613 -109 -236 1613 -362 -179 1458 -418 -268 1409 -115 -237 1643
@mey1274
6 жыл бұрын
hi, can you share your coding with me ?