How to use Raspberry Pi to track motion and turn skeleton head as people walk by

This project utilizes a Raspberry Pi Zero, servo, camera, and OpenCV python library.

Parts:
Pi Zero W (with wireless): https://www.adafruit.com/product/3708
PWM Servo bonnet: https://www.adafruit.com/product/3416
Servo: https://www.adafruit.com/product/2307
USB to Barrel Jack cable: https://www.adafruit.com/product/2697
Pi NoIR Camera (camera without an IR filter that’s better at night): https://www.adafruit.com/product/3100
camera cable that fits Pi Zero: https://www.adafruit.com/product/3157
USB Hub: https://www.adafruit.com/product/2991
mini HDMI to regular HDMI adapter: https://www.adafruit.com/product/2819
BYOS (bring your own skeleton)

Thread Types: Most common types and when to use which

The most common thread types are the inch-based Unified coarse / fine (UNC/UNF) and metric coarse / fine. Other types and their purposes are described at the end of this section.

Coarse or Fine? To oversimplify, use a coarse thread unless you’re tapping into sheet metal. The differences are:

  • Coarse theads have fewer threads per inch than fine threads.
  • Coarse threads are more common, and more shops will have coarse taps.
  • Coarse threads are less likely to cross-thread, or jam because the screw is inserted at an angle. They’re also faster to install.
  • Screws with fine threads are slightly stronger. This is because the smaller fine threads take up less of the available area. See the loading charts below to see typical differences between the tensile strength of a fine vs coarse thread. A 1/4 UNF thread is about 14% stronger than its UNC counterpart.
  • Coarse threads are slightly stronger (against stripping) per length of engagement than finer threads (see thread strength section below). This may be surprising given the almost universal recommendation that fine threads be used in sheet metal and other thin-walled materials. If coarse threads are stronger and there is less than optimal thread engagement length available, wouldn’t it better to use the stronger threads?
  • Coarse threads are more tolerant to slight damage or corrosion than fine threads since they have more room for error.
  • Fine threads provide finer adjustment since they advance less per rotation than coarse threads.
  • The metric coarse thread is actually between UN coarse and fine thread, and the metric fine thread is finer than the UNF threads. Blake’s “What Every Engineer Should Know About Threaded Fasteners: Materials and Design,” recommends not using fine metric threads.

Thread specification – How threads are notated / designated:

example Unified thread designation:

1/4-20 UNC-2A

  • 1/4 – the nominal diameter, also the major / largest diameter
  • -20 – the number of threads per inch
  • UNC – UNC = Unified Coarse, UNF = Unified Fine. You may also see UNRC or UNRF. These refer to an external Unified Rounded thread (there is no internal rounded thread). UNRC’s and UNRF’s are interchangeable with their non-R counterparts. The only difference is that the vallies (roots) of external R threads have a mandatory rounded shape, whereas with the UNC and UNF threads the roundness is optional.
  • -2A – This represents the tolerance / fit of the thread. There are 6 common options, 1A, 2A, 3A, 1B, 2B, and 3B. A=external, B=internal. 1 is the loosest fit, 3 is the most precise and tightest fit with potentially zero clearance. If the tolerance isn’t specified, chances are it’s the more common 2A or 2B designation. 1 is hardly used, and only in cases where frequent re-assembly is needed or the threads need to work even with significant damage. Class 3 have slightly greater stripping resistance, and are common in the aerospace industry.

example ISO Metric thread designation:

M6 x 1 -4g6g or M6-6g

  • M6– M is for metric, 6 is the major diameter and nominal size in mm
  • x 1 – Pitch. Note that this is different from how Unified threads are specified. UN threads write the number of threads per inch after the nomimal size, whereas metric designations write 1 / threads_per_inch after the nominal size. If this is absent, coarse pitch is assumed.
  • -4g6g – This is the tolerance / fit class. The number refers to a manufacturing tolerance window, higher numbers are “sloppier.” The letter places that tolerance window relative to the ideal thread. Capital letters refer to internal threads, lowercase external. An h/H has the least amount of allowance–ie, there could be no clearance. g/G and lower represent more allowance. The two numberLetter pairs apply to pitch grade/tolerance and major diameter grade/tolerance for external threads, pitch and minor diameter for internal threads. When only one pair is present (as in M6-6g) it applies to both pitch and major/minor dia. 6g/6H is approximately equivalent to 2A/2B, 4h6h/4H5H is approximately equivalent to 3A/3B, although 4g6g/6H is usually used, which provides a little clearance over 3A/3B.

