loading

Inspiration:

Last November, I was having a conversation with one of my buddies in college. Our discussion centered around a module called "Turtle Module" he used when he was learning Python programming. The module allows users to write code that progressively draws lines and curves to form shapes and figures on-screen. Upon demonstrating the module to me, I determined I could write software that encapsulates much of the same tasking using Java instead.

Fast forward a few weeks and I had working software that mimicked the Turtle Module functionality. My buddy and I had another conversation after I demonstrated my software, and he brought up the concept of harmonographs, something I had never heard of before, which he thought would be a neat addition to my software.

I researched harmonographs and found that they are mechanical devices that use the motion of two pendulums tied to a drawing device to trace geometric designs on a drawing surface. When an additional axis of motion is created by allowing the drawing surface to rotate, more complexity is introduced to the figures produced by the machine. A picture of such a machine can be seen above (courtesy: http://www.karlsims.com/harmonograph/).

After I finished implementing the harmonograph-drawing code in my Java-Turtle Module, I realized that it deserved a stand-alone program to allow more than programmers access to the wonder harmonographs produce.

This Instructable:

The purpose of this Instructable is to spark curiousity of harmonographs and emphasize their artistic potential. This is accomplished through use of the software I wrote and have included for readers to download. One of my eventual goals is to utilize some of the plots produced by my software and laser engrave them onto wood.

Step 1: The Nitty-Gritty: Equations of Motion

This step is not necessary to read and fully understand for using the software, but it touches on the math behind the creation of harmonographs, for us math-nerds.

From physics, we know the basic motion of a pendulum, the primary mechanism in the harmonograph machine, is sinusoidal.* Both the x-axis and y-axis motion is delivered by pendulums, which means the basic equation for motion along each axis is a sinusoid. When you add in the rotation of the drawing surface, you introduce one more sinusoid for both the x-axis and y-axis motion.

Because this is a real-world machine, there is inherently friction in the motion of the pendulums; hence, the pendulum swinging decays to zero over the progression of time - this is the damping factor.** Consolidating these principles, one can generate the equations seen in this step's images (image source: Wikipedia).

With a physical device, the amplitude is adjusted by the pendulum's release point height, the frequency is adjusted by changing the height (not amount) of the affixed mass on the pendulum, phase is changed by differing the timing of the pendulum's release, and the damping is tuned by changing the amount of weight on the pendulum.

* Sinusoids have an amplitude (how intense or high a wave reaches), frequency (how often the wave oscillates), and phase (offset in time).

** The damping factor is mathematically represented by an exponential term. Decay of motion (removing energy) is represented by a negative exponent while an increase in motion (adding energy) is represented by a positive exponent.

Step 2: The Software

As I mentioned in the introduction, I decided to create a stand-alone program to handle the drawing and saving of harmonographs. The program interface can be seen in step's images above. It may seem daunting when you first start the program, but after a few minutes of trial-and-error, you should get the hang of it. The software is included at the end of this step - it is a JAR file.

Features:

* Freedom to adjust any of the sinusoids' critical variables (amplitude, frequency, phase, damping)
* Load harmonographs from a list of presets to get you started
* The ability to save a high-resolution image of your generated harmonograph (shown images are not high-res)
* The ability to open a saved harmonograph from an image's associated text file and tweak settings
* Draw harmonographs near-instantaneously, extremely quickly, or limit the frames per second
* Adjust the image background color (I recommend black)
* Choose any two colors for the harmonograph drawing to transition between
* Adjust how quickly the colors transition using the interpolation slider
* Pressing 'enter' initiates the harmonograph drawing; pressing 'escape' cancels the drawing

Drawing Examples:

I have embedded a few videos to demonstrate the software in action, using the maximum drawing speed setting. I apologize for the poor video quality, I do not have video capture software on my computer.


Step 3: Creating Memorable Harmonographs

Using the presets I've included should give you a great starting point - adjusting the values for the presets will let you see what works when it comes to makings excellent images. Below are some keys to keep in mind regarding changing values.

  • Your best patterns will develop with changes to frequency values. Typically, if you keep a 3:2, 4:5, 4:3, or 5:4 ratio, you will see spectacular patterns. You will also notice if you deviate from the ratios by one unit, beautiful patterns have a tendency to show up. High frequencies will decrease the resolution of the drawing (increased jaggedness). Low frequencies with a damping term will result in a faster decay of the figure.
  • Frequency alone will not create amazing shapes. Adjusting damping values will be your second term that results in the most pleasing changes. If damping is set to zero, the drawn pattern will eventually repeat. A positive damping will result in the figure becoming increasingly smaller. A negative damping will result in an increase in figure size.

As noted previously, one of this program's features is the capability to draw geometric shapes slowly, allowing the user to observe the pattern tracing as you would with a physical harmonograph. This mode provides you with a fantastic way to visualize what is really happening when you change settings.

There really is no better way to create great harmonographs besides spending some time to play with values.

Step 4: Artistic Application

As I stated in the introduction, my eventual desire is to use a laser engraver to burn some harmonographs into wood to display on walls and give as gifts. There are so many artistic applications for the images you produce, most of which I'm not creative enough to think of! Use your imagination, and show off some of the cool things you guys do with this, I'm interested to see what you all come up with!

<p>Great! If I wanted to get the same infinite shape with higher frequencies, such as 727Hz, is there a formula that will help me calculate the settings so I don't have to do trial and error? Do you have a Mac version? Thanks for your help!</p>
<p>I will first address your question for a Mac version: I did a little poking around on Google (I don't use a Mac, so I'm unfamiliar with how JAR files work on Macs), and it looks like you need the JRE (Java Runtime Environment) installed on your computer. It seems Apple doesn't pre-install this on Macs for whatever reason, but you should be able to download what you need from this page: </p><p><a href="http://www.oracle.com/technetwork/java/javase/downloads/jre8-downloads-2133155.html">http://www.oracle.com/technetwork/java/javase/down...</a></p><p>I programmed the file using Java 8, so as long as you download JRE 8 or higher, you shouldn't have any problems running the file.</p><p>Now regarding your frequencies question, as I mentioned in the third step of the 'ible, higher frequencies will result in lower resolution of your image, meaning you will have more jagged edges. For this reason, I limited the user-inputted frequency values to be no greater than 999 Hz. To see what I mean with the jaggedness, see the image associated with this comment. The general rule of thumb is to keep the frequency moderately low to maintain smooth curves.</p><p>The general shape of harmonographs is maintained by the frequency ratio amongst constituent waveforms. What I mean is demonstrated by the following example:</p><p>Suppose my frequencies were:</p><p style="margin-left: 20.0px;">X-Axis: 60<br>Y-Axis: 59<br>Rot, X-Axis: 120<br>Rot, Y-Axis: 60</p><p>Now if I want my x-axis frequency to be raised to 350 Hz, I can maintain the shape of my harmonograph by scaling the other frequency terms by the same factor as the x-axis:</p><p style="margin-left: 20.0px;">X-Axis = (350/60) * 60 = 350<br>Y-Axis = (350/60) * 59 = 344.17<br>Rot, X-Axis = (350/60) * 120 = 700<br>Rot, Y-Axis = (350/60) * 60 = 350</p><p>I hope that answers your questions. Give it a shot an let me know if I can be of any more help!</p>
<p>You can just open a .jar on a Mac by dbl-clicking it. Nothing else required.</p>
<p>Eventually you need to open it with Open from the context menu (if you have standard security settings). The above jar works on my Mac without issue.</p>
<p>What were your settings to get the infinite shape above (green)? </p>

About This Instructable

432views

5favorites

License:

Bio: I vastly enjoy DIY projects, especially those involving woodworking. I'm an avid Java programmer, computer animator, and electronics enthusiast.
More by Stratofortress:Java Game Programming Tutorial - Flappy Bird Redux Harmonographs: a Subtle Artform How to Merge PDF Documents 
Add instructable to: