Serial begin with ssc-32

Hi,
I did a test both with arduino and ssc-32 on my router that commands them serially. This test revealed to me that I must learn how to issue serial.begin from ssc-32 but I don’t know how.

In Arduino, we have a setup() before the endless loop(), in which we may issue:
Serial.begin([baud rate]);
Due to this command, when I connect arduino to my router, I can issue a command from router, say to read a sensor, and get the answer back serially.

My ssc-32 configuration with the router:

  1. TX, RX and Gnd connected properly and tested.
  2. In the connected state, I just turn on the router.
  3. In initialization process of the router, I see the indicator of ssc-32 going on and off and finally not back to on.
  4. then I issue a query on motors by “Q”, having another console open waiting for serial data back (cat < /dev/tts/0)
  5. nothing is back! to get the data, I must first short RX and TX of the router once, and then the response of “Q” arrives.
  6. I don’t need to do this in arduino, and I think it is because of that Serial.begin() and may be I’m wrong!

If this is true, then should I change the sketch of ssc-32 to have it issue a kind of Serial.begin to the router, after the router’s initialization?

Thank you! :slight_smile:

Is the router trying to use flow control?

Sorry, what do you mean by flow control?
I actually limited things to the simple examine I did with both arduino and ssc-32. It is very interesting arduino does not need the RX & TX of the router being once short, but ssc-32 won’t respond to my queries without that! This is exactly what I’d like to understand, so that get rid of shorting RX & TX!

Are you using pins 0 and 1 on the Arduino to the router? And Software serial to connect to the SSC-32? Need more info here. Are you remembering to assign the correct pin numbers and whether they are inputs or outputs? Is your SSC-32 gnd connected (its next to the TX/RX pins) to the Arduino gnd? This is a pretty simple connection to make, so usually where it goes wrong is in the message formatting to the SSC-32. You’ll want to make sure you send a carriage return, using either Serial.println(""); That’s printline, or add a carriage return in your SSC-32 string using \r.

//Arduino to SSC-32 demo
#include <SoftwareSerial.h>
#define txPin 3 //using digital pins 3 and 4 
#define rxPin 4 
SoftwareSerial ssc32 = SoftwareSerial(rxPin, txPin); // Create serial port 'ssc32'

void setup() 
{
  pinMode(rxPin, INPUT);
  pinMode(txPin, OUTPUT); 

  ssc32.begin(9600); // Start serial connection with SSC32 at 9600bps
}
void loop()
{
Serial.print("ver\r");
}

The fact that the SSC-32 lights up is good. Its means its funcioning properly. The fact that the light goes out is good also. That means it has received a valid command. Where it doesn’t respond to commands after that, leads me to to suspect your message formatting. Also, double check the jumpers on your SSC-32 match the baudrate you start your serial connection in your sketch.

I don’t think that is a valid statement. I think the light going out just means that there was electrical activity on the ssc-32 rx pin.

As to the setup in question, Stonebot1 probably needs to start with a simple schematic or description of how all of the hardware is connected, and to describe the type of communication between each. There was some stuff posted earlier today that I found totally confusing just trying to sort out the basic setup. If the communication loop is just between a computer, a router, and an ssc-32, then the Arduino material is just an additional confusion factor. The “If this is true, then should I change the sketch of ssc-32 to have it issue a kind of Serial.begin to the router, after the router’s initialization?” is also confusing.

I guess the first question to ask is have you successfully sent a servo command to the ssc-32 and had the servo properly respond? If this works, then the issue is just getting the returned info.

I guess I misunderstand the function of the green led then. And yeah a whole lot more information is needed.

  1. no serial software, I did the experiment with ssc-32 and arduino separated.
  2. no problem with C/R. I used “echo” in Linux to send ssc-32 commands, and it IS sending C/R too.
  3. my jumpers are well placed, I don’t have trivial problems.
  4. ssc-32 is successfully running my commands to move servo motors. What is not being done properly, is giving me info back when I issue “Q”, which is done AFTER I short RX-TX of the router and echo something from the router to itself ONCE. Then the query ALSO returns info back. This is not the case with arduino, there I don’t need to short anything: everything works from the start (I mean, sending a command, and receiving the serial respond back to the router).

have you successfully sent a servo command to the ssc-32 and had the servo properly respond?
Yes! Motors start to work properly. Then I issue “Q” (C/R automatically being sent). I don’t have info back! I did an experiment with arduino SEPARATELY, to be sure it is not because of router. I describe it fully here. I hope I am clear. Please let me know where not clear and I’ll try again :slight_smile:

description of how all of the hardware is connected
In both disjoint experiments, arduino and ssc32 SEPARATELY are receiving a serial message from the router and respond by another serial message. The essence of the experiment is to be sure that serial communication between ssc-32 and router is 100% under control and clearly done, which is NOT the case at the moment. Arduino is there just as a test tool to reveal differences and problems. I just do the experiment with ssc-32, and repeat a similar one with arduino SEPARATELY.

Nothing special in configurations:

  1. Experiment one:
    Config> router <—serial port----> ssc-32
    Descripton> router is commanding ssc-32 to move, and then queries the movement.

  2. EXperiment two:
    Config> router <—serial port----> arduino
    Description> router is sending a letter to arduino. Then arduino checks if the letter is ‘A’ and turns a green LED on and prints a confirmation message back to the router. Otherwise, it does nothing (I was sure that it will works, so didn’t programmed a lot for the “otherwise” case).

1 and 2 are disjoint experiments!

In the first experiment, when I just turn ssc-32 and router on, I can command ssc-32 and it runs the motors, NO PROBLEM! But when I QUERY the movement, I get nothing back from ssc-32 back into the router! I.e. serial communication takes place only in ONE-WAY. To solve this, I short RX and TX of the router, and “echo” something from router back to itself. It works. Then I just return serial communication connections back to their places between ssc-32 and router, and now if I query ssc-32, I get the back communication right, i.e. a + for a work in progress and a period for a finished movement. Why should I short the router? Why don’t I have back-communication from the start? How to get rid of this?

In the second experiment, this is not needed! It is the part strange to me: I just turn router and arduino on, and everything works with no need to short the router RX and TX for the feed back!

My “guess” is that ssc-32 and arduino start their communication differently and something must be updated in the firmware of ssc-32. I hope this guess is wrong.

So the single question is, why for the ssc-32 to respond to the query, an RX-TX shorting of router lines and self-echo is needed first, which is not the case with arduino experiment?

Well, when you say motors, I assume you are refering to the servos. Make sure the router allows for at least 30ms or more before checking its input buffer for the return data. The ssc-32 does not send a carrage return at the end of its data. Make sure the router is not looking for one. The status of a servo or servo operation will not be sent if there has not been a preceeding command since the ssc-32 has been reset for an action. I suggest you test using the “ver” command as it sends back a string of ascii bytes in stead of a single byte, and may be easier to use while troubleshooting.

Thanks Zoomkat!

I assume you are refering to the servos
Right.

Make sure the router allows for at least 30ms or more before checking its input buffer for the return data.
Allows.

The ssc-32 does not send a carrage return at the end of its data.
I AM receiving them without the c/r, and it is not the problem. The problem is why I need ONCE to short RX & TX of the router, after which everything works fine. This is not needed for arduino! Only ssc-32 query responses won’t come to the router, without ONCE shorting router serial pins to itself!

I suggest you test using the “ver” command as it sends back a string of ascii bytes in stead of a single byte
Yes I did and I got: 00SSC32-V2.1XE.

Data IS coming, I just need to get rid of this “once shorting”! Help please!
SSC32_VER_query.JPG

I’d say it probably has something to do with the router and its programming. I think in other forums others have asked about the program on the router and if it is set for no flow control. I notice two bites (00) preceding the info sent from the ssc-32 that are not sent by the ssc-32. These might be put in the input buffer when you connect the tx/rx lines. Also, doesn’t your router operate at 3.3v and the ssc-32 at 5v? Do you have any level shifting between the two You might try connecting a high value resistor between the router rx line and ground to see if floating charge building up on the pin possibly causing issues.

  1. I believe it is ssc-32. Why this does not happen with arduino board? It doesn’t need this “shorting” and works fine from the beginning by my sketch written for it. Is the ssc-32 sketch open source? Shall I see the code somewhere?

  2. Those two bytes you saw, are from the ssc32 too, but sent before. I have an IR sensor that is sending zero.

  3. I have level shifting right, I use voltage divider, AND I measured outputs are all ok. Besides, I could count this if the behavior of the router was the same with both ssc-32 and arduino, but it is not!

If the code for ssc-32 is not accessible, then my next job is to recompile OpenWRT Linux for the router by myself. I’m trying not to reach to this point :smiley:

  1. I believe it is ssc-32. Why this does not happen with arduino board? It doesn’t need this “shorting” and works fine from the beginning by my sketch written for it. Is the ssc-32 sketch open source? Shall I see the code somewhere?

Well, hundreds if not thousands of people use the ssc-32 and it works as designed. You are using an electrically and software hacked router, so I would think your setup is the outlyer. Similar to “My child would never do something like that!”.

  1. Those two bytes you saw, are from the ssc32 too, but sent before. I have an IR sensor that is sending zero.

Before what? The shorting of the tx/rx pins?

  1. I have level shifting right, I use voltage divider, AND I measured outputs are all ok. Besides, I could count this if the behavior of the router was the same with both ssc-32 and arduino, but it is not!

Do you have both the ssc-32 and the Arduino connected to the same serial port on the router at the same time? If so, this might be causing issues. Do you have a schematic of your wiring between the tx/rx lines of the three devices? I’d like to see how you are implementing the voltage divider setup.

If the code for ssc-32 is not accessible, then my next job is to recompile OpenWRT Linux for the router by myself. I’m trying not to reach to this point.

Well, like I said before, your issues seem to be the unique in the ssc-32 world. I think you probably have wiring issues. When you are doing your ssc-32 trouble shooting, do you have the Arduino electrically disconnected from the router? As posted previously, you really need to have the Arduino electrically removed from your setup while trouble shooting your issues with the ssc-32.

Something quick to try, instead of shorting the tx/rx lines, momentairly short the rx line to ground similar to the tx/rx and see if you get the same result.

Thanks Zoomkat! I’ll try here to provide detailed answers for your kind suggestions.

Well, hundreds if not thousands of people use the ssc-32 and it works as designed.
I didn’t say it is not working as designed! It has an issue in its design, with relation to THIS experiment. It may work well in OTHER experiments, BUT, Arduino is doing well in THIS experiment too (not trying to say one of them better). In any case, sure SSC-32 is working as designed!

You are using an electrically and software hacked router, so I would think your setup is the outlyer.
I can hardly say this is logical. I’ve done it exactly as instructed by other people (hacking, serial mod, etc.) and the word “hack” here does not sound well too. Adding some pins at the place already designed in the factory for serial port, is not a real hack! Also, the OS I use for the router is a standard one, tested by “sure thousands” of specialists. So, I can’t agree in this case with you. Next, I am not using a program I wrote: I issued “cat” and “echo” of the Linux!

Similar to “My child would never do something like that!”.
You are telling me the same thing. Just because hundreds of people have used SSC-32 in different experiments, it doesn’t mean it can’t do something strange in this concrete experiment.

Before what? The shorting of the tx/rx pins?
before issuing “VER”, AND, after shorting the RX and TX of the router.

Do you have both the ssc-32 and the Arduino connected to the same serial port on the router at the same time?
NO! If you read other posts, I mentioned “disjoint” experiments. Nothing in common: I do the experiment with Arduino, then remove it COMPLETELY (even a small piece of it won’t remain!) and connect SSC-32 right the same way, in the same configuration, AND, SSC-32 needs the router to be shorted once to operate logically, but Arduino does NOT need this.

Do you have a schematic of your wiring between the tx/rx lines of the three devices? I’d like to see how you are implementing the voltage divider setup.

Well, like I said before, your issues seem to be the unique in the ssc-32 world.
So it is a wrong experiment? Why Arduino is working with it?

I think you probably have wiring issues.
Ok you see my wiring now, please let me know those issues.

When you are doing your ssc-32 trouble shooting, do you have the Arduino electrically disconnected from the router?
YES! SURE! ALWAYS!

As posted previously, you really need to have the Arduino electrically removed from your setup while trouble shooting your issues with the ssc-32.
OBVIOUS!

Something quick to try, instead of shorting the tx/rx lines, momentairly short the rx line to ground similar to the tx/rx and see if you get the same result.
I did, and it didn’t work either.

If SSC-32 is all ok, then why the same experiments work with NO problem for Arduino (with my sketch) and WON’T work with SSC-32? (Recalling that experiments are absolutely disjoint, and absolutely the same configuration).

