Show Posts
Pages: [1] 2 3
1  Using Arduino / Motors, Mechanics, and Power / servo question on: October 13, 2011, 10:35:13 am
Hello,

I was wondering to connect a servo to the arduino mega do you need a servo controller. I have seen lots of servo controller but I dont really see the need for them. I was under the impression that I could use a prototyping board from radio shack. Sodder in the some pins to connec the servos. Connec the servo pins to a power pin and ground pin where the battery for the servo is connected. then run the signal pins to seperate digital I/O pins on the mega and give command from there. Is this correct?
2  Using Arduino / Networking, Protocols, and Devices / Re: Arduino + Xbee question on: October 12, 2011, 01:20:17 pm
Thanks PaulS and Xenosis . I will get the series 1 then because the megas Xbee will be a listener only as it is just intended to receive the laptop command and move servos for an attachment and receive the controllers command to move the legs/wheels/etc. thanks for the help I appreciate it.
3  Using Arduino / Networking, Protocols, and Devices / Re: Arduino + Xbee question on: October 12, 2011, 12:00:54 pm
Thanks! My last question about the xbee then is this from what I have found the series 1 is for point-to-point ie(2 xbees communicating) and the series 2 is for multiple xbees communicating. Would it be possible to connect 2 xbees to one mega. I want to use an xbee for a wireless controller similar to the arbotix wireless controller () but I am also planning on a xbee wireless serial connection to recieve inputs from a computer hooked too a laptop. Therefore I onlt need 2 xbees commuicating to each other.

Controller xbee >>>>> Arduino xbee
Laptop xbee >>>>>>arduino xbee #2

If this isn't possible would I then need to get the series 2 so that all can talk to each other and the laptop and controller xbees will just ignore each other based on tags but on the signals? Thanks for all the help too I really appreciate it. I have been planning this project for a long time now and since the budget isnt huge I am trying to avoid unnessecary spending by getting components I am sure will be able to work together.
4  Using Arduino / Networking, Protocols, and Devices / Re: Arduino + Xbee question on: October 12, 2011, 10:38:16 am
Thank you. Does the Xbee sheild work with the mage 2560 and if so can someone link a sheild that will work. What I am concerned about is the sheild blocking too many of the io ports so that I wont have enough for my project. thanks
5  Using Arduino / Networking, Protocols, and Devices / Arduino + Xbee question on: October 12, 2011, 09:08:47 am
I was wondering is it possible to connect the Xbee to the arduino mega without the Xbee sheild. I am planning on using Xbee to tranmit serial data from PC to teh mega  on board a robotics platform. I was curious on the difficulty of connecting it without the sheild. I just think for my application it may be more practical to just breadboard the xbee to the arduino. Just want to make sure it can be done before I start ordering things. Thanks
6  Using Arduino / Programming Questions / Re: Sweeping servo program question on: October 11, 2011, 09:37:53 am
I think that answers my question without the feedback I am either going to have to step through the sweep so I know the approximate position or keep the camera stationary so that the exact angle of rotation needed can be found. thanks for your help. The only other option I have thought of is possibly using hacked full rotation servos and instuting some form of PID control where the programmer code will give a left or right value based on how far it need to move and give a 90 degree (no motion) value if the object is in the center. I may see how this works out. Thanks for your help though I do appreciate it.
7  Using Arduino / Programming Questions / Re: Sweeping servo program question on: October 11, 2011, 08:36:13 am
Ok. I am gonna try to explain what I mean. I know the value in write is the angle to turn to. However, If I have the servo panning the angle sent from the serial isnt the angle needed by the servo. I am using digital servos so I can slow down the rotation speed so to sweep i can use.

myservo.write(0)
myservo.write(180)

which will sweep the full 180 degrees. Now however say the camera picks up a red object at 90 degrees. It used the pixel and view angle values to calculate the needed angle of rotation based on where the servo is now. Lets say the program determine the servo needs to rotate 15 degrees furthur from the current location. If it was to send this and use your way the byte value sent would be 15. So the servo would then rotate backward to 15 degrees when I actually intended it to go to 105 degrees. I could write the programmer code to write the actual rotation angle needed but I would need some feedback of the current servo location.
8  Using Arduino / Programming Questions / Re: Sweeping servo program question on: October 11, 2011, 08:01:07 am
Well what I plan to do is sweep the servo back and forth to search for red objects. The camera is connected to the sweep servo. So when the camera sees the object it will track the object using blob detection. It will find the centroid of the object and retrieve the pixel info (x-pixel,y-pixel). Knowing the pixels, total resolution, and camera view angle it will calculate the ammount of degrees it needs to turn to center the object in the frame. So serial.read() will retrieve the 2 angles (pan and tilt but i am simplifying just to understand how to do it) being passed from the programmer code. Since, the servo is in a sweep the angles it needs to turn are degrees from the current location. I am just not sure how to have the arduino stop the sweep and do something like this

panangle = serial.read()
panservo.write(current/last angle + panangle);

Just not sure how to get the current/last command angle to make it work. So far the only thing I have thought of is to step the servo through certain angles in the sweep like this (syntax may not be right just writing an example)

val = 0;
if (serial.read()<1)
val = val +10
panservo.write(val)
delay(10)
else if (serial.read()!<1)
panangle = serial.read()
targetangle = val+panangle;
panservo.write(targetangle)

This just seems messy and I am hoping there is a better way.
9  Using Arduino / Programming Questions / Re: Sweeping servo program question on: October 10, 2011, 08:51:03 pm
I'm sorry your right I forgot that. The servo I am using requires it between 600-2300. I just don't know how to tell the arduino to move the servo from the current position. For instance

Start sweep>>>if(Serialinput >1), stop sweep, serial.read >>>>>>>> take serial.read number and add it to the current servo position.>>>> Turn servo to that position
10  Using Arduino / Programming Questions / Sweeping servo program question on: October 10, 2011, 08:37:04 pm
Hello,

I am trying to write a program that will sweep a servo from 0 to 180 degrees. This is pretty basic but I am including a webcam that Is attached to the servo. I will be using the programmer IDE since it has an arduino library to do tracking. The video will be fed into my laptop where the programmer program will do object tracking and transmit the object location in terms of degerees to rotate the servo through serial to the arduino. I am just wondering how to i tell the arduino to stop  sweeping the servo and move X degrees from the CURRENT position. This is where my problem is seeing as in the servo library you give a 0-2400 signal to rotate the servo but I want to move a certain number from the current location in the sweep motion. Thanks for any help you can give.
11  Using Arduino / Project Guidance / Re: camera system guidance needed on: October 10, 2011, 08:19:15 am
I was saying size doesn't matter as much as weight. As long as it is light it can be large if need be. The pixels arn't of too much concern. I just need to be able to make out the image of what the robot is seeing at the time so that I can perform tracking algorithms. So maybe enough to be able to make out a 3" x 3"red square from approx. 5' away. I claim pixels dont matter as I am only planning on line of sight control therefore the robot will not need to be piloted through the camera so it will only be used for tracking pruposed. As for speed I turely dont know what is needed I would assume the tracking algorithm could keep it semi-accurate as long as i was getting a couple frames per second of the video.

I am more concerned now with  figuring out how exactly to transmit the data from a camera to my laptop as this is where I am having trouble. I am concerned with using the IP cameras as they are heavy which can be helped by removing the outer casing etc.. But Since the system is mobile I am hoping to make it battery powered which some IP cameras can handle. The problem is most of them need direct ethernet connection and I am trying to find a wireless solution. I have seen RC planes with on board cameras where they are transmitting the video back to a ground station. I was hoping someone could point me towards something similar as I know with aircraft weight is a large concern as well.
12  Using Arduino / Project Guidance / Re: camera system guidance needed on: October 09, 2011, 07:24:41 pm
Well distance requirements are not that important mainly line of sight maybe somewhere in the 50-200 ft is fine for transmission distance. Size doesn't matter as much as weight I am trying to go as light as possible.
13  Using Arduino / Project Guidance / Re: camera system guidance needed on: October 09, 2011, 05:49:49 pm
Thanks for the help. I know the arduino can't collect the data. Thats why I need to find something that connects to the camera directly to send the data to my laptop. I am then planning on processing the data on my laptop to then transmit a command to the arduino to take an action (i.e. move the camera XX degrees by rotating a servo in my pan/tilt system)
14  Using Arduino / Project Guidance / camera system guidance needed on: October 09, 2011, 04:42:52 pm
Hey again,

I am thinking of installing a small camera on a robotics system I am developing. However, I am hoping to do some form of tracking with the video feed ( future project) however this question applies even without the tracking. Can someone help explain to me how to send the camera feed to my laptop. I thought of just using some wireless webcams but I truely can't find any of these that are affordable and small. So I am thinking of maybe just making something using a small camera and transmitting the data to my computer. This will also expand when I start some tracking algorithms as I dont think I can program a chip with enough onboard memory for the image processing (something like an ARM microcontroller). So I am thinking of something along the lines of sending data to my laptop having the processing take place on the laptop and sending a command back to the arduino on board.

I am thinking a camera like this:
http://www.robotshop.com/productinfo.aspx?pc=RB-Fds-15&lang=en-US

I just dont know how or what to use to transmit the data to my laptop. Thanks for any help you guys can supply.
15  Using Arduino / Programming Questions / Servo movement question on: October 09, 2011, 11:05:39 am
Hey guys,

So I am planning to use the arduino mega 2560 for a project I am doing. I am confused on one thing though. I will be using servos and have gone through the servo library. However, I know that code is read by the controller line by line. So Even though I know how I want to move my servos I dont know how/if you can move 2 servos at the same time. For example if I wanted to move servo 1 to 45 degrees and servo 2 to 45 degrees (both from zero) I could write.

Code:
#include <SoftwareServo.h>

SoftwareServo myservo;  // create servo object to control a servo

void setup()
{
  myservo1.attach(2);  // attaches servo1 on pin 2 to the servo object
 myservo2.attach(3);  // attaches servo2 on pin 3 to the servo object
}

void loop()
{
 
  myservo1.write(600);                  // sets the servo position according to the scaled value
  delay(15);                           // waits for the servo to get there
  myservo2.write(600);                  // sets the servo position according to the scaled value
  delay(15);                           // waits for the servo to get there
  SoftwareServo::refresh();
}

But this would move servo 1 followed by servo 2. How would I move them both simultaneously? Thanks

P.S. Code is just an example and not meant to be functional.
Pages: [1] 2 3