Arduino Giga R1 WiFi DC Motor Shield
The Arduino Giga R1 WiFi packs a dual-core STM32H747 processor, built-in Wi-Fi and Bluetooth, and plenty of RAM - yet it still sports Uno-compatible headers. That makes it a perfect match for the Motor Shield Rev3 when your motor project also needs wireless connectivity or heavy computation.
By the end of this tutorial you will know how to:
- Seat the Motor Shield Rev3 on the Giga R1 WiFi.
- Hook up a DC motor and an external power supply.
- Command the motor to rotate clockwise or counterclockwise.
- Fine-tune rotation speed with PWM duty values from 0 to 255.
- Bring the motor to an immediate halt using the brake function.
- Sample the motor's current draw through the analog sensing pin.
- Coordinate two motors on Channel A and Channel B together.

Hardware Preparation
Or you can buy the following kits:
| 1 | × | DIYables Sensor Kit (18 sensors/displays) |
Additionally, some of these links are for products from our own brand, DIYables .
The Motor Shield Rev3 Explained
Beneath the shield's screw terminals lives an L298P dual full-bridge driver IC. It handles the heavy lifting of switching motor polarity and modulating power - your Arduino sketch just toggles a handful of digital and analog pins.
Each of the two independent motor channels offers:
- A direction digital output - write HIGH or LOW to choose the rotation sense.
- A PWM output - vary the duty cycle between 0 (halted) and 255 (maximum torque).
- A brake digital output - pull HIGH to lock the motor instantly, or set LOW to let it coast.
- A current-sensing analog input - reads a voltage that scales with the current flowing through the motor.
The Giga R1 WiFi's Uno-compatible headers place these signals on the standard pins:
| Function | Channel A | Channel B |
|---|---|---|
| Direction | D12 | D13 |
| PWM (Speed) | D3 | D11 |
| Brake | D9 | D8 |
| Current Sensing | A0 | A1 |
About External Power
The L298P can deliver up to 2 A per channel - far beyond what USB provides. Attach a 6-12 V battery pack (or bench supply) to the power screw terminals on the shield. The Giga R1 WiFi itself draws power from USB Type-C independently.
Wiring Diagram
Carefully line up the Motor Shield Rev3 with the Giga R1 WiFi headers and press it into place. No soldering, no breadboard.
Run the motor leads to the Channel A screw terminals. Connect your external battery to the power terminals, observing polarity.

This image is created using Fritzing. Click to enlarge image
Setting Up the Library
- Connect the Giga R1 WiFi to your computer through the USB Type-C port.
- Launch the Arduino IDE, then select Arduino Giga R1 WiFi from the board menu and pick the appropriate port.
- Open the Libraries panel.
- Enter "DIYables_DC_Motor" in the search field. The library from DIYables should appear.
- Click Install.

Everything is included in the library package - there are no extra dependencies to install.
Program Template
Here is the simplest program that drives a motor:
Three calls are all you need: begin() prepares the hardware, run() starts the motor, and brake() stops it. The motor continues spinning at the last requested speed until you issue a new command.
Driving a Motor on Channel A
Toggle a single motor between forward and reverse rotation, stopping in between.
Getting Started
- Seat the shield onto the Giga R1 WiFi and connect the motor to Channel A.
- Attach the battery pack.
- Plug in the USB Type-C cable.
- In Arduino IDE, confirm the board and port settings, paste the code, and tap Upload.
- Open the Serial Monitor to track direction changes.
The motor spins at speed 30 for two seconds, brakes for two seconds, reverses, and loops.
Motor Control Methods
| Method | Description | Example Call |
|---|---|---|
| run(dir, speed) | Sets direction and speed; releases brake automatically | motor.run(MOTOR_FORWARD, 100) |
| setSpeed(speed) | Updates PWM output (0-255) | motor.setSpeed(180) |
| setDirection(dir) | Switches rotation sense | motor.setDirection(MOTOR_BACKWARD) |
| brake() | Locks shaft and zeroes PWM | motor.brake() |
| release() | Frees the brake without changing speed | motor.release() |
| readCurrent() | Returns raw ADC from the sensing pin | motor.readCurrent() |
Driving a Motor on Channel B
Same experiment, wired to the second channel.
Getting Started
- Reconnect the motor to the Channel B terminals.
- Upload the sketch and open the Serial Monitor.
No code logic changes - the constructor constant handles the pin swap.
Dual-Motor Control
Orchestrate two motors through synchronized and opposing motion patterns.
Getting Started
- Wire one motor to Channel A and another to Channel B.
- Upload and monitor via Serial.
The sketch demonstrates three phases: both forward, both backward, and opposing directions, each separated by a braking interval.
Measuring Motor Current
Continuously read the current drawn by a running motor.
Getting Started
- Attach a motor to Channel A.
- Upload and open the Serial Monitor.
- Watch the raw ADC value update every 500 ms.
Interpreting the Reading
The Giga R1 WiFi's default ADC resolution produces values in the 0-1023 range. Apply the motor shield's documented voltage-to-current ratio to convert the reading into milliamps.
Using Custom Pins
When your hardware layout differs from the standard shield - perhaps you are using a breakout board or a custom PCB - specify every pin explicitly.
Getting Started
- Substitute your actual pin numbers into the constructor.
- Upload and verify that the motor responds correctly.
What to Check When Things Go Wrong
- Complete silence from the motor - Verify external power polarity and voltage. Confirm that motor leads are tight in the screw terminals. Ensure the channel constant in code matches the physical connection.
- Motor vibrates but does not turn - The speed value is probably too low. Bump it up to at least 50-80.
- Unexpected direction - Either reverse the two motor wires at the terminal, or swap MOTOR_FORWARD and MOTOR_BACKWARD in your sketch.
- readCurrent() returns -1 - You created the motor with the 3-pin constructor, which excludes current sensing. Switch to the channel constructor or the 4-pin variant.
- Thermal shutdown - The motor may be stalled or overloaded. Keep each channel under 2 A continuous.
Platform Support
The library is built on Arduino's standard API surface - pinMode, digitalWrite, analogWrite, analogRead - and carries the architectures=* flag, so it compiles on every Arduino-supported platform.