Menu
Microbots
0
  • Learn
    • Getting Started
    • Maker Builds
    • Education
  • Shop
    • ProtoBot
    • Modules & Parts
    • Tools & Gears
    • Coming Soon
  • About
    • Our Story
    • Reach Out
    • FAQs
  • Sign in
  • English
  • Your Cart is Empty
Microbots
  • Learn
    • Getting Started
    • Maker Builds
    • Education
  • Shop
    • ProtoBot
    • Modules & Parts
    • Tools & Gears
    • Coming Soon
  • About
    • Our Story
    • Reach Out
    • FAQs
  • Language

  • 0 0

CoilPad - Creating Vibration

This guide explains how the CoilPad can generate vibrations, how frequency and polarity affect its movement, and how to create its drive signals.

How it Works?

To make CoilPad vibrate, an electric current is applied to its coil, generating a magnetic field. By reversing the polarity at a set frequency, we create a repetitive push-pull motion that causes vibrations.

The vibration frequency can be controlled within the range of 1 Hz to 25 Hz, which means CoilPad can oscillate between 1 to 25 times per second depending on the input signal. It can go to higher frequencies, but usually the magnet won't have enough time to react.

If you attach it to something, you can adjust it to match its new resonant frequency and make the whole thing shake.

Generating a Square Wave for Vibration

A square wave signal is required to make the CoilPad vibrate. An H-Bridge driver like our DriveCell is needed reverse its polarity and switch its polarity to make it vibrate. The input signals of the square wave can be generated using simple digitalWrite() commands in Arduino:

#define VIB_PIN1 2
#define VIB_PIN2 3

void setup() {
  pinMode(VIB_PIN1, OUTPUT);
  pinMode(VIB_PIN2, OUTPUT);
}

void loop() {
  digitalWrite(VIB_PIN1, HIGH);
  digitalWrite(VIB_PIN2, LOW);
  delay(100); // Adjust delay for desired vibration speed
  
  digitalWrite(VIB_PIN1, LOW);
  digitalWrite(VIB_PIN2, HIGH);
  delay(100);
}

This simple code creates a square wave oscillation, making the CoilPad vibrate continuously. You can adjust the delay time to change the vibration frequency.

Optimizing Vibration with PWM

The code example above generates a basic square wave, which drives the coil in an abrupt on-off manner. At low frequencies, this might not be desirable. To smooth this out, we can use Pulse Width Modulation (PWM) on both outputs. This method gradually changes the magnetic field intensity, reducing mechanical stress on the CoilPad.

This function is automatically handled within our DriveCell library:

#include <drivecell.h>

#define IN1_pin1 2
#define IN1_pin2 3
#define IN2_pin1 5
#define IN2_pin2 6

DriveCell CoilPad1(IN1_pin1, IN1_pin2);
DriveCell CoilPad2(IN2_pin1, IN2_pin2);

uint16_t vibration_counter = 0;

void setup() {
  CoilPad1.Init();
  CoilPad2.Init();

  CoilPad1.Tone();
  CoilPad2.Tone();
}

void loop() {
  delay(1);
  vibration_counter++;
  if (vibration_counter < 2000U) {
    CoilPad1.Run(0, 100, 100); // Square Wave mode
    CoilPad2.Run(0, 100, 100); // Square Wave mode
  }
  else if (vibration_counter < 8000U) {
    CoilPad1.Run(1, 100, 1000); // Smooth PWM Wave mode
    CoilPad2.Run(1, 100, 1000); // Smooth PWM Wave mode
  } else {
    vibration_counter = 0U;
  }
}

Understanding the Functions:

  • Init() → Initializes DriveCell and sets up the input pins.
  • Run(smooth, power, speed_ms) → Oscillates the CoilPad in either a square wave or a smoother PWM wave.
    • smooth → 1 (PWM wave) / 0 (square wave)
    • power → Magnetic-field strength (0 to 100%)
    • speed_ms → Vibration speed in milliseconds

⚠ Note: The Run() & Drive() function uses a high-speed PWM timer, making it compatible only with CodeCell and ESP32-based devices.

Conclusion

With these techniques, you can start using CoilPad to vibrate. Check out the DriveCell GitHub Repository for more code examples and technical documentation!

  • Share:

Follow

Github

  • About
  • Software
  • Education
  • Contact
  • FAQs
  • Terms
  • Refund Policy
  • Privacy Policy

Join our Community ~ Be the first to know about new products and get exciting deals!

© 2026 Microbots.

★ Reviews

Let customers speak for us

68 reviews
Write a review
84%
(57)
6%
(4)
3%
(2)
3%
(2)
4%
(3)
63
21
C
CodeCell C3
Cloke74

Great piece of kit, had just what i needed to complete the project i had in mind. Shame shipping to the UK is so expensive, but appreciate this isn’t necessarily in the hands of MicroBots

A
CodeCell C6
Anonymous

I had an issue, got a red light, I used too much flux. Support said clean it, then the one sensor worked fine. I got the help and answer same day I provided a foto.

A
CodeCell C6 Drive
Anonymous

I think this is the best of the ESP offered, most versatile.

User picture
P
CodeCell C6
Prudhvi tej Chinimilli

Been testing the Microbots CodeCell C6 and honestly impressed with how much functionality they packed into such a tiny module. Great form factor for rapid prototyping wearable/embedded sensing applications. ESP32-C6 + IMU integration makes development much easier compared to building everything from scratch.

Still exploring battery optimization and compact LiPo options for our use case, but overall the platform is promising for low-cost real-time sensing systems. Excited to keep building with it.

F
CodeCell C6
Francisco Estivallet

Amazing hardware, my go to for compact projects.

User picture
123