Week 6. Electonics design¶
Individual Assignment¶
Electronics Design individual assignment includes circuit simulation, the purpose of which is to test the circuit’s operation in a software environment in advance, ensuring that all components are connected correctly, the calculations are accurate, and the circuit will function as intended before physical fabrication. During the assignment, Onik Babajanyan explained Ohm’s Law to me, which describes the relationship between voltage, current, and resistance and is one of the fundamental laws for calculating electrical circuits.
According to Ohm’s Law, current is equal to voltage divided by resistance (I = V / R). To properly understand this relationship, it is important to distinguish the symbols and measurement units: R is resistance and is measured in ohms (Ω), I is current and is measured in amperes (A), and U or V is voltage measured in volts (V). The relationship between these quantities allows calculation of any unknown parameter in a circuit if the other two are known, which is important both for theoretical analysis and for circuit design and simulation.
Circuit Description¶
The given electrical circuit consists of a 5V voltage source and a single resistor R = 1Ω connected in a closed loop. In the circuit, current flows from the positive terminal of the source through the resistor and returns to the negative terminal. This configuration represents the simplest single-resistor electrical circuit and is used as a classical example to demonstrate the application of Ohm’s Law.

Current Calculation¶
The current in the circuit is calculated using Ohm’s Law, which states that current equals voltage divided by resistance. For this circuit, the voltage is U = 5V and the resistance is R = 1Ω. Substituting these values into the formula gives I = U / R = 5 / 1 = 5A. Therefore, the current flowing through the circuit is 5 amperes. Using this circuit, we calculated the amount of electric current flowing through the circuit, which represents the charge passing per unit time. Since the circuit contains only one resistor, the entire voltage drops across it, which corresponds to the theoretical principles of simple circuits.
Analysis and Conclusion¶
The analysis of this circuit shows that current is directly proportional to voltage and inversely proportional to resistance, which fully agrees with Ohm’s Law. Since the resistance value used is small (1Ω), the resulting current in the circuit is large (5A). This confirms that when resistance is small, current increases significantly, and when resistance is large, current decreases.
This simple circuit makes it possible to theoretically understand the relationship between voltage, current, and resistance and serves as a fundamental example for analyzing and designing electronic circuits. Such preliminary calculations are an important stage before simulation and physical implementation, as they help predict circuit behavior and prevent possible errors or component damage.
Circuit Simulation in LTspice¶

The circuit was recreated in LTspice to verify its operation through simulation and to confirm the theoretical calculations. A DC voltage source set to 5V was placed, and a 2Ω resistor was connected in series in the circuit. The negative terminal of the source was connected to ground to define the reference node. To run the simulation, a transient analysis command was added with a duration of 1 second. As a result, the current flowing through the circuit was observed to be about 2.5A, which fully matches the theoretical value calculated using Ohm’s law: I = V / R = 5 / 2 = 2.5A.

The current value was measured in LTspice using the probe tool by clicking on the corresponding component, which displayed both the graph and the precise numerical value.
In the second experiment, the resistance value was changed to 2kΩ. In this case, the current became 2.5mA, meaning it decreased by a factor of 1000, because the resistance became 2000Ω instead of the previous 2Ω. This also agrees with Ohm’s law: I = 5V / 2000Ω = 0.0025A = 2.5mA.

In the third experiment, the circuit was modified to form a voltage divider circuit. In this case, two resistors were connected in series: R₁ = 2kΩ and R₂ = 2kΩ, while the voltage source remained the same at 5V. In a series connection, the total resistance equals the sum of the resistances: R_total = R₁ + R₂ = 2000Ω + 2000Ω = 4000Ω.
According to Ohm’s law, the current flowing through the circuit is: I = V / R = 5 / 4000 = 0.00125A = 1.25mA.

From the simulation graph, a current of about 1.25mA was observed, which fully matches the theoretical calculation. Since the resistors are equal, the voltage is divided equally, meaning each resistor has about 2.5V across it. This confirms the operating principle of the voltage divider and shows that the simulation results match the theoretical model.
The voltage divider circuit is used when it is necessary to reduce a higher voltage to a level that is safe for a device. For example, if we have a board that operates at a maximum voltage of 3.3V (such as a Xiao RP2040 microcontroller module), and we connect it directly to a 12V battery, the device may be damaged because it would receive a voltage higher than its allowed limit. In such a case, a voltage divider is used to divide and reduce the input 12V so that the output becomes a safe level, for example around 3.3V. This helps protect electronic components and ensures their correct operation.
This section presents the application of a voltage divider circuit whose purpose is to reduce a high input voltage and make it safe for a microcontroller input. The corresponding calculations are provided, and it is explained how the resulting voltage values can be used to monitor the condition of a power source, such as the charge level of a battery. We have a 12V battery, and it is necessary to monitor whether it is properly charged. To do this, the voltage must be supplied to a microcontroller so it can measure the battery voltage. When fully charged, the battery provides about 12.5V, and when the charge decreases, it may drop to around 11.5V. However, a microcontroller input pin can typically tolerate only about 3.3V maximum, so this voltage cannot be connected directly, as it could damage the device. To solve this problem, a voltage divider circuit is used. For example, let us choose the upper resistor as R₁ = 20kΩ. We must select the second resistor so that when the input voltage is 12.5V, the output becomes about 3.3V. The voltage divider formula is:
Vout = Vin * R2 / (R1 + R2)
The divider circuit was calculated in order to reduce a high input voltage and obtain a safe output voltage for the microcontroller. The supply source was Vin = 12V, and two series resistors were chosen: R₁ = 20kΩ and R₂ = 2kΩ. The lower node of the circuit was connected to GND as the reference node.
First, the current flowing through the circuit was calculated:
I = Vin / (R1 + R2)= 12 / (20000 + 2000)= 12 / 22000
Next, the output voltage across the second resistor was calculated:
Vout = I * R2
or directly using the divider formula:
Vout = Vin * R2 / (R1 + R2)= (12 * 2000) / 22000= 1.09 V

The result is approximately 1.09V, which is significantly lower than 3.3V and therefore safe for a microcontroller input. This confirms that the selected resistor ratio is appropriate for reducing high voltage for measurement or sensing purposes.
If the measured voltage at the microcontroller input pin is approximately 1.09V, this indicates that the source voltage at the divider input is about 12V, meaning the battery is fully charged (around 100%). This matches the calculation, since with the chosen resistor ratio a 12V input is divided to about 1.09V.
If the battery voltage decreases during operation and becomes 11V instead of 12V, the divider output voltage will also decrease. According to the calculation:
Vout = Vin * R2 / (R1 + R2) = 11 * (2 / 22) = 1 V
Thus, if the microcontroller input pin measures about 1V (instead of 1.09V), a condition can be defined in software indicating that the battery is in a discharged state, for example around 20% charge. In this way, the microcontroller can monitor battery status simply by measuring the divider output and comparing it to predefined threshold values.
If we change the input voltage to 11V and use a divider with R₁ = 20kΩ and R₂ = 5kΩ, then according to the formula:
Vout = Vin * R2 / (R1 + R2)
we obtain:
Vout = 11 * (5 / (20 + 5))=11 * (5 / 25)=2.2 V
This means that if the microcontroller input pin reads about 2.2V, the program can interpret this as a drop in battery voltage. In that case, the microcontroller can respond—for example, by generating a sound alert, turning on a red LED indicator, or sending a warning signal. This approach allows automatic monitoring of battery status and timely notification when the charge decreases.
Capacitor in Electronic Circuits¶
A capacitor is one of the fundamental components used in electronic circuits. Its main function is to store electrical energy temporarily in the form of an electric field. A capacitor consists of two conductive plates separated by an insulating material called a dielectric. When voltage is applied across the plates, electric charge accumulates on them, allowing the capacitor to store energy.
The ability of a capacitor to store charge is called capacitance and is measured in farads (F). In practical electronics, smaller units such as microfarads (µF), nanofarads (nF), and picofarads (pF) are more commonly used.
The basic relationship that describes a capacitor is:
Q = C × V
where Q is the stored charge (coulombs), C is the capacitance (farads), and V is the voltage across the capacitor (volts).
Capacitors are widely used in electronic circuits for several purposes. One common application is filtering and smoothing voltage in power supply circuits. When a capacitor is connected across a power supply line, it can store energy and release it when the voltage temporarily drops, helping stabilize the voltage level.
Another important use of capacitors is decoupling or bypassing in microcontroller circuits. In such cases, a small capacitor (for example 0.1µF) is placed between the power supply (VCC) and ground (GND) close to the microcontroller. This helps remove noise and sudden voltage fluctuations that may affect the operation of the microcontroller.
Capacitors are also used in timing circuits, signal filtering, and energy storage applications. Because they can charge and discharge over time, they are often combined with resistors to form RC circuits that control timing behavior in electronic systems.
Understanding the behavior of capacitors is important when designing electronic circuits, especially when working with microcontrollers and sensors, because they help improve stability, reduce noise, and protect sensitive components.
Capacitor in a Parallel Circuit¶
The diagram below shows a simple electronic circuit that includes a capacitor. On the left side of the circuit there is a 12V battery, which acts as the power supply. To the right of the battery a capacitor is connected, and further to the right there can be a load, for example a motor or a small lamp/LED.

