# Wiring Actuators

## DC Motors

Let's start by taking a look at the ports on the HD Hex Motor and Core Hex Motor:

<figure><img src="https://3023198990-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FnKoHwxC0Q1NBpLowZUmu%2Fuploads%2Ff6xLeWRNYbEqruBMd5TE%2Fimage.png?alt=media&#x26;token=4b9bc4ad-5267-452e-818c-8949f62d1fe9" alt=""><figcaption></figcaption></figure>

Each motor has a power and encoder port. Encoders are a form of sensor built into the motor that can send information back to the Control Hub to be used during programming. Specifically, these motors use incremental encoders, which count the number of revolutions or "ticks".

#### Power Wires

<figure><img src="https://3023198990-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FnKoHwxC0Q1NBpLowZUmu%2Fuploads%2FROXJat9EsRRuiVf65K5s%2Funknown.png?alt=media&#x26;token=6c48c818-1f61-43d8-bf94-381fdfa24151" alt="" width="375"><figcaption></figcaption></figure>

Red provides power while black serves as the ground. These wires are **keyed**, meaning they are meant to only attach to the motor and Control Hub one way as dictated by the clip on the connector.&#x20;

In the event a power wire is connected backwards, the motor will spin the opposite expected direction!

#### Encoder Wires

<figure><img src="https://3023198990-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FnKoHwxC0Q1NBpLowZUmu%2Fuploads%2FYHAiyeaHFvSs47wvC4Wf%2Funknown.png?alt=media&#x26;token=3d2e0df7-306b-4a6c-b263-15704bbac5fb" alt="" width="375"><figcaption></figcaption></figure>

Similarly to the power wires, red provides power while black serves as ground. The blue and white wires transmute signal between the motor and the Control Hub. These wires can be used with various sensors, not just motor encoders. The wires are keyed with the intention of only connecting one way.

### Connecting the Wires

When connecting the wires to both the motor and the Control Hub it should be a snug fit. Giving a small, light tug is a recommended practice to help wires are seated correctly.&#x20;

## Servos

On the servo end, the needed wire is already built-in. Unlike the motor wires, the power and ground are both black while white is the signal wire. On the Control Hub, signal is labeled as S.&#x20;

These wires are not keyed meaning students will have to be careful which direction they are connecting them. While reversing the wire is unlikely to damage the servo, it will prevent it from working as expected.

<figure><img src="https://3023198990-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FnKoHwxC0Q1NBpLowZUmu%2Fuploads%2FC9lhWkMZiWTjfql7Fv0c%2Fimage.png?alt=media&#x26;token=30650da1-3ed1-4453-bc9e-2203d801c69a" alt="" width="375"><figcaption></figcaption></figure>

#### PWM Wires

Often times there may be a need to extend the built-in wire of the servo. To do so we can use a standard PWM[^1] cable.&#x20;

<figure><img src="https://3023198990-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FnKoHwxC0Q1NBpLowZUmu%2Fuploads%2F1PZcLAStH7ZxYelNNwQg%2Fimage.png?alt=media&#x26;token=7ba7be14-9f32-4e48-8fcc-5c1cbe684302" alt="" width="375"><figcaption></figcaption></figure>

The PWM wires available within the EDU Kit V2 are red for power, black for ground, and white for signal. When connecting a PWM cable to the servo's built-in cable, its easiest to focus on lining up the white signal wire to ensure the correct orientation.

### On the Control Hub

Motor ports are located on the left side of the Control Hub and servo ports along the bottom.&#x20;

<figure><img src="https://3023198990-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FnKoHwxC0Q1NBpLowZUmu%2Fuploads%2Fs8ucNienejEcVrFL95JP%2Fimage.png?alt=media&#x26;token=0e676ed9-9c02-4bfc-b1af-4679568003f6" alt="" width="563"><figcaption></figcaption></figure>

For motors, each port pairs a power connector, the more square option, and an encoder connector, the more rectangular option.&#x20;

The servo ports include a label to help with orienting the cable while connected since these are often not keyed.

### Testbed Wiring

When completing the [configuration process](https://docs.revrobotics.com/rev-professional-development-technical-path/gs/config), we tell the Control Hub what is connected and where.

It is NOT able to autodetect or correct once parts are wired meaning which port a motor is connected to DOES matter and should match the configuration.&#x20;

For the testbed, the wiring layout is below:

| Port         | Actuator          |
| ------------ | ----------------- |
| Motor Port 0 | Core Hex Motor    |
| Motor Port 1 | HD Hex Motor      |
| Servo Port 0 | Smart Robot Servo |

After wiring your testbed, you will need to create a configuration before starting programming. Give this a try or review the [Creating a Configuration](https://docs.revrobotics.com/rev-professional-development-technical-path/gs/config) section!&#x20;

Recall that device names should be easily recognizable even, when creating test configs, to reduce future confusion. The names used from curriculum are below:

| Actuator          | Name     |
| ----------------- | -------- |
| Core Hex Motor    | coreHex  |
| HD Hex Motor      | ultraHex |
| Smart Robot Servo | servo    |

[^1]: Pulse-width modulation - the signal type used to communicate with the servo
