Pages: 1 [2]   Go Down
Author Topic: ADXL193 Accelerometer Assistance Needed!  (Read 3662 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


That depends on what the project is for. If the project to read the accelerometer IS part of your course work, then paying someone else to write the code is cheating, and we don't support that.

If the project to read the accelerometer data is a personal project that has nothing to do with school then post in Gigs and Collaboration to hire someone.

Ok, thanks for clearing that up. My project is to design and construct a new take on a folding Cycling helmet. Testing the impact resistance is one on many factors. I guess paying for code is like paying for a 3D printed part for a concept though - which is fine.

Thanks
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello,

I have a 3rd year Product Design University project that requires the use of a 250g accelerometer for helmet testing.

I have the following kit:
Arduino UNO board
ADXL193 Accelerometer
Breadboard
Jumpers

I need a code and any other supporting scripts to allow me to visually see the G-force the accelerometer is subjected to.

I am open to payment suggestions and I will pay via Paypal.

I look forward to hearing from you!

Thanks
Mike

Logged

Offline Offline
Newbie
*
Karma: 3
Posts: 34
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Try this code out - it constantly checks for minimum and maximum recoil.
But it only displays once every second.  The more you display the smaller your sample rate becomes.
If the sample rate is too slow, you will miss the recoil event.

Code:
/*
 Recoil Viewer designed by AB9VH Electronics, James Douglas III - 2012
 Sparkfun ADXL193 single axis accelerometer, 5v reference
 
 X axis analog pin 0
 Ground, black wire
 +5v, red wire  (Vin: voltage input 5v)
 
 ZERO G = 508  (calibration data)
 */

int X = 0;                          // fresh data from accelerometer
int Xmax = 508;                     // maximim recoil data
int Xmin = 508;                     // minimum recoil data
int R = 0;                          // recoil reading in g force
unsigned long time = 0;             // time in millis of recoil event

void setup() {
  Serial.begin(9600);            // opens serial port for LCD shield
  Serial.println("Recoil Viewer by AB9VH Electronics");
  Serial.println();
  time = millis();               // time of recoil event
}

void loop() {
  X = analogRead(0);             // read analog input
  if (X < Xmin) Xmin = X;
  if (X > Xmax) Xmax = X;
  if (millis()-time >= 1000) {      // display every one second
    time = millis();               // time of recoil event 
    R = (Xmin-508)*.5;              // calculate maximum recoil
    Serial.print("Min recoil = ");
    Serial.print(R);
    Serial.print("g     ");
    R = (Xmax-508)*.5;              // calculate minimum recoil
    Serial.print("Max recoil = ");
    Serial.print(R);
    Serial.println("g");
  }
}

Logged

That little black caterpillar you just stepped on will set you back a few bucks....

Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I was not aware I crossposted, to be honest. This thread is asking for code for payment. This section of the forum was suggested to me by another forum user - I did not ask for a new code in that thread, as far as I'm concerned, I got my answer out of that thread.

If it needs to be merged, so be it, I had no intension of violating any forum rules. It’s the last thing I want to do in my time of need.
Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 474
Posts: 18696
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Threads merged.

- moderator
Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 474
Posts: 18696
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

This is the third thread I've found on this subject. I hope there aren't too many more.

Please do not cross-post. This wastes time and resources as people attempt to answer your question on multiple threads.

Threads merged.

- Moderator
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Try this code out - it constantly checks for minimum and maximum recoil.
But it only displays once every second.  The more you display the smaller your sample rate becomes.
If the sample rate is too slow, you will miss the recoil event.


Excellent, thank-you! It works! Well, as far as I know, I need to test this on a real on the market helmet to know for sure. I will let you know.

Where did you find the code? My only issue is it displays/scrolls just the maximum achieved G-load in the session, it doesn't reset to zero. Is there anyway of doing this? I would like to enter the results on to a chart at the desired intervals you see.

Oh, and Moderator, I am sorry that I appeared to be cross-posting. I thought I was OK because each thread was a different query i.e one was asking for coding help, one for basic what pin when help and the last was asking for paid assistance. But I can see how it could be seen/classified as cross-posting.

Logged

Offline Offline
Newbie
*
Karma: 3
Posts: 34
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I wrote the sketch for detecting recoil with ADXL193.  I have used it with several projects.

Here is the original version that I had modified and posted earlier.
I wasn't sure what you were doing or needed to display.

Code:

/*
 Recoil Viewer designed by AB9VH Electronics James Douglas III - 2012
 Sparkfun ADXL193 single axis accelerometer, 5v reference
 
 X axis analog pin 0
 
 ZERO G = 508  (calibrated data)
 */

int X = 0;                          // fresh data from accelerometer
int Xmax = 508;                     // max raw data, opposite of gravity
int Rmax = 0;                       // max recoil reading in g force
unsigned long time = 0;             // time in millis of recoil event
boolean lcd = false;                // okay to display info

void setup() {
  Serial.begin(9600);            // opens serial port for LCD shield
  Serial.println("Recoil Viewer by AB9VH Electronics");
  Serial.println();
  time = millis();               // time of recoil event
}

void loop() {
  X = analogRead(0);          // read analog input
  if (X > Xmax) {             // recoil event is opposite of gravity
    Xmax = X;
    time = millis();         
    lcd = true;
  }
  if ((lcd == true) && (millis()-time >= 1000)) {    // display 1 second after recoil
    Rmax = (508-Xmax)*.5;                // calculate max recoil
    Serial.print(Rmax);
    Serial.print("g   ");
    lcd = false;
  }
  if (millis()-time >= 4000) Xmax = 508;  // reset max recoil after 4 seconds
}
Logged

That little black caterpillar you just stepped on will set you back a few bucks....

Pages: 1 [2]   Go Up
Jump to: