Using the MOSFET driver with Arduino involves wiring up the MOSFET driver to your Arduino-compatible microcontroller and running the provided example code.

Wiring

Wire as shown for a 5V board like an Uno. If you are using a 3V board, like an Adafruit Feather, wire the board's 3V pin to the MOSFET driver V+.

Here is an Adafruit Metro wired up to the MOSFET driver with a motor using the STEMMA JST PH cable:

Mini Push-Pull Solenoid wired to Trinket, activating back and forth
Solenoids are basically electromagnets: they are made of a coil of copper wire with an armature (a slug of metal) in the middle. When the coil is energized, the slug is pulled into the...
$4.95
In Stock
If the load that you are driving requires more than 5V, then it will not trigger with this circuit.
  • Board 5V to driver V+ (red wire)
  • Board GND to driver GND (black wire)
  • Board pin 3 to driver In (white wire)
  • Motor black wire to driver terminal block -
  • Motor red wire to driver terminal block +

Here is an Adafruit Metro wired up using a solderless breadboard:

  • Board 5V to driver V+ (red wire)
  • Board GND to driver GND (black wire)
  • Board pin 3 to driver In (white wire)
  • Motor black wire to driver terminal block -
  • Motor red wire to driver terminal block +

Example Code

// SPDX-FileCopyrightText: 2022 Liz Clark for Adafruit Industries
//
// SPDX-License-Identifier: MIT

#define driverPin 3

void setup() {
  while (!Serial);
  delay(1000);
  Serial.begin(115200);
  Serial.println("Basic MOSFET Driver Test");
  pinMode(driverPin, OUTPUT);
}

void loop() {
  
  digitalWrite(driverPin, HIGH);
  Serial.println("The MOSFET driver is triggered.");
  delay(1000);
  digitalWrite(driverPin, LOW);
  Serial.println("The MOSFET driver is not triggered.");
  delay(1000);
}

Upload the sketch to your board and open up the Serial Monitor (Tools -> Serial Monitor) at 115200 baud. You should see the load triggered on and off while its status is printed to the Serial Monitor.

This guide was first published on Dec 14, 2022. It was last updated on Mar 28, 2024.

This page (Arduino) was last updated on Mar 28, 2024.

Text editor powered by tinymce.