CoilCell is a compact magnetic actuator that can make magnets move and even jump! In this guide, we will explore how to make a small 5mm diameter ball magnet bounce using the CoilCell, using short pulses to generate motion.
CoilCell generates a magnetic field when an electric current passes through its coil. By applying a short pulse, we create a rapid magnetic repulsion that propels the magnet upwards. Depending on the power of the CoilCell module, the effect varies:
When using the 2.5W 200-Turns CoilCell, always wear eye protection. The repulsion force may cause small magnets to shoot upwards unpredictably.
To generate a pulse, we use the CoilCell library. The following example demonstrates how to make a 5mm ball magnet bounce using an on-time pulse of 20ms, followed by a delay to allow the magnet to be attracted back:
#include <CoilCell.h>
/* Learn more at microbots.io */
/* In this example, we initialize a CoilCell and make a 5mm diameter ball magnet bounce */
#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 */
}
Understanding the Function:
direction
: The pulse direction (0 for normal bounce behavior).duration
: Time in milliseconds for the activation pulse.By tweaking the duration
and delay
, you can fine-tune the bouncing effect. A longer pulse will push the magnet higher, while a shorter delay may not allow it to return fully before the next bounce.
This showed us how to make a small ball magnet bounce using CoilCell! Check out the CoilCell GitHub Repository for more code examples and technical documentation!
Erfahren Sie als Erster von neuen Projekten und sichern Sie sich spannende Angebote!
© 2025 Microbots.