adxl335 arduino

 


 
This is the ad XL. 335 accelerometer got this on eBay for about two dollars: twenty five cents, including shipping. This is an awesome, little mini board, and so we connected this up to the Arduino. We have our dupont style connectors here and on the arduino we’re, bringing the x y and z analog values into a 5 a 4 and a 3 respectively we’re getting 3.3 volt VCC input we’re, also bridging that, over to the a ref, the analog reference pin on The Arduino, because this accelerometer outputs its analog values using 3.3 volts, and so we want to make sure that the Arduino references them at 3.3 instead of 5 volts and that’s. Why we use the a ref pin. I wired the Arduino using the instructions in this instructable and I will link this in the video details in the description. The only difference is in this instructable. The author says that you can use a 5 volt VCC input on the a DXL 335, because that chip has a regulator, and I could not find the regulator on mine and the datasheet does not say that it can accept a 5 volt input. In fact, the datasheet tells us that it will accept between a 1.8 and a 3.6 volt input, so that is why I used the 3.3 volt out from the Arduino and simply bridged that over to the analog reference, so I wired up the Arduino. I ran my code and so let’s take a look at the code itself, so here’s our Arduino code, very, very simple.

Here, we’re defining the X, pin Y pin and Z, pin again that’s a 5 a 4 and a 3 and then we’re setting the serial output with a 9600 baud connection and we’re simply looping and reading those analog values. So, here, I’m printing to the serial port and I’m reading from the analog X, pin and then you’ll notice, here: I’m subtracting 507, I’m reading from Y and subtracting 512, so what’s 507. 512. 615. When I first did this, I set the a DXL 335 flat on a breadboard on the table to try to find it’s at rest values there. There are probably many better ways to do this. This was my sort of quick way to do it. To get some code up and running, and these were the at rest – values that consistently I found so here. We here here, we’re outputting, this data to serial notice that I’m printing a tab character in between each of these values and that’s, so that at some point I could read this in to excel or to some other application to do. Some logging and some analysis of the data so to that end I didn’t want to just use the built in arduino serial monitor. I wanted to output this directly to the terminal, which would give me some more options. So I looked that up and here on the Arduino playground. They have some information on doing this. You can use the stty command line function on mac and linux, to tell your computer for this serial port and this isn’t, the one that I’m using.

We want to communicate at this bod rate and then you can do things like cat the input from that serial port directly to standard out now. So what does that mean? Well let’s, open up our terminal here. First, like I said, we’re going to run this stty command to tell it that on my Mac, dev slash Cu, USB modem 1411, that is my serial input for the Arduino and we’re, going to communicate at 9600. Baud so we’ll run that command and then – and this is what’s really cool – I can simply cat the input from that serial port directly to the terminal. So when I hit enter you’re going to start to see the numbers flow, this is my accelerometer data I’m, holding it as close to zero. As I can now watch what happens if I tap the accelerometer, you see that spike in the numbers.

 
 

adxl335 arduino Video

 

 

 

 

 

 

adxl335 arduino news

 

 

 

 

 

 

 

adxl335 arduino Social

 

 

 

 

Hand Gesture Controlled Robot using Arduino – ADXL335 Accelerometer – wireless RF (433Mhz)

Arduino ADXL335 Triple Axis Accelerometer Breakout Module

 

 

(Visited 60 times, 1 visits today)

About The Author

You might be interested in

Comment (35)

    1. +Theresa E Do you mean that you get those values consistently, and they never change? I’m not sure what would cause that. Maybe others in this comment thread would know. Thanks for watching!

    2. Hi I think my mistake is that i havn’t red the data sheet exactly. It is possible that the Intervalls of the switching between 0 and 1023 gives information about the speed. But you say you even got it with aref? I thought it is not forced to use it? 🙂

    3. +Theresa E Sorry, I don’t have an ADXL202EB. If any other viewers know of an answer, please post it here. Thanks for watching!

  1. Hi Nate Smith… don’t you use ADC in your program? if yes, why do you not use ADC and use aref?

    Mr Nate Smith, do you have a link (program) for sending sensor accelorometer ADXL335 using nrf24l01 or xbee or esp8266 with arduino?

    1. Upik Jamil, unfortunately, I don’t have any examples of sending accelerometer data to Xbee or ESP8266. That would be a fun project, though!

      The AREF is an analog reference pin, and works with the ADC. It says, “base your calculations on analog input up to THIS maximum voltage.” It sets the acceptable range of analog voltages that the ADC might encounter.

      Thanks for watching!

    2. do you ever use nr24l01 for sending sensor data? I try to sending sensor data ADXL335 but the data does not appear in serial monitor

  2. hi nate. i want to turn on a led whith the value of this sensor, how can i use this sketch to do it? thanks!

    1. when iam using this your code it is showing
      Xsensor1=1023 output1=255
      Ysensor2=1023 output2=255
      Zsensor3=1023 output3=255

      IT continually same values please help me

  3. Hi, Nate thanks for the video if i am using WINDOWS 8 what changes are to be done to use
    “stty”

  4. I’m in the Process of Building a Vibration Switch (ADXL335 + Attiny13a)
    I have only one analog input pin left on the Attiny13a , if I connect the ADXL335 X,Y,Z Pins together and Connect them to that analog input pin in the Attiny13a , Can I Get a Vibration switch that can be triggered by any movement ?
    Great Video by the Way

    1. I believe that would work. Give it a try, and let us know! I’m sure your findings could help someone in the future. +ذو ذو

    1. +Lokesh They represent the pull of gravity against each axis of the accelerometer chip. If the chip is lying flat on a surface, you’ll see large numbers on the Z axis, and much smaller numbers on the X and Y axis. Thanks for watching!

  5. Sir, can we calculate reaction forces coming on vehicle during dynamic condition using this sensor..?

  6. Hi
    Thanks for the video. But I also need to convert the acceleration data to the frequency value. I tried with FFT but could solve it. Can you help me in this regards.

LEAVE YOUR COMMENT

Your email address will not be published. Required fields are marked *