0

ADXL377 Startup
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

ADXL377 Startup

by Fore_2016 on Mon May 02, 2016 3:19 pm

We have some basic questions on the ADXL377/Arduino Startup:
1) We should run the calibration sketch first, correct?
2) Do we then download the main 377 sketch to then get it operations?
3) Once we compile that, how do we get it in run mode; ie, run it repeatedly as we move our object around (car) with the accelerator attached to it?

Team FTM

Fore_2016
 
Posts: 26
Joined: Tue Jan 05, 2016 2:46 pm

Re: ADXL377 Startup

by adafruit_support_bill on Mon May 02, 2016 4:45 pm

The ADXL377 is an analog accelerometer. You connect each axis output to an analog pin and call analogRead() to read the raw value.

When run according to the instructions, the calibration sketch will give you the raw readings corresponding to 1G in each of the 3 axis.
https://learn.adafruit.com/adafruit-ana ... ion-sketch

This data can be used as a basis for a 2-point calibration in your code: https://learn.adafruit.com/calibrating- ... alibration

adafruit_support_bill
 
Posts: 69809
Joined: Sat Feb 07, 2009 10:11 am

Re: ADXL377 Startup

by Fore_2016 on Tue May 03, 2016 1:26 am

Thanks. Yes, we understand it is an analog accelerator.

To that end, once, we paste in the sketch for calibration, compile, then we are good to go, correct?

By the way, when we copy the calibration sketch in, and compile; we get numerous errors such as: error: expected declaration before '}'token.

Any suggestions on how to resolve this?

Also, when you refer to 'instructions for the ADXL 377, what instruction document are you referring to'.

Thank you.

Fore_2016
 
Posts: 26
Joined: Tue Jan 05, 2016 2:46 pm

Re: ADXL377 Startup

by adafruit_support_bill on Tue May 03, 2016 6:17 am

To that end, once, we paste in the sketch for calibration, compile, then we are good to go, correct?

You should be good to go for generating calibration data. Not sure what your application requirements are, but I'd expect you will need to write some additional code for that.
By the way, when we copy the calibration sketch in, and compile; we get numerous errors such as: error: expected declaration before '}'token

I just tried it and it compiles without error here. Be sure to use the copy button in the upper right corner of the code window to make sure you get a complete copy of the code.

Also, when you refer to 'instructions for the ADXL 377, what instruction document are you referring to'.

The instructuions for running the calibration sketch:
https://learn.adafruit.com/adafruit-ana ... ion-sketch

adafruit_support_bill
 
Posts: 69809
Joined: Sat Feb 07, 2009 10:11 am

Re: ADXL377 Startup

by Fore_2016 on Wed May 04, 2016 1:26 am

Thank you, good info.

After the calibration, we wish to mount to a Lacrosse helmet, that is mounted to a test stand, and move the test stand with a computer. Is there any existing code that we can use for that. We will inflict 2-50 gs on the Lacrosse helmet. Thank you.

Fore_2016
 
Posts: 26
Joined: Tue Jan 05, 2016 2:46 pm

Re: ADXL377 Startup

by adafruit_support_bill on Wed May 04, 2016 7:51 am

What kind of data are you looking to collect? If you simply want to capture the peak acceleration forces, that would be a relatively simple modification of the calibration sketch. If you want to log the data over time, you will need either an SD card interface, or a serial interface back to a computer to collect the data.

adafruit_support_bill
 
Posts: 69809
Joined: Sat Feb 07, 2009 10:11 am

Re: ADXL377 Startup

by Fore_2016 on Thu May 05, 2016 12:44 am

Thanks Bill.

We wish to collect the peak acceleration.

Later, we will need to do it over time.

What modifications would be needed to the cal sketch?

Regards.

Fore_2016
 
Posts: 26
Joined: Tue Jan 05, 2016 2:46 pm

Re: ADXL377 Startup

by adafruit_support_bill on Thu May 05, 2016 5:58 am

The calibration sketch only selects the min and max readings from the data when the button is pressed:
Code: Select all | TOGGLE FULL SIZE
  if (digitalRead(buttonPin) == LOW)
  {
    AutoCalibrate(xRaw, yRaw, zRaw);
  }


If you remove the 'if' statement and just call AutoCalibrate, it will monitor the data continuously for min and max readings.

adafruit_support_bill
 
Posts: 69809
Joined: Sat Feb 07, 2009 10:11 am

Re: ADXL377 Startup

by Fore_2016 on Fri May 06, 2016 12:06 am

Thank you very much. We will try that.

Fore_2016
 
Posts: 26
Joined: Tue Jan 05, 2016 2:46 pm

Please be positive and constructive with your questions and comments.