Skip to content

FTC Single Hub

Westside Robotics edited this page Dec 26, 2022 · 2 revisions

Introduction

In a 2022 "Share the Spare" universe, some FTC teams this season may temporarily have only one REV Hub available. Does this mean the robot can use only 4 DC motors?

Not to worry! This tutorial shows how to run more than 4 DC motors on a single REV Control Hub or REV Expansion Hub.

==========

The key is a REV Robotics device allowing a DC motor to be controlled from a servo port.

The SPARKmini needs two inputs: 12V DC power and a control signal (from a servo port). A single output sends the controlled power to the motor.

Reminder: only 8 DC motors are allowed on an FTC robot. So, don't add 6 SPARKmini units...

Return to Top

Power Input

The 12V input originates at the robot battery, passing through the robot's power switch and one or more power junctions. Such junctions simply split off, or share, the 12V power with other devices (including the REV Hub itself).

You're already familiar with the simple in-and-out power junction at the top left corner of the REV Hub.

Simply connect the SPARKmini power input to this yellow-orange port on the REV Hub.

See far below for other power connection options.

Return to Top

Control Input

The SPARKmini's control input originates from any servo port, located along the bottom edge of a REV Hub.

Plug the SPARKmini servo connector into the selected port, with the correct orientation. See the small legend at the left side:

The simple rule is to place the black or darkest servo wire to the left.

If using a servo extension cable, perhaps with different wire colors, make sure the black or brown "ground" wires line up. Secure those connections.

Does it matter which port? See far below for further discussion.

Return to Top

Motor Output

Connect the SPARKmini's output power cable directly to the DC motor. Change or adapt the white JST-VH connector with PowerPole if needed.

That's it! Your SPARKmini is ready to configure and program.

Note: the SPARKmini's small C-B switch will be discussed below, in the section called “Zero-Power Behavior”.

Return to Top

Configure the Motor

Before you dive into programming, the robot's configuration must reflect the presence of a DC motor connected via SPARKmini.

Open the FTC Driver Station app, on a Driver Station (DS) device that's connected/paired (via Wi-Fi) with a Robot Controller -- either the REV Control Hub or an Android RC phone plugged into the REV Expansion Hub.

Or, open the FTC Robot Controller app on the Android RC phone.

In either app, touch the three-dots icon, open Configure Robot. Create or edit the desired configuration, navigate to the Control Hub or Expansion Hub, and open the Servos menu.

Choose REV SPARKmini Controller and name the DC motor.

Save and activate that configuration. Done!

Return to Top

Programming with SPARKmini

In the FTC Blocks command palette or menu, open Actuators, and CR Servo. Here you will find the Blocks available to control your SPARKmini DC motor.

These 5 commands allows basic control of the DC motor, without encoder position and its associated features such as RunModes and isBusy status. Also missing is ZeroPowerBehavior, discussed below.

Likewise in Java, use all commands for CR Servo; do not use the DcMotor class. Here’s a simple example for a SPARKmini DC motor named “Spool”:

Return to Top

Power Distribution

Each SPARKmini needs its own 12V input. You may find it convenient to add another 12V power junction:


images not to scale


images not to scale

Other devices and arrangements are possible, but the robot must meet all FTC wiring and safety rules. Careful wire management pays for itself.

You may change or adapt the SPARKmini's yellow-orange XT-30 connector to PowerPole, if needed.

Return to Top

Servo Port Management

Some teams should choose the SPARKmini port carefully.

Each pair of servo ports offers a maximum 2 Amps (2A or 2000mA) of current draw for servos. Namely, the 0-and-1 pair offers 2000mA, likewise the 2-and-3 pair, and the 4-and-5 pair.

Why does this matter? The SPARKmini's control line draws very little current; the other input provides the DC motor's power. But... if the other/paired servo port is overloaded by a stalled high-power servo, the port pair may be automatically (temporarily) disabled for safety by the REV Hub. This could affect your DC motor performance.

How easy is it to overload the ports with high-performance servos?


images not to scale

