yet another perpetual pendulum

Introduction

Heya. So I found people building perpetual self-exciting pendulums (pendula? pendulae?) and showing them off on youtube. Nice 🙂 So far the most elegant that I know of seems to be THIS ONE by youtube channel [TinselKoala] … which is in turn a “cover version” of some original circuit by David Williams, published in the magazine(?) “Nuts & Volts” in August 2012. The circuit is shown at the very end of TK’s video.

The basic idea is: You have a magnet on a string – the pendulum – which swings by a coil that acts both as a sensor (detecting the magnet is above) and an electromagnetic motor (giving the magnet a repulsive kick). Obviously the kicking has to occur at exactly the right time, i.e. when the magnet just barely swooshed past the center of the coil.

Let’s be honest: The Williams/TinselKoala circuit is very close to perfection: Only two transistors and barely a handful of passive components. Hats off! There is just two problems (arising from my ignorance):

  • BC556B and BC337-25 … errm I have never heard of these transistor types, I can probably buy them easily, but the thing is: I don’t have them at home.
  • I did not understand the circuit after staring at it for three minutes.

But I wanted to build such a pendulum the same evening. And in the end I did 🙂 (as you see below). I decided to rely on an Arduino to control the behaviour. You might argue that an Arduino is overkill here, since we already know it can be done with two transistors only. But since a chinese Arduino leonardo clone (pro micro) costs me only 4€ and in return I get fine-tuning of the trigger threshold and FET switching timing and all that in software, I’d say that it’s a fair deal.

Schematic

So what’s going on here? We can view it as two separate circuits that have one component in common – The coil!

  1. driver circuit:
    • The Arduino output pin drives the gate of the MOSFET (Q1). This way we can let current flow through the coil and turn it into an electromagnet. The current is provided by the 470uF capacitor (C1) which previously has been charged to 5V through the 100R resistor (R1). C1 is recharged, once the MOSFET is turned off again. Although very briefly there are up to 2A flowing through the coil, the power source never sees this dramatic current spike. A diode (D1) is wired in parallel to the coil and shorts it, when the FET opens and the voltage across the coil shoots up because of self-induction. Blah blah, just coil magic – just think of it like this: The energy of the magnetic field wants to go somewhere. And we tell the coil: Please dump your excess energy into the diode, rather than destroy the FET. Thank you very much.
  2. sensor circuit:
    • When the FET is turned off and C1 is fully charged again, then one end of the coil is at 5V and the other end is not really connected to anything. When the coil is sensing changes in external magnetic fields, the voltage at the FET side (open end) of the coil will wiggle around and display the signal that the coil picked up. We use 1uF as an AC-coupling capacitor to connect this end of the coil to a simple inverting amplifier. In the following video I have disabled the drive pulse and we can see what comes out of the sensor circuit, i.e. what the Arduino ADC sees:
What the Arduino ADC pin sees

Code

In the above video you see that the signal that comes out of the sensor amplifier is a wiggle that first rises above the baseline, then way below the baseline, then above the baseline again and then returns to the baseline:

(picture manually redrawn for beauty)

What the Arduino shall do is:

  1. Measure the baseline once when the device is turned on. Whenever we read the ADC value we want the baseline subtracted from it. This is done by the functions adjust_baseline() and sense().
  2. Detect a pulse. There are several ways. I went for the following: Wait for the signal to rise above a cercain threshold, then wait until it sinks below the baseline. Now we can be pretty sure that the magnet is above the coil.
  3. Turn the FET on for a certain time (in my case 20 ms)
  4. Turn the FET off and don’t do anything for a while (100 ms). We don’t want the Arduino read its ADC during the switching and the recharging. Let’s just ignore all sensor data during the period where the coil is not a sensor but a driver.
  5. GOTO 2.

Here is the Arduino code (works on ANY Arduino or Arduino compatible board):

const int FET_PIN = 10;  // digital pin 10
const int SENSE_PIN = 2; // A2 pin

const int threshold = 35; // sensor threshold above baseline

// all delays are defined in ms
const int pulse_off_delay = 100;
const int pulse_on_delay = 20;
const int pulse_pre_delay = 0;

int baseline = 0;

void adjust_baseline(){
  int accumulator = 0;
  int n = 10;
  for (int i = 0; i < n; i++){
    delay(10);
    accumulator += analogRead(SENSE_PIN);
  }
  baseline = accumulator/n;
}

void pulse(void){
  delay(pulse_pre_delay);
  digitalWrite(FET_PIN,HIGH);
  delay(pulse_on_delay);
  digitalWrite(FET_PIN,LOW);
  delay(pulse_off_delay);
}

int sense(void){
  return analogRead(SENSE_PIN)-baseline;
}

void setup() {
  // init output pin
  digitalWrite(FET_PIN,LOW);
  pinMode(FET_PIN, OUTPUT);
  delay(200);
  adjust_baseline();
}

void loop() {
  
  // wait for sensor > threshold
  // -> magnet approaches coil
  while(not(sense() > threshold)){
    // do nothing
  }
  
  // wait until sensor < 0 
  // -> magnet just above coil center
  while(not(sense() < 0)){
    // do nothing
  }
  
  // switch FET, make pulse
  // -> repulse magnet
  pulse();
  
}

The Coil

One more word about the coil. I used 0.15mm diameter lacquer coated copper wire wound around the above 3d-printed spool. I didn’t count the windings, but l sorta filled up the spool up to the beginning of the outer tiny holes. Here is the spool’s STL file. And here is the SCAD script that created the shape. You see the hexagonal hole in the middle? That shape is not random … this way you can put the spool on the shaft of an electric screwdriver to wind the coil. In the end my coil had a DC resistance of slightly more than 3 Ohms. The pendulum only works with the right orientation of the coil towards a particular pole of the magnet. If you observe that the coil is decelerating the pendulum instead of exciting it, then flip either the magnet or the coil.

Conclusion

That’s it. Build your own pendulum. Be happy. If you succeed send me pictures or videos.

One response to “yet another perpetual pendulum

  1. Pingback: Yet another perpetual pendulum #Arduino « Adafruit Industries – Makers, hackers, artists, designers and engineers!·

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.