Show Posts
Pages: [1] 2 3 4
1  Using Arduino / Sensors / Re: Please help!Newbie on ADXL335 on: May 16, 2012, 11:55:19 am

Using what circuit? Running which code? You have to help us to help you...
it is just a simple code:
Code:
const unsigned int X_AXIS_PIN = 0;
const unsigned int Y_AXIS_PIN = 1;
const unsigned int Z_AXIS_PIN = 2;
const unsigned int BAUD_RATE = 9600;

void setup() {
  Serial.begin(BAUD_RATE);
}

void loop() {
  Serial.print(analogRead(X_AXIS_PIN));
  Serial.print(" ");
  Serial.print(analogRead(Y_AXIS_PIN));
  Serial.print(" ");
  Serial.println(analogRead(Z_AXIS_PIN));
  delay(100);
}
how can i get the acceleration from the output?
2  Using Arduino / Sensors / Please help!Newbie on ADXL335 on: May 16, 2012, 11:05:01 am
Hi when i connect with arduino Uno, i saw output:
326 326 400

how do i change the these value for each axis into acceleration value?in real ms-2 unit...appreciate for any1 to replied, thanks in advance
3  Topics / Robotics / Re: How to control 3 servo motors with the UNO on: May 05, 2012, 01:30:00 am
Hi, i am also uisng servo motors to do my project. As what author mentioned i need 3 servo motors also. Can anyone suggest about the external power of the servo motors? Using AA battery??
4  Using Arduino / Sensors / Re: Need help for algorithm that act like wrist (Adxl335 + servo motor) on: May 03, 2012, 08:03:53 am
What you should do is power the servo with an external source, the arduino should just send the commands. In practice, plug the servo power pin and ground to a power source, and the servo command pin and ground to the arduino.

this is also another way that i am thinking of. But i need another power source..the external power source u mean is battery?because i wish to make a easier carry and mobility sensor...hope my sensor will not be too much stuff on top. Is that mean i need to use another 1 arduino board?
Any more suggestion is appreciate...really need help here.... smiley-cry
5  Using Arduino / Sensors / Re: Need help for algorithm that act like wrist (Adxl335 + servo motor) on: April 22, 2012, 09:55:10 am
Does sound like a power issue - generally, you can't power servos from the Arduino, especially if you're trying it with more than one.

so what method can u suggest to me??because i saw from:


so i believe that can use the power. Is there any problem in my code?...anyway...really thanks so much for your replied..appreciate...
6  Using Arduino / Sensors / Re: Need help for algorithm that act like wrist (Adxl335 + servo motor) on: April 22, 2012, 04:23:03 am
i modified my code at the part of atan2 to:
Code:
//convert read values to degrees -90 to 90 - Needed for atan2
  int xAng = map(xRead, minVal, maxVal, 0, 180);
  int yAng = map(yRead, minVal, maxVal, 0, 90);
  int zAng = map(zRead, minVal, maxVal, 0, 90);

  //Caculate 360deg values like so: atan2(-yAng, -zAng)
  //atan2 outputs the value of -π to π (radians)
  //We are then converting the radians to degrees
  x = RAD_TO_DEG * (atan2(yAng, zAng));
  y = RAD_TO_DEG * (atan2(xAng, zAng));
  z = RAD_TO_DEG * (atan2(yAng, xAng));

To convert to degree and match with servo motor range. I remap it to become 0-180 for x, 0-90 for y and 0-90 for z. But now the problem i met is when i use more than 1 servo motor, the reading will become unstable...may i know why?
when i am using 1 servo motor. It works well. I can control the servo motor with sensor. (although not exact accurate angle). But when i connect 2 servo motor. The data will become negative values...is it be power supplied problem?all the Vcc and Gnd is connected with same pin. That is 3V3.

any suggestion is really helpful. Thanks first smiley-cry
7  Using Arduino / Sensors / Need help for algorithm that act like wrist (Adxl335 + servo motor) on: April 21, 2012, 02:28:09 am
Hi all before that i am using ADXL345 eval board. Because of the communication problem between the eval board and arduino. I give up on the eval board and change to breakoutboard ADXL335. The before posting is: http://arduino.cc/forum/index.php/topic,95980.0.html

