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
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.
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.
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?
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...
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 :)
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.
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! :-)
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
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]
Hey, thanks for your time. :-)
I get the same error. did you fix it?
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
Is this code is useful for arduino uno
Thanks man. Your one works. @@Schmogel92
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.
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.
Great tutorial! Thank you for posting it.
outsidersTexas Thank you!!!
Could you please please make a video on adding servo to this gyro for thrust vector control cpu
Can you help me for code Arduino adxl 345 led for projet bad sitting posture detection
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?
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...
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 :)
I have an error that says "writeRegister was not declared in this scope" how can I fix it??
Hi, can i know what is the other board that the ADXL345 is connected to?
Erna Eliyana Munir it's a pro mini.
I am trying to find this tutorial video for days
could you please share the code?
LOL same surname as me 😁 i will put one of these eventually on my ender 3 pro maybe 😆
It's a rare surname too!
thx
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.
Эти американцы никогда не выкладывают свои коды, жадины
I'm not American, I'm British! :-)
какая разница? В России под всеми видео ссылки на скетч без проблем. Например: ua-cam.com/video/nT824cziyiY/v-deo.html
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! :-)
ладно, это всё вода, ты можешь кинуть ссылку?
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