% !TEX root = master.tex
\section{Design Constraints and Standards}
Every engineering endeavor has certain limitations, collectively referred to as constraints. They may be financial, technological, or legal constraints, but nonetheless they exist and must be dealt with accordingly. Successful designers observe these constraints and work according to various standards to create a successful product.

The following section contains:
\begin{itemize}
	\item  A list of design constraints pertaining to the development of the smart table.
	\item Various standards that apply to the smart table.
\end{itemize}

 
\subsection{Standards and Other Safety Concerns}
In this section, various electrical and software standards are examined. Also found here is a discussion to the relevance to each standard to our application. Along with various industry standards, also found in this section is a discussion on general safety concerns and procedures to ensure the safety of the group mates at all sections of design and manufacturing. 

\subsubsection{Soldering Standards}
The National Aeronautics and Space Administration (NASA) has a soldering standard, with a PDF called "NASA TECHNICAL STANDARD: SOLDERED ELECTRICAL CONNECTIONS". In this documentation, they discuss several very important key points of proper solder technique. Several diagrams are included, which will be reproduced here in order to lay out exactly how solder should look once distributed on the pad. NASAs document includes several sections for through hole technology, as well as various other surface mount soldering techniques ssuch as round lead termination and other package styles. In this application, we will be dealing with 100 percent either gull wing packages or simple chip components such as 803 package resistors and capacitors. In order to understand soldering standards, it is important to understand the specific language used to describe several facets of soldering. NASA defines a Fillet as a smooth concave buildup of material between two surfaces, e.g. a fillet of solder between a conductor and a solder pad or terminal. With this definition, refer to the following figure.

\begin{figure}[H]
	\centering
	\includegraphics{img/Nasa1}
	\caption[NASA Soldering Methods]{ Proper soldering method \cite{NASA} \textit{Permission submitted to reproduce}.}
	\label{fig:NASASolder}
\end{figure}

In the figure, example A is defined as the maximum acceptable heel fillet flat and round leads. If any more solder is added, the heel fillet (the fillet located "behind" the bend of the gull wing pin of the package) would be destroyed. The concave nature of the fillet must be retained. Example B is a similar situation to example A, but there is almost two little solder. Any less solder would compromise the integrity of the fillet. Example C is the exact same as B, but with a different style of gull wing that is round rather than flat.

Along with information on what solder should look like on the board with regards to a gull wing package, NASA provides several pointers towards how proper hand soldering of printed circuit board should be handled. They specify that pressurized air should never be used to cool solder after working on a solder joint. The solder should always be left to cool under room temperature conditions only. This is because cooling the solder too rapidly could lead to one of several problems, including but not limited to fragile solder joints or bad fillet connections. In regards to solder coverage, the molten solder should be flowed around the conductor and over the pad, give reference to the figure above to decide how much solder should be used in order to properly affix the package to the board. Importantly, there should be no motion between conductors and the pad during soldering or while solder is cooling. This rule is in place for the same reason as above, the fillets could be destroyed and the joints themselves could be compromised if not allowed to set properly.

After the action of soldering to the printed circuit board has been completed, it is then important to inspect the board to ensure that some measure of quality has been maintained. Visual inspection of all solder connections is important to ensure that the board will function as expected. Where visual inspection is not possible, other nondestructive means such as X-ray, fiberscope optics, ect. shall be used. This is in cases where, for example, the pads are located under the part such as particular microprocessors or communication modules. We will not be using any package where typical visual inspection would not be sufficient. Therefore, no complex methods of inspection will be necessary here, but for more robust applications it is important to understand that such options for inspection exist. Once the solder paste has been set and completely cooled, then it is important to perform a continuity test with a multimeter. The multimeter probes should be probed on the pins of the devices, to ensure that each of the pins are connected through the solder to the board, then through the board back through the solder to the pins of the other device that is being connected to. 

For another point of reference, an online reference called Circuit Technology Center is an online resource detailing the proper procedure for soldering components to a board. As previously mentioned, the gull wing package of hardware is the most common type seen on our finished product. As a result, the analysis on the gull wing from this site will be considered. Please refer to the Figure and Table below.


\begin{figure}[h]
	\centering
	\includegraphics[]{img/7-1-3-4_001}
	\caption[NASA Proper Soldering]{ Proper soldering method \cite{NASA} \textit{Permission submitted to reproduce}.}
	\label{fig:NASAP-Soldering}
\end{figure}

\begin{figure}[h]
	\centering
	\includegraphics[]{img/circuitworkstable}
	\caption[Circuit Work]{ Description of above figure \cite{NASA} \textit{Permission submitted to reproduce}.}
	\label{fig:CicuitWorkStable}
\end{figure}

This is simply a more in depth analysis of the particulars of the solder application, giving particular dimensions and exammples of both proper and improper solder paste distribution. Circuit Technology Center also has a brief description of soldering techniques, similar to NASA. An important point that Circuit Technology Center makes is the desire to avoid resoldering. Care should be taken to avoid the need for resoldering, as the quality of the resoldered connection may suffer. The addition of flux will almost always be necessary when resoldering a connection on the board, as simple reheating typically does not produce the same quality connection as would be expected from a fresh solder connection. Adding a small amount of flux before touching the soldering iron to the lead solder allows the solder to settle properly and gives a better chance that the solder will flow properly and that you will see the proper fillets as labeled in the above figures. 

%http://www.ipc.org/ContentPage.aspx?pageid=J-STD-001
%https://nepp.nasa.gov/docuploads/06AA01BA-FC7E-4094-AE829CE371A7B05D/NASA-STD-8739.3.pdf

\subsubsection{Lead Solder Safety}
We intend on using pb63sn37 solder, which means that the component parts of the actual solder are made up of 63 percent lead and 37 percent tin. The danger of lead and lead byproducts are well known in modern science, and as a result careful concern must be taken when working with lead solder. Lead (Pb) is known as a neurotoxin, and can pose several significant chronic health effects. Potential issues include but are not limited to reproductive problems, digestive problems, memory and concentration problems, muscle and joint pain, and more. However, as covered below, as long as solder is handled properly there is minimum hazard to any person working with the solder.

First of all, it must be noted that inherent in soldering in any respect is the danger of burns. For our application and with the particular solder we intend on using, the setting of the soldering iron will be around 750 degrees Fahrenheit. This, of course, can cause fairly serious burns if not respected. As a result, any time a team mate is handling the soldering iron it is important to be very careful, and only use the soldering iron for a short time before returning the iron to the cradle. While a majority of the production will be done using a pick and place machine and an oven (refer to section 4.1.2, board manufacturing concerns), there are still sections of the build that will require hand soldering parts. These include the prototyping that needs to be done, where parts will be attached to a breadboard through soldered wired onto the pins. Also, in the case that the finished product comes off the line and some issue is noticed with the final product (for example a part is misaligned or other issues), at that time hand soldering will be implemented to resolve the issue.

As mentioned in the introduction to this section, the potential health issues of lead have been well documented in the scientific community, and as such there is a decision to make in terms of what type of solder we intend on using for this project. There are several important considerations to be analyzed before making a final decision on solder use. First and foremost, the health aspect should be the main concern in any development procedure. However, in most applications, including ours, it is fairly difficult for typical lead solder to pose any threat to humans. It takes a very large amount of lead solder accidentally ingested to pose any threat. Please reference the next paragraph for an in depth discussion on the safety procedures laid out by several organizations. Another consideration to be made when choosing a particular solder is RoHS compliance. RoHS is discussed in detail in section 1.4.3, however a brief overview will be discussed here. Basically, a device that is in compliance with RoHS has restricted certain chemicals and elements in order to meet foreign export necessities and other health standards. In our case, RoHS is not of major concern because we do not intend on exporting this product internationally at any point, nor do we plan on selling the product at all in any extent. This could change eventually, and at that point the type of solder should be reexamined. For our immediate needs, however, the 63 percent lead base solder is acceptable. This solder is much more friendly to use in all applications, it is typically cheaper and more forgiving of temperature fluctuations in the oven. It is also easier to solder in general, experience has shown that non lead based solders are very picky to temperature changes and require much finer adjustments to flow properly to the pad. Also, they appear almost grainy when soldering and do not look quite as good when completed. In general, if there is no other restraint, it is typically a good idea to use the lead based solder.

In terms of lead solder safety, Carrnegie Mellon University has a document on general safety precautions when working with lead. Of primary concern for CMU is the solder fumes produced by the melting of solder. When the product is in the oven, there is no concern for these fumes as there is an internal fan and ventilation system. However, when hand soldering and repairing parts, the fumes can become an issue. CMU specifies that working in a well ventilated area, or working under a local exhaust ventilation while making every effort to avoid inhaling the fumes should be exercised at all times while working with lead based solder. It is also important to wear proper clothing while soldering of any time, which includes typical lab attire such as closed toed shoes and eye protection. 

