Menü
Microbots
0
  • Lernen
  • Geschäft
    • Module & Technik
    • Maker-Packs
    • Werkzeuge und Ausrüstung
    • Robots & Displays
    • Alle Produkte
  • Gemeinschaft
    • Education
    • Software
  • Um
    • Unsere Geschichte
    • Kontakt
    • FAQs
  • Deutsch
  • Ihr Warenkorb ist leer
Microbots
  • Lernen
  • Geschäft
    • Module & Technik
    • Maker-Packs
    • Werkzeuge und Ausrüstung
    • Robots & Displays
    • Alle Produkte
  • Gemeinschaft
    • Education
    • Software
  • Um
    • Unsere Geschichte
    • Kontakt
    • FAQs
  • Sprache

  • 0 0

Antriebszelle

Using DriveCell to Control Buzzing

Using DriveCell to Control Buzzing

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.

How Buzzing Works with DriveCell

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.

Wiring a Buzzer or Actuator to DriveCell

Basic Connection for a Buzzer or Actuator

Here’s how to wire a buzzer, CoilPad, or FlatFlap to DriveCell:

  1. Connect DriveCell Output Pins to the Device:
    • OUT1 → Device Positive (+)
    • OUT2 → Device Negative (-)
  2. Connect DriveCell Input Pins to the Microcontroller:
    • IN1 → Any digital pin
    • IN2 → Another digital pin
  3. Power Connections:
    • VCC → 5V maximum
    • GND → Common ground with the microcontroller

Controlling Buzzing with DriveCell Library

To generate buzzing tones, DriveCell provides Arduino-compatible functions for buzzing tones.

1. Installing the Library

  1. Open Arduino IDE
  2. Go to Library Manager
  3. Search for DriveCell and install it

2. Code Example for Generating a Buzzing 

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);
}

3. Understanding the Functions

  • 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.

Conclusion

The tiny DriveCell module makes buzzing simple! Check out the DriveCell GitHub Repository for more code examples and technical documentation!

Vollständigen Artikel anzeigen

Using DriveCell to Control High-Power LEDs

Using DriveCell to Control High-Power LEDs

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.

Why Use DriveCell for High-Power LEDs?

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.

DriveCell Specifications for High-Power LED Control

Before connecting your LED, it's essential to understand DriveCell’s electrical limitations:

  • Operating Voltage: 1.8V to 5V (suitable for LED applications)
  • Maximum Continuous Current: 1.8A (sufficient for most high-power LEDs or small LED strips)
  • Built-in Protections: Overcurrent, undervoltage lockout, and thermal shutdown

Note: When it comes to lighting, DriveCell is only ideal for controlling the brightness of single-color LED strips or individual high-power LEDs.

Wiring a High-Power LED to DriveCell

Basic Connection for One LED

Here’s how to wire a single LED or LED strip to DriveCell:

  1. Connect DriveCell Output Pins to the LED:
    • LED Positive (+) → OUT1
    • LED Negative (-) → Connect to Ground or OUT2 (while forcing it to ground with the input pin)
  2. Connect DriveCell Input Pins to the Microcontroller:
    • IN1 → Connect to your Microcontroller (any digital PWM-capable pin)
    • IN2 → Connect to your Microcontroller (any digital PWM-capable pin)
  3. Power Connections:
    • VCC → LED Voltage (e.g. 5V)
    • GND → Common ground with the Microcontroller

Controlling LED Brightness with DriveCell

To adjust LED brightness dynamically, DriveCell provides a software library. Below is an example of a fading effect.

1. Installing the Library

  1. Open Arduino IDE
  2. Go to Library Manager
  3. Search for DriveCell and install it

2. Code Example for LED Brightness Control

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 */
}

3. Understanding the Code

  • Init() → Initializes DriveCell and sets up the input pins
  • Drive(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.

Conclusion

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!

Vollständigen Artikel anzeigen

Using DriveCell to Control Magnetic Actuators

Using DriveCell to Control Magnetic Actuators

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.

Understanding Magnetic Actuators & Why They Need DriveCell

What Are Magnetic Actuators?

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.

Why Use an H-Bridge Driver Like DriveCell?

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.

DriveCell Specifications for Magnetic Actuators

Before connecting your actuators, it's essential to understand DriveCell’s electrical limitations:

  • Operating Voltage: 1.8V to 5V 
  • Maximum Continuous Current: 1.8A 
  • H-Bridge Chip: DRV8837, allowing polarity switching & PWM control
  • Built-in Protections: Overcurrent, undervoltage lockout, and thermal shutdown

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.

Wiring a Magnetic Actuator to DriveCell

Basic Connection for One Actuator

Here’s how to solder/wire a single CoilPad or FlatFlap actuator to DriveCell:

  1. Connect DriveCell Output Pins to the Actuator:
    • OUT1 → Actuator Terminal 1
    • OUT2 → Actuator Terminal 2
  2. Connect DriveCell Input Pins to the Microcontroller:
    • IN1 → Any digital PWM-capable pin
    • IN2 → Another digital PWM-capable pin
  3. Power Connections:
    • VCC → 5V (or up to 11V based on your actuator requirements)
    • GND → Common ground with the microcontroller

Parallel Connection for Multiple Actuators

You can connect multiple actuators in parallel:

  • OUT1 → Both Actuator 1 and Actuator 2 terminal-1
  • OUT2 → Both Actuator 1 and Actuator 2 terminal-2

This setup will drive both actuators in sync, making them activate simultaneously.

Controlling Magnetic Actuators with DriveCell Library

To simplify actuator control, DriveCell provides a software library. Below are the key functions you’ll need:

1. Installing the Library

  1. Open Arduino IDE
  2. Go to Library Manager
  3. Search for DriveCell and install it

2. Code Example

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 pins
  • Drive(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.

Conclusion

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!

Vollständigen Artikel anzeigen

Using DriveCell to Control DC Motors

Using DriveCell to Control DC Motors

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.

Understanding Brushed DC Motors & Why They Need a DriveCell

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:

  • Direction control by reversing the current flow
  • Speed control via PWM (Pulse Width Modulation)

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.

DriveCell Specifications

Before connecting your motors, it's essential to understand the DriveCell's electrical limitations:

  • Operating Voltage: 1.8V to 5V (suitable for small motors)
  • Maximum Continuous Current: 1.8A
  • H-Bridge Chip: DRV8837, handling motor direction & speed
  • Built-in Protections: Overcurrent, undervoltage lockout, and thermal shutdown

If your motor requires less than 0.5A, you can also connect two motors in parallel and drive them using a single DriveCell.

Wiring a DC Motor to DriveCell

Basic Connection for One Motor

Here’s how to wire a single DC motor to DriveCell:

  1. Connect DriveCell Output Pins to the Motor:
    • OUT1 → Motor Terminal 1
    • OUT2 → Motor Terminal 2
  2. Connect DriveCell Input Pins to the Microcontroller:
    • IN1 → Any digital PWM-capable pin
    • IN2 → Another digital PWM-capable pin 
  3. Power Connections:
    • VCC → 5V or less
    • GND → Common ground with the microcontroller

Parallel Connection for Two Motors

If your motors consume less than 500mA each, you can connect two motors in parallel:

  • OUT1 → Both Motor 1 and Motor 2 terminals
  • OUT2 → Both Motor 1 and Motor 2 terminals

This setup will drive both motors synchronously, making them spin in the same direction at the same speed.

 

Controlling the Motor with DriveCell Library

To make motor control simple, DriveCell provides an software library. Below are the key functions you’ll need:

1. Installing the Library

  1. Open Arduino IDE
  2. Go to Library Manager
  3. Search for DriveCell and install it

2. Code Example

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.

Conclusion

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!

Vollständigen Artikel anzeigen

Understanding DriveCell Circuitry

Understanding DriveCell Circuitry

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.

The Heart of DriveCell: DRV8837 H-Bridge

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:

  • Motor Speed & Direction Control via two input pins
  • PWM (Pulse Width Modulation) Support for fine-tuned control
  • Overcurrent Protection, Undervoltage Lockout, and Thermal Shutdown for safety
  • Maximum continuous output current of 1.8A, making it suitable for powering small but powerful dc motors or for powering multiple in parallel actuators like the CoilPad

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.

Understanding DriveCell's Pinout & Functionality

The DriveCell module operates based on the state of its two input pins (IN1 and IN2) to control current flow through its output pins: 

  • Forward Current: IN1 = VCC/PWM, IN2 = GND → Motor spins forward
  • Reverse Current: IN1 = GND, IN2 = VCC/PWM → Motor spins in reverse
  • Off State: IN1 = GND, IN2 = GND → Motor stops

For added clarity, an onboard LED provides visual feedback, indicating the direction of the output.

Why Choose DriveCell?

DriveCell is designed to be compact, efficient, and easy to integrate into various projects. Here’s why it stands out:

  • Ultra-compact size – about the size of a fingertip
  • Castellated pins for easy soldering and integration into custom PCBs
  • Seamless compatibility with Arduino, CodeCell, and other microcontrollers
  • No need for complex H-Bridge configurations – just a simple function call

Getting Started with DriveCell

To start using DriveCell, follow these steps:

1. Wiring DriveCell to Your Circuit

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

    • Setting IN2 high makes OUT2 high
    • Typically, IN1 and IN2 are set in opposite polarities to allow current to flow through the motor

The VCC must be connected to a maximum supply voltage of 5V. 

2. Coding with the DriveCell Library

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.

Steps to Install the Library:

  1. Open Arduino IDE
  2. Go to Library Manager and search for “DriveCell”
  3. Click Install
  4. Load the example sketches to start experimenting!

3. Keeping things tiny

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.

Conclusion

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!

Vollständigen Artikel anzeigen

DriveCell Basics: Your First Steps

DriveCell-Grundlagen: Ihre ersten Schritte

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 eine DriveCell und wie funktioniert sie?
  • Erste Schritte mit der Arduino-Softwarebibliothek
  • Steuern Sie zwei Gleichstrommotoren und fahren Sie sie mit unterschiedlicher Geschwindigkeit
  • Machen Sie die DriveCell interaktiver mit den CodeCell -Sensoren

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:

  • Es ist ein super kleiner Treiber (ungefähr so ​​groß wie Ihre Fingerspitze)
  • Kann leicht mit Zinnenstiften gelötet werden
  • Funktioniert mit Arduino-Mikrocontrollern und verfügt über benutzerfreundliche Funktionen, mit denen Sie Motoren, Aktuatoren und LEDs direkt steuern können, ohne sich in komplizierte Programmierung vertiefen zu müssen.

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:

  • Durchlassstrom: IN1 = VCC/PWM, IN2 = GND
  • Rückstrom: IN1 = Masse, IN2 = VCC/PWM
  • Aus: IN1 = Masse, IN2 = Masse

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:

    • DriveCell anschließen:
    Löten Sie zunächst die DriveCell- Ausgangspins an Ihren Motor oder Aktuator und die Eingangs- und Strompins an Ihren Mikrocontroller. Stellen Sie sich diese Pins wie die Teile eines Puzzles vor, die es der DriveCell ermöglichen, Strom zwischen den Ausgangspins zu leiten. Diese Ausgangspins werden durch den Zustand des Eingangspins gesteuert. Wenn Sie also IN1 hochziehen, wird OUT1 hoch gesetzt, und wenn Sie IN2 hochziehen, wird OUT2 hoch gesetzt. IN1 und IN2 werden normalerweise auf entgegengesetzte Polaritäten gesetzt, um Strom durchzulassen. Diese technischen Details können alle von der DriveCell-Softwarebibliothek behandelt werden.

    • Codierung DriveCell:
    Wenn Sie einen der Eingangspins mit VCC verbinden, wird die DriveCell sofort eingeschaltet. Um es aber noch intelligenter zu machen, haben wir auch eine Arduino-Softwarebibliothek entwickelt, die Ihnen den Einstieg erleichtert. Sie müssen einen einfachen Code schreiben, um DriveCell mitzuteilen, was es tun soll. Keine Sorge, es ist ganz einfach! Beginnen Sie damit, die Bibliothek „DriveCell“ aus dem Bibliotheksmanager von Arduino herunterzuladen. Sobald diese installiert ist, können wir Ihr Gerät steuern. Es gibt mehrere Beispiele, die Ihnen den Einstieg erleichtern können, aber als Nächstes werden wir alle Funktionen aufschlüsseln und verstehen.
    Bevor wir beginnen, stellen Sie sicher, dass Sie die DriveCell anschließen an Ihren Mikrocontroller. Wir empfehlen die Verwendung eines CodeCell ist Pin-zu-Pin-kompatibel, unterstützt alle Bibliotheksfunktionen und kann drahtlose Steuerung und interaktive Sensorik hinzufügen.


    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!

    Vollständigen Artikel anzeigen


    Sozial

    Github

    • Um
    • Software
    • Education
    • Kontakt
    • FAQs
    • Bedingungen
    • Rückerstattung-Politik
    • Datenschutzrichtlinie

    Erfahren Sie als Erster von neuen Projekten und sichern Sie sich spannende Angebote!

    © 2025 Microbots.