In this circuit the capacitor is connected in parallel with the power supply. When the circuit is powered, current does not continuously flow through the capacitor as it does through a resistor. Instead, the capacitor stores electrical energy between its plates.
The ability of a capacitor to store energy is called capacitance (C). When voltage is applied across the capacitor, an electric field is created between its two conductive plates. During this process positive charges accumulate on one plate, while negative charges accumulate on the other plate. From physics we know that opposite charges attract each other, and this attraction forms the electric field where the energy is stored.
In this configuration the capacitor acts as a temporary energy storage element. While the circuit is operating, the capacitor charges and stores energy. If later a device is connected to the circuit or if there is a voltage fluctuation or drop, the capacitor can discharge and help compensate for the voltage drop, keeping the circuit more stable.
For this reason, capacitors are widely used in electronic circuits for voltage stabilization, noise reduction, and temporary energy storage.
Power Supply Noise and Capacitor Filtering¶
In real electronic systems, a power source is never ideal. Every battery or power supply has a small internal resistance called parasitic resistance. In this simulation the 12V battery is modeled with a very small internal resistance of 0.1Ω. Additionally, a small AC signal of 0.4V is added to represent noise or ripple that can appear in real power supplies.
No Capacitor (First Simulation)¶

In the first simulation the circuit includes a 12V power source with a small AC component and a 5kΩ resistor load. Because the source contains a small AC signal, the output voltage is not perfectly stable.
From the graph we can see voltage oscillations around 12V. This means that the voltage is slightly increasing and decreasing over time. In electronic systems this behavior is called power supply noise or ripple.
Such oscillations can be dangerous for electronic devices, especially for sensitive circuits such as microcontrollers, sensors, or computers. A stable power supply is very important for reliable operation.
In real life, the electricity in our homes is AC power, which varies sinusoidally between positive and negative values (for example about −220V to +220V in many regions). When we connect devices like a laptop charger, the charger converts this AC voltage into a stable DC voltage, for example 12V or 19V, using rectification and filtering circuits.
If this conversion and filtering is not done correctly, the output voltage may contain large fluctuations, which can damage electronic devices such as laptops or embedded systems.
Capacitor Filtering (Second Simulation)¶

In the second simulation a capacitor is connected in parallel with the power supply and the load. The capacitor acts as a filter for the power supply.
When the voltage slightly increases, the capacitor stores energy by charging. When the voltage drops, the capacitor releases energy by discharging. Because of this behavior, the capacitor helps smooth the voltage.
As we can see in the second graph, the voltage oscillations become much smaller, and the output voltage becomes almost a straight line near 12V. This means the power supply is now much more stable.
For this reason, capacitors are widely used in electronic circuits as decoupling or filtering capacitors, helping reduce noise and stabilize the power supply voltage.
KI Cad¶

This week I worked in KiCad, focusing on the electronics design for my Final Project. I explored the main tools of the software and started creating the schematic for my circuit. I added the necessary electronic components and began connecting them to understand how the system should work.

At this stage, my main goal was to define the correct connections between the microcontroller and the other components needed for the project. Using KiCad, I created the schematic and checked the connections in preparation for the PCB design.
This process helped me better understand how to turn my project idea into a real electronic circuit and prepare for the next step, which is designing the PCB.
At this stage, I decided to focus on designing the electronics for my Final Project. The goal of the project is to create a system that can monitor environmental conditions, control lighting, and display information on a screen. For this purpose, I needed several key components: a light sensor, a temperature and humidity sensor, an LCD display, and 12V LED strip lights.
Before starting the schematic design in KiCad, I first checked which of these components were available in our lab. This was an important step because it allowed me to design the circuit using components that I could actually use later when producing the PCB. After selecting the components, I carefully studied their datasheets and pinouts in order to understand how they work, their voltage requirements, and how they should be properly connected to the microcontroller.
As the main controller of the system, I used the Seeed Studio XIAO RP2040 microcontroller module. This board is compact, has enough input and output pins, and supports several communication protocols such as I2C, which is useful for connecting the LCD display.

While designing the power system, I planned for the entire board to be powered by a 12V adapter.

The 12V power enters the board through a power jack connector. Since the microcontroller and some of the sensors require 5V to operate, it was necessary to regulate the voltage. For this purpose, I used the NC1117 Voltage Regulator,

which converts the 12V input into a stable 5V output. Capacitors were added at the input and output of the regulator to stabilize the voltage and reduce electrical noise.
After establishing the power circuit, I connected the sensors and other components.
To detect the ambient light level, I used a Photoresistor (LDR).

A photoresistor changes its resistance depending on the intensity of the light falling on it. This sensor is connected to the microcontroller so that the system can read changes in light levels and decide when to turn the LED lighting on or off.
For measuring environmental conditions, I used the DHT11 sensor.


This sensor provides digital data about the surrounding temperature and humidity. It is connected to a digital pin of the microcontroller and powered with 5V.

To display the collected data to the user, I used an I2C LCD Display.

The LCD is connected to the microcontroller using the I2C communication protocol, which requires only two wires: SDA and SCL. This approach helps save microcontroller pins and simplifies the wiring.
The system also includes 12V LED strip lights that will be used for lighting control.

Since the microcontroller pins cannot directly drive high-voltage loads, the LED strips are controlled using MOSFET transistors. The MOSFETs act as electronic switches: the microcontroller sends a small control signal to the gate, which then allows the transistor to switch the 12V LED strip on or off safely.
After finishing the schematic design, the next step was assigning footprints to all the components. The footprint defines how each component will be physically placed and soldered onto the PCB.
Once the footprints were assigned, I moved to the PCB design stage in KiCad. During this stage, I carefully placed the components on the board so that the connections would remain short and well organized. Proper component placement is important because it simplifies routing and improves the overall reliability of the circuit.
After positioning the components, I routed all the electrical traces between them. I tried to keep the traces as short and organized as possible while avoiding unnecessary crossings. In addition, I added a ground plane connected to GND, which helps reduce electrical noise and improves the stability of the system.
During the design process, I also considered the possibility of expanding the system in the future. For this reason, I left several free sensor pins on the microcontroller that can be used later to connect additional sensors.

These pins are brought out to connectors, which will make it easier to add new modules without redesigning the entire board. This approach makes the system more flexible and modular, allowing future integration of additional sensors such as motion sensors, gas sensors, or other environmental monitoring devices.
The final PCB design includes connectors for the microcontroller, sensors, LCD display, LED strips, and the power input. After completing this stage, the board is ready for manufacturing and further assembly.
