Sunday, April 6, 2014

Circuit troubleshooting

ARGH! In the process of installing the steering servo & thus extending the front wheels, somehow the right motor channel is no longer working. Troubleshooting steps:

  • check all connections, remove & reinstall motor wires
  • double-check pin assignments in the code
  • jumper across from the other channel to see if motors are OK
  • isolate motor circuit (disconnect "peripherals")
  • load a "motor test" sketch with basic configuration

AHAH! finally a positive result. The wiring is fine, and with the test sketch I used skid steering actually works quite well with the steering gear "loose" (no servo control.) Great! So the issue must be in the code... copy the code and reassign the motor pins back to original config and comment out peripherals...still something odd but it may be related to the IR. Time to rebuild the motor code that works and add the IR back in... something went awry when I added other components to the code!

Running by USB with the motor board off (one advantage of having it's power separate) I can watch the Serial Monitor - my cheap remote is throwing inconsistent codes, which might be part of the problem. Doesn't take long to try my TV/Stereo remotes and figure out which one will best meet my needs. Remapped a Sony remote for the commands I want (stop/go, left/right, fast/slow) and change those in the copied code... OK, so far so good. Now add the LED lights back in... AHAH! Suddenly I'm back to where I was, with motors not responding properly. Is there a limit to how many pins I can use, or is there some overlap in the pins? I seem to have reached some kind of limit, or maybe a conflict on pins 11-13. OK, I'll move the LED pins down to 0 and 1... Hmmm... they both stay on so those two pins seem to be "live," perhaps paired with others? What about 5 and 6? Now the right motor spins backward only... I think there MUST be some sort of pin conflict, or pins that can't both be used! What about 3 and 12? Same results as 5/6. OK, comment out the LEDs again and... No go.

Back to the drawing board, checking connections and using my MotorTest sketch. AH! Perhaps what I am getting is interference with so many wires on the breadboard? Just found that if I tweak my front IR sensor to the side, the motors work properly. Move those wires on the breadboard - still need the IR sensor in the right place, so there is still something up with the way things are attached in the front. This has now been nearly three hours of troubleshooting! Now with that sensor "tweaked" to the side, maybe my original script will work properly... YES it does!

So all along I had underlying wiring issues. It turned out that one of the ground wires for the on/off switch was loose, so the motor circuit was not completely grounded. What was deceptive was that the driver board light was on! Since the driver board and Arduino share a ground, the power light was on but grounded through Arduino, I guess. Hopefully today's troubleshooting is done.


No comments:

Post a Comment