Home >> Programming Projects >> VB 2008: Lever Arm Leadscrew Length Calculator and Tutorial

VB 2008: Lever Arm Leadscrew Length Calculator and Tutorial

Here is a program I wrote which will calculate the length of the leadscrew that pushes a lever arm. This may sound like an obscure thing to do, but it can be quite useful when you need a lever arm to move a precise distance. A ran into just such a problem when programming the Sun Tracker Program for my heliostat projects.

Click here to download the stand alone program.

Click here to download the Visual Basic 2008 source code. Note: Make sure to extract folder before attempting to run. You may build on to this source code and use it for whatever you wish.

Screenshot

Here is a screenshot of the program. You can input either positive or negative angles, and the program will tell you how long the leadscrew needs to be in order to match that angle. It also tells you the change in the length of the leadscrew, which can sometimes be the more important of the two numbers.

The "Change" is how much the leadscrew has changed its length since the initial angle.

Settings

In the picture below, you can see where the numbers for the settings come from. Length A and Length B are assigned arbitrarily and can be reversed without affecting the output.

The initial angle, 90 degrees in the picture, is the angle of the lever arm when it is in its start position.

heliostat setup

The final setting is the "Acute Yes/No." The two pictures below attempt to explain it. If the lever arm moves in the positive direction (left picture) and the angle becomes more acute, you would want to have "Acute Yes/No" selected.

If, however, the lever arm moves in the positive direction (right picture) and the angle becomes more obtuse, you would not want to have "Acute Yes/No" selected.

Selecting the "Acute Yes/No" checkbox essentially just lets the program know which side of the lever arm the leadscrew attaches.

obtuse heliostat

A Glance at the Math

Check out the Wikipedia link here, and scroll down to where it says "The sine and cosine rules." This is where I found the math for this program. Essentially, the angle, side b, and side c are known, so it is possible to use those three numbers to find side a, which is the length of the leadscrew.

In the VB code, you will see that I used the formula in the picture below.

a^2\ = b^2 + c^2 - 2bc\cos(\alpha)

The End

That seems to cover just about everything. It can be confusing I know, so, to help get a better understand about how this works, you might try experimenting with different lever arm angles and drawing them out either by hand or with a CAD program. This should help you see how the programs output relates to the real world.

Home >> Programming Projects >> VB 2008: Lever Arm Leadscrew Length Calculator and Tutorial