> For the complete documentation index, see [llms.txt](https://docs.protoboard.xyz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.protoboard.xyz/tutorials-and-examples/motor-control-chain.md).

# Motor Control Chain

Model a battery-to-motor power chain with an Ovonic LiPo, L298N motor driver, DC motor, and Arduino controller.

## Goal

Build a complete motor control system: an **Ovonic 4S LiPo** battery powering an **L298N motor driver**, which drives a **DC motor**, all controlled by an **Arduino Uno Rev3**. You'll model the full power chain from battery to motor, add control logic, validate with DRC, and review the BOM.

{% hint style="info" %}
**Time:** About 20 minutes. **What you need:** A free Protoboard account. No hardware required.
{% endhint %}

## What you're building

A robotics-style motor control system. The battery provides high-voltage power to the motor driver, which regulates current delivery to the motor. The Arduino sends control signals (direction and PWM speed) to the motor driver. This is the core pattern behind every wheeled robot, conveyor belt, and motorized mechanism.

{% columns %}
{% column %}

### Parts you'll use

| Part                       | Role                                                      |
| -------------------------- | --------------------------------------------------------- |
| **Ovonic 4S 1300mAh LiPo** | Battery: 14.8V nominal power source                       |
| **L298N Motor Driver**     | Driver: dual H-bridge, controls motor direction and speed |
| **DC Motor** (blank part)  | Motor: the actuator that does the physical work           |
| **Arduino Uno Rev3**       | Controller: sends direction and PWM signals to the driver |
| {% endcolumn %}            |                                                           |

{% column %}

### Connections you'll make

| Harness              | Type                                             |
| -------------------- | ------------------------------------------------ |
| Ovonic 4S to L298N   | Power supply (14.8V battery to motor supply)     |
| L298N to DC Motor    | Motor drive (H-bridge output to motor terminals) |
| Arduino Uno to L298N | Control signals (direction + PWM enable)         |
| {% endcolumn %}      |                                                  |
| {% endcolumns %}     |                                                  |

{% hint style="warning" %}
**Blank part needed:** The ProtoPart library doesn't include a generic DC motor, so you'll create one as a blank part. This is a common real-world scenario; you often know the motor you want to use before it's cataloged.
{% endhint %}

***

## Steps

{% stepper %}
{% step %}

### Create a new board and place the battery

Open Protoboard, create a **New Board**, and name it "Motor Control Chain".

Open the **Parts Bin** (cuboid icon) and search for **"Ovonic"**. Drag the **Ovonic 4S 1300mAh 120C LiPo (XT60)** onto the left side of the canvas.

This is a 4-cell lithium polymer battery:

* **Nominal voltage:** 14.8V (4 cells x 3.7V)
* **Voltage range:** 12V (depleted) to 16.8V (fully charged)
* **Discharge rate:** 120C, meaning this battery can deliver serious current
* **Connector:** XT60

{% hint style="info" %}
**Why this battery?** The Ovonic 4S is common in robotics and FPV applications. Its 14.8V nominal is within the L298N's motor supply range (5-35V), making them a compatible pair.
{% endhint %}
{% endstep %}

{% step %}

### Place the L298N motor driver

Search the Parts Bin for **"L298N"**. Drag the **L298N Dual H-Bridge Motor Driver Module** onto the canvas to the right of the battery.

The L298N is a versatile motor driver:

* **Motor supply (Vs):** 5V to 35V, which accepts the 14.8V from our LiPo
* **Per-channel current:** Up to \~2A
* **Onboard 5V regulator:** Can power its own logic and an external controller (via jumper)
* **Control inputs:** IN1, IN2, IN3, IN4 for direction; ENA, ENB for PWM speed control
  {% endstep %}

{% step %}

### Create a blank part for the DC motor

Since the library doesn't have a generic DC motor, create a **Blank Part** from the Parts Bin. Configure it in the Inspector:

1. **Name:** `DC Motor (12V)`
2. **Description:** `Generic 12V brushed DC motor, ~1A stall current`
3. **Domain:** Add the **Electrical** domain
4. **Interface:** Add a **motor input** interface with the role set to **motor** (the driven device). Include two functions:
   * `Motor+`: signal class: power, direction: sink
   * `Motor-`: signal class: power, direction: sink

Place the motor to the right of the L298N on the canvas.

{% hint style="info" %}
**Alternative:** If you'd prefer to use a library part, the **Tower Pro SG90** servo is available, though it connects differently (PWM signal instead of H-bridge). For this tutorial, the blank DC motor demonstrates the H-bridge motor drive pattern.
{% endhint %}
{% endstep %}

{% step %}

### Place the Arduino Uno Rev3 as the controller

Search for **"Arduino Uno"** and drag the **Arduino Uno Rev3** onto the canvas above or below the motor driver, wherever it fits cleanly in your layout.

The Arduino will send digital control signals to the L298N:

* **Direction pins:** Two digital outputs (e.g., D7, D8) mapped to IN1 and IN2
* **PWM speed pin:** One PWM-capable output (e.g., D9) mapped to ENA
  {% endstep %}

{% step %}

### Connect the battery to the motor driver (power harness)

Create the first harness: **Ovonic 4S LiPo to L298N**.

1. Hover near the edge of the **Ovonic 4S** until a handle appears
2. Drag to the **L298N** to create a harness
3. Protoboard should detect the battery's power output interface and the L298N's motor supply (Vs) power input

In the Inspector, verify the interface link:

* Battery's **power output** paired with L298N's **Motor Supply (Vs)** domain
* Function links: **Battery Positive to Vs+** and **Battery Negative to GND**

{% hint style="info" %}
**Voltage check:** The Ovonic 4S delivers 12-16.8V. The L298N's motor supply accepts 5-35V. These ranges overlap, so Protoboard should find them compatible.
{% endhint %}
{% endstep %}

{% step %}

### Connect the motor driver to the motor (drive harness)

Create the second harness: **L298N to DC Motor**.

1. Hover near the edge of the **L298N** and drag to the **DC Motor**
2. Pair the L298N's **motor output** interface with the motor's **motor input** interface
3. Create function links: **OUT1 to Motor+** and **OUT2 to Motor-**

This harness represents the H-bridge output. The L298N switches the polarity of these lines to control the motor's direction, and modulates the duty cycle (via PWM) to control speed.
{% endstep %}

{% step %}

### Connect the Arduino to the motor driver (control harness)

Create the third harness: **Arduino Uno Rev3 to L298N**.

1. Hover near the edge of the **Arduino Uno** and drag to the **L298N**
2. This is a **control signal** connection; the Arduino's digital outputs connect to the L298N's logic inputs

You'll need to create function links for:

| Arduino Pin               | L298N Input | Purpose                    |
| ------------------------- | ----------- | -------------------------- |
| Digital output (e.g., D7) | IN1         | Direction control A        |
| Digital output (e.g., D8) | IN2         | Direction control B        |
| PWM output (e.g., D9)     | ENA         | Speed control (PWM enable) |

{% hint style="warning" %}
**Resource allocation matters here.** The Arduino has many digital pins, but you need to assign specific ones. Pin D9 is a good choice for ENA because it supports hardware PWM. D7 and D8 work well for direction control since they only need simple HIGH/LOW states.
{% endhint %}

You may also need to connect the Arduino's GND to the L298N's logic GND to establish a common ground reference.
{% endstep %}

{% step %}

### Run DRC and fix issues

Click the **Board Review** icon (shield icon) to run DRC. With three harnesses connecting four parts, there are several things the DRC checks:

{% tabs %}
{% tab title="Common issues" %}
**Resource allocation (amber)**

The Arduino needs specific pin assignments for the control harness. Select the harness, open the Inspector, and allocate D7 to IN1, D8 to IN2, and D9 to ENA.

**Voltage domain mismatch (amber or red)**

If the battery's voltage range doesn't fully overlap with the L298N's accepted range, you may see a warning. Verify the L298N's Vs domain accepts the battery's output range (12-16.8V falls within 5-35V, so this should pass).

**Missing ground references (amber)**

Ensure each harness has a GND-to-GND function link. The battery, motor driver, Arduino, and motor all need a common ground.

**Motor interface roles (red)**

If the blank motor part's interface role doesn't complement the L298N's output role, you'll get INCOMPATIBLE. Make sure the motor uses a **motor** or **input** role and the L298N uses a **driver** or **output** role.
{% endtab %}

{% tab title="Let ProtoBot fix it" %}
Open **ProtoBot** and try:

> "Fix all DRC issues. Allocate Arduino pins D7, D8, and D9 for motor driver control. Make sure all ground references are connected."

ProtoBot can handle resource allocation, add missing function links, and verify voltage domain compatibility in one pass.
{% endtab %}
{% endtabs %}

Re-run DRC after each round of fixes until all connections show **CONFIGURED** (green).

{% hint style="success" %}
**All green?** Your motor control chain is fully validated. Power flows from battery through the motor driver to the motor, and the Arduino controls direction and speed.
{% endhint %}
{% endstep %}

{% step %}

### Review the BOM

Click the **BOM** icon (cart icon) to see your parts list:

| Part                                    | Manufacturer        | Type            |
| --------------------------------------- | ------------------- | --------------- |
| Ovonic 4S 1300mAh 120C LiPo (XT60)      | Ovonic              | Battery         |
| L298N Dual H-Bridge Motor Driver Module | STMicroelectronics  | Motor driver    |
| DC Motor (12V)                          | (custom blank part) | Motor           |
| Arduino Uno Rev3                        | Arduino             | Microcontroller |

{% hint style="info" %}
**Blank parts in the BOM:** Your custom DC motor will appear in the BOM but won't have supplier data or pricing. You can manually add manufacturer info and cost in the Inspector to complete the BOM.
{% endhint %}

Export to **CSV** or **PDF** when you're ready to share or purchase.
{% endstep %}
{% endstepper %}

***

## Understanding the power chain

The signal flow in this design follows a clear hierarchy:

```
[Battery] --14.8V--> [Motor Driver] --switched output--> [Motor]
                           ^
                           |
                     [Arduino Uno]
                  (direction + PWM control)
```

**Power path:** Battery supplies high-voltage/high-current power to the L298N, which switches it to the motor. The motor never connects directly to the battery; the driver controls when and how power is delivered.

**Control path:** The Arduino sends low-current logic signals to the L298N. IN1/IN2 set direction (which way current flows through the motor), and ENA sets speed (PWM duty cycle).

**Ground path:** All four parts share a common ground. This is essential for the logic signals to work correctly.

***

## Common failures

<details>

<summary>DRC shows INCOMPATIBLE on the battery-to-driver connection</summary>

Check that the battery's power output role complements the driver's power input role. Also verify voltage ranges overlap. The Ovonic 4S (12-16.8V) should fit within the L298N's Vs range (5-35V). If the DRC still flags it, check whether the power domain types match (both should be "non\_isolated" with "common" ground reference).

</details>

<details>

<summary>The control harness from Arduino to L298N won't auto-detect</summary>

The Arduino has many interfaces (I2C, SPI, UART, GPIO), and the L298N's control inputs may not auto-match with any of them. You may need to manually create the interface link, pairing the Arduino's digital output interface with the L298N's logic control input interface. Then create function links for each signal (IN1, IN2, ENA).

</details>

<details>

<summary>My blank motor part shows NOT_CONFIGURED</summary>

Make sure the motor's interface has the correct role. It should be **motor** (the driven device), complementing the L298N's **driver** role. If the roles aren't complementary, Protoboard can't validate the connection. Edit the blank part in the Inspector and adjust the interface role.

</details>

<details>

<summary>Can I use a library motor instead of a blank part?</summary>

Yes. The **Tower Pro SG90** servo is in the library, but it uses PWM position control rather than H-bridge drive. The **REV NEO Brushless** motor is also available but requires a compatible motor controller like the **REV SPARK MAX** instead of the L298N. Choose parts that match your drive topology.

</details>

***

## Taking it further

* **Add a second motor** to the L298N's Channel B (it's a dual H-bridge) and see how DRC handles shared resources
* **Replace the Arduino with a Teensy 4.1** for more PWM channels and higher clock speed
* **Add the REV SPARK MAX** motor controller with a **REV NEO Brushless** motor for a brushless motor chain
* **Connect a sensor** (e.g., an HCSR04 ultrasonic sensor) to the Arduino for obstacle-avoidance logic

***

## Next steps

* [**Common DRC Failures**](/tutorials-and-examples/common-drc-failures.md): See what happens when connections go wrong
* [**MCU + Sensor + Regulator**](/tutorials-and-examples/mcu-sensor-regulator.md): Build a data-focused system with I2C communication
* [**Fixing Errors**](/user-guide/fixing-errors.md): Learn systematic approaches to resolving DRC issues
* [**BOM + Export**](/user-guide/bom-and-export.md): Deep dive into the bill of materials workflow


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.protoboard.xyz/tutorials-and-examples/motor-control-chain.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