General safety precautions to take while actively soldering are as follows. It is important to understand that while soldering with lead, the fumes are typically more likely produced by flux containing rosin. Flux is simply a component that is an alcohol base that allows the solder to flow more evenly and cleanly to any pin or pad on the board. As mentioned previously, it is very important to work in a well ventilated area when soldering. The UCF TI lab is a good example of a proper soldering station, the location is a relatively open area with good ventilation.

 Clearly, it is also very important to not touch the tip of the soldering iron while in operation, as the iron is typically very hot (>750 F for our application). Also, with regards to the iron, ensure that the iron is unplugged and off when leaving the station. Leaving a soldering iron on and heated while unattended is a major fire concern, as the tip could easily fall off the cradle and onto any flammable surface, quickly heating and causing a fire. 
 
 To protect against as many avenues of lead exposure as possible, there are several preventative steps to take. Eye protection is recommended for soldering applications, as solder has a tendency to "spit", or disperse smaller pellets of molten solder into the air. Keeping these out of the users eye is of utmost importance. After completing any work with solder, you should always immediately wash your hands in order to rid your hands of any lead deposits left from working with the solder. Typical skin on lead contact is of no primary health concern, however if lead deposits exist on your hands, it is possible to accidentally ingest them through other avenues. For example, if eating after working with solder, if the hands are not washed the lead can be deposited onto the food.

When soldering, it is of utmost importance to ensure that the circuit you are working on is not live. There are several reasons for this, ranging from the safety of the parts on the board to the protection against electrocution to the user. If using a live circuit, if there is a fine pitch device that you are trying to solder or two pads otherwise close to each other, it is entirely possible to short the two pads together through an accidental solder bridge. This happens rarely when using a stencil and solder paste, however when performed by hand soldering methods, it is more likely to occur. If two pins are accidentally shorted through solder bridge or touching the two pads or pins together with the solder tip (which is typically electrically conductive), any number of problems could occur. Of primary concern, as previously mentioned, is the safety of the user. If working with high voltage applications, the user could become part of the circuit if not properly grounded and as a result suffer an electric shock. Problems also arise with part destruction, where shorting two pins together could destroy individual ICs on the board, or destroy the power supply. Some soldering irons have a ground pin that can be affixed to the circuit or to earth ground in order to prevent such problems from occurring, but this is not a all encompassing solution. The easiest way to prevent all of these issues, and the safest protocol in general is to ensure that the power has been removed from the circuit before working.

Lead soldering waste, like any other lead byproduct, is considered a hazardous material. Therefore, proper disposal methods for such waste must be followed to ensure that the lead is not handled improperly at a landfill, potentially causing issues with groundwater sources. Lead solder must be disposed of in a metal container, and labeled as a hazardous waste. Storage of solder must also be properly handled, with a proper label for the dross (a type of container). Approved labels are provided by UCF EHS if desired. Such labels should describe the potential for danger, clearly stating "contains lead" or some variation thereof. Used solder sponges and contaminated rags must be disposed of in the same way as standard solder, as it contains lead deposits. Follow the above procedure to dispose of these components.

Any further concerns regarding the handle, disposal, or other facets of lead based products can be directed to the Environmental Health and Safety (EHS) at ucf, phone number 407-823-6300.

\subsubsection{RoHS Compliance}

RoHS, pronounced Row Haas, stands for the Restriction of Hazardous Substances Directive. This is a short hand of the Directive on the restriction of the use of certain hazardous substances in electrical and electronic equipment, and was adopted in February 2003 by the European Union. Typically, people associate RoHS primarily with a restraint on lead, and that is the case in most electrical engineering applications. However, RoHS documentation details ten substances that are to be limited: lead, mercury, cadmium, hexavalent chromium, polybromated biphenyls, polybromated diphenyl ether, bis(2-ethylhexyl) phthalate, butyl benzyl phthalate, dibutyl phthalate, and Diisobutyl phthalate. RoHS is closely associated with the Waste Electrical and Electronic Equipment Directive, otherwise known as WEEE. A complete discussion on WEEE will not be included here, however it is important to understand that WEEE sets collection, recycling, and recovery standards for various electronic goods. It is intended to remove various toxic components from electronic parts, such as lead. RoHS does not require specific markings in order to specify that the product is RoHS compliant. However, if shipping to various locations abroad, it is required that you follow the RoHS restrictions. 

Our main concern out of the list of 10 restricted substances on the RoHS list is clearly lead should we decide to be RoHS compliant. Lead is commonly found in solder and solder paste, and is considered widely to be the standard for solder. RoHS specifies that a concentration of < 1000 parts per million is to be maintained over the board to ensure compliance. However, because we are not selling overseas, it is not likely that we will be working towards RoHS compliance. The common alternative for lead solder is a 98 percent tin solder, which is very unruly and produces much less acceptable solder joints. It is, however, important to mention the standard here for future reference, if the product was ever intended to be sent overseas, it would be important to change the manufacturing procedure to ensure RoHS compliance.

%https://en.wikipedia.org/wiki/Restriction_of_Hazardous_Substances_Directive

\subsubsection{C Language Standards}

As a note, there is not an ISO standard C programming/coding style and/or standard defined. As such, there are two notable general purpose coding styles that can be observed and followed. Notably the AT\&T's Indian Hill labs \cite{InHilC} coding style and Nasa's \cite{NasaC} C coding style documentation. Both of these can be pulled from for interesting and useful coding standards to help in the implementation of larger programs and to keep the clutter and code explosion down when building such projects.

AT\&T's Indian Hill labs C coding style reveals some decent styles, while not as important with modern styles and compilers, are still useful in reducing clutter. As such, files longer than 1000 lines are actively discouraged due to handling issues arising from the sheer length of such a file, additionally the file shall not have columns longer than 79 lines as some editors cannot handle and/or display a width properly. Additionally the file structure is specified.
\begin{itemize}
	\item Prologue: A description of what is included in the file and the purpose of each object.
	\item Header Files: The include and reason for include, commented out.
	\item Defines + Typedefs: Assuming these apply to the whole, should be included next.
	\item Globals: This includes global defines and data.
	\item Functions: Last in the list, should come in some sort of meaningful order.
\end{itemize}
Additionally useful are the inclusion of definitions for comments "The comments should describe what is happening, how it is being done, what parameters mean, which globals are used and which are modified, and any restrictions or bugs. " which is explicit and clear in the definition. This along improves the readability of code and transfer of information for another person working on the same code. Additionally proper tabbing and spacing of comments should be followed in this standard and are essentially defined as the same alignment as what the comments are commenting upon and if commenting upon a line and if residing upon the same line, the comments should be right-justified to the same amount. 

Declarations should be also taken care of in a careful manner to reduce possible errors later on and to increase code readability. As such when defining a pointer the individual variables themselves should have the * assigned to them instead of the type-def, this improves readability and avoids the issue of only one variable becoming a pointer variable. Unrelated declarations of variables should be on different lines, even if the same type. Additionally the empty initializer {} should never be used and structure initializations should be fully enclosed by proper parenthesized braces.

Whitespace should be used generously and as such, there should be at the minimum two blank line between the end of one function and the comments for the next. This vastly improves readability when scanning a source document. Additionally there are definitions for styling simple and more complex statements; as such simple statements should only have one statement per line excluding those that are closely related. Compound statements, defined as those included in a list of statements enclosed in a brace, should remain consistent to the predefined local standard. The specification of local standard is due to the fact that C's calls and definitions of various features and functions can changed between hardware and compiler, thus a hard solid standard is near impossible for coding in C. For operators such as the binary comma operator and the ? ternary operator should be avoided in nesting if possible due to the confusion they can cause in ease-of-readability of the source code. Additionally unary operators shouldn't be divided from their singular operand. Though generally all binary operators excluding a few should be separated from their operands by spaces to improve readability.

Naming conventions, though arguable per project, have some predefined styling conventions used in the AT\&T lab C style documentation. 
\begin{itemize}
	\item Names should not have leading or trailing underscores as these should be reserved for system purposes, if private identifiers are needed they should have leading letters for identification.
	\item \#Defines should be in pure CAPS.
	\item Enum are capitalized or in all CAPS.
	\item Function, typedef, and variable names, additionally struct, union, and enum tags should be in lower case. 
	\item Macro functions are in  CAPS, though some lower case macro names are acceptable if they behave like a function call
	\item Avoid names that only are differentiable due to the leading case, as these are near indistinguishable
	\item Additionally avoid name that look like each other, i.e. 1 i I look similar  
\end{itemize}
Additionally not mentioned in the main list, is to try and avoid names that might conflict with various standard library names, thus avoiding issues in which different systems including more library code than expect and also allowing for the easier extension of your program in the future as per normal operating in code design.

Numerical constant definitions should not be hard-coded in-line if possible as this is bad practice for the most part and should be avoided. As such the \#Defines feature should be used in this case, thus also allowing the easier modification and portability of the code in future iterations and testing. Macro parameters and operator-precedence problems can occur when parameters are not properly enclosed inside parentheses. This is hard to avoid and thus it is good practice when possible to write macro that evaluate any input parameters exactly once, though this is not always possible. Additionally when using macros, globals should be avoided as local declarations may be hidden and thus led to undefined and undesirable behavior.

Conditional compilation is another area of focus to help with machine dependencies, debugging, and for setting certain options at compile-time.  By use of the iddef command, more portable code can be generated with less hassle and simplifies debugging. Enum style definitions are also specified and defined; if enums are used the first enum constant should have a non-zero value or the first constant should indicate an error. Thus initialized values can be caught this way reducing debug time. Also included in the definitions are further readings on portability and machine specific coding which is of little relevance to this project. The focus was also on AT\&T's coding style instead of NASA's due to its higher value of relevance.