DriveCell isn’t just for driving motors and actuators—it can also make them generate sound and vibrations. By sending a signal through the audible frequency range, DriveCell can create different tones that can be played on devices like piezo buzzers, CoilPads, FlatFlaps, and even motors. Making it useful for alert systems or interactive responses. In this guide, we’ll explore how DriveCell can generate buzzing tones, how to wire it, and how to use it for various applications, from piezo buzzers to CoilPad and motor vibrations.
Buzzing is achieved by sending rapid electrical pulses to a device, causing it to oscillate within the audible frequency range (~20Hz–20kHz). DriveCell allows control over these pulses using PWM (Pulse Width Modulation), letting you generate tones, alerts and vibrations.
Here’s how to wire a buzzer, CoilPad, or FlatFlap to DriveCell:
To generate buzzing tones, DriveCell provides Arduino-compatible functions for buzzing tones.
The following example makes a buzzer, CoilPad, or FlatFlap buzz using DriveCell's library built-in function:
#include <DriveCell.h>
#define IN1_pin1 2
#define IN1_pin2 3
DriveCell myDriveCell(IN1_pin1, IN1_pin2);
void setup() {
myDriveCell.Init(); /* Initialize DriveCell */
}
void loop() {
myDriveCell.Buzz(100); /* Buzz at 100 microseconds */
delay(500);
myDriveCell.Tone(); /* Play a fixed tone with varying frequencies */
delay(500);
}
Buzz(duration)
→ Generates a buzzing effect:
duration
→ Tone frequency in microseconds (adjust to change intensity)Tone()
→ Plays a fixed tone built into the library⚠ Note: Some sounds can also be played on DC motors, but check the datasheet and avoid running high-frequency buzzing on brushed motors continuously, as it may cause excessive wear.
The tiny DriveCell module makes buzzing simple! Check out the DriveCell GitHub Repository for more code examples and technical documentation!
High-power LEDs are widely used in lighting projects, from flashlights to light strips and signal indicators. Typically, a single transistor is used to switch or dim high-power LEDs, but DriveCell, a tiny H-Bridge module which is packaged into the smallest module, can provide an alternative while handling up to 1.8A of continuous current.
In this guide, we’ll explore how DriveCell can be used to control high-power LEDs or single-color LED strips, discuss wiring configurations, and demonstrate a fading effect using its library.
DriveCell is built around the DRV8837 H-Bridge which has four transistors in the shape of an 'H' to allow bi-directional current. You only require one transistor to dim the brightness of high-power LEDs - But if you're looking for a tiny solution DriveCell can handles up to 1.8A continuous current with an easy integration with microcontrollers.
Before connecting your LED, it's essential to understand DriveCell’s electrical limitations:
Note: When it comes to lighting, DriveCell is only ideal for controlling the brightness of single-color LED strips or individual high-power LEDs.
Here’s how to wire a single LED or LED strip to DriveCell:
To adjust LED brightness dynamically, DriveCell provides a software library. Below is an example of a fading effect.
The following example demonstrates how to fade an LED in and out using DriveCell:
#include <DriveCell.h>
#define IN1_pin1 2
#define IN1_pin2 3
DriveCell LED(IN1_pin1, IN1_pin2); /* Pin2 will output the PWM signal, and Pin3 will be connected to 0V */
uint16_t led_brightness = 0;
bool led_brightness_flag = 1;
void setup() {
LED.Init(); /* Initialize the LED */
}
void loop() {
delay(10); /* Adjust this delay to change the fading speed */
if (led_brightness_flag == 1) {
if (led_brightness < 100U) {
led_brightness++;
} else {
led_brightness_flag = 0;
}
} else {
if (led_brightness > 1U) {
led_brightness--;
} else {
led_brightness_flag = 1;
}
}
LED.Drive(0, led_brightness); /* Output the new brightness level */
}
Init()
→ Initializes DriveCell and sets up the input pinsDrive(direction, brightness)
→ Controls LED brightness:
direction
→ 0
(fixed polarity for LEDs)brightness
→ Dimming level (0 to 100%)This code gradually increases and decreases the brightness of the LED, creating a smooth fading effect.
⚠ Note: The Drive() function is only compatible with ESP32 and CodeCell, as it uses a high-speed PWM timer.
Below is another example that can be used with other microcontrollers like the Arduino Uno:
#include <DriveCell.h>
#define IN1_pin1 2
#define IN1_pin2 3
DriveCell myLED(IN1_pin1, IN1_pin2);
void setup() {
myLED.Init();
}
void loop() {
myLED.Run(1000); // Blink LED on and off every 1 second
}
This example simply turns the LED on and off every second.
The tiny DriveCell module makes high-power LED control simple and easy to use! Check out the DriveCell GitHub Repository for more code examples and technical documentation!
Magnetic actuators, like the CoilPad and FlatFlap, use planar PCB coils to generate a small magnetic field to interact with magnets, converting electrical into mechanical energy. DriveCell is perfect for driving these actuators, because of its small size and easy to use library.
Magnetic actuators work by passing current through a coil, which creates a magnetic field that interacts with nearby magnets. This allows them to vibrate or oscillate.
Unlike traditional DC motors, magnetic actuators require rapid polarity switching and precise control to function effectively, which is why H-Bridge drivers like DriveCell are required.
Since magnetic actuators rely on alternating current directions, a standard transistor circuit won’t be enough. The DRV8837 H-Bridge in DriveCell allows current to flow in both directions, enabling full control over the polarity and intensity of the magnetic field.
Before connecting your actuators, it's essential to understand DriveCell’s electrical limitations:
Note: Both the CoilPad and the FlatFlap consume around 200mA - this means you can connect up 8 actuators in parallel, driving them using a single DriveCell.
Here’s how to solder/wire a single CoilPad or FlatFlap actuator to DriveCell:
You can connect multiple actuators in parallel:
This setup will drive both actuators in sync, making them activate simultaneously.
To simplify actuator control, DriveCell provides a software library. Below are the key functions you’ll need:
The following example demonstrates how to control two actuators with different intensities:
#include <DriveCell.h>
#define IN1_pin1 2
#define IN1_pin2 3
#define IN2_pin1 5
#define IN2_pin2 6
DriveCell Actuator1(IN1_pin1, IN1_pin2);
DriveCell Actuator2(IN2_pin1, IN2_pin2);
void setup() {
Actuator1.Init();
Actuator2.Init();
}
void loop() {
delay(3000);
Actuator1.Drive(1, 40); // Activate Actuator1 North-Polarity at 40% power
Actuator2.Drive(1, 80); // Activate Actuator2 North-Polarity at 80% power
delay(3000);
Actuator1.Drive(0, 50); // Activate Actuator1 South-Polarity at 50% power
Actuator2.Drive(1, 50); // Activate Actuator2 North-Polarity at 50% power
delay(3000);
Actuator1.Drive(0, 0); // Deactivate Actuator1
Actuator2.Drive(0, 100); // Activate Actuator2 South-Polarity at 100% power
}
Understanding the Functions:
Init()
→ Initializes DriveCell and sets up the input pinsDrive(direction, power)
→ Controls actuator:
direction
→ 1
(north) / 0
(south)power
→ Magnetic-field strength (0 to 100%)Here's another example where we configure two FlatFlaps and flap them at different speeds:
#include <DriveCell.h>
#define IN1_pin1 2
#define IN1_pin2 3
#define IN2_pin1 5
#define IN2_pin2 6
DriveCell FlatFlap1(IN1_pin1, IN1_pin2);
DriveCell FlatFlap2(IN2_pin1, IN2_pin2);
uint16_t flap_counter = 0;
void setup() {
FlatFlap1.Init();
FlatFlap2.Init();
FlatFlap1.Tone();
FlatFlap2.Tone();
}
void loop() {
delay(1);
flap_counter++;
if (flap_counter < 2000U) {
FlatFlap1.Run(0, 100, 100);
FlatFlap2.Run(0, 100, 100);
}
else if (flap_counter < 8000U) {
FlatFlap1.Run(1, 100, 1000);
FlatFlap2.Run(1, 100, 1000);
} else {
flap_counter = 0U;
FlatFlap1.Drive(0, 100);
FlatFlap2.Drive(1, 100);
delay(500);
FlatFlap1.Drive(1, 100);
FlatFlap2.Drive(1, 100);
delay(500);
FlatFlap1.Drive(1, 100);
FlatFlap2.Drive(0, 100);
delay(500);
FlatFlap1.Drive(1, 100);
FlatFlap2.Drive(1, 100);
delay(500);
FlatFlap1.Drive(0, 100);
FlatFlap2.Drive(0, 100);
delay(500);
FlatFlap1.Drive(1, 100);
FlatFlap2.Drive(1, 100);
delay(500);
FlatFlap1.Tone();
FlatFlap2.Tone();
}
}
Understanding the Functions:
Run(smooth, power, speed_ms)
→ Oscillate the FlatFlap in either a square wave or a smoother PWM wave.
smooth
→ 1
(pwm wave) / 0
(square wave)power
→ Magnetic-field strength (0 to 100%)power
→ Flipping speed in milliseconds⚠ Note: The Run() & Drive()
function uses a high-speed PWM timer, making it compatible only with CodeCell and ESP32-based devices.
Below is another example that can be used with other microcontrollers like the Arduino Uno:
#include <DriveCell.h>
#define IN1_pin1 2
#define IN1_pin2 3
DriveCell myActuator(IN1_pin1, IN1_pin2);
void setup() {
myActuator.Init();
}
void loop() {
myActuator.Run(1000); // Activate actuator for 1 second, then reverse
}
This example activates the actuator in North-polarity for 1 second before reversing polarity, creating an oscillating square wave movement.
The tiny DriveCell module makes magnetic-actuator control simple and easy to use! Check out the DriveCell GitHub Repository for more code examples and technical documentation!
When working with brushed DC motors, controlling their speed and direction is key to building functional robotics, automation systems, and interactive projects. DriveCell is a tiny compact motor driver based on the DRV8837 H-Bridge, simplifies this process by providing an easy-to-use library. In this guide, we'll explore how DriveCell works, how to control a DC motor, and how to connect multiple motors efficiently.
A brushed DC motor is a simple type of electric motor where current flows through a set of brushes and a commutator to create rotational motion. It operates based on the principle of electromagnetic induction, which generates a magnetic field inside the motor, pushing it into continuous rotation.
Unlike servo motors or stepper motors, brushed DC motors require two input signals to control their movement:
This is where H-Bridge drivers like the DRV8837 in DriveCell come into play. The H-Bridge circuit allows current to flow in both directions, enabling bidirectional motor control with just two input pins.
Before connecting your motors, it's essential to understand the DriveCell's electrical limitations:
If your motor requires less than 0.5A, you can also connect two motors in parallel and drive them using a single DriveCell.
Here’s how to wire a single DC motor to DriveCell:
If your motors consume less than 500mA each, you can connect two motors in parallel:
This setup will drive both motors synchronously, making them spin in the same direction at the same speed.
To make motor control simple, DriveCell provides an software library. Below are the key functions you’ll need:
The following example demonstrates how to control two motors at different speeds:
#include <DriveCell.h>
#define IN1_pin1 2
#define IN1_pin2 3
#define IN2_pin1 5
#define IN2_pin2 6
DriveCell Motor1(IN1_pin1, IN1_pin2);
DriveCell Motor2(IN2_pin1, IN2_pin2);
void setup() {
Motor1.Init();
Motor2.Init();
}
void loop() {
delay(3000);
Motor1.Drive(1, 40); // Move Forward at 40% speed
Motor2.Drive(1, 80); // Move Forward at 80% speed
delay(3000);
Motor1.Drive(0, 50); // Move Backward at 50% speed
Motor2.Drive(0, 50); // Move Backward at 50% speed
delay(3000);
Motor1.Drive(0, 0); // Set to 0% speed
Motor2.Drive(0, 100); // Move Backward at 100% speed
}
⚠ Note: The Drive()
function in this example uses a high-speed PWM timer, making it compatible only with CodeCell and other ESP32-based devices.
Below is another example that can be used with other microcontrollers like the Arduino Uno:
#include <DriveCell.h>
#define IN1_pin1 2
#define IN1_pin2 3
DriveCell myDriveCell(IN1_pin1, IN1_pin2);
void setup() {
myDriveCell.Init();
}
void loop() {
myDriveCell.Run(1000); // Run motor forward for 1 second, then reverse
}
This example will spin the motor in one direction for 1 second and then reverse its direction, creating a simple oscillating motion.
The tiny DriveCell module makes DC motor control simple and easy to use! Check out the DriveCell GitHub Repository for more code examples and technical documentation!
When working with small electronics projects that involve motors or actuators, controlling speed and direction can be a challenge. This is where DriveCell steps in. Packed into a fingertip-sized module, DriveCell simplifies motor control by utilizing a tiny H-Bridge chip, the DRV8837, making it an ideal solution for robotics, actuators, and even LED control. In this post, we’ll dive into the circuitry behind DriveCell and how it works.
At the core of DriveCell is the DRV8837 chip, an H-Bridge driver designed to handle low-power DC motors and actuators. An H-Bridge is a circuit configuration composed of four transistors arranged in an "H" shape, allowing for bidirectional control of a motor by reversing the current flow. The DRV8837 integrates this functionality into a compact form, offering:
Although the DRV8837 simplifies motor control, the DriveCell module takes it a step further by providing an easy-to-use software library that abstracts complex programming, making motor control accessible even to beginners.
The DriveCell module operates based on the state of its two input pins (IN1 and IN2) to control current flow through its output pins:
IN1 = VCC/PWM
, IN2 = GND
→ Motor spins forwardIN1 = GND
, IN2 = VCC/PWM
→ Motor spins in reverseIN1 = GND
, IN2 = GND
→ Motor stopsFor added clarity, an onboard LED provides visual feedback, indicating the direction of the output.
DriveCell is designed to be compact, efficient, and easy to integrate into various projects. Here’s why it stands out:
To start using DriveCell, follow these steps:
Solder the output pins to your motor or actuator and the input/power pins to your microcontroller. The input pins determine the state of the output pins:
Setting IN1 high makes OUT1 high
The VCC must be connected to a maximum supply voltage of 5V.
While wiring one of the input pins to VCC will instantly activate DriveCell, we recommend using the DriveCell Library for automatic control. This library makes DriveCell highly flexible and programmable.
Use our CodeCell module which is designed to be pin-to-pin compatible with DriveCell. With CodeCell, you can add wireless control and interactive sensing, unlocking new possibilities for your projects.
DriveCell simplifies the complexities of motor control with a compact design. Whether you’re building a tiny robot or a magnetic actuator, DriveCell provides an easy way to get started.
Check out the DriveCell Schematics here to explore its circuit design in detail and start integrating it into your next project!
DriveCell is a tiny but powerful device that helps you easily control motors, actuators, and high-power LED lights for your DIY projects. DriveCell makes controlling these components easy, even if you're new to programming or electronics.
In this tutorial we will explain:
What is DriveCell?
Imagine you want to make a small robot and control its motor's speed and direction. This can be complex for beginners and usually would require bulky modules. DriveCell simplifies this process because:
How Does DriveCell Work?
DriveCell utilizes an on-board DRV8837 H-bridge chip to control current flow through the output pins, controlled by the state of the input pins:
The DRV8837 chip provides overcurrent protection, undervoltage lockout, and thermal shutdown features, ensuring safe operation.
Getting Started with DriveCell
Before you can start using DriveCell, you need to set it up and connect it to your project. Here’s a simple guide to get you started:
1. Init()
First we need a basic setup code to get you started:
#include <DriveCell.h> // This line includes the DriveCell library
DriveCell myDriveCell(IN1, IN2); // Replace IN1 and IN2 with your specific pins
void setup() {
myDriveCell.Init(); // Initializes the DriveCell
}
This code tells the DriveCell to start up and get ready to control your motor or actuator. The Init function makes sure all the necessary peripherals are configured.
2. Pulse(bool direction, uint8_t ms_duration)
This command sends a short burst of power in a specified polarity, to quickly energize the actuator and turn it back off.
myDriveCell.Pulse(true, 10); // Short burst for 10 milliseconds
3. Buzz(uint16_t us_buzz)
This makes the actuator vibrate like a buzzer. It’s great for creating sounds for feedback.
myDriveCell.Buzz(100); // Creates a 100us buzzing sound
4. Tone()
This function plays a default tone by making the actuator vibrate at different saved frequencies.
myDriveCell.Tone(); // Plays varying tones
5. Toggle(uint8_t power_percent)
This function simply switches the direction at the full 100% power, which can be useful for reversing the spinning direction of a brushed motor or creating simple flapping movements.
myDriveCell.Toggle(); // Switches direction
By using the CodeCell or any other ESP32 microcontroller, you can also adjust the duty cycle 'power_percent'. For magnetic actuators the 'power_percent' controls the magnetic strength, while for brushed motors this adjusts the speed.
6. Run(bool smooth, uint8_t power_percent, uint16_t flip_speed_ms)
By using the CodeCell or any other ESP32 microcontroller, this function lets you flip the polarity of an actuator or reverse a motor every 'flip_speed_ms' at the duty cycle 'power_percent'. Setting 'smooth' to 1, smooths out the motion, which is ideal when driving the FlatFlap or CoilPad with slow motions (less than 2Hz).
myDriveCell.Run(true, 50, 1000); // Smooth drive at 50% power every 1000 ms
For other Arduino devices, this command makes the motor/actuator flip its direction (forward and backward) at full speed. For example:
myDriveCell.Run(500); // Motor changes direction every 500 milliseconds
7. Drive(bool direction, uint8_t power_percent)
By using the CodeCell or any other ESP32 microcontroller, this function lets you control the speed and direction of your motor. You can make the motor go forward or backward and adjust how fast it goes.
myDriveCell.Drive(true, 75); // Moves forward at 75% power
Examples:
By using any of these functions in a loop, you can create the desired sequence for your motor, actuator, or high-power LEDs. Here's an example where we initialize two dc-motors and drive them at different speeds:
#include <DriveCell.h>
#define IN1_pin1 2
#define IN1_pin2 3
#define IN2_pin1 5
#define IN2_pin2 6
DriveCell Motor1(IN1_pin1, IN1_pin2);
DriveCell Motor2(IN2_pin1, IN2_pin2);
uint8_t mode = 0;
uint8_t speed_percentage = 0;
void setup() {
Motor1.Init();
Motor2.Init();
speed_percentage = 80; /* Set Motor to 80% power */
}
void loop() {
delay(3000);
mode++;
switch (mode) {
case 1:
/* Move forward */
Motor1.Drive(1, speed_percentage);
Motor2.Drive(1, speed_percentage);
break;
case 2:
/* Move backward */
Motor1.Drive(0, speed_percentage);
Motor2.Drive(0, speed_percentage);
break;
case 3:
/* Turn left */
Motor1.Drive(1, speed_percentage);
Motor2.Drive(0, speed_percentage);
break;
case 4:
/* Turn right */
Motor1.Drive(0, speed_percentage);
Motor2.Drive(1, speed_percentage);
break;
case 5:
/* Turn off both motors */
Motor1.Drive(1, 0);
Motor2.Drive(1, 0);
if (speed_percentage < 95) {
speed_percentage += 5; /* Increment speed */
} else {
speed_percentage = 50; /* Reset to 50% power */
}
mode = 0;
break;
}
}
In this next example we use the CodeCell's Proximity Sensor to activate the motors. This sensor will act as a gesture switch, and activate when a hand is within 5cm away.
#include <CodeCell.h>
#include <DriveCell.h>
#define IN1_pin1 2
#define IN1_pin2 3
#define IN2_pin1 5
#define IN2_pin2 6
CodeCell myCodeCell;
DriveCell Motor1(IN1_pin1, IN1_pin2);
DriveCell Motor2(IN2_pin1, IN2_pin2);
uint8_t speed_percentage = 0;
bool on_flag = 0;
void setup() {
Serial.begin(115200); /* Set Serial baud rate to 115200. Ensure Tools/USB_CDC_On_Boot is enabled if using Serial. */
myCodeCell.Init(LIGHT); /*Initializes Light Sensing*/
Motor1.Init();
Motor2.Init();
speed_percentage = 100;
}
void loop() {
if (myCodeCell.Run()) {
/*Runs every 100ms - Put your code here*/
if (myCodeCell.Light_ProximityRead() > 3000) {
/*If Tap is detected shine the LED Yellow for 1 sec*/
myCodeCell.LED(0XA0, 0x60, 0x00U);
Motor1.Drive(0, 0);
Motor2.Drive(0, 0);
delay(1000);
on_flag = !on_flag;
}
if (on_flag) {
/*Move forward*/
Motor1.Drive(1, speed_percentage);
Motor2.Drive(1, speed_percentage);
} else {
Motor1.Drive(0, 0);
Motor2.Drive(0, 0);
}
}
}
If you have any more question about the DriveCell feel free to email us and we will gladly help out!
Join our Community ~ Be the first to know about new products and get exciting deals!
© 2025 Microbots.