Having trouble with 18v7 serial communication (maybe)

My Lego R2-D2 (L3-G0.blogspot.com) is using an 18v7 controller to turn the dome, and to accept 2 channels of input for the dome and a “spray” control. To handle that an Arduino listens over the serial and echos the dome speed back to the controller, but triggers a relay on an 8 channel relay board for the spray. The arduino only has the one digital output to the board, and a couple serial lines to this and an mp3 trigger.

Mostly it works “fine” (eg: for days), but after running for some time it appears to get confused and stop talking to the Arduino. The rest of the arduino’s sketch runs fine (it’s a fairly simple loop), so I think that it’s the controller that’s confused, or the serial connection. It’s basically acting like the Arduino and Motor Controller are sending eachother random bytes on the serial port no matter the state of the rest of the controller.

If I reset it, it then behaves for a little bit (<1 minute) before blowing up again. The symptoms are that the dome motor doesn’t run (which makes sense if the Motor Controller’s hearing random data), and that the spray toggles rapidly (which makes sense if the Arduino’s seeing random data).

Has anyone seen anything like this? The serial rate is only 38.4, which doesn’t seem like a lot, and the controller is only 8 inches or so from the Arduino, so it seems unlikely to be noise. I’d suspect low voltage, but it’s in a 12V system so never gets near either the Arduino or the Motor controller’s needs. The “big” drive motors run fine even when this system is acting up. (They’re 12A controllers, and don’t bother with the serial handshaking, they just listen to the RC signals and run the motors).

I’ve pretty much ruled out the Arduino since A) it can communicate with the rest of the system ‘fine’, and the sketch loop is pretty simple, B) it runs fine 99% of the time, and C) the symptoms exactly match what random data on the serial lines would look like.

Hello.

We have not heard of this issue before. When it goes into a bad state again, you might try plugging the controller into USB and checking the “Status” tab in the Simple Motor Control Center program to see what might be going on. It is possible that the Simple Motor Controller’s readings of the RC transmitter are getting messed up. You mention that it works fine for days, but that the error comes back quickly when resetting it from the problematic state. Is there any correlation between the state of the batteries and when the error happens (i.e. does charging the batteries eliminate the problem)?

- Jeremy

Its awkward when it fails so PC is hard, but I’ll try if it happens again. AFAICT battery level doesn’t help :frowning: I’m going to try to add some error handling to the sketch too.

The symptoms are fairly similar to what happens when I unplug the serial wire. Interestingly when I plug the serial wire back in, I seem to correctly be reading the data, but the motor controller isn’t running the motor. The Red LED isn’t lit though. Is there something I need to do to reset the motor when a connection is reestablished? I don’t have the safe start set…

With the Safe-Start feature disabled, you should not have to do anything special before sending commands to the motor controller. However, I am not sure how well it will reestablish connection with the controller. You mentioned that your Arduino runs a fairly simple loop. Could you post the entire sketch and your SMC settings file?

- Jeremy

Wow, I left this hanging…

Root cause is pretty unbelievable. A fuse “partially” blew. After a little time it broke the circuit, but when you tried to measure it, it seemed OK. (ATC type car fuse). Eventually I ended up replacing the fuse not really because it was suspect but rather because I was out of things to try… and it worked…