Menu
Microbots
0
  • Learn
  • Shop
    • Maker-Modules
    • Maker-Packs
    • Tools & Gears
    • Robots & Displays
    • All Products
  • Community
    • Education
    • Software
  • About
    • Our Story
    • Reach Out
    • FAQs
  • English
  • Your Cart is Empty
Microbots
  • Learn
  • Shop
    • Maker-Modules
    • Maker-Packs
    • Tools & Gears
    • Robots & Displays
    • All Products
  • Community
    • Education
    • Software
  • About
    • Our Story
    • Reach Out
    • FAQs
  • Language

  • 0 0

CoilCell Basics: Your First Steps

CoilCell is a compact planar coil designed for various DIY projects. Whether you're just starting or are an experienced maker, CoilCell offers easy integration to simplify your creations. In this tutorial we will explain:

  • What is a CoilCell and how does it work?
  • Getting started with its Arduino software library
  • Program a ball-magnet to bounce every few milliseconds
  • Make the CoilCell more interactive with the CodeCell sensors

What is CoilCell?
CoilCell is a thin, planar coil built on a multi-layered PCB, with an integrated driver that simplifies controlling magnetic polarity and strength. It is available in two configurations:

  • 1W CoilCell: 70 turns, with a peak magnetic field of 2.3 mT.
  • 2.5W CoilCell: 200 turns, with a peak magnetic field of 10 mT, which can be upgraded to 17 mT using an iron back-plate.

Magnetic Applications

  • N52 Magnets: Use lightweight N52 ball or disk magnets for dynamic interactions like bouncing or shaking objects by finding their resonant frequency.
  • FlipDot: Create interactive mechanical pixel by pivoting a magnet to flip. Build your own 3D-printed magnetic FlipDot pixel, and add more for a mini displpay. Both your ears and eyes will love it!
  • Iron Back-Plate: Upgrade the 2.5W CoilCell to boost its peak strength to 17 mT, turning it into a weak electromagnet suitable for attracting small metallic objects like paper clips.
  • Magnetic Dice: Perform fun tricks with our special dice containing a hidden magnet inside, allowing you to create automatic shaking or influencing the roll outcome with the 2.5W CoilCell.

Safety Tips
While using the 2.5W 200-Turns CoilCell, it can potentially heating up to 110°C, especially when combined with the iron back-plate. Follow these precautions:

  • Keep hands away from hot surfaces and turn off the coil when not in use.
  • Ensure that 3D-printed parts and materials can withstand high temperatures. 
  • Also, use eye protection when working with small magnets that may be repelled at high speeds.

How Does CoilCell Work?
CoilCell utilizes an on-board DRV8837 H-bridge chip to control current flow through the coil, allowing it to switch magnetic polarity:

  • North: IN1 = VCC/PWM, IN2 = GND
  • South: IN1 = GND, IN2 = VCC/PWM
  • Off: IN1 = GND, IN2 = GND

The DRV8837 chip provides overcurrent protection, undervoltage lockout, and thermal shutdown features, ensuring safe operation.


Getting Started with CoilCell
Wiring one of the input-pins to VCC will instantly turn on the CoilCell. But to make it smarter we also developed a Arduino Software Library to make it easier for you to get started.

You will need to write some basic code to tell CoilCell what to do. Don’t worry, it’s quite simple! Start by downloading the "CoilCell" library from the Arduino's Library Manager. Once this is installed, we are ready to control your device. There are multiple examples that can help you get started but next we will breakdown and understand all the functions:

Before we start make sure you connect the CoilCell to your microcontroller -- We recommend using a CodeCell which is pin to pin compatible, the same size, supports all the library functions, and can add wireless control + interactive sensing. 

1. Initialize CoilCell

#include <CoilCell.h>

CoilCell myCoilCell(IN1, IN2); // Replace IN1 and IN2 with your specific pins

void setup() {
    myCoilCell.Init(); // Initializes the CoilCell
}

This code configures the CoilCell, setting it up for magnetic control based on your selected pins and microcontroller.

2. Bounce(bool direction, uint8_t ms_duration)

The Bounce() function makes a magnet bounce up and down. The first parameter, sets the polarity of the CoilCell and the delay_ms, sets the duration for which the magnet is repelled./

myCoilCell.Bounce(true, 20); //Bounce the magnet up for 20ms

