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 ist ein kleines, aber leistungsstarkes Gerät, mit dem Sie Motoren, Aktuatoren und Hochleistungs-LED-Leuchten für Ihre Heimwerkerprojekte ganz einfach steuern können. DriveCell macht die Steuerung dieser Komponenten einfach, selbst wenn Sie keine Erfahrung mit Programmierung oder Elektronik haben.
In diesem Tutorial erklären wir:
Was ist DriveCell?
Stellen Sie sich vor, Sie möchten einen kleinen Roboter bauen und die Geschwindigkeit und Richtung seines Motors steuern. Dies kann für Anfänger komplex sein und erfordert normalerweise sperrige Module. DriveCell vereinfacht diesen Prozess, weil:
Wie funktioniert DriveCell?
DriveCell verwendet einen integrierten DRV8837-H-Brückenchip zur Steuerung des Stromflusses durch die Ausgangspins, der durch den Zustand der Eingangspins gesteuert wird:
Der DRV8837-Chip verfügt über Überstromschutz, Unterspannungssperre und thermische Abschaltungsfunktionen und gewährleistet so einen sicheren Betrieb.
Erste Schritte mit DriveCell
Bevor Sie DriveCell verwenden können, müssen Sie es einrichten und mit Ihrem Projekt verbinden. Hier ist eine einfache Anleitung für den Einstieg:
1. Init()
Zuerst benötigen wir einen grundlegenden Setup-Code, damit Sie loslegen können:
#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
}
Dieser Code weist die DriveCell an, zu starten und sich für die Steuerung Ihres Motors oder Aktuators vorzubereiten. Die Init-Funktion stellt sicher, dass alle erforderlichen Peripheriegeräte konfiguriert sind.
2. Puls (bool Richtung, uint8_t ms_Dauer)
Dieser Befehl sendet einen kurzen Stromstoß mit einer bestimmten Polarität, um den Aktuator schnell mit Strom zu versorgen und wieder auszuschalten.
myDriveCell.Pulse(true, 10); // Short burst for 10 milliseconds
3. Buzz (uint16_t us_buzz)
Dadurch vibriert der Aktuator wie ein Summer. Das ist ideal, um Feedback-Töne zu erzeugen.
myDriveCell.Buzz(100); // Creates a 100us buzzing sound
4. Ton()
Diese Funktion spielt einen Standardton ab, indem sie den Aktuator mit verschiedenen gespeicherten Frequenzen vibrieren lässt.
myDriveCell.Tone(); // Plays varying tones
5. Umschalten (uint8_t power_percent)
Diese Funktion schaltet einfach die Richtung bei voller Leistung von 100 % um, was nützlich sein kann, um die Drehrichtung eines Bürstenmotors umzukehren oder einfache Schlagbewegungen zu erzeugen.
myDriveCell.Toggle(); // Switches direction
Mithilfe der CodeCell oder eines anderen ESP32-Mikrocontrollers können Sie auch den Arbeitszyklus „power_percent“ anpassen. Bei magnetischen Aktuatoren steuert „power_percent“ die magnetische Stärke, während es bei Bürstenmotoren die Geschwindigkeit anpasst.
6. Ausführen (bool glatt, uint8_t Leistungsprozentsatz, uint16_t Flip-Geschwindigkeit_ms)
Mithilfe der CodeCell oder eines anderen ESP32-Mikrocontrollers können Sie mit dieser Funktion alle „flip_speed_ms“ die Polarität eines Aktuators umkehren oder einen Motor umkehren, und zwar im Arbeitszyklus „power_percent“. Wenn Sie „smooth“ auf 1 setzen, wird die Bewegung geglättet, was ideal ist, wenn Sie FlatFlap oder CoilPad mit langsamen Bewegungen (weniger als 2 Hz) antreiben.
myDriveCell.Run(true, 50, 1000); // Smooth drive at 50% power every 1000 ms
Bei anderen Arduino-Geräten bewirkt dieser Befehl, dass der Motor/Aktuator seine Richtung (vorwärts und rückwärts) bei voller Geschwindigkeit ändert. Beispiel:
myDriveCell.Run(500); // Motor changes direction every 500 milliseconds
7. Antrieb (bool Richtung, uint8_t Leistung_Prozent)
Mithilfe der CodeCell oder eines anderen ESP32-Mikrocontrollers können Sie mit dieser Funktion die Geschwindigkeit und Richtung Ihres Motors steuern. Sie können den Motor vorwärts oder rückwärts laufen lassen und die Geschwindigkeit einstellen.
myDriveCell.Drive(true, 75); // Moves forward at 75% power
Beispiele:
Indem Sie eine dieser Funktionen in einer Schleife verwenden, können Sie die gewünschte Sequenz für Ihren Motor, Aktuator oder Ihre Hochleistungs-LEDs erstellen. Hier ist ein Beispiel, in dem wir zwei Gleichstrommotoren initialisieren und sie mit unterschiedlichen Geschwindigkeiten antreiben:
#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; /* Motor auf 80 % Leistung einstellen */
}
void schleife() {
Verzögerung (3000);
Modus++;
Schalter (Modus) {
Fall 1:
/* Vorwärts gehen */
Motor1.Antrieb(1, Geschwindigkeitsprozentsatz);
Motor2.Drive(1, Geschwindigkeitsprozentsatz);
brechen;
Fall 2:
/* Rückwärts bewegen */
Motor1.Drive(0, Geschwindigkeitsprozentsatz);
Motor2.Drive(0, Geschwindigkeitsprozentsatz);
brechen;
Fall 3:
/* Biegen Sie links ab */
Motor1.Antrieb(1, Geschwindigkeitsprozentsatz);
Motor2.Drive(0, Geschwindigkeitsprozentsatz);
brechen;
Fall 4:
/* Biegen Sie rechts ab */
Motor1.Drive(0, Geschwindigkeitsprozentsatz);
Motor2.Drive(1, Geschwindigkeitsprozentsatz);
brechen;
Fall 5:
/* Schalte beide Motoren aus */
Motor1.Antrieb(1, 0);
Motor2.Antrieb(1, 0);
wenn (Geschwindigkeitsprozentsatz < 95) {
speed_percentage += 5; /* Geschwindigkeit erhöhen */
} anders {
speed_percentage = 50; /* Auf 50 % Leistung zurücksetzen */
}
Modus = 0;
brechen;
}
}
Im nächsten Beispiel verwenden wir den Näherungssensor von CodeCell , um die Motoren zu aktivieren. Dieser Sensor fungiert als Gestenschalter und wird aktiviert, wenn sich eine Hand im Umkreis von 5 cm befindet.
#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) {
/*Wenn ein Tippen erkannt wird, leuchtet die LED 1 Sekunde lang gelb*/
myCodeCell.LED(0XA0, 0x60, 0x00U);
Motor1.Antrieb(0, 0);
Motor2.Antrieb(0, 0);
Verzögerung (1000);
ein_flag = !ein_flag;
}
wenn (on_flag) {
/*Vorwärts gehen*/
Motor1.Antrieb(1, Geschwindigkeitsprozentsatz);
Motor2.Drive(1, Geschwindigkeitsprozentsatz);
} anders {
Motor1.Antrieb(0, 0);
Motor2.Antrieb(0, 0);
}
}
}
Wenn Sie weitere Fragen zur DriveCell haben, senden Sie uns einfach eine E-Mail und wir helfen Ihnen gerne weiter!
Erfahren Sie als Erster von neuen Projekten und sichern Sie sich spannende Angebote!
© 2025 Microbots.