Pages: [1]   Go Down
Author Topic: Strangeness with Serial and pololu  (Read 751 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 1
Posts: 28
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi -

I'm using a pololu servo controller via Serial - I have pin #1 (tx) on the arduino connected to "logic-level serial input" pin #3 on the pololu. Power and gnd is wired okay, I'm using 3 servos - it all works.

Sort of.

If I power up the arduino, and connect a terminal (can see the text equivalent of the commands sent to the pololu) everything works great. I can then quit the terminal app, unplug the usb cable, and the servos continue to work fine.

But if I don't hook up the terminal app, it doesn't work. In other words, if I just power up the board with no usb or terminal app, the servos don't move - there is something that the polulo doesn't like (?). As soon as a terminal app is connected, the servos start turning (and the app can be killed and usb unplugged).

I can't figure out what the heck is going on.

Can anyone shed any light? Seems that the act of connecting the terminal somehow "makes it work".

Cheers, and thanks.

b...
Logged

0
Offline Offline
Tesla Member
***
Karma: 145
Posts: 9685
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

How are you powering your setup when it is not connected to the USB port?
Logged

Consider the daffodil. And while you're doing that, I'll be over here, looking through your stuff.   smiley-cool

0
Offline Offline
Newbie
*
Karma: 1
Posts: 28
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello- I have 5v power supply- it doesn't seem to be power related, as it works with just the 5v supply.

The weird part is that the terminal program needs to be connected to serial, if only briefly- it can be disconnected and the servos continue to work.

b...
Logged

0
Offline Offline
Tesla Member
***
Karma: 145
Posts: 9685
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

May be code that expects some type of terminal interaction.
Logged

Consider the daffodil. And while you're doing that, I'll be over here, looking through your stuff.   smiley-cool

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

Sounds more like the Arduino is not properly initializing serial communication with the controller. Post a link to the controller (and data sheet) and your code.
Logged

0
Offline Offline
Newbie
*
Karma: 1
Posts: 28
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The user's guide for the pololu is here:

http://www.pololu.com/file/0J37/ssc03a_guide.pdf

My code is straightforward - here's my setup function:

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

And the commands to control the servo take place here:

void servoSet(int servo, int angle)
{
      unsigned char buff[6];

      unsigned int temp;
      unsigned char pos_hi,pos_low;

      temp = angle & 0x1f80;
      pos_hi = temp >> 7;
      pos_low = angle & 0x7f;

      buff[0] = 0x80; //start byte
      buff[1] = 0x01; //device id
      buff[2] = 0x04; //command number
      buff[3] = servo; //servo number
      buff[4] = pos_hi; //data1
      buff[5] = pos_low; //data2

      for(int i = 0; i < 6; i++) Serial.print(buff, BYTE);
}

And so a call to servoSet sets the position of the servo.

As stated, all works fine as long as a terminal connection has been connected briefly.

There is a possibly similar thread here, but it doesn't address my issue:

http://forum.pololu.com/viewtopic.php?t=745
Logged

0
Offline Offline
Newbie
*
Karma: 1
Posts: 28
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

ARG. Arg arg arg - I apologize - I am an idiot - I went down a rabbit hole - still have the issue, but it's not related to the pololu - this is a red herring.

The way I am sending messages to the arduino is via the ethernet shield - have a little http server. If I connect the terminal app, then everything works, if I don't connect the terminal app via serial, then nothing.

So, something to do with how Serial and Ethernet are behaving - I am still stumped, but know a bit more.

Hmmmm... Frustrating....

Thanks.
Logged

0
Offline Offline
Newbie
*
Karma: 1
Posts: 28
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Closing this thread out, and starting a new one, as the problem still persists, in that I need a serial connection before the server works.
Logged

Pages: [1]   Go Up
Jump to: