New to accelerometer code, a few questions?
hi, have seen couple of accelerometer tuts, , more or less using based going.
i have modified suit accelerometer , add output serial monitoring values.
i have accelerometer mounted on 'tube' on pvc.. mimic final 'mounting' orientation , use.
with wire/cable going arduino duemilanove per circuit outline in sketch comments:
im little unsure original author meant section/comments:
i have:
accelerometer pwr analog pin5
accelerometer gnd analog pin4
accelerometer x axis analog pin3
accelerometer y axis analog pin2
accelerometer z axis analog pin1
my goal two-fold.. i want able 'track' whenever 'sword' (accelerometer) being swung @ relatively decent speed, , of course execute event/function.. (later might add multi swing/force checking, 1 'threshold' enough going)
secondly.. i'd learn/figure out how detect abrupt stop swung , hit something
i hope havent lost anyone.. trying give decent background communication purposes.
onto 'results' , best way handle this.
the values of given axis around 340-360 (when output serial monitor in arduino ide) , of course 1 value/axis of 3 around 470-490.. 'higher valued 'axis' depends on orientation/mounting of board.
more or less after plain totaling of axis values.. under 'around' 1000 verified swing/movement..swinging harder gave me lower total..
i not feel accurate way of doing since orientation not known (think swordplay/fighting..etc)
and orientation , way might held..etc.. swing in direction needs trigger event/function....and id take 1 step closer detecting abrupt stop or 'hit' event.
id imaging id need write sort of 'timer' watchdog check sudden increase/decrease in force in 'under' ms time frame?
ie:
value of swing 900 something.. if value reaches 100 in under milisecond threshold consider hit/abrupt stop event?
anyone input chime in.. comments (positive) appreciated.
thanks
i have modified suit accelerometer , add output serial monitoring values.
i have accelerometer mounted on 'tube' on pvc.. mimic final 'mounting' orientation , use.
with wire/cable going arduino duemilanove per circuit outline in sketch comments:
code: [select]
/*
accelerometer: de-accm3d [buffered 3d accelerometer]
http://www.dimensionengineering.com/de-accm3d.htm
original code:
http://www.arduino.cc/en/tutorial/adxl3xx
created: 07.02.08
(by david a. mellis)
modified 06.13.10
(by jerry dugan)
the circuit:
analog 1: z-axis
analog 2: y-axis
analog 3: x-axis
analog 4: ground
analog 5: vcc
example code in public domain.
*/
// these constants describe pins. won't change:
const int groundpin = 18; // analog input pin 4 -- ground
const int powerpin = 19; // analog input pin 5 -- voltage
const int xpin = 3; // x-axis of accelerometer
const int ypin = 2; // y-axis
const int zpin = 1; // z-axis (only on 3-axis models)
void setup()
{
// initialize serial communications:
serial.begin(9600);
// play tone when ready
tone(8, 350, 250);
// provide ground , power using analog inputs normal
// digital pins. this makes possible directly connect the
// breakout board arduino. if use normal 5v and
// gnd pins on arduino, can remove these lines.
pinmode(groundpin, output);
pinmode(powerpin, output);
digitalwrite(groundpin, low);
digitalwrite(powerpin, high);
}
void loop()
{
// print sensor values:
serial.print("x: ");
serial.print(analogread(xpin));
// print tab between values:
serial.print("\t");
serial.print("y: ");
serial.print(analogread(ypin));
// print tab between values:
serial.print("\t");
serial.print("z: ");
serial.print(analogread(zpin));
// print axis value totals:
serial.print("\t");
serial.print(analogread(xpin) + analogread(ypin) + analogread(zpin));
unsigned int total = (analogread(xpin) + analogread(ypin) + analogread(zpin));
serial.print("------>");
serial.print(total);
if (total < 1000){
tone(8, 550, 250);
}
serial.println();
// delay before next reading:
delay(100);
}
im little unsure original author meant section/comments:
code: [select]
// provide ground , power using analog inputs normal
// digital pins. this makes possible directly connect the
// breakout board arduino. if use normal 5v and
// gnd pins on arduino, can remove these lines.
pinmode(groundpin, output);
pinmode(powerpin, output);
digitalwrite(groundpin, low);
digitalwrite(powerpin, high);
}i have:
accelerometer pwr analog pin5
accelerometer gnd analog pin4
accelerometer x axis analog pin3
accelerometer y axis analog pin2
accelerometer z axis analog pin1
my goal two-fold.. i want able 'track' whenever 'sword' (accelerometer) being swung @ relatively decent speed, , of course execute event/function.. (later might add multi swing/force checking, 1 'threshold' enough going)
secondly.. i'd learn/figure out how detect abrupt stop swung , hit something
i hope havent lost anyone.. trying give decent background communication purposes.

onto 'results' , best way handle this.
the values of given axis around 340-360 (when output serial monitor in arduino ide) , of course 1 value/axis of 3 around 470-490.. 'higher valued 'axis' depends on orientation/mounting of board.
more or less after plain totaling of axis values.. under 'around' 1000 verified swing/movement..swinging harder gave me lower total..
i not feel accurate way of doing since orientation not known (think swordplay/fighting..etc)
and orientation , way might held..etc.. swing in direction needs trigger event/function....and id take 1 step closer detecting abrupt stop or 'hit' event.
id imaging id need write sort of 'timer' watchdog check sudden increase/decrease in force in 'under' ms time frame?
ie:
value of swing 900 something.. if value reaches 100 in under milisecond threshold consider hit/abrupt stop event?
anyone input chime in.. comments (positive) appreciated.
thanks
bump.. 
anyone? am alone here.. lol
on side note.. there other 'arduino' forums..that re more active? lots of members/traffic?
thanks

anyone? am alone here.. lol
on side note.. there other 'arduino' forums..that re more active? lots of members/traffic?
thanks
Arduino Forum > Forum 2005-2010 (read only) > Software > Syntax & Programs > New to accelerometer code, a few questions?
arduino
Comments
Post a Comment