Smart Motor with Ar...
 
Notifications
Clear all

Smart Motor with Arduino, can't receive reports

15 Posts
1 Users
0 Likes
32.1 K Views
(@Fredjikrang)
Posts: 8
Active Member Guest
Topic starter
 

I am working on a research project, and haven't had any significant problems with getting an Arduino to talk to a Smart Motor over RS232, but I can't get reports back. When I send a request for a report, all I get back is gibberish. I'm not really sure what is going on.

Do I need to send a "PRINT(RP)", or can I just send "RP"? I get something back for each one, but they don't make sense. What should the information I get back look like?

Also, the gibberish doesn't seem consistent, and it seems like if it was a translation problem it should be. For example, if I send "RA" to the motor, I don't always get the same nonsense back. Here are some real examples:

RA
Sent
Status:

RA
Sent
Status:
ƒ‚jþ

RA
Sent
Status:
Áƒjþ

RA
Sent
Status:
‚®ø

RA
Sent
Status:

RA
Sent
Status:
‚®ø

RA
Sent
Status:

So, I can control it just fine, but I can't get the motor's status back in a way that makes sense. Any ideas?

 
Posted : 10/07/2012 3:06 pm
(@csearcy)
Posts: 0
New Member Guest
 

The response to an RA command may change... depending on commands sent to the motor.
It would be best to monitor the RS232 communications to determine the problem.

Try using the Serial Data Analyzer in the SMI2 software. It will show all printable and non-printable characters. You may need to use a null modem cable.

 
Posted : 10/07/2012 6:47 pm
(@Fredjikrang)
Posts: 0
New Member Guest
 

The list that I posted is a complete list of the commands being sent. There were no commands sent between them, and so no way that the acceleration was changed between the different report requests. And they were all sent within seconds of each other. (I am basically using the Arduino as a serial bridge until I can get it working well enough to work on its own.)

I'll try and find a computer that I can use the software on, but computers with RS232 are becoming hard to find.

 
Posted : 10/07/2012 8:19 pm
(@Fredjikrang)
Posts: 8
Active Member Guest
Topic starter
 

Well, I've spent the last few hours working on this, and I still don't know what is going on.

I tried to connect the motor to the computer, but I can't get it to recognize the motor at all. I tried with two different motors without luck. I also tried through a normal serial port, and a USB to serial converter, and on two different computers. Could this depend on the model of motor? I downloaded the latest version of SMI, but the motors that I am using are older (SM2340SQ and SM1720). Do I need to download a different version of SMI?

I also connected my Arduino to the USB to serial converter to confirm that the converter works, and I am able to send messages from one computer, through the Arduino, through the USB converter, to the SMI sniffer on a different computer, but messages sent with the SMI program don't arrive at the other computer. I'm not sure what exactly is going on with this part.

Also, I noticed some unusual behavior. In the sniffer, the commands that I send out from SMI are normal ASCII decimal, but the ones that it receives from the Arduino look like the are in Hex. Is this normal? From my understanding, the Arduino sends ASCII decimal standard.

Also, I have a spare character that I can't account for, "0A", that gets sent after each new line. It looks like this is a "line feed" character. It doesn't seem to affect anything though, as the motor responds as expected when commands are sent to it.

Any ideas?

 
Posted : 12/07/2012 6:33 pm
(@csearcy)
Posts: 0
New Member Guest
 

The 0A is an ASCII Linefeed. That isn't a valid delimeter for the SmartMotor. The only allowed delimeters are a CR (0x0D) or a SPACE (0x20).

 
Posted : 12/07/2012 7:13 pm
(@Fredjikrang)
Posts: 8
Active Member Guest
Topic starter
 

Okay, I'll try and delimit the commands with spaces or only CR, and see if that fixes the strange receive behavior.

Any ideas on why the SMI couldn't find the motor?

 
Posted : 12/07/2012 8:10 pm
(@csearcy)
Posts: 316
Reputable Member Guest
 

SMI2 couldn't find it because of the old firmware. You can go to our website... support... download center... software... and download an older version of SMI that may work better for you.

 
Posted : 12/07/2012 8:15 pm
(@Fredjikrang)
Posts: 8
Active Member Guest
Topic starter
 