So, connect the SPARKmini to a lightly loaded port pair if possible. In general, it's wise to consider the peak power demand (and timing) for all devices, ports and the overall robot. Limits and problems may appear, far below the robot battery's 20A fuse protection!

Return to Top

Servo Power Offload

On the subject of high-power servos, this product can help:

The REV Servo Power Module (SPM) doesn't directly interact with extra DC motors on a REV Hub, but it does offload electrical load from REV Hub servo ports. This in turn can allow SPARKmini DC motors to operate unaffected by overloaded/high-power servos, as described above.

The SPM needs two inputs: 12V DC power and a control signal (from a servo port). A single output sends the controlled power to the servo. REV Robotics calls this a power injector arrangement, similar to the SPARKmini.

SPM documentation is here.

If the robot electrical load is very high, the SPM may not eliminate temporary power reductions ('brownouts') or control system shutdown. Again, consider and test the peak power demands (and their in-match timing) for all devices, ports and the overall robot. Limits and problems may appear, far below the SPM's 15A rating, or the robot battery's 20A fuse protection.

Such issues have become more common in recent competitions, as FTC teams reach for extreme performance from new high-power devices. Before immediately blaming a "disconnect", check the power consumption.

Return to Top

Motor Encoders

REV Hubs have 4 motor encoder ports, alongside the power ports at the REV Hub's left edge. The REV Hub's sensor ports (right edge) cannot directly read DC motor encoder data.

A technical solution has been developed by Digital Chicken Labs, a collaboration of @Windwoes and @gearsincorg. @Windwoes is the developer of EasyOpenCV and other valuable programming tools.

From the public announcement:

Introducing: The OctoQuad - a low-cost 8 channel encoder sensor, which is fully compatible with the FTC control system, and directly compatible with any encoder that works with the Control Hub / Expansion Hub.

The OctoQuad accepts input from DC motor encoders, using the same cables/connectors as the REV Hubs. The encoder values are provided to your Java code through the REV Hub's I2C sensor port.

As an alternate, the OctoQuad also accepts input from a REV Through-Bore Encoder, usually available here and here.

The OctoQuad was released Sept. 1, 2022, and cannot be used in FTC competition. You may find this device useful for development projects and debugging. Documentation is here.

Use the SPARKmini for DC motors that don't need encoders. Reserve the standard REV Hub ports for each DC motor that does need an encoder and its associated features (RunModes and isBusy status).

Return to Top

Other Sensors

Besides encoder data, feedback is still available for SPARKmini DC motors. You can use other sensors for motor axle or mechanism position.

For example, a limit switch or touch sensor can detect end-of-travel or a key intermediate position:

Also, the REV Potentiometer reports shaft rotation within a 270-degree range of motion. This could be used in a mechanism with hard stops and/or limit switches to keep rotation well within the pot's range.

Tip: REV Hubs accept two sensors at each Analog and Digital sensor port.

Use programming logic to determine what the DC motor should do, when these sensors report certain values.

Return to Top

Zero-Power Behavior

The FTC SDK provides two choices for DC motor behavior when its Power is set to zero: FLOAT and BRAKE. Under FLOAT, the motor will come to rest from natural effects of friction. Under BRAKE, the motor will resist rotating, thus stopping sooner.

These programmed choices are not available for DC motors controlled with SPARKmini. Fortunately, the device itself can be manually set to one mode or the other.

The letter "C" is for Coast, same as FLOAT. The letter "B" is for Brake.

Carefully slide each unit's switch to your preferred mode for its DC motor. Add a comment in your programming code, telling the reader which setting is selected for each motor. It might be difficult to find out later!

Return to Top

Summary

This tutorial showed how to run more than 4 DC motors on a single REV Control Hub or REV Expansion Hub. This may help teams who temporarily have only one REV Hub available, during FTC’s “Share the Spare!” environment in 2022.

Much of this information, and more, is presented in REV Robotics’ comprehensive documentation site. Recommended reading!

Return to Top

===========

Questions, comments and corrections to: westsiderobotics@verizon.net

Clone this wiki locally