Build it step by step
0 of 7 doneFix the pipe
Vertical, with a soft cloth at the bottom.
Fix the sensors
One near the top and one near the bottom, flat face to the pipe, and measure the gap.
Wire the sensors
5V, GND, OUT to D2 and D3, each OUT with 10 kilo-ohms to 5V.
Wire the display and button
OLED on A4 and A5, button D4 to GND.
Set SPACING_CM
In the sketch to the measured distance.
Test
Wave the magnet past each sensor, turn it round if there is no reaction.
Drop the magnet
Down the copper pipe, then the plastic pipe, and compare.
How do you build a magnet drop timer?
Two Hall sensors on a copper pipe time a small magnet falling through it, and a Nano shows how much slower it falls than through a plastic pipe, because of the currents it induces. You need Arduino Nano, Hall Effect Sensor A3144 × 2, Resistor 10 kΩ × 2, SSD1306 OLED Display, Tactile push button 6 mm, Jumper wires male to male (40 pcs, 20 cm) and Breadboard 830 Tie Points. It takes 7 steps and about 150 minutes.
- Level
- Intermediate
- Time
- About 150 min
- Parts
- 7
Parts list
- Development BoardsBuyArduino Nano × 1
- SensorsBuy
- PassivesBuyResistor 10 kΩ × 2
- DisplaysBuy
- SwitchesBuy
- PrototypingBuy
- PrototypingBuy
Tick what you already own. It saves to My Garage, so “Build with what I have” knows.
Wiring
| From | To | Why |
|---|---|---|
| Top Hall sensor pin 1 (VCC) | Nano 5V | Power at 5 V |
| Top Hall sensor pin 2 (GND) | Nano GND | Common ground |
| Top Hall sensor pin 3 (OUT) | Nano D2 | Goes low when the magnet passes |
| Bottom Hall sensor pin 1 (VCC) | Nano 5V | Power at 5 V |
| Bottom Hall sensor pin 2 (GND) | Nano GND | Common ground |
| Bottom Hall sensor pin 3 (OUT) | Nano D3 | Goes low when the magnet passes |
| 10 kilo-ohm resistors | One between each OUT pin and 5V | Pull-ups (the outputs are open collector) |
| OLED VCC | Nano 5V | Power (check your OLED accepts 5 V, otherwise use 3V3) |
| OLED GND | Nano GND | Common ground |
| OLED SDA and SCL | Nano A4 and A5 | I2C, address 0x3C |
| Reset button | Nano D4 and GND | Clears the times |
Code
When a magnet moves through a copper pipe, its changing field drives circles of electric current, called eddy currents, in the copper, and those currents make a magnetic field of their own that pushes against the magnet. The result is that the magnet falls very slowly, as if through honey, even though copper is not magnetic and the magnet does not touch it. In a plastic pipe, nothing like this happens and it falls freely. Two A3144 Hall sensors fixed to the outside of the pipe, a measured distance apart, sense the magnet as it goes by, because the field passes through the pipe wall. Interrupts record the exact time of each pass in microseconds, and the program shows the time between them, the speed and the ratio between the last two drops, so you can compare copper and plastic directly. The A3144 only reacts to one pole, so if a sensor does not trigger, turn the magnet round. Use a small magnet, no bigger than a coin, and catch it at the bottom on a soft cloth. Strong magnets can pinch fingers, can break, and can wipe cards and damage phones and watches, and a person with a pacemaker must keep away. Keep magnets out of the reach of young children.
Runs on a virtual Arduino Nano in your browser, with sliders for the sensors. Happy with it? Verify and upload to your real board from the same page (Chrome or Edge on a computer).
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
Adafruit_SSD1306 oled(128, 64, &Wire, -1);
const int TOP = 2, BOTTOM = 3, RESET_BUTTON = 4;
const float SPACING_CM = 50.0; // distance between the two sensors, measured with a ruler
volatile unsigned long tTop = 0, tBottom = 0;
volatile bool gotTop = false, gotBottom = false;
float lastTime = 0, previousTime = 0;
void topHit() {
if (!gotTop) { tTop = micros(); gotTop = true; }
}
void bottomHit() {
if (gotTop && !gotBottom) { tBottom = micros(); gotBottom = true; }
}
void draw(const char* status) {
oled.clearDisplay();
oled.setTextColor(SSD1306_WHITE);
oled.setTextSize(1);
oled.setCursor(0, 0);
oled.print(status);
oled.setCursor(0, 14);
oled.print("Last "); oled.print(lastTime, 3); oled.print(" s");
oled.setCursor(0, 26);
oled.print("Before "); oled.print(previousTime, 3); oled.print(" s");
if (lastTime > 0) {
oled.setCursor(0, 40);
oled.print("Speed ");
oled.print(SPACING_CM / 100.0 / lastTime, 2);
oled.print(" m/s");
}
if (lastTime > 0 && previousTime > 0) {
oled.setCursor(0, 52);
oled.print("Ratio ");
oled.print(lastTime / previousTime, 2);
}
oled.display();
}
void setup() {
pinMode(TOP, INPUT_PULLUP);
pinMode(BOTTOM, INPUT_PULLUP);
pinMode(RESET_BUTTON, INPUT_PULLUP);
Wire.begin();
if (!oled.begin(SSD1306_SWITCHCAPVCC, 0x3C)) { while (true) {} }
attachInterrupt(digitalPinToInterrupt(TOP), topHit, FALLING);
attachInterrupt(digitalPinToInterrupt(BOTTOM), bottomHit, FALLING);
draw("Ready: drop the magnet");
}
void loop() {
if (gotTop && gotBottom) {
previousTime = lastTime;
lastTime = (tBottom - tTop) / 1000000.0;
draw("Done: drop again");
delay(1500); // let the magnet settle before the next drop
noInterrupts();
gotTop = false;
gotBottom = false;
interrupts();
}
if (digitalRead(RESET_BUTTON) == LOW) {
lastTime = 0;
previousTime = 0;
noInterrupts();
gotTop = false;
gotBottom = false;
interrupts();
draw("Ready: drop the magnet");
delay(300);
}
}Test checklist
What you should see at each check. If a reading is far off, stop and use the troubleshooting list.
| Check | Expected |
|---|---|
| Start | Ready: drop the magnet |
| Drop in the copper pipe | A time of a second or more |
| Drop in the plastic pipe | A time of a fraction of a second |
| Ratio | Copper is many times slower |
| Press the button | Times cleared |
If it does not work
No trigger
Turn the magnet round, move the sensor closer or use a stronger magnet.
Time is tiny in copper
Check you used a copper pipe and that the sensors are far enough apart.
Triggers by itself
Move the sensors away from other magnets and metal.
Display blank
Check the OLED address 0x3C.
Magnet sticks
Use a thinner magnet or a larger pipe.
Still stuck? Find the fault step by step with your multimeter →
Common questions
What parts do I need for the magnet drop timer?
Arduino Nano, Hall Effect Sensor A3144 × 2, Resistor 10 kΩ × 2, SSD1306 OLED Display, Tactile push button 6 mm, Jumper wires male to male (40 pcs, 20 cm) and Breadboard 830 Tie Points.
How long does the magnet drop timer take to build?
About 150 minutes for a intermediate maker, in 7 steps.
How do I know the magnet drop timer works?
Start: Ready: drop the magnet. Drop in the copper pipe: A time of a second or more. Drop in the plastic pipe: A time of a fraction of a second.
No trigger: what should I check?
Turn the magnet round, move the sensor closer or use a stronger magnet.
Time is tiny in copper: what should I check?
Check you used a copper pipe and that the sensors are far enough apart.
Triggers by itself: what should I check?
Move the sensors away from other magnets and metal.
Display blank: what should I check?
Check the OLED address 0x3C.
