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 est un appareil petit mais puissant qui vous permet de contrôler facilement les moteurs, les actionneurs et les lumières LED haute puissance pour vos projets de bricolage. DriveCell facilite le contrôle de ces composants, même si vous débutez en programmation ou en électronique.
Dans ce tutoriel, nous expliquerons :
Qu'est-ce que DriveCell ?
Imaginez que vous vouliez fabriquer un petit robot et contrôler la vitesse et la direction de son moteur. Cela peut être complexe pour les débutants et nécessite généralement des modules volumineux. DriveCell simplifie ce processus car :
Comment fonctionne DriveCell ?
DriveCell utilise une puce de pont en H DRV8837 intégrée pour contrôler le flux de courant à travers les broches de sortie, contrôlé par l'état des broches d'entrée :
La puce DRV8837 offre une protection contre les surintensités, un verrouillage en cas de sous-tension et des fonctions d'arrêt thermique, garantissant un fonctionnement sûr.
Premiers pas avec DriveCell
Avant de pouvoir commencer à utiliser DriveCell , vous devez le configurer et le connecter à votre projet. Voici un guide simple pour vous aider à démarrer :
1. Init()
Nous avons d’abord besoin d’un code de configuration de base pour vous permettre de démarrer :
#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
}
Ce code indique au DriveCell de démarrer et de se préparer à contrôler votre moteur ou votre actionneur. La fonction Init s'assure que tous les périphériques nécessaires sont configurés.
2. Impulsion (bool direction, uint8_t ms_duration)
Cette commande envoie une courte rafale de puissance dans une polarité spécifiée, pour dynamiser rapidement l'actionneur et le réteindre.
myDriveCell.Pulse(true, 10); // Short burst for 10 milliseconds
3. Buzz (uint16_t us_buzz)
Cela fait vibrer l'actionneur comme un buzzer. C'est idéal pour créer des sons de retour.
myDriveCell.Buzz(100); // Creates a 100us buzzing sound
4. Tonalité()
Cette fonction émet une tonalité par défaut en faisant vibrer l'actionneur à différentes fréquences enregistrées.
myDriveCell.Tone(); // Plays varying tones
5. Basculer(uint8_t power_percent)
Cette fonction change simplement le sens de rotation à 100 % de puissance, ce qui peut être utile pour inverser le sens de rotation d'un moteur à balais ou créer de simples mouvements de battement.
myDriveCell.Toggle(); // Switches direction
En utilisant le CodeCell ou tout autre microcontrôleur ESP32, vous pouvez également ajuster le rapport cyclique « power_percent ». Pour les actionneurs magnétiques, le « power_percent » contrôle la force magnétique, tandis que pour les moteurs à balais, il ajuste la vitesse.
6. Exécuter(bool smooth, uint8_t power_percent, uint16_t flip_speed_ms)
En utilisant le CodeCell ou tout autre microcontrôleur ESP32, cette fonction vous permet d'inverser la polarité d'un actionneur ou d'inverser un moteur toutes les « flip_speed_ms » au cycle de service « power_percent ». Le réglage de « smooth » sur 1 adoucit le mouvement, ce qui est idéal pour piloter le FlatFlap ou le CoilPad avec des mouvements lents (moins de 2 Hz).
myDriveCell.Run(true, 50, 1000); // Smooth drive at 50% power every 1000 ms
Pour les autres appareils Arduino, cette commande permet au moteur/actionneur d'inverser sa direction (vers l'avant et vers l'arrière) à pleine vitesse. Par exemple :
myDriveCell.Run(500); // Motor changes direction every 500 milliseconds
7. Drive(bool direction, uint8_t power_percent)
En utilisant le CodeCell ou tout autre microcontrôleur ESP32, cette fonction vous permet de contrôler la vitesse et la direction de votre moteur. Vous pouvez faire avancer ou reculer le moteur et ajuster sa vitesse.
myDriveCell.Drive(true, 75); // Moves forward at 75% power
Exemples :
En utilisant l'une de ces fonctions dans une boucle, vous pouvez créer la séquence souhaitée pour votre moteur, votre actionneur ou vos LED haute puissance. Voici un exemple où nous initialisons deux moteurs à courant continu et les pilotons à des vitesses différentes :
#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; /* Régler le moteur à 80 % de puissance */
}
boucle vide() {
délai(3000);
mode++;
commutateur (mode) {
cas 1:
/* Avancer */
Motor1.Drive(1, pourcentage_vitesse);
Motor2.Drive(1, pourcentage_vitesse);
casser;
cas 2:
/* Déplacer vers l'arrière */
Motor1.Drive(0, pourcentage_vitesse);
Motor2.Drive(0, pourcentage_vitesse);
casser;
cas 3:
/* Tourner à gauche */
Motor1.Drive(1, pourcentage_vitesse);
Motor2.Drive(0, pourcentage_vitesse);
casser;
cas 4:
/* Tournez à droite */
Motor1.Drive(0, pourcentage_vitesse);
Motor2.Drive(1, pourcentage_vitesse);
casser;
cas 5:
/* Éteignez les deux moteurs */
Moteur1.Drive(1, 0);
Moteur2.Drive(1, 0);
si (pourcentage_vitesse < 95) {
speed_percentage += 5; /* Incrémenter la vitesse */
} autre {
speed_percentage = 50; /* Réinitialiser à 50 % de puissance */
}
mode = 0;
casser;
}
}
Dans l'exemple suivant, nous utilisons le capteur de proximité du CodeCell pour activer les moteurs. Ce capteur agira comme un interrupteur gestuel et s'activera lorsqu'une main se trouvera à moins de 5 cm.
#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) {
/*Si un tapotement est détecté, la LED s'allume en jaune pendant 1 seconde*/
monCodeCell.LED(0XA0, 0x60, 0x00U);
Moteur1.Drive(0, 0);
Moteur2.Drive(0, 0);
délai(1000);
sur_drapeau = !sur_drapeau;
}
si (sur_drapeau) {
/*Avancer*/
Motor1.Drive(1, pourcentage_vitesse);
Motor2.Drive(1, pourcentage_vitesse);
} autre {
Moteur1.Drive(0, 0);
Moteur2.Drive(0, 0);
}
}
}
Si vous avez d'autres questions sur le DriveCell, n'hésitez pas à nous envoyer un e-mail et nous serons heureux de vous aider !
Soyez le premier informé des nouveaux projets et bénéficiez d'offres intéressantes !
© 2025 Microbots.