Now i can get the reading directly from adxl335 and process it at arduino. Now my project is related on the hand movement control servo motor. I am referring to http://bildr.org/2011/04/sensing-orientation-with-the-adxl335-arduino/ so that i can figure out what algorithm can be used to act like the movement of the wrist.

Objective:
1. the sensor is placed on wrist. The movement of the wrist is transfer to the Arduino Uno board and process and then send the output to servo motor.
2. 3 servo motors are used to control each axis. (x,y,z)

Here is what i had in my code:
Code:
#include <Servo.h>
 
Servo myservo;  // create servo object to control a servo
                // a maximum of eight servo objects can be created
Servo myservo1;
Servo myservo2;
 
const int xPin = 0;
const int yPin = 1;
const int zPin = 2;

//The minimum and maximum values that came from
//the accelerometer while standing still
//You very well may need to change these
int minVal = 262;
int maxVal = 402;

//to hold the caculated values
int x = 0;
int y = 0;
int z = 0;

void setup(){
  Serial.begin(9600);
  myservo.attach(9);
  myservo1.attach(10);
  myservo2.attach(11);
}

void loop(){

  //read the analog values from the accelerometer
  int xRead = analogRead(xPin);
  int yRead = analogRead(yPin);
  int zRead = analogRead(zPin);

  //convert read values to degrees -90 to 90 - Needed for atan2
  int xAng = map(xRead, minVal, maxVal, -90, 90);
  int yAng = map(yRead, minVal, maxVal, -90, 90);
  int zAng = map(zRead, minVal, maxVal, -90, 90);

  //Caculate 360deg values like so: atan2(-yAng, -zAng)
  //atan2 outputs the value of -π to π (radians)
  //We are then converting the radians to degrees
  x = RAD_TO_DEG * (atan2(-yAng, -zAng) + PI);
  y = RAD_TO_DEG * (atan2(-xAng, -zAng) + PI);
  z = RAD_TO_DEG * (atan2(-yAng, -xAng) + PI);

  //Output the caculations
  Serial.print("x: ");
  Serial.print(x);
  myservo.write(x);
  delay(15);
  Serial.print(" | y: ");
  Serial.print(y);
  myservo1.write(y);
  delay(15);
  Serial.print(" | z: ");
  Serial.println(z);
  myservo2.write(z);
  delay(15);

  delay(100);//just here to slow down the serial output - Easier to read
}

Question:
1. according to the code, converting method to degree can be modified or not?
2. After tested the code with servo motor, the servo motor will move randomly (seem like messy output but it gives no problem in serial monitor)
3. Any1 can advised me how to works on this moving algorithm? many thanks for those who replied. Many thaks smiley
8  Using Arduino / Project Guidance / Re: How to send text file in pc to arduino? on: April 15, 2012, 04:01:35 am