Do you have a suggestion as to which version I should try?

 
Posted : 13/07/2012 5:32 am
(@csearcy)
Posts: 316
Reputable Member Guest
(@Fredjikrang)
Posts: 0
New Member Guest
 

Okay, I'll try that.

It looks like the line feed was at least a part of the problem. I can now get back good information from the motor in my test program, where the Arduino is acting as a serial bridge. I'm still struggling a little bit with another program that I am trying to get to work where the Arduino uses that information. It is very odd, since as far as I can tell I am sending the exact same commands, but am getting back corrupt information. I'm wondering if maybe I am sending the commands too quickly? (I was running it at about 100hz, but I am going to try at 10hz, just to see if that is the case. Especially since I know that serial at 9600K is a bit slow.)

Specifically the command that I am sending is "RBo", which works fine in my test program, but not in my other one. I am still working on it, and should know more later today.

 
Posted : 19/07/2012 10:53 am
(@Fredjikrang)
Posts: 8
Active Member Guest
Topic starter
 

Everything seems to be working as expected now! Thank you for all of your help!

 
Posted : 23/07/2012 4:26 pm
(@Fredjikrang)
Posts: 8
Active Member Guest
Topic starter
 

I have been having pretty good success with the motor since my last post, but I have just started trying to change the baud rate in order to further increase responsiveness, but I haven't been having any luck.

I am communicating with the motor over RS232, and it works great at 9600 BAUD, but I can't get it to work at other speeds. I send the motor the "BAUD19200" command, for example, and change the baud rate of the Arduino, but once done I can no longer communicate with the motor.

Any ideas?

 
Posted : 23/10/2012 6:54 pm
(@csearcy)
Posts: 0
New Member Guest
 

Real Laptop RS232 ports... usually don't have a problem... but if you have a USBtoRS232 or a 3rd party RS232 USART... Then the operating system comes back in play. See if you can sustain higher baud rates with the SMI2 software first. If it fails... you may need to check wiring and grounding (shielded cables with the shield tied to Single Point Ground is recommended)

When running Windows and SMI...
The following is dependant on what version of Windows you are running...
... I'm running Win7/64bit...
Go to the Device Manager... and look for Ports (COM & LPT)... open that up.
Select your USBtoRS232 device... open that up.
Select the Port Setting Tab...
Select the Advanced Tab...
You should have two sliders for Receive Buffer and Transmit Buffer. Slide those to the Lowest setting.
You can also reset your COM Port Number if needed.
Click OK and close Device Manager out.
Retry communications at the higher Baud Rate. If the communications works at the higher Baud Rate with SMI2 and your Laptop/PC... then you need to check the timing on the Arduino compared to your Laptop/PC.

 
Posted : 23/10/2012 7:15 pm
(@Fredjikrang)
Posts: 8
Active Member Guest
Topic starter
 

I am actually using SoftwareSerial on the Arduino directly with the Smart Motor, and I think that that was my issue. Apparently SoftwareSerial isn't very reliable at high baud rates, or anything over 9600 really. I can get it to work at lower baud rates, such as 4800, and for a short amount of time at 19200, but it only works for a few seconds, and it doesn't seem to work at all at 38400. Or at least not in my application. I tried using the hardware serial port on the Arduino, but it doesn't seem to work correctly. I think it may be because I have it plugged into the Arduino USB port.

Right now I am investigating the possibility of using an alternate serial library called AltSoftSerial that should be faster. ( http://www.pjrc.com/teensy/td_libs_AltSoftSerial.html)

If that doesn't work, then I'm planning on trying either an Arduino Leonardo or Arduino Mega, as they have hardware serial ports that are separate from USB communications.

 
Posted : 26/10/2012 9:23 am
(@BaseMell)
Posts: 0
New Member Guest
 

Hello..i think you can also reset your COM Port Number if needed.Click OK and close Device Manager out.
Retry communications at the higher Baud Rate. If the communications works at the higher Baud Rate with SMI2 and your Laptop/PC... then you need to check the timing on the Arduino compared to your Laptop/PC.

 
Posted : 20/02/2019 7:48 am
Share: