Show Posts
|
|
Pages: [1]
|
|
1
|
Community / Gigs and Collaborations / Re: ADXL193 Accelerometer Assistance Needed!
|
on: February 02, 2013, 07:31:40 pm
|
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.
|
|
|
|
|
2
|
Community / Gigs and Collaborations / Re: Code needed! ADXL193 Accelerometer
|
on: February 02, 2013, 01:11:40 pm
|
|
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.
|
|
|
|
|
3
|
Community / Gigs and Collaborations / Code needed! ADXL193 Accelerometer
|
on: February 02, 2013, 12:59:36 pm
|
|
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
|
|
|
|
|
4
|
Community / Gigs and Collaborations / Re: ADXL193 Accelerometer Code
|
on: February 02, 2013, 11:01:47 am
|
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
|
|
|
|
|
6
|
Community / Gigs and Collaborations / ADXL193 Accelerometer Code
|
on: February 02, 2013, 08:50:01 am
|
Hello, I am I need of some assistance with some code I have found. I want to be able to measure the G-load of the deceleration of a helmet I designed with various materials and constructions built with-in it. Currently I have in my possession: Arduino Uno Board; ADXL193 +/- 250g accelerometer; breadboard and jumper wires. Here is the code: import processing.opengl.*; import processing.serial. *; Serial serial; int WIDTH = 1440; int analog_in = 0;
PFont font; void setup() { size(WIDTH,900,0PENGL); font= loadFont("Helvetica-Bold-20.vlw"); textFont(font, 20); textAiign(TOP,LEFT); serial =new Serial(this, Serial.list()[O], 115200); background(255); smooth(); }
int val = 0; void draw(){ background(255); fiii(O); stroke(O); while (serial.available() > 0) { int c =serial.read(); if (c >= '0' && c <= '9') { val =val * 10 + ((int)c - (int)'O'); } else if (c == '\n') { next(val); val= 0; } }
text("input: "+ analog_in, 40,140); renderBuffer(); text("max-noise: " + maxlnBuffer(), 340,90); text("min-noise: "+ minlnBuffer(), 340, 40); text("initial min: " + maxlnBuffer2(), 40,40); text("initial max:"+ minlnBuffer2(), 40,90); } float minInBuffer() { float min= 99999; for (inti= 0; i <WIDTH; i++) { if (min> buffer[i]) min = buffer[i]; } return min; }
float maxlnBuffer() { float max= 0; for (inti= 0; i <WIDTH; i++) { if (max< buffer[i]) max = buffer[i]; } return max; }
float minlnBuffer2() { float min = 99999; for (inti = 0; i < WIDTH; i++) { if (min > buffer2[i]) min = buffer2[i]; }
return min; } float maxlnBuffer2() { float max = 0;
for (inti= 0; i <WIDTH; i++){ if (max< buffer2[i]) max = buffer2[i]; } return max; }
int index= 0; float buffer[] =new float[ WIDTH]; float buffer2[] = new float[WIDTH]; float min = 509.0; float max = 506.0; float m = 2.0/(max- min); float b = 1.0 - m *max;
void next(int val) {
analog_in = val; float ace= (analog_in - 508)12; //println(val); if (pause) return; float gz = m *val + b; //float gz = 5.f*val*1OOO.f/(8.f*1024.f);
buffer[index] = gz; buffer2[index] = ace; index= (index+ 1)% WIDTH; } boolean pause= false;
void keyPressed() { if (key == 's') { saveFrame("snapshot.png"); pause =true; } if (key == 'p' II key == ' ') { pause = !pause; } } void renderBuffer() { int in = WIDTH-1; float last= 0; for (inti= index; i <WIDTH; i++, in--) { line(in,heightl2+buffer[i],in+1 ,last); last = heightl2+buffer[i]; } for (inti = 0; i <index; i++, in--) { line(in,heightl2+buff er[i],in+1 ,last); last = heightl2+buffer[i]; } }
Now, with this code the writter used the same equippment as me and managed to get usuable results from the code. I, cannot. The code is riddled with errors: sketch_feb02a.ino:9:16: error: invalid suffix "PENGL" on integer constant sketch_feb02a:1: error: 'import' does not name a type sketch_feb02a:2: error: 'import' does not name a type sketch_feb02a:3: error: 'Serial' does not name a type sketch_feb02a:7: error: 'PFont' does not name a type sketch_feb02a.ino: In function 'void setup()': sketch_feb02a:9: error: 'size' was not declared in this scope sketch_feb02a:10: error: 'font' was not declared in this scope sketch_feb02a:10: error: 'loadFont' was not declared in this scope sketch_feb02a:11: error: 'textFont' was not declared in this scope sketch_feb02a:12: error: 'TOP' was not declared in this scope sketch_feb02a:12: error: 'LEFT' was not declared in this scope sketch_feb02a:12: error: 'textAiign' was not declared in this scope sketch_feb02a:13: error: 'serial' was not declared in this scope sketch_feb02a:13: error: expected type-specifier before 'Serial' sketch_feb02a:13: error: expected `;' before 'Serial' sketch_feb02a:14: error: 'background' was not declared in this scope sketch_feb02a:15: error: 'smooth' was not declared in this scope sketch_feb02a.ino: In function 'void draw()': sketch_feb02a:20: error: 'background' was not declared in this scope sketch_feb02a:21: error: 'O' was not declared in this scope sketch_feb02a:21: error: 'fiii' was not declared in this scope sketch_feb02a:22: error: 'stroke' was not declared in this scope sketch_feb02a:23: error: 'serial' was not declared in this scope sketch_feb02a:33: error: 'text' was not declared in this scope sketch_feb02a:35: error: invalid operands of types 'const char [12]' and 'float' to binary 'operator+' sketch_feb02a:36: error: 'minlnBuffer' was not declared in this scope sketch_feb02a:37: error: invalid operands of types 'const char [14]' and 'float' to binary 'operator+' sketch_feb02a:38: error: invalid operands of types 'const char [13]' and 'float' to binary 'operator+' sketch_feb02a.ino: In function 'float minInBuffer()': sketch_feb02a:42: error: 'inti' was not declared in this scope sketch_feb02a:42: error: 'i' was not declared in this scope sketch_feb02a:43: error: 'buffer' was not declared in this scope sketch_feb02a.ino: In function 'float maxlnBuffer()': sketch_feb02a:51: error: 'inti' was not declared in this scope sketch_feb02a:51: error: 'i' was not declared in this scope sketch_feb02a:52: error: 'buffer' was not declared in this scope sketch_feb02a.ino: In function 'float minlnBuffer2()': sketch_feb02a:60: error: 'inti' was not declared in this scope sketch_feb02a:60: error: 'i' was not declared in this scope sketch_feb02a:61: error: 'buffer2' was not declared in this scope sketch_feb02a.ino: In function 'float maxlnBuffer2()': sketch_feb02a:70: error: 'inti' was not declared in this scope sketch_feb02a:70: error: 'i' was not declared in this scope sketch_feb02a:71: error: 'buffer2' was not declared in this scope sketch_feb02a.ino: At global scope: sketch_feb02a:78: error: initializer fails to determine size of 'buffer' sketch_feb02a:79: error: initializer fails to determine size of 'buffer2' sketch_feb02a.ino: In function 'void next(int)': sketch_feb02a:88: error: expected ',' or ';' before numeric constant sketch_feb02a:90: error: 'pause' was not declared in this scope sketch_feb02a.ino: In function 'void keyPressed()': sketch_feb02a:101: error: 'key' was not declared in this scope sketch_feb02a:101: error: 'saveFrame' was not declared in this scope sketch_feb02a:103: error: 'key' was not declared in this scope sketch_feb02a:103: error: expected `)' before 'II' sketch_feb02a.ino: In function 'void renderBuffer()': sketch_feb02a:110: error: 'inti' was not declared in this scope sketch_feb02a:110: error: 'i' was not declared in this scope sketch_feb02a:111: error: 'heightl2' was not declared in this scope sketch_feb02a:111: error: 'line' was not declared in this scope sketch_feb02a:114: error: 'i' was not declared in this scope sketch_feb02a:115: error: 'heightl2' was not declared in this scope sketch_feb02a:115: error: 'buff' was not declared in this scope sketch_feb02a:115: error: 'line' was not declared in this scope
Along with "import does not have a name type" in an orange box. Ultimately, I want the code to interpret the results from the accelerometer and display them to me on a graph so I can draw some conclusions. Goes without saying really, your help is very much appreciated. Thanks Mike
|
|
|
|
|
8
|
Community / Gigs and Collaborations / Re: ADXL193 Accelerometer Assistance Needed!
|
on: February 02, 2013, 05:54:17 am
|
|
I assumed the code was Arduino. Maybe that is where I went wrong. Ardunio was defiantly used for the testing though. I know what you mean about it being incomplete though, I mean, it doesn’t include the void setup and void loop.
Just tried formatting it, no luck. I'll re type it in Notepad++ and give that a shot.
I had come across the punch sensor during my Internet trawl but they talk a lot about an analog converter and, to my knowledge (HA!) I don't need one.
Thanks for your help Codlink.
|
|
|
|
|
9
|
Community / Gigs and Collaborations / Re: ADXL193 Accelerometer Assistance Needed!
|
on: February 02, 2013, 03:50:39 am
|
Here are the errors: sketch_feb01b:27: error: stray '\' in program sketch_feb01b:27: error: stray '\' in program sketch_feb01b:28: error: stray '\' in program sketch_feb01b:28: error: stray '\' in program sketch_feb01b:28: error: stray '\' in program sketch_feb01b:35: error: stray '\' in program sketch_feb01b:35: error: stray '\' in program sketch_feb01b:38: error: stray '\' in program sketch_feb01b:38: error: stray '\' in program sketch_feb01b:39: error: stray '\' in program sketch_feb01b:39: error: stray '\' in program sketch_feb01b:40: error: stray '\' in program sketch_feb01b:40: error: stray '\' in program sketch_feb01b:41: error: stray '\' in program sketch_feb01b:41: error: stray '\' in program sketch_feb01b:105: error: stray '\' in program sketch_feb01b:105: error: stray '\' in program sketch_feb01b:106: error: stray '\' in program sketch_feb01b:106: error: stray '\' in program sketch_feb01b:109: error: stray '\' in program sketch_feb01b:109: error: stray '\' in program sketch_feb01b:109: error: stray '\' in program sketch_feb01b:109: error: stray '\' in program sketch_feb01b:1: error: 'import' does not name a type sketch_feb01b:2: error: 'import' does not name a type sketch_feb01b:4: error: 'Serial' does not name a type sketch_feb01b:7: error: 'PFont' does not name a type sketch_feb01b.ino: In function 'void setup()': sketch_feb01b:10: error: 'OPENGL' was not declared in this scope sketch_feb01b:10: error: 'size' was not declared in this scope sketch_feb01b:11: error: 'font' was not declared in this scope sketch_feb01b:11: error: 'textFont' was not declared in this scope sketch_feb01b:12: error: 'TOP' was not declared in this scope sketch_feb01b:12: error: 'LEFT' was not declared in this scope sketch_feb01b:12: error: 'textAIign' was not declared in this scope sketch_feb01b:13: error: 'serial' was not declared in this scope sketch_feb01b:13: error: expected type-specifier before 'Serial' sketch_feb01b:13: error: expected `;' before 'Serial' sketch_feb01b:14: error: 'background' was not declared in this scope sketch_feb01b:15: error: 'smooth' was not declared in this scope sketch_feb01b.ino: In function 'void draw()': sketch_feb01b:21: error: 'background' was not declared in this scope sketch_feb01b:22: error: 'fill' was not declared in this scope sketch_feb01b:23: error: 'stroke' was not declared in this scope sketch_feb01b:24: error: 'seriaI' was not declared in this scope sketch_feb01b:27: error: 'u20190' was not declared in this scope sketch_feb01b:27: error: expected `)' before 'u2019' sketch_feb01b:28: error: 'u2018' was not declared in this scope sketch_feb01b:28: error: expected `)' before 'n' sketch_feb01b:35: error: 'u201cinput' was not declared in this scope sketch_feb01b:35: error: 'text' was not declared in this scope sketch_feb01b:38: error: 'u201cmax' was not declared in this scope sketch_feb01b:38: error: 'noise' was not declared in this scope sketch_feb01b:39: error: 'u201cmin' was not declared in this scope sketch_feb01b:40: error: 'u201cinitiaI' was not declared in this scope sketch_feb01b:41: error: expected `)' before 'max' sketch_feb01b.ino: In function 'float minInBuffer()': sketch_feb01b:47: error: 'buffer' was not declared in this scope sketch_feb01b.ino: In function 'float maxInBuffer()': sketch_feb01b:55: error: 'buIfer' was not declared in this scope sketch_feb01b:56: error: 'buffer' was not declared in this scope sketch_feb01b.ino: In function 'float minlnBuffer2()': sketch_feb01b:63: error: 'buffer2' was not declared in this scope sketch_feb01b.ino: In function 'float maxlnBuffer2()': sketch_feb01b:72: error: 'buffer2' was not declared in this scope sketch_feb01b.ino: At global scope: sketch_feb01b:78: error: 'O' was not declared in this scope sketch_feb01b:79: error: 'WlDTH' was not declared in this scope sketch_feb01b:79: error: initializer fails to determine size of 'bufter' sketch_feb01b:80: error: 'WlDTH' was not declared in this scope sketch_feb01b:80: error: initializer fails to determine size of 'bufter2' sketch_feb01b.ino: In function 'void next(int)': sketch_feb01b:92: error: 'pause' was not declared in this scope sketch_feb01b:97: error: 'buffer' was not declared in this scope sketch_feb01b:98: error: 'buffer2' was not declared in this scope sketch_feb01b.ino: In function 'void keyPressed()': sketch_feb01b:105: error: 'key' was not declared in this scope sketch_feb01b:105: error: 'u2018s' was not declared in this scope sketch_feb01b:105: error: expected `)' before 'u2019' sketch_feb01b:106: error: 'u201csnapshot' was not declared in this scope sketch_feb01b:106: error: 'saveFrame' was not declared in this scope sketch_feb01b:109: error: 'key' was not declared in this scope sketch_feb01b:109: error: 'u2018p' was not declared in this scope sketch_feb01b:109: error: expected `)' before 'u2019' sketch_feb01b.ino: In function 'void renderBuffer()': sketch_feb01b:118: error: 'height' was not declared in this scope sketch_feb01b:118: error: 'buffer' was not declared in this scope sketch_feb01b:118: error: 'line' was not declared in this scope sketch_feb01b:122: error: 'height' was not declared in this scope sketch_feb01b:122: error: 'buffer' was not declared in this scope sketch_feb01b:122: error: 'line' was not declared in this scope
I got the code from a .pdf document of a report based on helmet testing. I had to run the .pdf doument through an OCR program to get the text. The only thing I can think is that there are background programs/requirements the previous code writer had on their PC? Or maybe the OCR program didn't do too good of a job. I'll have a pop at writing it all myself today and see where that gets me. What's the general consensus of people writing code for other people and being paid in return, that is seriously where I am right now... Thanks
|
|
|
|
|
10
|
Community / Gigs and Collaborations / Re: ADXL193 Accelerometer Assistance Needed!
|
on: February 01, 2013, 04:09:08 pm
|
Ok folks, thanks for the help so far! I will get that all wired up soon. I have moved onto the code, you know, the one I already had and that wasn't going to be a problem. Well, now, it sort of is. import processing.opengl.*; import processing.serial.*;
Serial serial; int WIDTH = 1440; int analog_in = 0; PFont font;
void setup(){ size(WIDTH,900,OPENGL); textFont(font,20); textAIign(TOP,LEFT); serial = new Serial(this, SeriaI.Iist()[0], 115200); background(255); smooth(); }
int val = 0;
void draw() { background(255); fill(0); stroke(0); while (seriaI.available() > 0) { int c = seriaI.read(); if (c >= '0' && c <= '9') { val = val * 10 + ((int)c - (int)’0’); } else if (c == ‘\n’){ next(val); val = 0; } }
text(“input: “ + anaIog_in,40,140);
renderBuffer(); text(“max-noise: “ + maxInBuffer(),340,90); text(“min-noise: “ + minInBuffer(),340,40); text(“initiaI min: “ + maxInBuffer2(),40,40); text(“initiaI max: “ + minInBuffer2(),40,90);
} float minInBuffer() { float min = 99999; for (int i = 0; i < WIDTH; i++){ if (min > buffer[i]) min = buffer[i]; } return min; } float maxInBuffer() { float max = 0; for (int i = 0; i < WIDTH; i++){ if (max < buIfer[i]) max = buffer[i]; } return max; } float minlnBuffer2() { float min = 99999; for (int i = 0; i < WIDTH; i++){ if (min > buffer2[i]) min = buffer2[i]; } return min; }
float maxlnBuffer2() { float max = 0; for (int i = 0; i < WIDTH; i++){ if (max < buffer2[i]) max = buffer2[i]; } return max; }
int index = O; float bufter[] = new float[WlDTH]; float bufter2[] = new float[WlDTH];
float min = 509.0; float max = 506.0; float m = 2.0/(max - min); float b = 1.0 - m * max;
void next(int val) {
analog_in = val; float acc = (analog_in - 508)/2; //println(val); if (pause) return;
float gz = m * val + b; //float gz = 5.f*val*1000.f/(8.f*1024.f); buffer[index] = gz; buffer2[index] = acc; index = (index + 1) % WIDTH; }
boolean pause = false;
void keyPressed(){ if (key == ‘s’){ saveFrame(“snapshot.png”); pause = true; } if (key == ‘p’ ll key == ‘ ‘){ pause = !pause; } }
void renderBuffer(){ int in = WIDTH-1; float last = 0; for (int i = index; i < WIDTH; i++, in--){ line(in,height/2+buffer[i],in+1,last); last = height/2+buffer[i]; } for (int i = 0; i < index; i++, in--){ line(in,height/2+buffer[i],in+1,last); last = height/2+buffer[i]; } }
When I try to upload the code to the board I get a large amout of errors. I do not have anything wired up by the way. I found this code from a web page and I tried to use it because it is exactly what I am after and uses the same accelerometer. Help please. Thanks Mike
|
|
|
|
|
11
|
Community / Gigs and Collaborations / ADXL193 Accelerometer Assistance Needed!
|
on: January 31, 2013, 04:38:24 pm
|
Hello, A bit of a poor first post, asking for assistance and all. A bit of background first. I am looking into the impact resistance qualities of some materials and constructions for a new cycling helmet idea for a University project. I plan to drop the helmet from varying heights with a 5kg head form with the accelerometer mounted and record the results as they come I took the plunge and bought an UNO board, and an ADXL193 +/-250g accelerometer as well as a solder-less bread board and a lot of pins. Now I find myself with a whole lot of bits and just as much inexperience. I have viewed the data sheet for the accelerometer but it does not look anything like the one I have in my hand. http://www.sparkfun.com/datasheets/Sensors/Accelerometer/ADXL193.pdfAnd here is the accelerometer... https://www.sparkfun.com/products/9332I have a code I plan to use I just need to get it all together and in harmony. So then, what pins go where?  Any assistance will be greatly appreciated. Thanks Mike
|
|
|
|
|