A sample text widget

Etiam pulvinar consectetur dolor sed malesuada. Ut convallis euismod dolor nec pretium. Nunc ut tristique massa.

Nam sodales mi vitae dolor ullamcorper et vulputate enim accumsan. Morbi orci magna, tincidunt vitae molestie nec, molestie at mi. Nulla nulla lorem, suscipit in posuere in, interdum non magna.

Programming the Do-Nothing Grinder

The Working Painted Do-Nothing

The problem with doing these posts is that often I don’t have time to finish the things I have started. There are several things I want to finish before I call the do-nothing machine complete. (If you are new to here, a site search for “do-nothing machine” and “ellipsograph” will bring up all the posts.)
When I fabricated the original version I used a middle of the road method by using portable power tools.  Before I call it complete I want to do a version with nothing but hand tools and I want to present some ideas for building one using methods more suitable for faster production.   The other thing I want to do is some analysis of the motion of the various pieces.  To do that it is necessary to do some programming.  Much of the values of the ellipsograph, another name for the do-nothing machine are standard algebra formulas and are listed in the wikipedia article ellipse. However, the only way to calculate the circumference is to perform an infinite series calculation.  I wanted to know the path of the handle so the only way I knew to do that was to write a program.

Initial set-up of the ellipse problem.

I placed the major axis of the machine on the X axis and it was easy to determine how this related to the two lengths of the handle.  (The between shuttle length and the shuttle to knob length.)  To solve the circumference problem and to get points along the circumference I used an iterative approach to solve the problem.  First, I decided I only had to calculate one-fourth of the problem by just doing the upper right portion of the ellipse, or said another way from 0 to 90 degrees.  Everything else can me solved by mirroring the points calculate for that quadrant.

First iteration, dividing the angles in half.

I drew a line between the points and called this the initial circumference. Next, I then started calculating points midway between the existing points. So for example, the first iteration took a point at 45 degrees as shown in the picture to the left. I then again added up all the line lengths and calculated the difference between this new calculated circumference and the previous circumference.

The 2nd iteration with angles at 22.5 degrees.

I continued this process until the difference between the previous circumference and the most recent calculated circumference was small enough to consider the process done.

3rd iteration with the angles spaced at 11.25 degrees.

With the error set at the value I had chosen I ended up with 255 points between 0 and 90 degrees.

The program is written in Python,and is pretty much bare bones calculations, but it is fairly well documented so you can follow it. So far all I have completed is calculating the points in the upper right quadrant. The next step will be to expand the points to all four quadrants by mirroring the points. Then for each point I will calculate both shuttle positions and put all this data in a csv format so I can plot what is going on. At that point I will use a normal spreadsheet and possibly a graphing program.

The program can be downloaded for your viewing and running.  The first subroutine in the program. “setconstants()” will have to have the two file paths edited to run on your computer.   If you are using a windows based machine remember to use \ for a directory name separator.   The subroutine named “calc_allfromradiusvalues” uses the formulas from the wikipedia article to calculate the other standard forms of values associated with an ellipse.  The calculation of the mid angles happens in the subroutine “calculatemidpoints” and the main program at the end of the listing determines when enough is enough.

In python the # symbol denotes a comment and everything on a line after the # is ignored by the computer and is only there for humans.   There are a few lines in the program where a # is followed by the word print.   Those were print statements I used to print variables while debugging the program.   The one that says #print poop would cause the program to try to print a variable called poop.  Poop did not exist and the program would crash on purpose because at that point in debugging I was stuck in an infinite loop, the program would not stop.  (Yes, I have a sick sense of humor, I on purpose caused the program to poop its pants.)

The earlier posts on programming, “Episode 44: Programming to learn logical thinking.”  and “Episode 45: More about programming and Python”  will provide information about how to download Python and the python help files to understand and run the program.  You may e-mail me if you have further questions.

The final link is the cad file I used to generate the pretty pictures.  ellipse_solve.dxf

Tomorrows post will be about the status of the popsicle crane.

If you find these posts educational and enjoyable, please consider subscribing using one of the methods in the upper right column on the home page or the e-mail subscription in the form below.

Gary


 

 

Print Friendly

1 comment to Programming the Do-Nothing Grinder

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>