In the light of all those quoted statements(it's been a hard time understanding all that  smiley-eek-blue  smiley-lol) i think you are not using the serial tx/rx uart ports and going to this method of posting in a text file because you can't get the whole values from the accelerometer (adxl) which are like 355, 456 and you are getting single values '7' ? is this the problem ? then ustilising the packet's will solve it.

Hi Nishant, sorry to make u confuse. The purpose of this thread is to ask how to send the data from test file in pc to arduino. It is because i have the data from eval board ADXL345. Then, Udo Klein ask me why i am not direct connect arduino to eval board ADXL345. So i am explained what is the problem that i am facing.

About Serial.write("7") is the example that i am going to test whether the data is sending out from arduino by using Serial communication. If i direct connect arduino to eval board. The data cant send/receive to/from eval board.

If i use hyperterminal in pc (connect eval board to PC), the reading i get is in the format : X:ff01 Y:0023 Z:ff11
So my perception is that: i hope i can replaced PC to Arduino and received the data from eval board. But i failed to do it.  smiley-cry smiley-cry

And now i change another way round, get the data and stored in a txt file in pc first. Then, only transfer the file to arduino.

Hope you can understand. Really so appreciate your time here thanks  smiley-grin
9  Using Arduino / Project Guidance / Re: How to send text file in pc to arduino? on: April 15, 2012, 03:39:44 am
The eval board has a pair of serial pins. Can you not make use of those?

HI thanks for ur replied. I tried make use of those TX and RX at the eval board as well. I try before to declare the pin at arduino RX to receive the input from TX on Eval board but the reading is something just like a current electric value, not the position value for those 3 axis. From the beginning till now, i search through many information about this eval board but it is less. So i do hope that can discuss with you all here.

Thanks for you all spending your time here.
10  Using Arduino / Project Guidance / Re: How to send text file in pc to arduino? on: April 15, 2012, 03:23:51 am
Why not connect the eval board directly with the Arduino thus leaving the PC out of the loop?
This is the step that i tried at the beginning. At the first sight i receive the project (Eval board adxl345 + arduino Uno) i am just planning to connect both without pc. But regarding to my previous post:
http://arduino.cc/forum/index.php/topic,97346.0.html

Mr.johnwasser suggested that my eval board is not suitable to connect direct to arduino since the pin mapping in the eval board already used up for another purpose. The only 1 possible way is using USB direct connect to arduino uno. But i faced another problem that arduino cant even been activated (maybe not recognize the eval board) when i connect directly Uno to eval board. For example, a simple code Serial.write("7").
Suppose the Tx led on Uno will be light up if data sent. But when i connect it to eval board. It is no light up at all. The data cant sent.

So i try another way, save the data to a text file and then transfer it to arduino. PC as intermediate medium. I really hope that i could find someone to help me out to hear my problem....

Sorry for my english if anywhere make you trouble to read this. Thanks
11  Using Arduino / Project Guidance / Re: How to send text file in pc to arduino? on: April 15, 2012, 03:07:40 am
Quote
Can any1 help me out??really appreciate thanks.

It might be good to Explain the big picture on what you are trying to do. With windows you can send a file to the com port using a simple batch file like below.

Code:
type hotpix.jpg >com5


ok basically i am using a eval board of adxl345 sensor. I can stored the value to a txt file in my PC. Then i have to send the data in the txt file to arduino to control a servo motor. So since the data is read line by line in each line as i describe previously. How i going to stored each axis value to a variable?
12  Using Arduino / Project Guidance / Re: How to send text file in pc to arduino? on: April 15, 2012, 02:39:02 am
I made it   smiley

You can not use it to send a text file as a whole unit to Arduino, but you can use it to send a line at a time from a text file.

Check the documentation page 26.



Hi i also done it with given downloadtest.pde in sample folder...able to print it at the gobetwino ....but i have to store it into a variable for further calculation...is it possble"??
for example in a line i have : x:ff22 y:f00ef z:ff23

can i stored a = ff22, b= 00ef c=ff23? can i make something like this???
Let's say i have 100 lines with different value....

Can any1 help me out??really appreciate thanks.
13  Using Arduino / Project Guidance / Re: How to send text file in pc to arduino? on: April 14, 2012, 06:56:14 am
In the GoBetwino download there's a PDF file describing the sample code that also comes with the download.

In there you can see how your Arduino program can ask GoBetwino to send over a line from a text file.



have u ever used it?i checked on this software already. I read that it is not fully tested for windows 7...just wondering how to use to send the text file to arduino....
14  Using Arduino / Project Guidance / Re: How to send text file in pc to arduino? on: April 14, 2012, 04:01:50 am
If you want to automatically transmit it this is the way to go. If you want to copy it manually you could use the serial monitor. If you are satisfied to transmit it statically you could compile it into your program. Until you explain clearly what you want to achieve more specific advice is close to impossible.

Maybe the GoBetwino will fit you bill but unless you get more specific nobody can tell you.

Now i am just a beginner to face with whatever i am working on. These kind of stuff is strange for me...so i need some example to start...after searching the information that you provided...it is seem like less what i had found regarding to my case....so to read a txt file and send to arduino, is this necessary to use another software to do it? cant just use arduino code?
15  Using Arduino / Project Guidance / Re: How to send text file in pc to arduino? on: April 14, 2012, 03:59:20 am
Don't know GoBetwino, but when I look here: http://arduino.cc/playground/Interfacing/GoBetwino I see in the list what we can do with it: "Read a file and return data to Arduino." AreN#t there any examples in the package? (I've not downloaded it). Perhaps Processing will help? http://www.processing.org, too.

best regards
Andreas


Hi Andreas...thanks for your info. I am not using processing before so i just scare will make this become complicated...is it suitable for my case?if yes then i probably will work on this....about gobetwino...i cant find any examples through their blog...so this make me struggling....anyway thanks
Pages: [1] 2 3 4