wireless control of 6 servos

I have 2 of the arduino Duemilanove boards, I am working on a robot project that I would like to use the arduino's on. I would like to have 6 pots connected to the 1st arduino and the 6 servos connected to the second arduino. The communication medium would be over xbee or simple wireless transceivers. I have 2 wireless transceivers, I believe they max out at 9600 baud. Not sure if they are fast enough for communication for controlling 6 servos though. Xbee would be much better. Has anyone seen anything like this on the net or have any ideas. I am fairly new with the whole arduino thing. I do very well with designing circuits and the mechanics of robotics, I just struggle with the programming.

I appreciate any help. Thanks

You might get the servo arduino working with the serial monitor, the pot arduino sending strings to the serial monitor, then connect the the arduinos tx/rx/grounds appropriately together. With this working, then work on adding the wireless component.

That is what I would like to do with this starting out, Just have the arduinos in a since function as encoders/decoders same as in the R/C systems. After this I could add more automatic "Robotic" function to this setup with the arduinos in the code. Also I would be able to recieve data back from the robot. Much more room for modification.

I have connected pots on the first arduino and was able to display continuous readings on the serial monitor. What I could not figure out was how to decode these on the second arduino and figure out the error correction for any errors in the wireless medium. Programing has never been my stronghold. I look at some code other people have written and it looks very overwhelming.

Below is some test code that might be of use on the receiving arduino. Each pot coulds send its servo control position as a string prefaced with a letter, then the position, and ended with a comma. The receiving arduino could reconstruct the string into readString, check the first letter in the string to see what servo is to get positioned, then send that position to the appropriate servo. Probably numerous ways to do it using “if”, “case” and such to determine which string goes to which servo.

//zoomkat 8-12-10 roborealm serial servo parce test
//type servo position 0 to 180 in serial monitor
//for writeMicroseconds, use a value like 1500
// for WString.h see
// http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1285129740

#include <WString.h> //provides easy string handling
String readString = String(100);
String parce1 = String(10);
String parce2 = String(10);
int pos = 0;
int ind1 = 0;
int ind2 = 0;

 
#include <Servo.h> 
Servo myservo;  // create servo object to control a servo 

void setup() {
      Serial.begin(9600);
        myservo.attach(9);
        }

void loop() {

        //expect a string like wer,qwe rty,123 456,hyre kjhg,
       while (Serial.available())
{
   delay(10);
   if (Serial.available() > 0)
   {
     char c = Serial.read();  //gets one byte from serial buffer
     if (c == ',')
        break;
     readString.append(c); //makes the string readString
    }
}

      
      
      parce:  
      if (readString.length() >0) {
      Serial.println(readString);
      pos = readString.length(); //capture string length
      ind1 = readString.indexOf(' '); //position of the space
      parce1 = readString.substring(0, ind1); //first part of string
      parce2 = readString.substring(ind1+1, pos); //second part of string
      Serial.println(parce1);
      Serial.println(parce2);
      Serial.println();
      
      int n;
     n = atoi(readString); //convert string to number
     myservo.writeMicroseconds(n);
     myservo.write(n);
      readString="";
      } 
   }

Thanks Zoomkat,

I will try working with your code example this weekend. Looks straightforward.

Thanks again!

I'll just leave this here

http://www.satistronics.com/mini-24ghz-wireless-nrf24l01-nrf24l01-transceiver-module_p2450.html

cross-link: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1289089043/45