Here's a quick and simple project for a lazy afternoon. We are going to make a perpetual pendulum using Arduino and a few components. If you pack it nicely it will make a great decoration for your workshop or a nice gift.

Step 1: Parts

Here are the basic parts you will need:

  1. Arduino.I used Nano on a small breadboard.
  2. Coil. You can salvage one from a dead hard drive, or even make one, as described below.
  3. Acquire some magnets. I found some small neodymium 2x5mm disk shape magnets on eBay.
  4. 100Ω..1kΩ resistor.

You will need some additional parts to complete the pendulum. This is up to your imagination, but I will give an example.

Step 2: How It Works

Imagine a magnet passing over a coil. According to the Faradey's law of induction, the voltage induced in the coil is proportional to the rate of change of the magnetic flux through the coil. Without going into equations, the induced voltage will depend on the number of turns in the coil, speed of the magnet, magnet's flux density ("strength") and the size/shape of the coil. The induced voltage will look pretty much like the one shown above (or inverted, depending on polarity). The first, in this case negative, part is induced as the magnetic field is entering the coil (magnetic flux rises) and the second, in this case positive, part as the field is leaving the coil (magnetic flux decreases). When the magnet is right above the coil the induced voltage is zero as the magnetic flux is constant, since the magnet is neither coming nor going, and the rate of change (derivative) of the field is zero.

OK, enough with the science. What we want is to detect the second part of the waveform just when the magnet passes the center of the coil. Then, by turning the coil into electromagnet, we'll give the magnet a small push.

Step 3: Schematic

Connect the resistor and the coil in series between A0 and GND on your Arduino board. Don't worry about the coil polarity as the proper operation can be achieved later by flipping the coil or the magnet. The resistor value is not fixed, different values will change the force that the magnet will be pushed with (lower resistance - higher force). Although it might even work without the resistor if the coil resistance is high enough, I wouldn't recommend going bellow 100 Ω and relying on Arduino's current limiting (or the lack thereof).

If you don't have a premade coil you can make one. Find some thin enameled wire and wind a coil using this calculator. Aim for couple of mH or more. Mine is about 2.6 mH, inner radius ~15 mm, approximately 250 turns of 0.14 mm wire.

Step 4: Code

The ADC is constantly sampling the coil voltage at 1 ms period. Once the THRESHOLD value is reached during the second, positive, part of the waveform the coil turns into electromagnet, pushes the coil for PUSH_TIME milliseconds and than goes back to sensing the voltage again. Here, it is important that the second part of the waveform is positive since we cannot measure negative voltages directly with the Arduino's ADC.

Set THRESHOLD low enough to detect the magnet as soon as it passes the center of the coil, but high enough to avoid false triggering by noise. Set PUSH_TIME to couple of tens of milliseconds.

Step 5: Completing the Pendulum

Here's one example how to complete the pendulum. Using a plastic cap, a wire, some cotton thread and an IC make a miniature swing. Place the circuit inside the box, glue the coil under the top side of the cap and cut a hole for the power supply. Using some LEDs, diodes and resistors make a small figure, give it a pair of magnetic feet and place it on the swing. Adjust the thread length and bend the figure's legs to position the magnets just above the coil. Plug the power in, give the figure a little push and enjoy the perpetual motion! In case it's not working reverse the coil or magnet polarity and give it another try, or play with THRESHOLD and PUSH_TIME values as described above.

I like this but do you know if it is possible to get it to light up every time it passes its peek or the base
<p>You could simply use the pulse to the coil to light a Led. </p><p>The Arduino can be replaced with a couple of transitors and passive components.</p>
<p>Do you have more info on how this can be done with the transistors and passive components? Arduino is great, but it seems like overkill for many things.</p>
<p>Here is a two transistor kicker circuit I have used. Simple and works great.</p><p><a href="http://www.trainelectronics.com/Pendulum/article.htm">http://www.trainelectronics.com/Pendulum/article.h...</a></p>
<p>Thanks! That's exactly what I was looking for!</p>
<p>Welcome. I use mine for a couple of projects and it runs for days or weeks on a set of batteries. I want to replace the 1 meg with a 1 meg potentiometer to get some control over the timing. I think that is the resister to replace.</p>
<p>You could also use the Adafruit Trinket or even an ATTiny45 or ATTiny85 if you already have a programmer.</p>
Was thinking about the same... ;)
<p>Thanks for this. I use a two transistor circuit but want to use an Arduino.</p>
<p>Very nice! Love it. I'll make one. Thank you.</p>
<p>Awsome idea. I used an ATTiny85 and added a swing activated, blinking LED-head.</p>
What is the code? I am a noob.
<p>See Step 4:</p><p><a href="https://www.instructables.com/files/orig/FGE/M61L/HXLM9Y46/FGEM61LHXLM9Y46.ino" rel="nofollow">magnetic_pendulum.ino</a>308 bytes</p>
<p>I'd love to see a video or animated gif of this!</p>
<p>Me to.</p>
<p>no video?</p>
Awesome project and writeup!

About This Instructable




More by zohurap:Magnetic Pendulum Bicycle Handlebar Phone Holder 
Add instructable to: