Menu
Microbots
0
  • Robots & Kits
    • ProtoBot
    • CubeBot
    • Robot Parts
  • Modules & Parts
    • CodeCell ESP32 Modules
    • Motors & Actuators
    • LiPo Batteries
  • Gear
    • Tools
    • Merch
  • Learn
    • User Guide & Tutorials
    • DIY Projects & Files
    • Education Discounts
  • About
    • Our Story
    • Reach Out
    • FAQs
  • Sign in
  • Your Cart is Empty
Microbots
  • Robots & Kits
    • ProtoBot
    • CubeBot
    • Robot Parts
  • Modules & Parts
    • CodeCell ESP32 Modules
    • Motors & Actuators
    • LiPo Batteries
  • Gear
    • Tools
    • Merch
  • Learn
    • User Guide & Tutorials
    • DIY Projects & Files
    • Education Discounts
  • About
    • Our Story
    • Reach Out
    • FAQs
  • 0 0

CoilCell - Turning it into an Electromagnet

CoilCell can be used as a weak electromagnet, instead of interacting with magnets. By upgrading to the Iron Back-Plate option, you can enhance the 2.5W CoilCell's peak strength to 17 mT, turning it into a weak electromagnet suitable for attracting small metallic objects like paper clips.

⚠ Caution: When using the 2.5W 200-Turns CoilCell, it may heat up to 110°C (especially the iron back-plate). Keep hands away from hot areas to prevent injury and always turn off the coil when not in use.

How It Works

CoilCell operates by passing current through its coil, generating a magnetic field. Instead of controlling polarity to interact with magnets, we can maximize field strength to attract small metallic objects.

Since CoilCell has an integrated H-bridge, it can directly control the coil’s magnetic strength without requiring an external driver. By pulling one of the input pins HIGH, CoilCell will operate at maximum magnetic power. If magnetic field adjustments are needed, the CoilCell library can be used to adjust the power using Pulse Width Modulation (PWM) to finely tune the intensity.

Varying the Magnetic Field Strength

The following example demonstrates how to adjust the strength of the electromagnet:

#include <coilcell.h>

#define COIL_PIN1 2
#define COIL_PIN2 3
CoilCell myCoilCell(COIL_PIN1, COIL_PIN2);

void setup() {
  myCoilCell.Init();
}

void loop() {
  myCoilCell.Drive(true, 100); // Maximum power
  delay(3000);
  
  myCoilCell.Drive(true, 75); // 75% power
  delay(3000);
  
  myCoilCell.Drive(true, 50); // 50% power
  delay(3000);
  
  myCoilCell.Drive(true, 25); // 25% power
  delay(3000);
}

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

Understanding the Functions:

  • Init() → Initializes CoilCell and sets up the control pins.
  • Drive(bool direction, uint8_t power_percent)
    • direction: true (activates electromagnet) / false (not used in this case)
    • power_percent: Magnetic force strength (0 to 100%)

Conclusion

This showed us how to power and control a CoilCell and use it as a weak electromagnet, capable of attracting paper clips and other lightweight metal objects. Check out the CoilCell 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

86 reviews
Write a review
87%
(75)
5%
(4)
2%
(2)
2%
(2)
3%
(3)
80
21
A
ProtoBot
Anonymous

This is a great product for beginners who want hands-on experience with Arduino and 3D printing. The Protobot has a sleek, solid design, and the software is just as polished. I’ve bought several educational robotics kits, and this is the best one so far. Looking forward to more awesome products!

Thank you so much for your kind review! 😊

F
ProtoBot
Francis van Uyten

Really love this robot. I like that is simple to assemble and I like that you guys prepares it easy to start programming with examples and libraries. My opinion on what to improve is more like a add-on, can you guys develop a localisation sensor or function so it will know where the bot is. Expecting only great things coming from you guys. Succes

Thank you so much for your thoughtful review! Glad you’re enjoying ProtoBot 😊 A localisation sensor is a great suggestion! The I²C connection lets you add compatible sensors, so there’s room to explore this. Thanks for your support!

G
Experiment in Progress Mug
Gerald Kendrick

I am enjoying my Experiment in Progress coffee mug. It fits in well in the lab.

Hi Gerald, we’re so glad you’re enjoying it! Thanks for sharing your kind review.

K
12-in-1 Screwdriver (Pen-Size)
Klaas

Very useful fun little screwdriver for the all tiny stuff

Hi Klaas, thanks for the great review! We’re glad you’re enjoying your screwdriver!

f
ProtoBot
frederic marty

I don't have much time right now to test the micro bot, but it looks good.