* a -LH at the end of either inch or metric threads indicates Left Handed threading.
* a (22) or other number at the end refers to the ANSI series of threads.


Some history and info about other threads:

In 1949, Canada, the United Kingdom, and the US agreed to a Unified thread that is largely the same as the American National thread that came before it, and screws from both systems are interchangeable. The new Unified system bascially added more manufacturing tolerances and tweaked some other ones. See ANSI/ASME B1.1 -1989 (R2001) for details.

Metric threads are specified in ANSI B1.13M-1982 (R1995), which is very nearly equivalent to the original ISO 68 specification.

Camera mount threads: These are generally a coarser old standard called the “Whitworth” 1/4 inch diameter and 20 threads per inch.

UNJ or MJ: These threads are used in situations where fasteners must withstand high fatigue stress, predominantely the aerospace industry. The basic difference between UNJ and UN is a larger root radius. Avoidance of sharp corners is critical for fatigue resistance. The root is given a large enough radius that it could potentially interfere with a typical UN internal thread, so there are both external and internal UNJ threads (and MJ’s). According to Blake, it is statistically highly likely that an external UNJ thread will fit a regular internal UN thread.

Standards: In general, the geometry is definied by ANSI, ASME and the ISO, while material strength properties are defined by ASTM, IFI, SAE and ISO.

Cut vs. Rolled Threads: This refers to how threads are manufactured. Rolled threads are stronger than cut/ground threads because they are strain hardened when they are made, and the internal grains of the metal are not cut. The Unified standard doesn’t demand that the roots (vallies) of external threads be rounded, but just about all fasteners less than 1″ come that way because their threads are rolled (see Blake book ref. above), and rolling produces rounded roots.

Constant pitch series: This refers to the many series of threads where the pitch does not increase with diameter. The 8-UN (8 threads / inch) series is apparently very popular above 1″ diameter fasteners. Typically these are used for adjustment devices and not fasteners.

Extra fine threads and minature screws: The Machinery’s Handbook has listings of dimensions for really small screws.

Power Screws and ACME Threads: Power screws’ job is to translate rotational motion into linear motion. Because of this, efficiency is a concern, and the 60 degree thread profile in standard fasteners is unsuited. The most efficient thread would be square with 90 degree angles, but this is difficult to manufacture, so the ACME thread is used (this has a 15.5 degree angle between root floor and tooth wall). Why is square more efficient? None of its force goes into pushing outward, whereas a 60 degree thread has a substantial force component away from the axial direction of the screw.




Grade and Strength Information

There are numerous standards that fasteners are manufactured to, and those standards describe everything from material chemistry to surface finish to heat treatment. The most relevant numbers are “Proof Stress,” “Yield Stress” and “Tensile / Ultimate Stress.” Tensile Strength is how much stress the material can withstand before finally ripping apart. Yield Stress is the amount of stress that a material can undergo before permanently stretching. Proof stress is similar to Yield stress except that it is slightly less (about 90%), and only applies to fasteners. The thread geometry causes them to yield slightly before the Yield stress level of the material, so Proof Stress can be thought of the true yield–in other words, the fastener will behave like a spring below that stress level.

So which of these numbers should be used? While there are many arguments for tightening a screw past its yield point (for instance), from this author’s viewpoint, if an external load yields a screw, and if that load is ever removed, the screw will now be permanently stretched and loose. Therefore, we recommend designing so that the combined internal and external loads stay below the proof stress to avoid any possibility of yielding. If proof stress is unknown, 85% of Yield stress can be used as an approximation. The ultimate or tensile stress is sometimes designed to, but we do not know when this acceptable or not. Also, the ultimate stress is used in designing joints for alternating loads, but this is beyond our scope.

Several organizations publish standards for fasteners. For inch/english, this includes SAE, ASTM, ANSI, ASME and others, although the most commonly used are the SAE “Grades.”(standard J429). The most common metric specifications are published by the ISO. (ANSI metric specs agree with ISO for all practical purposes–Machinery’s Handbook)

Common Inch / Imperial SAE Grades: (all values in ksi or 1000 lbs / square inch)

Head
Marking
Grade Diameter (in) Proof Strength Yield Strength Tensile (Ultimate)
Strength
SAE grade 2 bolt marking 2 1/4 to 3/4 55 57 74
3/4 to 1-1/2 33 36 60
SAE grade 5 bolt marking 5 1/4 to 1 85 92 120
1 to 1-1/2 74 81 105
SAE grade 8 bolt marking 8 1/4 to 1-1/2 120 130 150

