The following warnings occurred:
Warning [2] Creating default object from empty value - Line: 11 - File: inc/plugins/tapatalk.php PHP 7.4.10 (Linux)
File Line Function
/inc/plugins/tapatalk.php 11 errorHandler->error
/inc/class_plugins.php 38 require_once
/inc/init.php 233 pluginSystem->load
/global.php 18 require_once
/showthread.php 28 require_once





Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Pololu Motor Controller Daisy Chains
#11
Several notes about the previous post/script.

A) I have a "debug" flag that is used to send output to the computer via USB if the computer is monitoring it.  That prints messages so you can see if the R/C signals are being read correctly, etc.

Code:
// Toggle spewing of debug spew
bool debug = true;

If you don't want that, you can change it to

Code:
// Toggle spewing of debug spew
bool debug = false;

B) As part of "debug mode" there's a statement that makes the motors cycle a little so you can check if they're moving the right directions.  You may comment that out with // to disable the test sequence, or remove the comment (and change the debug flag to true) to do the test motor sequence.  

This test sequence moves the motors when the script starts so you can see that it's correctly talking to the motors and moving them in the correct directions.

This (along with "bool debug = true;" above) runs the motor test sequence:
Code:
// Quick test program
// THIS MAKES THE MOTORS MOVE, COMMENT OUT TO NOT DO THIS!!!
testMotors();

To disable the motor test sequence, either set "bool debug = false;" above, or "comment out" this line as below.  (// lines are treated as comments and ignored by the compiler)
Code:
// Quick test program
// THIS MAKES THE MOTORS MOVE, COMMENT OUT TO NOT DO THIS!!!
// testMotors(); // Commented out with //

C) Some Arduinos have only a single "Serial" port (which is shared with the USB communication), and some have multiple "Serial" ports. The script was originally written for a Leonardo, which has a "Serial1" port.

If your Arduino doesn't have a "Serial1" port, change ALL of the "Serial1" references to "Serial" in the script. Note that when you do that you can't use the USB port to talk to the computer, so make sure you set the "bool debug = false;" above so that the script won't try to send USB data to your motors!

Of course if your Arduino has more than 2 Serial ports you could also change the Serial1 to Serial2 or Serial3 if that's better for your application.
Reply
#12
Reminder:  The ground bus is used as a reference baseline for all of the communications between the Arduino and the Simple Motor Controllers (SMCs), and also between the Motor Controllers and the R/C Receiver.  They should all be connected with a common ground.

Similarly, the Simple Motor Controllers all get their positive power from their 12V input and regulator, so they don't need a + power connected.  DO NOT connect their +5V lines together or their regulators will all get in an argument and probably bad things might happen.

The Arduino can also use it's own internal regulator *or* you could steal the regulated output from one of the SMC's to the Arduino for it's 5V power.  If you're using the Arduino's regulator, then DO NOT connect the Arduino +5V output to any of the SMC's 5V lines, they'd also get grumpy.

The R/C receiver, however, does need power from somewhere.  And from exactly ONE somewhere at that.  In R/C terminology they call that a "BEC" (Battery eliminator circuit - eg: get power from somewhere else so that the Receiver doesn't need it's own battery).  Since we're connecting the servo lines from the R/C receiver to the SMC's anyway, the easiest way to power the R/C receiver is from ONLY ONE of the Pololu Simple Motor Controllers.

Fortunately the SMC's have a "BEC" connector.  You need to connect the "BEC" line to the 5V line on one SMC.  That'll provide power through the servo wire to the receiver.  (I realize the receivers probably also have a power input, but mine are all connected internally, so all the + are common on the RX side, as are all the - wires).

FWIW: RC Servos have 3 wires:  Two are + & - to provide power to the servo.  And the 3rd wire is the signal.  If our receiver didn't need power, we'd only need the - and signal lines since our SMC's are self-powered.  But, as mentioned above, ONE of the lines needs to provide power to the receiver.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)