Introduction: JustAPendulum: Open-source Digital Pendulum
JustAPendulum is an Arduino-based open-source pendulum that measures and calculates the oscillation period to find the gravitational acceleration of the Earth (~9,81 m/s²). It contains a homemade Arduino UNO that uses an USB-to-serial adapter to communicate with your computer. JustAPendulum is highly accurate and has a companion (written in Visual Basic .NET) that, in real-time, will show you the position of the mass and a table and a graph with all the precedent measures. Completely laser cut and homemade, it’s very easy-to-use: just push a button and let the mass fall and the board will calculate everything. Ideal for tests in physics classes!
Project main page: marcocipriani01.github.io/projects/JustAPendulum
Step 1: The Physics Behind It
These are all the formulae used in JustAPendulum. I’m not going to demonstrate them, but if you’re curious, this information is easy to find in every physics book. To calculate the gravitational acceleration of the Earth, the pendulum simply measures the oscillation period (T), then uses the following formula to calculate (g):
and this one to calculate the absolute error over the acceleration:
l is the length of the wire of the pendulum. This parameter must be set from the Companion program (see below). 0.01m is the measurement error of the length (sensibility of the ruler is assumed 1 cm), while 0.001s is the precision of Arduino’s clock.
Step 2: Galileo Galilei and This Formula
This formula was first (partially) discovered by Galileo Galilei around 1602, who investigated on the regular motion of pendulums, making pendulums be adopted as the most precise timekeeping machines until 1930 when quartz oscillators were invented, followed by atomic clocks after World War 2. According to one of Galileo’s students, Galileo was attending a Mass in Pisa when he noticed that wind caused very slight motion of a chandelier suspended in the cathedral. He kept looking at the motion of the chandelier and he noticed that even though the breeze stopped and the back-and-forth distance travelled by the pendulum shortened, yet the time it took the chandelier to make the oscillation seemed to remain constant. He timed the swinging of the chandelier by the regular beating of the pulse in his wrist and realized he was right: no matter the distance travelled, the time it took was always the same. After more measurements and studies, he then found out that
The two times π, as in the in the previous equation, turns the proportional expression into a true equation - but that involves a mathematical stratagem that Galileo hadn’t got.
Step 3: Usage
Please note that before using the digital pendulum sensors must be calibrated and wire length adjusted. Put JustAPendulum below a pendulum (minimum 1m tall recommended) and make sure that the mass obscures all the three sensors when oscillating. Sensors work better in low light conditions, so turn off the lights. Switch on the board. A “Ready” screen will appear. Here’s the menu structure:
Left button: to start the measurements, put the ball to the right and press the button. Arduino automatically detects the ball position and starts.
“Starting… o.p.: x ms” is displayed
Left: calculate gravitational acceleration
Right: back to the main screen
Right button: show configuration
Step 4: The Companion
JustAPendulum’s companion is a Visual Basic .NET (written in Visual Studio 2015) program that allows the user to monitor the pendulum in real-time from the computer. It displays the last values and errors, has tables and graphs to show the past measures and has tools to calibrate the sensors and to set the length of the wire. History can also be exported to Excel.
Step 5: Calibrating the Sensors
Go the Advanced tab, turn on “ADC monitor” and observe how the displayed values change depending on the position of the ball. Try to find out an acceptable threshold: below it will mean no mass between the detectors, while above it will indicate that the mass is passing between them. If the values don’t change, maybe there’s too much light in the room, so turn off the lamps. Then, press the “Manual calibration” button. Write in the text box the threshold you decided and press enter.
Step 6: Changing the Wire Length
To adjust the length of the wire press the “Wire length” button and enter the value. Then set the measurement error: if you measured it with a tape measure the sensitiveness should be 1 mm. All the values will be stored in the memory of the ATmega328P microcontroller.
Step 7: The Laser Cut Box
Cut this structure from plywood (4 mm thick) with a laser cut machine, then asseble it, put the components on the panels and fix them with some nails and vinilic glue. Download DXF/DWG files at the bottom of this page (designed with AutoCAD 2016).
Step 8: The Structure
If you haven’t got a pendulum, you can make one yourself starting from this example (it’s an exact copy of the one I made). A 27,5·16·1 cm piece of plywood, a 5·27,5·2 cm splint and a rod are enough. Then use rings, fishing wire and a ball to complete the pendulum.
Step 9: The Mass
I hadn’t got an iron mass (would be better, of course), so I made a ball with a 3D printer and I added a ring to hang it to the wire. The heavier and thinner it is (see pendulum clocks: the mass is flat to avoid friction with air), the longer it will oscillate.
Step 10: The PCB
This is the less expensive method to create a homemade PCB using only low-cost stuff:
- Laser printer (600 dpi or better)
- Photo paper
- Blank circuit board
- Muriatic acid (>10% HCl)
- Hydrogen peroxide (10% solution)
- Clothes iron
- Steel wool
- Safety goggles and gloves
- Sodium bicarbonate
- Paper towel
The first step is cleaning the blank PCB with steel wool and water. If the copper appears a bit oxidized, you should wash it with vinegar before. Then, scrub the copper side with a paper towel soaked in acetone to remove any remaining dirt. Accurately rub every part of the board. Do not touch the copper with hands!
Print the PCB.pdf file at the bottom of this page using a laser printer and do not touch it with fingers. Cut it, align the image on the copper side and press it with the clothes iron (it must be hot but without vapour) for about five minutes. Let it cool with all the paper, then remove the paper very slowly and carefully under water. If there’s no toner on the copper, repeat the procedure; Use a small permanent marker to fix some missing connections.
Now it’s time to use acid to etch the PCB. In a plastic box put three glasses of muriatic acid and one of hydrogen peroxide; you can also try with equal amounts for a more powerful etching. Put the PCB in the solution (pay attention to your hands and eyes) and wait about ten minutes. When the etching is finished remove the board from the solution and wash under water. Put two spoons of sodium bicarbonate in the acid to neutralize the solution and throw it in the WC (or take it to a waste collection centre).
Step 11: Electronics
- ATMEGA328P MCU
- 2x 22 pF capacitors
- 3x 100 uF capacitors
- 2x 1N4148 diodes
- 7805TV voltage regulator
- 6x 10K resistors
- 2x 220R resistors
- 16 MHz crystal oscillator
- USB-to-serial adapter
- 940nm side-looking infrared emitters and IR detectors (I bought these from Sparkfun)
- 9V battery and battery holder
- 16x2 LCD screen
- 2 buttons
- A potentiometer and a trimmer
- Wires, wires and wires
Now that you’ve bought and collected the components, pick a solderer and solder them all! Then fix the PCB in the box, connect all the wires to the LCD, the USB-to-serial adapter, the potentiometer and the trimmer (for display brightness and contrast). Refer to the schematic, the PCB model in the previous step and to Eagle CAD files at the bottom of this page to correctly place all the parts and wires.
Step 12: Sensors
Add the sensors as shown in the pictures, then make some caps (I used a rotary tool to engrave them from a wood splint) to cover and protect them. Then connect them to the main board.
Step 13: You’re Ready!
Start using it! Enjoy!