TUTORIAL: How to Wire Up & Code ADXL345 Gyroscope Accelerometer - (Arduino Module)

Поділитися
Вставка
  • Опубліковано 27 жов 2024

КОМЕНТАРІ • 38

  • @muhammedaltuntas5150
    @muhammedaltuntas5150 6 років тому +13

    Code
    #include
    int CS=8;
    char POWER_CTL=0x2D;
    char DATA_FORMAT=0x31;
    char DATAX0=0x32;
    char DATAX1=0x33;
    char DATAY0=0x34;
    char DATAY1=0x35;
    char DATAZ0=0x36;
    char DATAZ1=0x37;
    unsigned char values[10];
    int x,y,z;
    void setup(){
    SPI.begin();
    SPI.setDataMode(SPI_MODE3);
    Serial.begin(9600);
    pinMode(CS,OUTPUT);
    digitalWrite(CS,HIGH);
    writeRegister(DATA_FORMAT, 0x01);
    writeRegister(POWER_CTL,0x08);
    }
    void loop()
    {
    readRegister(DATAX0,6,values);
    x=((int)values[1]

    • @AntonyCartwright
      @AntonyCartwright  6 років тому +2

      Hey, thanks for your time. :-)

    • @MeixnerQuest
      @MeixnerQuest 6 років тому

      I get the same error. did you fix it?

    • @Schmogel92
      @Schmogel92 6 років тому +3

      Maybe it's because the first "void readRegister" should be "void writeRegister"
      I adjusted the code a bit to make it work for me. Maybe it helps. pastebin.com/Mfwh9Gtk

    • @Gautamkumar-ls9fs
      @Gautamkumar-ls9fs 6 років тому

      Is this code is useful for arduino uno

    • @AzwadAbid
      @AzwadAbid 5 років тому +1

      Thanks man. Your one works. @@Schmogel92

  • @yeri63
    @yeri63 5 років тому +3

    This is actually an Accelerometer, not a Gyroscope. The readings you were getting as the device was tilted along the 3 different axis was that of 1G (9.8 m/s^2). As any axis was tilted towards the vertical, the 1G was shown as the 100+ reading, with the sign indicating whether the axis was pointing down or upwards. Unlike a gyroscope, the values are also subject to additional forces in the direction of any of the axis. For example, under free-fall, the Z-axis (vertical) would go to zero.

    • @rzalman96
      @rzalman96 3 роки тому

      You have a point but you can still use the adxl345 as you would a gyro if no significant accelerations exist. I personally used the adxl345 today as a gyro on a slowly tilting system to measure tilt angle.

  • @outsidersTexas
    @outsidersTexas 7 років тому +2

    Great tutorial! Thank you for posting it.

  • @animemafia2085
    @animemafia2085 4 роки тому

    Could you please please make a video on adding servo to this gyro for thrust vector control cpu

  • @rania2806
    @rania2806 4 роки тому

    Can you help me for code Arduino adxl 345 led for projet bad sitting posture detection

  • @CreativeTechno
    @CreativeTechno 7 років тому

    Hi Anthony! Great Video :)
    A question if i may. I've been using PIC Microcontrollers for years, interfacing them with various external devices and recently also used an Accelerometer module which would control a desktop program to show angle changes. The Arduino i have never used before and they seem very popular. Does the Arduino have something special that a PIC does not have?

    • @AntonyCartwright
      @AntonyCartwright  7 років тому

      Hi! I've never really used PIC before, but I think the Arduino is going to be easier. Arduinos come with a bootloader and programmer and some come with an onboard UART too. It's pretty much everything you need on one board. On some Arduino boards, you literally plug in the USB, your PC installs the drivers and you're good to go in less than 5 mins without having to do anything. The IDE is free too and good. The community is huge too! Antony...

    • @CreativeTechno
      @CreativeTechno 7 років тому +1

      Hi Anthony, thanks for getting back to me :)
      The setup you have above is same as i have for the PIC. The USB to Serial Data converter, the Arduino Module and then the Accelerometer Module itself. After some checking the Arduino is basically a module (PCB) with an Atmel chip on it, same as a PIC but the module makes interfacing for projects easier, especially as you say if they have a USB interface chip already on the module. Good luck with the future projects :)

  • @ardahankul8186
    @ardahankul8186 5 років тому

    I have an error that says "writeRegister was not declared in this scope" how can I fix it??

  • @ernaeliyanamunir1525
    @ernaeliyanamunir1525 7 років тому

    Hi, can i know what is the other board that the ADXL345 is connected to?

  • @animemafia2085
    @animemafia2085 4 роки тому

    I am trying to find this tutorial video for days

  • @MeixnerQuest
    @MeixnerQuest 6 років тому

    could you please share the code?

  • @barrycartwright8400
    @barrycartwright8400 Рік тому

    LOL same surname as me 😁 i will put one of these eventually on my ender 3 pro maybe 😆

  • @MsDRIVER7
    @MsDRIVER7 5 років тому

    thx

  • @grazianoturbogas
    @grazianoturbogas 5 років тому

    Ok, maybe you are faster than I2C, BUT your data precision is limited on units (or integers) you don't get anything in the decimal range from the sensor. ADXL345 is able to give substantially higher precision. That's a really great ISSUE. Soooo I dislike the video. I've been able to do what you say by myself.

  • @misterzaboyny607
    @misterzaboyny607 6 років тому

    Эти американцы никогда не выкладывают свои коды, жадины

    • @AntonyCartwright
      @AntonyCartwright  6 років тому

      I'm not American, I'm British! :-)

    • @misterzaboyny607
      @misterzaboyny607 6 років тому

      какая разница? В России под всеми видео ссылки на скетч без проблем. Например: ua-cam.com/video/nT824cziyiY/v-deo.html

    • @AntonyCartwright
      @AntonyCartwright  6 років тому

      There are many many differences between Britain and USA, but the most obvious one is their very different geographical locations! Also, I'm glad about Russian UA-cam videos having links - it means that Russians will not have to inconvenience themselves by having to look at foreign videos! :-)

    • @misterzaboyny607
      @misterzaboyny607 6 років тому

      ладно, это всё вода, ты можешь кинуть ссылку?

    • @AntonyCartwright
      @AntonyCartwright  6 років тому

      Hi, I'm afraid I don't have a link for the code because I don't keep the code. In the future, I'll make something so that people can get code from my website, but at the moment, this feature doesn't exist! Maybe it will exist in a Russian video, not an American one! :-D :-D :-D :-D