I have an 18V15 SMC that I am talking to via an arduino softserial port. It is running a linear actuator (drawing, I think, 500 mA without load). The SMC to serial communication works initially. When the USB connection is plugged in, it works fine and I see no serial errors or anything else on the pololu software. When I unplug the usb connection, it continues to work fine for a while then it hangs up (stops responding to the Arduino serial instruction). The error light does not light. Initially I thought it was a case of low Vin but if that were the case the error light should go on … it does when I cut power (an older HP lab type power supply that should be able to deliver 12V and 10 A at least). When I re-connect the USB connection there are no errors listed.
Thanks David. I will try the new code but I now see that it is a serial error problem (the error LED lights) and the pololu control center shows a serial error. I have the big blue capacitor soldiered into the board. The linear actuator motor is sealed but I suppose my next step is to put capacitors (what value?) from + and - to the motor case. Would it help if I slowed the baud rate down from autoselect (38000) to a more sedate 4800?
When I was updating that example code I found out that using Auto Baud Detect in conjunction with software serial doesn’t work well. The SoftwareSerial library in Arduino 1.0 has sloppy timing when it transmits, which means the SMC will detect the wrong baud rate, and this can cause trouble later. I recommend setting the Simple Motor Controller to have a fixed baud rate. Trying a lower baud rate is also a good idea. Let me know if you continue to have trouble because there is more we can do.
Thanks for that … hmmm, it’s still not reliable. I set the baud rate to 9600 via the controller software and it runs but sooner or later (usually sooner) the serial errors stop the motor. It seems like a dumb way to fix this but maybe I should monitor the error pin and reset when it goes high? How long does the reset take? The actuator is doing something important so reliability matters in my application.
Could you look at the “Count” column in the Simple Motor Control center and try to figure out what kind of serial error is occurring? It would be good to know.
How long are the wires between the Arduino and the SMC? Is there anything that could be causing noisy signals on the line? Do you have a direct ground connection between the SMC’s GND and the Arduino’s GND?
Maybe you have a noisy serial line and it’s just inevitable that errors will happen once in a while. If that’s the case, then I would recommend using CRC to avoid accidentally sending the wrong command and also having a way to recover from errors.
The easiest way to recover from the errors is just to send the Exit Safe Start command (0x83) regularly. For example, you could send it right before the setting the speed. I think that will solve your problem, but if you want extra reliability you could also reset the controller as you were suggesting. Resetting the motor controller should only take about a millisecond, but give it 5 ms just to be safe. The reset line only need to be held low for a few microseconds but then it takes a millisecond for the controller to reinitialize.
The serial wires are 8" long, the SMC, Arduino, and Power supply grounds are all connected at the same place.
In 1 hour of running (with USB plugged in so the error clears eventually) the serial error count was about 15300. In the table below, the entry adjacent to the noise row is 15 and format shows 11. No other numbers. these seem small compared to 15300 total.
Thanks, David, I appreciate your patience. I have put in two statements resetting the controller (one in each of two PID loops) and it works reliably now. I will work on the serial noise issue since the reset seems like it would cancel things like overtemp protection which is nice to have.
Uhhh, yes, I am. I also have had a safestart statement in both PID loops which didn’t solve the problem. So I am doing a controller restart in both PID loops and in every cycle of those loops. Yeah, I know, that can’t be good! This weekend I will try a different (much higher quality) linear actuator and I am hoping that the noise issue will go away and if so I’ll get rid of the reset commands.
Just to close the circle on this … my serial problems were apparently due to the motor I was using and prossibly a loose ground as well. The 18V15 now works beautifully with my arduino and my better quality linear actuator.