Pages: [1]   Go Down
Author Topic: Potentiometer servo control through an XBee  (Read 1667 times)
0 Members and 1 Guest are viewing this topic.
Virginia, US
Offline Offline
Jr. Member
**
Karma: 0
Posts: 75
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I want to make a wireless Arduino controller to control some servos positions.

In theory would it be possible to control a Servos position with a potentiometer, like in http://arduino.cc/en/Tutorial/Knob but have the potentiometer hooked to one Arduino and the servo connected to a different Arduino and have them communicate point-to-point through wireless with XBees?

Thanks,
Ec7
Logged

He who dares, Wins.

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 601
Posts: 48543
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
In theory would it be possible to control a Servos position with a potentiometer, like in http://arduino.cc/en/Tutorial/Knob but have the potentiometer hooked to one Arduino and the servo connected to a different Arduino and have them communicate point-to-point through wireless with XBees?
In theory, it is possible.

I practice, it works, too. Provided, of course, that you get the right XBees (Series 1), configure them correctly (PAN ID, MY, and DL need to be set to non-zero values, and MY on one must match DL on the other), and write the proper code for both of the Arduinos.
Logged

Western New York, USA
Offline Offline
Faraday Member
**
Karma: 32
Posts: 4258
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
... and write the proper code for both of the Arduinos.

You really can and should do this first - and get it working - before you consider implementing the XBees.

After you get it working with the two Arduinos and the two XBees you should be able to eliminate the Arduino at the potentiometer end.


Don
Logged

Virginia, US
Offline Offline
Jr. Member
**
Karma: 0
Posts: 75
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Why would I want to write code for a theory?

Oh, maybe I shouldn't have started with;
Quote
I want to make a wireless Arduino controller to control some servos positions.
Oops.

Anyways, I was wondering in theory if is could be done on a very simple, small scale, an example:

http://arduino.cc/en/Tutorial/Knob

Code:
// Controlling a servo position using a potentiometer (variable resistor)
// by Michal Rinott <http://people.interaction-ivrea.it/m.rinott>

#include <Servo.h>
 
Servo myservo;  // create servo object to control a servo
 
int potpin = 0;  // analog pin used to connect the potentiometer
int val;    // variable to read the value from the analog pin
 
void setup()
{
  myservo.attach(9);  // attaches the servo on pin 9 to the servo object
}
 
void loop()
{
  val = analogRead(potpin);            // reads the value of the potentiometer (value between 0 and 1023)
  val = map(val, 0, 1023, 0, 179);     // scale it to use it with the servo (value between 0 and 180)
  myservo.write(val);                  // sets the servo position according to the scaled value
  delay(15);                           // waits for the servo to get there
}

This isn't something anywhere near the stage of implementation, I am merely trying to get a feel of capabilities of the hardware. Theoretically speaking, if I could physically control something on one Arduino (potentiometer), and then have it relayed somehow (XBee) to another Arduino (Again XBee) and control a device that is interfaced to it (Servo).

This is only an example,
The potentiometer could be replaced with a button or anything else physical.
The servo could be replaced with anything as well.

The reason I chose an example with a potentiometer and servo is that it would show more accurately the precision of these devices working together in unison.

So this is possible? Also would it sound like it would be reasonable to do with:
2x arduino,
2x XBee (Series 1 is fine)
and of course the proper code.
Logged

He who dares, Wins.

UK
Offline Offline
Shannon Member
****
Karma: 222
Posts: 12553
-
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

There are various ways to establish a radio link between two Arduinos, using XBees is one solution. Which options available to you will depend on constraints such as range, cost, available power.

Given two Arduinos with communication between them, you can implement sketches that allow them to collaborate. For example, control inputs on one Arduino could cause actions on the other - but it is up to you to design the sketches and hardware correctly to achieve this. It's a little harder than putting all the functionality on one Arduino but not a lot harder, so it would be sensible for you to tackle the problem in small steps - get the functionality you want on a single Arduino; get radio comms working; split the functionality between the two Arduinos connected via radio.
Logged

I only provide help via the forum - please do not contact me for private consultancy.

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 601
Posts: 48543
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
get the functionality you want on a single Arduino
Agree that this should be the first step.

Quote
get radio comms working
I disagree with this as the 2nd step. Wired communication between two Arduinos would be my next step.

Then, add the complexity of radios.
Logged

Pages: [1]   Go Up
Jump to: