Arduino Microcontroller Circuitry and FreeCAD 3D Parametric Modeling Study Notes
Single LED Blinking Circuit Architecture

Circuit Components and Pin Identification
A – Negative Wire: Carries electric power back to the power source (the Arduino board).
B – LED (Light Emitting Diode): A specialized type of diode that emits light when electric current flows through it.
C – Resistor: Controls and limits the amount of current flowing through a circuit component. Without a resistor, excessive current could flow and burn out components such as LEDs, sensors, or the Arduino board itself.
D – Positive Wire: Carries current and signals from the power source (Arduino board) to the circuit components (LED).
E – Pin 5: Configured as an
OUTPUTsignal pin.F – Arduino Board: The main controller of the circuit.
G – GND Pin: Ground reference point in an electrical circuit from which voltages are measured, serving as a common return path for electric current.
Arduino C++ Source Code Breakdown
int ledPin = 5;defines digital pin 5 as the designated LED output pin.void setup()runs once upon power-up or reset; configuresledPinas an output viapinMode(ledPin, OUTPUT);.void loop()executes repeatedly in an infinite sequence after initialization.digitalWrite(ledPin, HIGH);sends to the pin, turning the LED ON.delay(5000);pauses code execution for (5 seconds).digitalWrite(ledPin, LOW);sends to the pin, turning the LED OFF.delay(5000);pauses code execution for another .
Code Analysis & Behavioral Principles
Role of Pin Definition (
int ledPin = 5;): Assigns pin number 5 to the identifierledPinfor system-wide reference.setup()vs.loop()Operational Difference:setup()runs once to initialize hardware settings and pin modes.loop()executes continuously to control interactive and timing behaviors.Role of
HIGHSignal State: Outputs a positive voltage () to drive power to the connected component.Role of
LOWSignal State: Drops the output voltage to (ground), de-energizing the component.Line 12 Execution (
digitalWrite(ledPin, LOW);): Deactivates the LED following its active state duration.
Dual LED Push Button Control System

Circuit Hardware Configurations
Green LED: Connected to digital pin 5.
Red LED: Connected to digital pin 6.
Green Push Button: Connected to digital pin 2.
Red Push Button: Connected to digital pin 3.
Internal Pull-Up Resistors
Using
INPUT_PULLUPmode inpinMode()engages the microcontroller's built-in internal pull-up resistor.When the push button is unpressed, the input pin reads
HIGH().When the push button is pressed, the circuit connects to ground and reads
LOW().
Dual LED Control Program Code
int greenLED = 5;andint redLED = 6;define the output LED pins.int greenButton = 2;andint redButton = 3;define the button input pins.pinMode(greenButton, INPUT_PULLUP);enables internal pull-up configuration for digital pin 2.pinMode(redButton, INPUT_PULLUP);enables internal pull-up configuration for digital pin 3.digitalRead(greenButton);reads the current logic level of pin 2.If
greenState == LOW,digitalWrite(greenLED, HIGH);turns on the Green LED; otherwisedigitalWrite(greenLED, LOW);turns it off.If
redState == LOW,digitalWrite(redLED, HIGH);turns on the Red LED; otherwisedigitalWrite(redLED, LOW);turns it off.
Potentiometer-Controlled Servo Motor System

Circuit Component Identifiers
A – Signal Output Pin: Digital pin 9, which transmits pulse-width control signals to the servo motor.
B – Arduino Board: Main controller that processes incoming potentiometer signal values and computes corresponding position output signals.
C – Potentiometer: Variable resistor functioning as a manual position controller or angle input device for the servo.
D – Servo Motor: Specialized motor capable of rotating to precise angular positions and maintaining that target position.
E – Power Supply Wire: Delivers operating power from the Arduino board to the servo motor.
F – Ground (GND) Wire: Completes the electrical circuit back to the Arduino board.
G – Potentiometer Signal Wire: Transmits raw variable analog voltage signals from the potentiometer to analog pin
A0.
Potentiometer Servo Program Breakdown
#include <Servo.h>imports the default Arduino Servo motor library.Servo myServo;instantiates a servo control object namedmyServo.int potPin = A0;designates analog pinA0for reading potentiometer input values.myServo.attach(9);assigns digital pin 9 as the output channel for servo pulse generation.val = analogRead(potPin);reads the raw 10-bit analog voltage input value ranging fromval = map(val, 0, 1023, 0, 180);converts the analog range into an angular rotation range ofmyServo.write(val);commands the servo motor shaft to rotate to the mapped angle valueval.delay(15);adds a delay of to ensure continuous, smooth movement without physical motor jitter.
Code Functionality & Analysis
Library Inclusion (
#include <Servo.h>): Loads predefined hardware driver functions needed to manage servo control timing.Object Instantiation (
Servo myServo;): Prepares an operational object instance capable of sending position commands.Analog Pin Definition (
int potPin = A0;): Specifies the physical channel connected to the center wiper of the potentiometer.Pin Attachment (
myServo.attach(9);): Binds the instantiated servo object to digital PWM-capable pin 9.Comparative Execution (
setup()vsloop()):setup()attaches pin configuration once initialization occurs;loop()repeatedly samples analog inputs and converts them into positional updates in real-time.Motion Smoothing Delay (
delay(15);): Gives the physical mechanical assembly to move toward the target angle before processing the next sensor read.
Automated Servo Sweep Circuit

Sweep Motion Logic
The circuit utilizes a single servo motor connected to digital pin 9 driven continuously across its full range of motion without manual sensor intervention.
Program Code Analysis
for (int angle = 0; angle <= 180; angle += 1)iterates the position variable from in increments ofInside the forward loop,
myServo.write(angle);updates target position anddelay(15);provides time for step completion.for (int angle = 180; angle >= 0; angle -= 1)decrements the position variable back from in step decrements ofInside the reverse loop,
myServo.write(angle);updates target position anddelay(15);maintains matching step timing.
Dual Servo Control with Dual Potentiometers

System Layout & Structural Mapping
A – Potentiometer 1: Connected to analog pin
A0; controls the angular position of Servo 1 (Pin 9).B – Potentiometer 2: Connected to analog pin
A1; controls the angular position of Servo 2 (Pin 10).C – Arduino Board: Central processor reading dual analog inputs and generating independent signal outputs.
Dual Servo Code Implementation
Servo servo1;andServo servo2;instantiate two distinct servo objects.int potPin1 = A0;andint potPin2 = A1;configure dedicated analog channels.servo1.attach(9);connects Servo 1 signal line to digital pin 9.servo2.attach(10);connects Servo 2 signal line to digital pin 10.val1 = analogRead(potPin1);reads potentiometer 1 ().val2 = analogRead(potPin2);reads potentiometer 2 ().val1 = map(val1, 0, 1023, 0, 180);translates potentiometer 1 values into a range ofval2 = map(val2, 0, 1023, 0, 180);translates potentiometer 2 values into a range ofservo1.write(val1);sets target shaft position for Servo 1.servo2.write(val2);sets target shaft position for Servo 2.delay(15);provides joint delay for hardware synchronization.
Functional Questions & Detailed Explanations
Line 1 Role (
#include <Servo.h>): Imports the standard Servo library to manage timing signals.Line 23 Function (
val1 = analogRead(potPin1);): Measures analog input voltage from Potentiometer 1 and returns an integer betweenPurpose of Line 27 (
val1 = map(val1, 0, 1023, 0, 180);): Rescales the numerical range from standard 10-bit analog conversion into proportional degrees of shaft rotation ().Line 31 Function (
servo1.write(val1);): Transmits position commands to rotate Servo 1 to mapped angleval1.Line 15 vs Line 21 Execution: Line 15 (
servo1.attach(9);) runs once insetup()for pin configuration. Line 21 (void loop()) opens the main block running continuously to support real-time user input.Setup vs. Loop Distribution:
setup()handles single-pass system configuration (attaching hardware pins), whileloop()continuously monitors user controls and updates servo outputs.
Dual Servo Control with Push Buttons

System Specifications & Pin Assignments
button1connected to digital pin 2 withINPUT_PULLUPmode enabled.button2connected to digital pin 3 withINPUT_PULLUPmode enabled.servo1attached to digital pin 9.servo2attached to digital pin 10.Default Rest Angles:
originalAngle1 = 90() andoriginalAngle2 = 90().Actuated State Angles:
pressedAngle1 = 150() andpressedAngle2 = 30().
Control Code Program Logic
During
setup(), both servos move to their default original positions () viaservo1.write(originalAngle1);andservo2.write(originalAngle2);.loop()constantly evaluates digital inputs:If
digitalRead(button1) == LOW(Button 1 pressed),servo1moves to ; otherwise it returns toIf
digitalRead(button2) == LOW(Button 2 pressed),servo2moves to ; otherwise it returns to
Execution pauses for
delay(15);at the end of each loop iteration for smooth motion transition.
FreeCAD 3D Modeling Fundamentals
Lesson 3: Polyline Tool, Geometric Constraints, and 3D Padding
Polyline Tool:
Creates connected series of lines and arcs within a continuous sketch shape without exiting the tool.
Connects the final endpoint directly to the initial starting point to generate fully closed 2D profiles.
Step-by-Step Procedure:
Open the Sketcher Workbench.
Select Create New Sketch and pick an alignment plane.
Select the Polyline tool (represented by a zig-zag line icon).
Click inside the viewport to set the primary starting point.
Click sequentially to construct secondary vertices and segments.
Right-click or press
Escto terminate line creation.
Applications: Ideal for sketching complex structural profiles, bracket geometry, frames, and custom polygons.
Constraints:
Parametric rules that strictly specify shape geometry, spatial positions, and numerical dimensions of sketch elements.
Geometric Constraints: Govern structural properties (e.g., Horizontal, Vertical, Parallel, Equal, Tangent, Perpendicular).
Dimensional Constraints: Govern exact measurements (e.g., Distance, Radius, Angle).
Visual Verification: A fully constrained sketch turns green, indicating complete geometric stability suitable for 3D operations.
Padding (Extrusion):
Converts a 2D closed planar sketch into a 3D solid model by extruding thickness or height.
Step-by-Step Procedure:
Complete and close the active 2D sketch.
Switch from Sketcher to the Part Design Workbench.
Select the target sketch and click the Pad icon.
Input the target extrude length (e.g., ).
Select OK to generate the solid feature.
Lesson 4: Datum Planes, Construction Lines, and Material Removal (Pockets)
Datum Planes:
Custom reference planes created at arbitrary offset distances or angular orientations when standard primary planes (XY, XZ, YZ) are inadequate.
Provide new attachment surfaces for drawing sketches on angled, offset, or complex model geometry.
Step-by-Step Procedure:
Access the Part Design Workbench.
Select Create Datum Plane.
Click a reference face or existing plane.
Adjust numerical offset, angular inclination, or rotation parameters.
Click OK to instantiate the plane.
Construction Lines:
Auxiliary reference lines used to guide, align, and position geometry elements within a sketch.
Rendered via the blue dashed-line toggle icon.
Hidden automatically during 3D operations and do not appear in the final solid model.
Pocket Tool:
Serves as the inverse feature of the Pad tool by subtracting or cutting material away from existing solid geometry.
Used to produce custom holes, internal cavities, cutouts, and surface grooves.
Step-by-Step Procedure:
Select a solid model face or datum plane and initiate a New Sketch.
Draw the closed 2D profile to be subtracted.
Click Pocket and specify the cut depth or select Through All.
Click OK to execute the subtraction.
Lesson 5: Edge Conditioning using the Fillet Tool
Fillet Tool:
Rounds off sharp linear edges or corner vertices on a 3D solid body.
Enhances mechanical structural strength while eliminating sharp stress concentration points.
Step-by-Step Procedure:
Highlight target 3D object edges or corners.
Click the Fillet Tool (represented by a rounded-edge icon).
Input the desired radius measurement value.
Click OK to generate rounded edge geometry.
Engineering Benefits: Mitigates internal stress concentrations along edges, improves aesthetic finish, and enhances manufacturing suitability.
FreeCAD Review and Assessment Solutions
Multiple Choice Questions & Key Answers
The Polyline tool is used to:
Answer: b) Connect multiple lines
A fully constrained sketch turns:
Answer: c) Green
Padding converts a sketch into a:
Answer: c) 3D solid
A datum plane is used to:
Answer: b) Create reference surfaces
Construction lines are used for:
Answer: b) Reference only
The Pocket tool is used to:
Answer: b) Remove material
Which workbench allows you to pad a sketch?
Answer: c) Part Design
Fillets are used to:
Answer: b) Round edges
Which constraint ensures two lines are at ?
Answer: c) Perpendicular
Which of the following is a dimensional constraint?
Answer: b) Radius
True or False Statements & Answers
A polyline can include arcs and lines.
Answer: True
Padding removes material from a model.
Answer: False
Constraints help define geometry accurately.
Answer: True
Datum planes are only decorative.
Answer: False
Construction lines appear in the final solid.
Answer: False
The Pocket tool cuts material away.
Answer: True
Fillets are used to make sharp corners.
Answer: False
A fully constrained sketch turns green.
Answer: True
Datum planes help create new sketch surfaces.
Answer: True
The Polyline tool can create closed shapes.
Answer: True
Conceptual "What" Questions & Answers
What is a polyline? A drawing tool used to create continuous connected lines and arc segments.
What does the Pad tool do? Converts a 2D sketch into a 3D solid by extruding material.
What is a datum plane used for? Creates custom reference surfaces for drawing sketches at custom angles or offsets.
What is the Pocket tool used for? Removes material from a solid object to make holes, slots, or cutouts.
What does a fillet do to edges? Rounds sharp model edges or corners to smooth geometry.
Analytical "Why" Questions & Answers
Why is constraint application important? Ensures sketch geometry is accurately dimensioned, stable, and predictable.
Why do designers use construction lines? Assists in precisely aligning and positioning sketch geometry without altering solid extrusions.
Why are datum planes needed? Allows features to be sketched on inclined or offset surfaces where standard planes are unavailable.
Why are fillets added to designs? Smooths sharp edges to reduce stress concentration and improve structural strength.
Why should a sketch be fully constrained before padding? Prevents geometry errors, unpredicted shifts, and model instability during 3D solid operations.
Procedural "How" Questions & Answers
How do you activate the Polyline tool? Click the Polyline icon inside the Sketcher Workbench.
How do you create a datum plane? Open Part Design Workbench, click Create Datum Plane, and select a reference surface to offset or tilt.
How do you remove material using the Pocket tool? Create a sketch on a face, open the Pocket tool, set depth parameters, and confirm with OK.
How do you apply a fillet? Select target edges on a 3D model, activate the Fillet tool, input the radius, and click OK.
How do you know your sketch is fully constrained? All lines and curves in the Sketcher viewport turn green.
Contextual "When" Questions & Answers
When should you use the Pad tool? When turning a fully constrained 2D profile into a 3D solid feature.
When do you use the Pocket tool? When material must be removed or cut out from existing 3D solid geometry.
When are construction lines helpful? When guide lines are required to position geometry without affecting solid features.
When is a sketch ready for padding? When all geometric elements are fully constrained and the sketch profile is closed.
When should fillets be applied? After the primary 3D base solid features have been completely generated.