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

  • @stub1116
    @stub11165 жыл бұрын

    I thought the video was, well thought out and implemented. It was a joy to watch, thanks.

  • @ipballdtime
    @ipballdtime9 жыл бұрын

    great explanatory video, the step by step walk-through made things very clear!

  • @hussain55019
    @hussain550194 жыл бұрын

    Very clear detailed and focused tutorial,Thanks a lot Sir..

  • @charlesmarlin6632
    @charlesmarlin66324 жыл бұрын

    Well Done!! Great detail walking through the code. Thank You

  • @mkschreder
    @mkschreder8 жыл бұрын

    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.

  • @AdlerRobertoMaiobadosSantos
    @AdlerRobertoMaiobadosSantos6 жыл бұрын

    OOOOWWWWWW ! Thank you very much! Thanks to you I did not burn another device.

  • @nikolaantonov5833
    @nikolaantonov58338 жыл бұрын

    Great tutorial m8! Saved me a lot of time! :)

  • @markspc1
    @markspc19 жыл бұрын

    Great video, thank you.

  • @muhammadsameer883
    @muhammadsameer8837 жыл бұрын

    great video buddy

  • @sevencostanza3883
    @sevencostanza38837 жыл бұрын

    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.

  • @devdadph
    @devdadph9 жыл бұрын

    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

  • @FlyMeAirplane
    @FlyMeAirplane8 жыл бұрын

    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

    @FlyMeAirplane

    8 жыл бұрын

    Turns out the first one I purchased was evidently bad because the second one worked as advertised. Thanks again for the video!

  • @kukudalachandrashekar8769
    @kukudalachandrashekar87699 жыл бұрын

    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?

  • @axelsolhall5830
    @axelsolhall58306 жыл бұрын

    Thanks alot! Great video! But this gives orientation and I want the XYZ forces... How can the code be modified for this??

  • @ArshadAli-zk5kj
    @ArshadAli-zk5kj6 жыл бұрын

    Superb video once again. what range have we set +-16g, +-8g, +-4g or +-2g??? how can i change this range ?

  • @gjp4jp6
    @gjp4jp69 жыл бұрын

    Thank you

  • @2000gile
    @2000gile6 жыл бұрын

    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.

  • @saifwedood286
    @saifwedood2867 жыл бұрын

    Big Like :) thanks but i want to ask some thing isn't the auto sleep bit is zero by defult ? ie:disabled by defult ?

  • @berladmusic
    @berladmusic8 жыл бұрын

    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!

  • @jayzlee3680
    @jayzlee36806 жыл бұрын

    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?

  • @Bozojimmy
    @Bozojimmy5 жыл бұрын

    can it be used for vibration analysis ?

  • @Ben55j
    @Ben55j4 жыл бұрын

    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.

  • @shoilishoili
    @shoilishoili9 жыл бұрын

    what about the ADXL345 board , is it the same setting ? is there any data sheet for this

  • @rolfdeloijer6196
    @rolfdeloijer61969 жыл бұрын

    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,

  • @kiikete1
    @kiikete13 жыл бұрын

    can u explain more why you used 16 and 8 for 0x2D?

  • @paulokhayat
    @paulokhayat5 жыл бұрын

    why do you need to pull up both i2c connections? also, does it matter what resistor is used?

  • @PASHTOTECHSTORIES
    @PASHTOTECHSTORIES6 жыл бұрын

    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

  • @cristianvaz30
    @cristianvaz307 жыл бұрын

    what are the units of the values ? and the maximum range of values, in order to convert it to N/m ?

  • @edwardanthony9467
    @edwardanthony94679 жыл бұрын

    Hello! Can this Arduino with Accelerometer readings(output) be read in the Labview wave form program? Thanks!!

  • @Wilksey37
    @Wilksey379 жыл бұрын

    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

    @beuleamkopf

    7 жыл бұрын

    Depends on LSB first or MSB first.

  • @onurolce

    @onurolce

    6 жыл бұрын

    Atmel ve PIC microcontrollers works MSB first. And that register also MSB. So Wilksey37 has right.

  • @maxwelldynamics7495
    @maxwelldynamics74958 жыл бұрын

    If you use digitalWrite instead of wire.write will the data be sent to the digital output to control an object?

  • @rajatjain6364
    @rajatjain63648 жыл бұрын

    i want to measure distance using this , what r the changes should i make in coding.

  • @jeffthagz8695
    @jeffthagz86959 жыл бұрын

    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.

  • @manishkumarmourya9164
    @manishkumarmourya91646 жыл бұрын

    sir i am getting 0 0 0 as output.......though there are no loose connections......plz help me

  • @veerbhadra7332
    @veerbhadra73327 жыл бұрын

    how to use ADXL345 to measure dynamic acceleration. I have gone through datasheet but not understanding. I'm working on accident detection. please help

  • @Mattiaeragiapreso
    @Mattiaeragiapreso7 жыл бұрын

    Hi! Can you explain how i can transform those number in real acceleration values?

  • @Azarias84
    @Azarias846 жыл бұрын

    sorry, another question: how can i control servomotors with this?

  • @iceman1st1
    @iceman1st13 жыл бұрын

    Hi, could I use this on a vehicle to activate the brake light's when it senses the vehicle slowing down

  • @yohent.8027
    @yohent.80275 жыл бұрын

    Do we need to install any libraries?

  • @usmanjanjua6571
    @usmanjanjua65718 жыл бұрын

    my Z axis only changes values upon shifting the sensor X and Y axis remain same

  • @arrowstheorem1881
    @arrowstheorem18815 жыл бұрын

    Why are there figures for the x,y,z when the module is at rest? Should they not be 0,0,0?

  • @aleximylearanton4712

    @aleximylearanton4712

    4 жыл бұрын

    He hasn’t calibrated it yet

  • @1979zeesh
    @1979zeesh8 жыл бұрын

    +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

  • @monixidor
    @monixidor8 жыл бұрын

    Great explanation! Thanks from Argentina. Can you help me? How can i change the sensibility of the accelerometer module to +-16 or +-8g?

  • @jeffreydijkstra3391

    @jeffreydijkstra3391

    3 жыл бұрын

    With the registers

  • @RDKCREATIONS
    @RDKCREATIONS3 жыл бұрын

    i gone through the code but still got 0,0,0 as output can u help me

  • @malangamba
    @malangamba8 жыл бұрын

    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!

  • @shoilishoili
    @shoilishoili9 жыл бұрын

    can I know the minimum and maximum tolerance I can get from these accelorometer

  • @fotoamgamgfoto3695
    @fotoamgamgfoto36953 жыл бұрын

    does it have adjustable adress? I need to connect more to same i2c bus

  • @HowThingsWork_CESI
    @HowThingsWork_CESI5 жыл бұрын

    thanks a lot

  • @NotLays
    @NotLays8 жыл бұрын

    what are the range of values that x , y & z can take??

  • @basedonprinciple

    @basedonprinciple

    5 жыл бұрын

    -/+ 16g

  • @Akatsuki_Aoiro
    @Akatsuki_Aoiro6 жыл бұрын

    how we can set the range +-16g, +-8g, +-4g or +-2g??? how can i change this range ?

  • @theeggdover1243
    @theeggdover12436 жыл бұрын

    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

    @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.)

  • @slayerdaku7012
    @slayerdaku70126 жыл бұрын

    Which pins are known as cuz axis in it

  • @Azarias84
    @Azarias846 жыл бұрын

    hello guys, can you tell me what units are in the screen of monitor? it means, what i seeing? grades? mph?

  • @nawaryoussef
    @nawaryoussef9 жыл бұрын

    Please, do you have an idea about how to connect the Arduino and accelerometer using Bluetooth connection?

  • @awihamzahrambe3012
    @awihamzahrambe30122 жыл бұрын

    can adxl345 sensor be simulated in proteus?

  • @Sivarajansam931
    @Sivarajansam9319 жыл бұрын

    thanks.but how to calibrate the accelerometer ?

  • @nikhetraikar9339
    @nikhetraikar93397 жыл бұрын

    how to use this output as input of mouse to a desktop

  • @madhugoud3850
    @madhugoud38507 жыл бұрын

    I want to replace 345 with 335, but the pins are different

  • @parthmehta760
    @parthmehta7606 жыл бұрын

    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

  • @thulasidharkattamreddy5937
    @thulasidharkattamreddy59376 жыл бұрын

    @ EEEnthusiast May I know the values of pull up resistors you had used in here ?

  • @parthsachdeva120

    @parthsachdeva120

    Ай бұрын

    220 ohm according to colorcode used in the diagram

  • @umedkhaitan5813
    @umedkhaitan58137 жыл бұрын

    can i have a link to this program ??

  • @DarshanShah1994
    @DarshanShah19948 жыл бұрын

    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

    @jeffreydijkstra3391

    3 жыл бұрын

    with the accelero you can measure gravity's G force, so you can measure the angle its standing at.

  • @aiacademybysid5631
    @aiacademybysid56317 жыл бұрын

    Have used 3 axis gyro

  • @jeffreydijkstra3391
    @jeffreydijkstra33913 жыл бұрын

    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

  • @CORZER0
    @CORZER07 жыл бұрын

    Can this be made into a switch?

  • @rania2806
    @rania28063 жыл бұрын

    Can you help me In order to write code Arduino adxl 345 led for projet bad sitting posture detection

  • @ericoudammerveld424
    @ericoudammerveld4245 жыл бұрын

    Your uno has internal pullup possibility...

  • @mariamhaydar5027
    @mariamhaydar50277 жыл бұрын

    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

  • @tonischmitt7529
    @tonischmitt75297 жыл бұрын

    How much Ohm do I need?

  • @gyakoboandy1802
    @gyakoboandy18028 жыл бұрын

    Hello! Nice tutorial. I wanted to ask, are this accelerometer values filtered or are they raw?

  • @EEEnthusiast

    @EEEnthusiast

    8 жыл бұрын

    +Gyakobo Andy Thank you for the comment! They are raw values.

  • @W.GUIADOSPORDEUS
    @W.GUIADOSPORDEUS7 жыл бұрын

    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

  • @v3m4rk
    @v3m4rk4 жыл бұрын

    sir please reply me how can i balanced of bldc motors???? any one reply me bhai.... please

  • @edwardhughes352
    @edwardhughes3523 жыл бұрын

    could you use the accelerometer without the arduino ?

  • @jayshah4212
    @jayshah42127 жыл бұрын

    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

    @jayshah4212

    7 жыл бұрын

    I might be missing a very small thing hope you could clear it

  • @arrowstheorem1881
    @arrowstheorem18815 жыл бұрын

    Is there a one axis accelerometer?

  • @marializianichols648
    @marializianichols6487 ай бұрын

    i connect it with arduino and vb6 its supper easy

  • @mohammedal.shammary7916
    @mohammedal.shammary79167 жыл бұрын

    I had received this error "0x53" may not appear in macro parameter list

  • @jayshah4212

    @jayshah4212

    7 жыл бұрын

    Give space between accel_module and the bracket keep it this " #define accel_module (0x53)"

  • @gunjansethi2896
    @gunjansethi28967 жыл бұрын

    Is this Analog or Digital?

  • @Sivarajansam931
    @Sivarajansam9319 жыл бұрын

    I dont have cs pin but i have ado pin what should Ido could some one help me

  • @techvevo814
    @techvevo8146 жыл бұрын

    it should be on 3.3v not 5 v?

  • @RobertKvsv

    @RobertKvsv

    5 жыл бұрын

    No. Documentation says 5V.

  • @akshayd211
    @akshayd2118 жыл бұрын

    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 :(

  • @FatimaHassan-fn1vk
    @FatimaHassan-fn1vk5 жыл бұрын

    //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])

  • @kalavathigopalaswamy1382
    @kalavathigopalaswamy13828 жыл бұрын

    What is the resistance of the pull up resistor ?

  • @EEEnthusiast

    @EEEnthusiast

    8 жыл бұрын

    +kalavathi gopalaswamy I used 20k.

  • @mohammadshaaban1345

    @mohammadshaaban1345

    8 жыл бұрын

    +EEEnthusiast can we use a 10k resistor?

  • @EEEnthusiast

    @EEEnthusiast

    8 жыл бұрын

    Mohammad Shaaban yes, 10k is fine.

  • @joshualiu8551
    @joshualiu85516 жыл бұрын

    Sorry do you have how to calibrate the module tutorial

  • @EEEnthusiast

    @EEEnthusiast

    6 жыл бұрын

    I don't unfortunately. Sorry.

  • @micah2936
    @micah29362 жыл бұрын

    The arduino comes with internal pull-up resistors. Your resistors aren’t necessary

  • @techvevo814
    @techvevo8146 жыл бұрын

    what is the unit of the output value and how to convert it to g unit ty

  • @rajeevudasi7464

    @rajeevudasi7464

    5 жыл бұрын

    Did You find

  • @user-gv5ut1jy3p

    @user-gv5ut1jy3p

    5 жыл бұрын

    Did you find the answer ?

  • @gyakoboandy1802
    @gyakoboandy18028 жыл бұрын

    Hello Eeenthusiast! I wanted to ask why then are these values so accurate with no noises with the absence of a filter.

  • @Desaad12
    @Desaad128 жыл бұрын

    i am making an hand motion control robotic arm so which one i use? accelerometer or gyro?

  • @EEEnthusiast

    @EEEnthusiast

    8 жыл бұрын

    +muhammad saad you would need a gyro for this. Alternatively, there are ways to measure this with a potentiometer.

  • @Desaad12

    @Desaad12

    8 жыл бұрын

    thanks

  • @user-iv4wq6tq2u
    @user-iv4wq6tq2u9 жыл бұрын

    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

    @JakeDancel

    9 жыл бұрын

    Check your comnections

  • @ecultrara2017

    @ecultrara2017

    8 жыл бұрын

    +黃冠儒 + EEEnthusiast I'm having the same problem. I checked all the connections - is there another possible solution?

  • @BioSniperX

    @BioSniperX

    7 жыл бұрын

    Read the Device ID first, it is 0xE5.

  • @ujalanadeem3638
    @ujalanadeem36387 жыл бұрын

    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

    @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()

  • @rhyagan
    @rhyagan5 жыл бұрын

    Can I have the source code please?

  • @nurlynnyunos2700
    @nurlynnyunos27008 жыл бұрын

    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

    @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

    @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

  • @jaskunwarsingh9178
    @jaskunwarsingh91788 жыл бұрын

    can u please give the code...

  • @avatar6699
    @avatar66997 жыл бұрын

    @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?

  • @mariamhaydar5027
    @mariamhaydar50277 жыл бұрын

    Can you send me the library and code plzz

  • @MrGopiii
    @MrGopiii9 жыл бұрын

    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

    @MrGopiii

    9 жыл бұрын

    EL TIGRE CHINO from the document: Supply voltage range: 2.0 V to 3.6 V

  • @FlyMeAirplane

    @FlyMeAirplane

    8 жыл бұрын

    +EL TIGRE CHINO No. Get the $18 version from Adafruit and you can use 5v.

  • @Synthetech

    @Synthetech

    7 жыл бұрын

    he makes a good point since there are many 3.3v versions out there

  • @ramakrishnasai5713
    @ramakrishnasai57138 жыл бұрын

    sir can u please send me the code?

  • @Ram-Deep
    @Ram-Deep8 жыл бұрын

    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

    @arjunjanardhanan3301

    8 жыл бұрын

    did u solder your breakout board to connector pins?

  • @5hayansan

    @5hayansan

    7 жыл бұрын

    maybe solder problem, too much solder makes the sensor broken.

  • @ESStonian
    @ESStonian9 жыл бұрын

    can you run this with raspberry pi?

  • @EEEnthusiast

    @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.

  • @Eincis
    @Eincis9 жыл бұрын

    My output: -109 -235 1612 -109 -236 1614 -108 -236 1613 -109 -236 1613 -362 -179 1458 -418 -268 1409 -115 -237 1643

  • @mey1274

    @mey1274

    6 жыл бұрын

    hi, can you share your coding with me ?

Келесі