Consider the following screen shot. I have 2 items of the same router and 2 SSC-32 to double test things. This one has an updated firmware, with new serial driver. I repeated the experiment again, with this my second router and second SSC-32. At the part 1, I have SSC-32 and router ONLY connected. I have a TESTED digital sensor connected to ‘A’ of SSC-32, and it is WORKING PROPERLY. I sent a query for two times to SSC-32. No response. Next, I removed it and connected Arduino and router ONLY. Repeating two times the same command worked well with my sketch on Arduino. Even I repeated the experiment with different order: first Arduino, net SSC-32. Also I tried to reset the routers each time and between switching the Arduino / SSC-32. I did this experiment for more than 15 times BEFORE writing you here. Every time it is the same. SSC-32 starts working correctly, but ONLY AFTER once shorting the router. This is NOT SIMILAR to “My child would never do something like that!”.

When the LED goes out it means the SSC-32 has received serial data. It could be formatted wrong, inverted, the wrong baudrate or complete and total jibberish. But the SSC-32 did see it. :wink: This was a better troubleshooting item than only going out and blinking with valid data.

Stonebot1,

I understand your frustration. I wish I could help more.

The biggest problem with this is the shorting out the pins on the router thing. If it were a repeatable problem that you could apply logic to, then it would be easier to diagnose. So you are using a terminal to send data to the router which sends the data to the SSC-32, which replies to a different port on the router which goes to another terminal that is waiting for the reply? Really, man, you have it in your head, but it’s not coming through… I have seen nothing pointing to the SSC-32 as being the culprit. You do have control over how fast the SSC-32 sends the response. Have you changed the trasmit delay or pacing delay on the ssc-32? I’m almost afraid to ask questions. I have read the entirety of both of your threads a few times. I’m not sure what the big picture here is… I must say I know the Arduino is only being used as a troubleshooting tools here, but you are confusing the heck out of everyone here with the use of it.

Jim I am not frustrated!
Actually SSC-32 is crucial to my small project. I am going to have two bots that will have around 12 servo motor each! If it was only two ones, I already switched to a PIC and forget about this problem! But SSC-32 makes things very simple! :smiley:

If it were a repeatable problem that you could apply logic to, then it would be easier to diagnose.
It IS repeatable! I didn’t change anything in Arduino, Router or SSC-32. No programming (except small sketch you see on the screen shot). You can try it by yourself and see!

I’m almost afraid to ask questions.
Well I spoke on the phone with you and knowing your voice, I can’t say that you can afraid of something ever! People who apply control theory on everything (even on the current that is passing from my brain via forums) usually deal with fear differently! :wink:

You are welcome to ask ANY questions!

I recall my problems:

  1. SSC-32 behaves normal and well, but ONLY after an RX-TX short on the router.
  2. Arduino with the same setup does not need this at all!
  3. Nothing special applied, no “hack” no program. All of components are standard.
  4. I don’t have enough hair on my head to take out! :frowning:

Perhaps I’m reading too much into all the !!! you are using…

The emphasis was on the “that you can apply logic to” not the repeatable part… I mean, what purpose does shorting tx and rx together serve, other than it makes something happen… There is no logic… And I still do not know what the big picture is. So you want to have 2 robots with 12 servos each. Finish the description here. The PC will send data to a wireless router and the robots will listen and act on the SSEC-32 commands? Is that it?

I was commenting on the fact that you look to be getting pretty frustrated and when someone asks a question you already answered…

Exactly, this means nothing to me. I have no idea what purpose the router has here. Is it being used as a simple wireless serial port? If so then what specifically are you shorting out. You are still of the belief that it is clear to all involved what you are trying to do, but it is not.

I think a big problem here is that people aren’t understanding your end goal for your project. It may help us help you if you explain that.

People on the forum have made a “router bot” before. You may want to take a look through these search results, and this link.

search.php?keywords=router&terms=all&author=&sc=1&sf=all&sk=t&sd=d&sr=topics&st=0&ch=300&t=0&submit=Search

robostuff.com/diy-projects/route … terbot-v1/

Is this the sort of thing you’re hoping to do?

Hopefully some of this information helps!

Ok I’ll try to be more clear and use less ‘!’.

  1. The final robot consists of:
    a - WRT54GL router.
    b - Sharp GP2D12 IR.
    c - SSC-32.
    d - 12 servo motors (two of them continuous rotation).

  2. Router will query the sensor on the SCC-32 and commands servo motors, based on the sensor output.

  3. Two copy of the same robot will be made.

  4. This is the first cycle. The copies will be expanded with new capabilities in future.

That’s all.

Actually I just didn’t think that this “big picture” will help to understand that strange “shorting requirement” to me or you. beside, as you see it is a very simple setup.

I’ve read every project about router bots.