Pages: [1]   Go Down
Author Topic: SD21 problems  (Read 1960 times)
0 Members and 1 Guest are viewing this topic.
Espoo, Finland
Offline Offline
God Member
*****
Karma: 7
Posts: 586
"Oops, try again..."
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi!

I have a problem with SD21 servo controller. It is probably D.O.A., but it is more likely that I am missing something with the wiring. As this is a first of a kind part for me, I can't be sure of anything.

It's connected to Duemilanove, pins 4 and 5, as I2C device should be, but I2C scanner program doesn't see it, my other devices are found nicely. I have tried this with and without pull-ups, no change.

Controller seems to be alive when I connect servos, they are moved to their center position as expected.

I tried also different ways to power it, external power is used normally for servos.

Control command have no effects, so... maybe it is the interface? This is my first "broken" piece of the puzzle I have got so far.

Any ideas how to test more?

Thanks!
Kari
« Last Edit: January 22, 2011, 01:39:30 am by GaryP » Logged


The only law for me; Ohms Law: U=R*I       P=U*I
Note to self: "Damn! Why don't you just fix it!!!"

Seattle, WA USA
Online Online
Brattain Member
*****
Karma: 614
Posts: 49376
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Post a link to the device in question. Post the code that talks to it.

Quote
I tried also different ways to power it, external power is used normally for servos.
Connecting ground to the Arduino, too?
Logged

Espoo, Finland
Offline Offline
God Member
*****
Karma: 7
Posts: 586
"Oops, try again..."
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes, it is connected.

Now, I came to visit my friend, and we tested my SD21 and his, with Romeo. I2C scanner find both cards from address 97 (hex 61). Still, we can't control servos.

Is there something special about SD21 that we should know?
 :-?

Kari
Logged


The only law for me; Ohms Law: U=R*I       P=U*I
Note to self: "Damn! Why don't you just fix it!!!"

Seattle, WA USA
Online Online
Brattain Member
*****
Karma: 614
Posts: 49376
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Is there something special about SD21 that we should know?
Is there something special about the SD21 that prevents you from posting a link?

It is not really necessary to own one or have used one before to be able to read a data sheet/user guide/sample code. But, first one needs to be able to find the data sheet/user guide/sample code.

If you want help, you'll make that easy. If not, oh, well.
Logged

Espoo, Finland
Offline Offline
God Member
*****
Karma: 7
Posts: 586
"Oops, try again..."
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hmm, interesting...

Why didn't you say that in the first place?

Here is the code I tried, with no luck:
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1224719165

Here is a link to technical information:
http://www.robot-electronics.co.uk/htm/sd21tech.htm

So far, seems like the card itself is ok, at least our both cards are functioning the same way.

We have separate power for servos, microcontroller get power from Arduino.

I will gladly answer your questions if you need more information.

Thanks
Kari
Logged


The only law for me; Ohms Law: U=R*I       P=U*I
Note to self: "Damn! Why don't you just fix it!!!"

Seattle, WA USA
Online Online
Brattain Member
*****
Karma: 614
Posts: 49376
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Why didn't you say that in the first place?
The first sentence in Reply # 1 says?

Quote
We have separate power for servos, microcontroller get power from Arduino.
The Arduino IS the microcontroller. Please explain the second sentence.

Also, take a picture (or more than one) of your hardware, showing all the connections between the Arduino, the SD21, the batteries/power supply that is powering the SD21, and the servo connections to the SD21. Host them on a picture sharing site, and post links to those pictures.
Logged

Espoo, Finland
Offline Offline
God Member
*****
Karma: 7
Posts: 586
"Oops, try again..."
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Paul, sorry my language problems, I don't use english very often, so I might miss some points. Your reply #1 was before quote, so I didn't saw it, sorry!

I see that you want to be hard to handle, but no worries, I don't mind. Instead of waiting to get any help from you, I can say that problem is solved... at least with Romeo it worked, don't understand why it didn't work with duemilanove?