Socket Head Cap Screws made from alloy steel are typically manufactured to a higher strength than SAE Grade 8: 180 ksi tensile strength for fasteners up to 1/2 inch, 170 ksi for larger sizes (ASTM A574, p. G-34).

For many more head markings and their corresponding specifications, see here.


Metric ISO Marking

Metric fasteners are marked with two numbers separated by a decimal point, like 10.9. The 10 is 1/100 of tensile strength in MPa, and the .9 represents the ratio of yield to tensile strength. So 10.9 represents a tensile strength of 1000 MPa and yield of 900 MPa. Some strengths are stronger than this method shows, see table 10 on this page. Other references for this table: here and here.

Grade size range proof
strength (MPa)
approx yield
strength (MPa)
grade dec x tensile*
tensile
strength (MPa)
approx equiv.
to SAE grade:
4.8 M1.6-M16 310 336 420 SAE 2
8.8 < M16 580 640 800 SAE 5
M16-M76 600 660 830
10.9 > M5 830 940 1040 SAE 8
12.9 M1.6-M100 970 1100 1220 ASTM-A574
alloy socket
screws

*these value aren’t necessarily from the standards, they’re calculated as described above.

Tensile stress areas and acceptable load estimates for various grades

For applications where there is any chance of bodily or property harm, don’t rely on our external load estimates–they are intended to give a rough approximation of what screws of various grades can hold in non-critical applications, and are based on the following assumptions:

 

  • We use the proof strength as the maximum stress that should be endured from the combined internal (original tightening) and external loads.
  • If proof load isn’t specified in the above tables, we use 85% of yield
  • It is assumed that the joint is twice as stiff as the bolt, which implies that 1/3 of the external load is seen by the bolt, and the other 2/3 goes into reducing clamping load. The forumla explained above and used below is 60% * proof * tensile area / 1.0 (safety factor). We recommend using a 2.5 safety factor for non-critical / costly applications–ie, divide the numbers below by 2.5. For joints clamping aluminum, plastic, gaskets or other softer material it’s safer to assume that 100% of external load is seen by the fastener (multiply by 20% instead of 60%).
  • tensile stress area:Tests have shown that the average of the minor and pitch diameters approximates the effective area of a fastener. The Machinery’s handbook has a different formula for bolts with tensile strengths over 100ksi, but due to some doubt about its origins, we don’t use it.
  • As far as we can tell, SAE Grades apply only to bolts at least 1/4″ in diameter. Any unmarked machine screws smaller than that are probably Grade 2; we show the higher Grades for reference only on those sizes. Alloy steel socket head cap screws will most likely have a greater strength than SAE Grade 8 unless their manufacturer says otherwise.
  • We assume shear loads and torsional loads from tightening are zero.
  • For alloy socket screws, yield strength is 180 ksi until 1/2″ and 170 ksi for larger diameters. We use 85% of these values to approximate proof strength.


Inch tensile areas and loads (in lbs), both fine and coarse thread

size –
threads / in
dec. major
diameter (in)
tensile
stress area
square inches
Grade 2
(proof strength:
<=3/4″: 55 ksi
>3/4″: 33 ksi)
Grade 5
(proof strength:
85 ksi)
Grade 8
(proof strength:
120 ksi)
alloy socket
head (ASTM A574)
<=1/2″: 153 ksi
>1/2″: 144.5 ksi
#0-80 .0600 .00180 59.4 91.8 129.6 165.24
#2-56 .086 .00370 122.1 188.7 266.4 339.66
#2-64 .086 .00394 130.02 200.94 283.68 361.692
#4-40 .112 .00604 199.32 308.04 434.88 554.472
#4-48 .112 .00661 218.13 337.11 475.92 606.798
#6-32 .138 .00909 299.97 463.59 654.48 834.462
#6-40 .138 .01015 334.95 517.65 730.8 931.77
#8-32 .164 .0140 462 714 1008 1285.2
#8-36 .164 .01474 486.42 751.74 1061.28 1353.132
#10-24 .190 .0175 577.5 892.5 1260 1606.5
#10-32 .190 .0200 660 1020 1440 1836
1/4-20 .250 .0318 1049.4 1621.8 2289.6 2919.24
1/4-28 .250 .0364 1201.2 1856.4 2620.8 3341.52
5/16-18 .3125 .0524 1729.2 2672.4 3772.8 4810.32
5/16-24 .3125 .0580 1914 2958 4176 5324.4
3/8-16 .375 .0775 2557.5 3952.5 5580 7114.5
3/8-24 .375 .0878 2897.4 4477.8 6321.6 8060.04
7/16-14 .4375 .1063 3507.9 5421.3 7653.6 9758.34
7/16-20 .4375 .1187 3917.1 6053.7 8546.4 10896.66
1/2-13 .5 .1419 4682.7 7236.9 10216.8 13026.42
1/2-20 .5 .1599 5276.7 8154.9 11512.8 14678.82
9/16-12 .5625 .182 6006 9282 13104 15779.4
9/16-18 .5625 .203 6699 10353 14616 17600.1
5/8-11 .625 .226 7458 11526 16272 19594.2
5/8-18 .625 .256 8448 13056 18432 22195.2
3/4-10 .75 .334 6613.2 17034 24048 28957.8
3/4-16 .75 .373 7385.4 19023 26856 32339.1
7/8-9 .875 .462 9147.6 23562 33264 40055.4
7/8-14 .875 .509 10078.2 25959 36648 44130.3
1-8 1.0 .606 11998.8 30906 43632 52540.2
1-12 1.0 .663 13127.4 33813 47736 57482.1

alternative load carrying recommendations: here.

Metric coarse thread tensile stress areas and estimated loads (in N)

Fine pitch information and more can be found here. Formula for tensile stress area: pi/4* (Nominal_Diameter-.938194*pitch)^2

Formula for load: 60% * tensile area * proof stress / (safety_factor = 1.0)

size x
pitch
tensile
stress area
square mm
Grade 4.8
(proof strength:
M1.6-M16: 310 MPa)
Grade 8.8
(proof strength:
< M16: 580 MPa
>= M16: 600 Mpa)
Grade 10.9
(proof strength:
> M5: 120 MPa)
Grade 12.9
(proof strength:
970 MPa)
2x.4 2.0732 386 N 721 N n/a 1207 N
2.5x.45 3.3908 631 1180 n/a 1973
3x.5 5.0308 936 1751 n/a 2928
4x.7 8.7787 1633 3055 n/a 5109
5x.8 14.183 2638 4936 n/a 8255
6×1 20.123 3743 7003 10021 N 11712
8×1.25 36.609 6809 12740 18231 21306
10×1.5 57.99 10786 20181 28879 33750
12×1.75 84.267 15674 29325 41965 49043
16×2 156.67 29141 56401 78022 91182
20×2.5 244.79 n/a 88124 121905 142468
24×3 352.5 n/a 126900 175545 205155



Nut and tapped hole strength – How much thread engagement is needed?

If a screw / bolt fails because the threads strip, it can be hard to detect both during installation and later because the threads will still have some grip on the screw. If the bolt breaks, however, it will be completely loose, be easy to detect and remove, and usually fail during installation when additional torsional loads are present (torsional loads usually dissipate within minutes after tightening if you’re wondering why we didn’t take them into account before). Because of this, fasteners are designed to fail in the bolt, not the threads, so most nuts are more than adequate–just make sure you use a similar grade of nut compared to the screw.

How much thread engagement is needed in a tapped hole, then? According to “Fundamentals of Machine Component Design”, 3rd addition, by Juvinall and Marshek, p. 413, if the bolt and nut are of similar material the thread stripping stength will equal the bolt tensile strenth when the nut is .47 * diameter. Standard nuts are 7/8 of a diameter, for comparison.

Interestingly, more than a third of the load is held by the first thread in a nut according to this. As the bolt tightens, its threads stretch and the nut’s threads compress, which reduces force on the far threads.

The .47*dia calculation above takes this imbalance into account, but it will certainly be different for other material combinations. This offers some formula (also found in machinery’s handbook) for calculating the shear area of threads, but it’s uncertain how one would apply that formula given the imbalanced thread load. The Machinery’s handbook suggests at least 3 threads of engagement. We recommend 1 diameter depth for steel and 1.5-2 diameters for aluminum. The referenced formulas may at least provide a rough estimate for sheet metal, where thread engagement is limited. Unbrako’s Engineering guide has several charts showing experimental testing of various sized holes. According to their guide, formulas have performed poorly at predicting thread strength.




About

CuriousInventor launched in late 2006 (pre-arduino era!) as a place to enable hobbyists, students, and musicians to create their own technology. We sold open-source kits and tools, and offered numerous guides & videos on things like soldering, metal working, screws, electronics, and more. 

The store is now mostly empty, but we’ve kept the product pages and guides up since they have useful information. Many of our guides and videos still rank on the first page of google searches and have been seen millions of times. Content on this site and the CuriousInventor YouTube channel produced by Scott Driscoll.

Top Videos