3. Buzz(uint16_t us_buzz)
Create a buzzing sound by rapidly alternating the coil’s polarity. Adjust 'us_buzz' to control the frequency of the buzz.

myCoilCell.Buzz(80); // Generates a buzzing effect at 80 microseconds intervals

4. Tone()
This function plays a default tone by making the CoilCell vibrate at different saved frequencies.

myCoilCell.Tone(); // Plays varying tones

5. Drive(bool direction, uint8_t power_percent)
By using the CodeCell or any other ESP32 microcontroller, this function lets control the coil’s magnetic polarity and strength. The magnetic strength is adjusted by the 'power_percent', which controls how far the magnet is pushed from the coil.

myCoilCell.Drive(true, 75); // Drive the coil north with 75% strength

6. Toggle(uint8_t power_percent)
By using the CodeCell or any other ESP32 microcontroller, this function toggles the coil’s polarity at a set power level, useful for simple magnetic flipping actions.

myCoilCell.Toggle(60); // Toggle polarity at 60% power

For other Arduino devices, this command makes the coilcell flip its direction at full power. 

myCoilCell.Toggle(); // Toggle polarity at 100% power

7. Vibrate(bool smooth, uint8_t power_percent, uint16_t vib_speed_ms)

This function flips the coil’s polarity at a specified speed and power. Setting 'smooth' to true creates smoother motions, ideal for slow frequencies below 2 Hz.

myCoilCell.Vibrate(true, 50, 1000); // Smooth vibration at 50% power every 1000 ms

For other Arduino devices, this command makes the coilcell flip its polarity at full power. 

myCoilCell.Vibrate(100); // Vibrate at 100% power every 100 ms

 

Here's an example where we initialize a CoilCell to make a 5mm diameter ball magnet bounce. In this example, the CoilCell is initialized with pins 5 and 6. The setup() function calls myCoilCell.Init() to configure the CoilCell. In the loop(), the Bounce() function is used to make the magnet bounce upwards for 20 milliseconds, followed by a 600 milliseconds delay that attracts the magnet back down.

#include <CoilCell.h>

#define IN1_pin1 5
#define IN1_pin2 6

CoilCell myCoilCell(IN1_pin1, IN1_pin2);

void setup() {
    myCoilCell.Init(); /*Initialize the CoilCell*/
}

void loop() {
    myCoilCell.Bounce(0, 20); /*Bounce the magnet up for 20ms*/
    delay(600); /*Attract the magnet back down for 600ms*/
}
    

In this next example we use the CodeCell's Motion Sensor to detect tapping. When a new tap is detected the CoilCell flips its magnetic polarity and sets a 1 second delay to flash the onboard LED to yellow.

#include <CodeCell.h>
#include <CoilCell.h>

#define IN1_pin1 5
#define IN1_pin2 6

CoilCell myCoilCell(IN1_pin1, IN1_pin2);
CodeCell myCodeCell;

void setup() {
  Serial.begin(115200); /* Set Serial baud rate to 115200. Ensure Tools/USB_CDC_On_Boot is enabled if using Serial. */

  myCodeCell.Init(MOTION_TAP_DETECTOR); /*Initializes Tap Detection Sensing*/
  myCoilCell.Init();
  myCoilCell.Tone();
}

void loop() {
  if (myCodeCell.Run()) {
    /*Runs  every 100ms*/
    if (myCodeCell.Motion_TapRead()) {
      /*If Tap is detected shine the LED Yellow for 1 sec and flip the CoilCell's polarity*/
      myCodeCell.LED(0XA0, 0x60, 0x00U);
      myCoilCell.Toggle(100);
      delay(1000);
    }
  }
}


With these basic functions, you can start experimenting with CoilCell in your projects. Whether you’re controlling magnets, creating interactive displays, or experimenting with magnetic forces, CoilCell provides a simple and effective solution.

If you have any more question about the CoilCell feel free to email us and we will gladly help out!

  • Share:


Also in Learn

MotorCell Basics: Your First Steps
MotorCell Basics: Your First Steps

Read More

CodeCell Basics: Your First Steps
CodeCell Basics: Your First Steps

Read More

CoilPad Basics: Your First Steps
CoilPad Basics: Your First Steps

Read More

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!

© 2025 Microbots.