As I don't have much experience with these little wonders and C-language, it took a while make things familiar.
At first, base address for SD21 seems to be 0x61, instead of 0xC2. Then I had to start thinking integers in two bytes, that helped a lot. Example code tell that you can give low byte in milliseconds, well... anyone can see (after well sleeped night) that 800ms can't be expressed within one byte. After that it was clear. I needed simply to devide that number in to two bytes, and give it to SD21 in two parts.

What I didn't remember to try, was that if these registers can be controlled sequentally, between begin- and end translation? Well, I'm sure that will be clear to me soon.

My simple code follows here, thanks!
Kari


**************************************



#include <Wire.h>
#define SD21 0x61 //SD21 I2C Address, shifted by one bit from 0xC2

void setup()
{
Wire.begin(); // start I2C
Serial.begin(9600);

Wire.beginTransmission(SD21);
Serial.print(" Set Speed 0 for servo1");
Wire.send(0); //Servo1 Speed register 0
Wire.send(0); // Set speed Servo1
Wire.endTransmission();
}

void loop()
{
Serial.print("To right ");

//Right side, 100111001000=2504ms
Wire.beginTransmission(SD21);
Wire.send(1);  //Low Byte to Register1 for pulse lenght
Wire.send(200);
Wire.endTransmission();

Wire.beginTransmission(SD21);
Wire.send(2); // High Byte to Register2 for pulse lenght
Wire.send(9); //
Wire.endTransmission();

 
delay(1500);


Serial.print("Middle position ");

Wire.beginTransmission(SD21);
Wire.send(1);  //Low Byte to Register1
Wire.send(255);
Wire.endTransmission();

Wire.beginTransmission(SD21);
Wire.send(2); // High Byte to Register2 for pulse lenght
Wire.send(5);
Wire.endTransmission();

 
delay(1500);

Serial.print("To left ");

//Left side, 1101000110=838ms
Wire.beginTransmission(SD21);
Wire.send(1);
Wire.send(70);
Wire.endTransmission();

Wire.beginTransmission(SD21);
Wire.send(2);
Wire.send(3);
Wire.endTransmission();


Wire.requestFrom(SD21>>1, 1 );
while(Wire.available())

{ ; }

int b = Wire.receive();
}

« Last Edit: January 22, 2011, 01:26:39 pm by GaryP » Logged


The only law for me; Ohms Law: U=R*I       P=U*I
Note to self: "Damn! Why don't you just fix it!!!"

Espoo, Finland
Offline Offline
God Member
*****
Karma: 7
Posts: 586
"Oops, try again..."
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Addition...

Still problems with duemilanove.

Connected these pins, no pull-ups.
Duemilanove >> SD21
pin 4 SDA    >>  SDA
pin 5 SCL     >>  SCL
Gnd             >>  GND
5v               >>  5v

Scanner software can't see my servo controller. I will continue testing...

Kari
Logged


The only law for me; Ohms Law: U=R*I       P=U*I
Note to self: "Damn! Why don't you just fix it!!!"

Espoo, Finland
Offline Offline
God Member
*****
Karma: 7
Posts: 586
"Oops, try again..."
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

More...

Two different duemilanoves tested, they can't see SD21 controller or SFR08 ultrasonic sensor.

Problem lies in wire library, or...? Any ideas? I'm totally lost here.

Cheers,
Kari
Logged


The only law for me; Ohms Law: U=R*I       P=U*I
Note to self: "Damn! Why don't you just fix it!!!"

Espoo, Finland
Offline Offline
God Member
*****
Karma: 7
Posts: 586
"Oops, try again..."
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quick test with Mega1280. Works just nice.

I'm stunned, why this don't work with Duemilanove? I have tried 2,2k and 10k pull-ups, and without. I2C problem...?

Maybe I should open a new topic with correct subject, since SD21 problem is gone now.

Kari
Logged


The only law for me; Ohms Law: U=R*I       P=U*I
Note to self: "Damn! Why don't you just fix it!!!"

Worcester, MA
Offline Offline
God Member
*****
Karma: 3
Posts: 623
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Wire.requestFrom(SD21>>1, 1 );

You've already shifted the address in your define statement, why are you shifting it again?
Logged

I2C GPS Shield

Checkout my Open Source GPS Tracker on Kickstarter

Pages: [1]   Go Up
Jump to: