<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="3.10.0">Jekyll</generator><link href="https://saper6569.github.io/blog-site/feed.xml" rel="self" type="application/atom+xml" /><link href="https://saper6569.github.io/blog-site/" rel="alternate" type="text/html" /><updated>2026-03-16T21:17:40+00:00</updated><id>https://saper6569.github.io/blog-site/feed.xml</id><title type="html">Sanija Perera - Engineering Blog</title><subtitle>Personal engineering blog covering electrical engineering, projects, and technical insights</subtitle><author><name>Sanija Perera</name></author><entry><title type="html">IODetect pcb update</title><link href="https://saper6569.github.io/blog-site/posts/2026/03/16/IODetect-PCB-Update/" rel="alternate" type="text/html" title="IODetect pcb update" /><published>2026-03-16T00:00:00+00:00</published><updated>2026-03-16T00:00:00+00:00</updated><id>https://saper6569.github.io/blog-site/posts/2026/03/16/IODetect-PCB-Update</id><content type="html" xml:base="https://saper6569.github.io/blog-site/posts/2026/03/16/IODetect-PCB-Update/"><![CDATA[<h1 id="issues-with-previous-design">Issues with previous design</h1>

<p>The main issue from the last print was that the pcb had signal traces that lied under and near the rf antenna of the eps32. The original plan was that this was not being used but it was later decided that the esp32 would be transmitting data using its 2.4GHz capabilities. I was aware that thius would be an issue as this could cause interfearance that would effect the signal integrity.</p>

<p>The previous design, which is inlcuded below, used a single layered design due to the contraints set by the pcb printer that we have access to. This constriant made me opt for a layout that routed under and near the antenna.</p>

<p><img src="/blog-site/assets/images/2026-03-02%20schem.png" alt="Schematic image" /></p>
<center>Schematic</center>

<p><img src="/blog-site/assets/images/2026-03-02%203d%20layout.png" alt="3d image" /></p>
<center>Layout</center>

<p>Another lkarge issue was that the measurements for the esp32 were off by around 1.5mm, specifically the distance between the pin rows. I ended up having to update the footprint in the changed pcb. We used third part esp32 which somehow had a varied size from the sizes that were stated on the espressif website. To fix thios the new measurements came directly from the esp32.</p>

<h1 id="main-change">Main Change</h1>

<p>I ended up getting permisision from my team lead to update the design to use two layers. The new design has a larger size but now has no routing under the antenna.</p>

<p>The other main change I added was large copper pours for heat reduction. The coppper pours were added for ground and power planes specificcally in the higher current traces.</p>

<p><img src="/blog-site/assets/images/2026-03-16%203d.png" alt="Layout image" /></p>
<center>PCB layout after changes</center>

<p><img src="/blog-site/assets/images/2026-03-16%20pcb.png" alt="3d image" /></p>
<center>3d veiw after changes</center>

<h1 id="upcoming-work">Upcoming Work</h1>

<p>In the coming weeks we have to solder the components onto the board, and do  testing on each individual components to ensure all the systems are working as intended. We also  plan on fionalizing the pump system as well as the hardware code.</p>]]></content><author><name>Sanija Perera</name></author><category term="IO Detect - QBIT" /><category term="Project" /><category term="Design Team" /><summary type="html"><![CDATA[Issues with previous design]]></summary></entry><entry><title type="html">Sound System Input Stages</title><link href="https://saper6569.github.io/blog-site/posts/2026/03/10/Sound-System-Input-Stage/" rel="alternate" type="text/html" title="Sound System Input Stages" /><published>2026-03-10T00:00:00+00:00</published><updated>2026-03-10T00:00:00+00:00</updated><id>https://saper6569.github.io/blog-site/posts/2026/03/10/Sound-System-Input-Stage</id><content type="html" xml:base="https://saper6569.github.io/blog-site/posts/2026/03/10/Sound-System-Input-Stage/"><![CDATA[<h1 id="sound-system-project">Sound System Project</h1>

<p><strong>Disclaimer:
This project involves high-power electronics, including circuits that can carry dangerous voltages and currents. Improper design, construction, or handling may result in electric shock, burns, fire, equipment damage, or personal injury. The information shared here is for educational and documentation purposes and is not a complete guide. Therefore it should not be followed blindly. Stay safe.</strong></p>

<p>In the past couple of days during my spare time I have been working on the input stages of the sound system. this is everything leading to the amplifier, more specifically: headphone jack input, volume control, eq and buffering.</p>

<h2 id="changes-from-original-plan">Changes From Original Plan</h2>
<p>I ended up changing the process order, as research led to me finding that it is more common to buffer the input, following this with volume control and finally the eq stage. The buffer early on would prevent loading effects on the input device by providing high impedance.</p>

<p>Another major difference I made was switching to a dual power supply. My original plan was to use dc coupling to push signals to entirely positive voltage range and operate rail to rail op amps with single supply. However I noticed that dual power supplies cost relatively the same as single supply and therefore I though it would save the hassle of having to add dc offsets and decided to just go with the dual power supply.</p>

<h1 id="input-stage">Input Stage</h1>

<p><img src="/blog-site/assets/images/2026-03-10%20input.png" alt="Input Schematic image" /></p>

<center>Input schematic</center>

<p>The first step in the audio processing is the headphone jack. this acts as the entrance point for audio signals into the system. I found that modern devices use a standard called CTIA for TRRS jacks. TRRS are the headphone jacks that include ground, 2 stereo lines and a microphone line. They are compatible with TRS as well (no microphone line).</p>

<p>After the signal enters the headphone jack I use a filter to remove any unwanted noise. I made sure that the cut-off frequency of the filter wouldn’t remove any frequencies from 20hz-20khz to ensure no audible cut-off. I found that isn’t fully necessary but I did it just in case. I also included a 10uF capacitor in series with the buffer. The coupling capacitor blocks any DC offset from the source so the signal is referenced around the amplifier’s 0V midpoint.</p>

<p>After being filtered a bit I went to a op amp based buffer. Buffers have a gain of 1. This means that the signal coming in will be the same as the signal coming out. It is wired by connecting the output back to the inverting input. It has extremely high input impedance and very low output impedance, isolating stages to prevent signal degradation caused by loading.</p>

<h1 id="volume-stage">Volume Stage</h1>

<p><img src="/blog-site/assets/images/2026-03-10%20volume.png" alt="Volume Schematic image" /></p>

<center>Volume stage schematic</center>

<p>The next part of the circuit is the volume control. This uses a simple logarithmic potentiometer to divert a varying amount of the signal to ground. This decreases or increases the amplitude of the audio signal without adding distortion or clipping. The logarithmic potentiometer should allow the volume to feel more “linear”, since humans hear on a logarithmic scale.</p>

<h1 id="equalizer">Equalizer</h1>

<p><img src="/blog-site/assets/images/2026-03-10%20left%20eq.png" alt="Equalizer Left Schematic image" /></p>

<p><img src="/blog-site/assets/images/2026-03-10%20right%20eq.png" alt="Equalizer Right Schematic image" /></p>

<center>Baxandall EQ schematic</center>

<p>For the equalizer I decided to use a fairly common 3-band active Baxandall equalizer. This design allows independent control over low, mid, and high frequencies, letting the user boost or cut different parts of the audio spectrum. Because the circuit is active (it uses an op amp), it can both attenuate and amplify certain frequency ranges. Passive tone controls can only reduce frequencies, not boost them.</p>

<p>The Baxandall equalizer works by using RC networks inside the op amp’s feedback path to shape the frequency response of the amplifier. Rather than splitting the signal into completely separate frequency bands, these networks modify how the amplifier responds to different frequencies. By adjusting the potentiometers, the amount of feedback at certain frequencies changes, which increases or decreases the gain for those frequency ranges.</p>

<p>Each tone control targets a different part of the audio spectrum:</p>

<ul>
  <li>
    <p>Low frequencies are controlled using a network that behaves like a low-pass response, affecting bass content.</p>
  </li>
  <li>
    <p>High frequencies are controlled using a network that behaves like a high-pass response, affecting treble content.</p>
  </li>
  <li>
    <p>Mid frequencies are controlled with a network that produces a band-shaped response centred around the middle of the audio spectrum.</p>
  </li>
</ul>

<p>Adjusting the potentiometers changes how strongly each of these networks influences the feedback of the op amp, allowing the gain at those frequencies to be increased or decreased. The op amp stage ultimately produces a single output signal whose gain varies with frequency, which is what creates the equalization effect.</p>

<p>Feel free to check out <a href="https://sound-au.com/articles/eq.htm">this</a> to get a better understanding of equalisers. There is some really good information on Baxandall eqs in it too.</p>

<p><strong>All op amps in schematics are OPA1656ID. They very low distortion and very low noise and are relatively cheap.</strong></p>

<h1 id="next-steps">Next Steps</h1>

<p>Now that I have completed a lot of the preliminary systems, my plan is to make a pcb layout and print the pcb using my schools free pcb printer. I want to go to the lab and test everything out on an oscilloscope before I finalize any designs. I will also continue to design the rest of the schematics, namely the active crossover, and the class d amplifier. The class d amplifier will likely be entirely from the datasheets so I think most of the hard design parts of this project are completed.</p>

<p>Stay tuned for updates.</p>]]></content><author><name>Sanija Perera</name></author><category term="Sound System" /><category term="Project" /><summary type="html"><![CDATA[Sound System Project]]></summary></entry><entry><title type="html">Sound System Research</title><link href="https://saper6569.github.io/blog-site/posts/2026/03/05/Sound-System/" rel="alternate" type="text/html" title="Sound System Research" /><published>2026-03-05T00:00:00+00:00</published><updated>2026-03-05T00:00:00+00:00</updated><id>https://saper6569.github.io/blog-site/posts/2026/03/05/Sound%20System</id><content type="html" xml:base="https://saper6569.github.io/blog-site/posts/2026/03/05/Sound-System/"><![CDATA[<h1 id="sound-system-project">Sound System Project</h1>
<p><strong>Disclaimer: 
This project involves high-power electronics, including circuits that can carry dangerous voltages and currents. Improper design, construction, or handling may result in electric shock, burns, fire, equipment damage, or personal injury.  The information shared here is for educational and documentation purposes and is not a complete guide. Therefore it should not be followed blindly. Stay safe.</strong></p>

<p>One of my main points of interest in electrical engineering is audio engineering. I play a lot of guitar and have been building pedals for the past year. I decided that I wanted to put my analog design skills to the test by designing a sound system, with a focus on sound quality, range and power.</p>

<h1 id="research">Research</h1>
<p>The first step I took in starting this project was researching various topics that would provide valuable information. The first thing I researched was amplifiers. I quickly found that class D amplifiers would be best fitting for the high power usage of the sound system. I found that <a href="https://www.analog.com/en/resources/analog-dialogue/articles/class-d-audio-amplifiers.html">this article</a>  on analog.com by Eric Gaalaas was very helpful in understanding class D audio amplifiers. It also gives a lot of pretty helpful background on amplifiers themselves. Feel free to check it out. The main reason for my decision to use class D amplification was the high efficiency which would result in less heat dissipated as well as requiring less simple power systems. Another upside is that many class D amplifier ics don’t require a dual power supply (positive and negative rail) and instead only require a positive rail.</p>

<p>I also researched into speaker drivers (the part of a speaker that actually produces noise) as this would be the driving factor in the power supply design, amplifier ic choice, other circuitry and budget. Based on information from various forums, I decided to go with a 2.1 system. This is made of two stereo general drivers and one subwoofer. Many of the forum users pointed out that this was highly suitable for listening to music, which i figured would it’s main use. I decided to aim for 2x50W 4-8ohm stereo speakers with a 100W 4ohm subwoofer. This would cover the entire audible range while also providing enough volume.</p>

<p><em>As a side note for anyone wondering the ohm value is the impedance. Lower impedance allows higher power delivery from a given amplifier voltage, which can increase output capability. Many subwoofers are 2ohm to allow higher power transfer, especially in low-voltage systems like car audio. Another thing to keep in mind is that increasing power doesn’t relate to “loudness” of a speaker very much as human hearing is logarithmic. So you cant just double the power and expect twice the “loudness”.</em></p>

<p>While searching for drivers I was simultaneously looking at amplifier ics. I found Texas instruments’ <a href="https://www.ti.com/product/TPA3116D2">TPA3116D2</a> and their <a href="https://www.ti.com/product/TPA3221">TPA3221</a> which are affordable class D amps with very little distortion. They operate on 4.5 to 26V supply and 7 to 32V respectively. Both also have configurations to work with either a single mono output or 2 stereo outputs. Because of this they fit very well for my purpose. The difference between the 2 is that the 3116 outputs 100W mono and 2X50W stereo while the 3221 doubles this at 200W mono and 2X100W stereo. The 3221 mono configuration also safely supports 2ohm speakers. For these reasons <strong>I decided to go with the TPA3221</strong>.</p>

<p><em>I should state here that the watt values are max ratings. It is probably a good idea to operate at 70-80% of this in case of current spikes. Another thing, it is generally safe to operate a speaker that has higher impedance than that of what the amp is meant for. Ex. a 4ohm speaker can safely operate with a amp meant for 2ohm. Usually not the other way around, 2ohm speaker with 4ohm amp can cause over current and heat.</em></p>

<p>For this project I decided to implement a prebuilt power supply since they are cheap reliable and easy to get my hand on. The specifications for this are 24V output and 300W rating as dictated by my amp. This is a very generous power rating for safety purposes, but also leaves space for future upgrades. I could find power supply models that met these specs for around 30 CAD on amazon.</p>

<h1 id="systems">Systems</h1>
<p>With the main components planned out I decided to plan out the systems that would be traversed from input to speaker.</p>

<ol>
  <li>Headphone jack input</li>
  <li>Buffer</li>
  <li>3 band equalizer</li>
  <li>Master volume</li>
  <li>Active crossover 2.1 split</li>
  <li>Amplifier</li>
  <li>Speaker output</li>
</ol>

<h2 id="breakdown-of-1-4">Breakdown of 1-4</h2>
<p>The input from the headphone jack is stereo, so the left and right lines will be kept isolated from each other. The input signal will be filtered to reduce noise and fed into an op amp based buffer (gain = 1) which will aim to minimize loading effects on the signal, that might be caused by the rest of the circuitry. Next the audio signals will be fed through a 3 band eq which will have a 3 potentiometer ui. After this a logarithmic potentiometer will be used as the master volume knob.</p>

<h2 id="breakdown-of-5-7">Breakdown of 5-7</h2>
<p>An active crossover is used to split full-range audio into specific frequency bands (ex. highs, mids, and lows) directing them only to the drivers designed to handle them (tweeters, mid-ranges, woofers). This prevents damage to components, minimizes distortion, improves sound clarity, and increases overall efficiency. since I am using a 2.1 system I need a low pass filter for the subwoofer and 2 high pass filters for the 2 stereo speakers. After being split the audio signals are amplified with minimal distortion and output from the speakers.</p>

<p><em>It is also important to note that since the subwoofer is mono, the previously isolated right and left channels must be put together either using a summing amplifier or a resistive network before being fed into the amp.</em></p>

<h1 id="conclusion">Conclusion</h1>
<p>With research completed I will soon begin design when I find time (I have 3 midterms coming up so might be a while). I expect to have to continue to research throughout the design process as there are many topics I am not very familiar with.</p>

<p>At this stage I have defined majority of the system: a Class D–based 2.1 system powered by a 24V supply, with buffering, equalization, and active crossover stages preceding amplification. While these choices are supported by research, the real validation will come during schematic design, simulation, PCB layout, and physical testing. This research serves as a technical foundation moving forward. The next step will be moving these concepts into detailed schematics and validating them through simulation before committing to hardware.</p>]]></content><author><name>Sanija Perera</name></author><category term="Sound System" /><category term="Project" /><summary type="html"><![CDATA[Sound System Project Disclaimer: This project involves high-power electronics, including circuits that can carry dangerous voltages and currents. Improper design, construction, or handling may result in electric shock, burns, fire, equipment damage, or personal injury. The information shared here is for educational and documentation purposes and is not a complete guide. Therefore it should not be followed blindly. Stay safe.]]></summary></entry><entry><title type="html">IODetect pcb</title><link href="https://saper6569.github.io/blog-site/posts/2026/03/02/IODetect-PCB-Design-1/" rel="alternate" type="text/html" title="IODetect pcb" /><published>2026-03-02T00:00:00+00:00</published><updated>2026-03-02T00:00:00+00:00</updated><id>https://saper6569.github.io/blog-site/posts/2026/03/02/IODetect-PCB-Design-1</id><content type="html" xml:base="https://saper6569.github.io/blog-site/posts/2026/03/02/IODetect-PCB-Design-1/"><![CDATA[<h1 id="pcb-purpose">PCB Purpose</h1>

<p>QBIT is working on a iodine deficiency detecting device that will use beer lamberts law to calculate iodine concentrations in pee. This is being done mainly using an opt101 sensor and a led of known wavelength. The project uses a esp32 for the main controller as well as an Arduino nano to collect samples from the opt sensor. The main purpose of the pcb is to allow all the peripherals to communicate with each other.</p>

<p>The board includes connections for analog to digital conversion of the opt sensor, power lines for all the electronics, 12c between the Arduino and esp, connections between the esp, motor shields, buttons and lcd display.</p>

<h1 id="constraints">Constraints</h1>

<p>The main constraint when designing the pcb was the use of a pcb printer on campus. this made me rely on single layered boards. This honestly made design feel like a puzzle and ended up leading to a lot of head scratching and thinking. I ended up coming up with a solution, however it has one very large issue. I have traces running under the esp32 rf antenna, specifically digital lines which can cause interference with the antenna. I plan on making another version with 2 layers and getting permission to print it somehow to fix this issue.</p>

<p>The second constraint is size and form factor, the aim was to make the pcb as compact as possible to ensure that the final prototype would be portable and also that it would fit inside the casing that the physical team already designed. This was not much of an issue since the esp and Arduino didn’t take up much space.</p>

<p><img src="/blog-site/assets/images/2026-03-02%20schem.png" alt="Schematic image" /></p>
<center>Schematic</center>

<p><img src="/blog-site/assets/images/2026-03-02%20before.png" alt="first image" /></p>
<center>3d veiw of first design</center>

<p><img src="/blog-site/assets/images/2026-03-02%203d%20layout.png" alt="3d image" /></p>
<center>3d veiw after iteration</center>]]></content><author><name>Sanija Perera</name></author><category term="IO Detect - QBIT" /><category term="Project" /><category term="Design Team" /><summary type="html"><![CDATA[PCB Purpose]]></summary></entry><entry><title type="html">Power System Changes</title><link href="https://saper6569.github.io/blog-site/posts/2026/03/01/UAV-Power-Systems-1/" rel="alternate" type="text/html" title="Power System Changes" /><published>2026-03-01T00:00:00+00:00</published><updated>2026-03-01T00:00:00+00:00</updated><id>https://saper6569.github.io/blog-site/posts/2026/03/01/UAV-Power-Systems-1</id><content type="html" xml:base="https://saper6569.github.io/blog-site/posts/2026/03/01/UAV-Power-Systems-1/"><![CDATA[<h1 id="uav-power-systems-changes">UAV Power Systems Changes</h1>
<p>Recently majority of my effort has been going into designing and implementing the power systems for the sub. The battery array we opted for is a 3s5p system. from previous calculations we found that it would be able to run for 30 minutes at a high energy consumption. The system has to be rated for upwards of 40A to ensure safety. 
<img src="/blog-site/assets/images/2026-03-01%203d.png" alt="PCB " /></p>

<h2 id="main-systems">Main Systems</h2>
<ul>
  <li>Battery Array (3s5p)</li>
  <li>Reverse Polarity Protection</li>
  <li>Battery Management system</li>
  <li>Safety System (Fuse, kill switch)</li>
  <li>Battery Fuel Gauge</li>
  <li>Buck Step Down Converters</li>
  <li>Power Rails
<img src="/blog-site/assets/images/2026-03-01%20schem.jpg" alt="Schematic " /></li>
</ul>

<h2 id="design-considerations">Design Considerations</h2>
<p><strong>High Current</strong>
The main consideration made for the design was safety. At high current my main focus was using strategies to reduce heat in the pcb. I focused on minimizing trace length while maximizing trace width. I did this by carefully planning component placement so that component that would draw the highest current were as close to the battery leads as possible. I also utilized the entire board ensuring large copper pours for high current traces. I also ran into issues when using multiple layers as I found that vias could not support high current paths. my workaround for this issue is simply just using more vias spread throughout traces.</p>

<p><strong>Cost</strong>
Another major consideration was cost. Majority of my component decisions would be heavily affected by budget. This project is entirely funded by me and my friends who are working on it. As a result while better solutions to issues exist I would often opt for the cheaper less effective solutions. this is especially evident in the battery management system, which i talk about later.</p>

<p><strong>Noise</strong>
The final consideration is the environment that the pcb will be located in. It will be in a underwater uav, cramped with other electronics. The main issue with this is noise reduction. High electromagnetic interference will effect sensors and other electronics on board the sub. To reduce this the main strategy was just using proper grounding techniques.</p>

<h2 id="battery-management-system-bms">Battery Management System (BMS)</h2>
<p>As design for the power systems of the sub have progressed I have spent a lot of time researching both battery management systems (BMS) as well as battery fuel gauges. after my research I came to the conclusion that designing the BMS might not be worth it. For starters the system would need to handle a 3s5p battery array which has a nominal voltage of 11.1V, but more importantly a max discharge current upwards of 40A. When working in this current range mistakes can end up casing fires. On top of this BMSs for 3s systems are often quite inexpensive, even for higher current ratings. Manufacturing it ourselves would include pcb printing charges that already make it more expensive than just buying it prebuilt.</p>

<p><strong>As a result of this I have decided to opt for a premade BMS module and incorporating it into the design.</strong></p>]]></content><author><name>Sanija Perera</name></author><category term="Underwater ROV" /><category term="Project" /><summary type="html"><![CDATA[UAV Power Systems Changes Recently majority of my effort has been going into designing and implementing the power systems for the sub. The battery array we opted for is a 3s5p system. from previous calculations we found that it would be able to run for 30 minutes at a high energy consumption. The system has to be rated for upwards of 40A to ensure safety.]]></summary></entry><entry><title type="html">Welcome to My Engineering Blog</title><link href="https://saper6569.github.io/blog-site/posts/2026/02/28/welcome/" rel="alternate" type="text/html" title="Welcome to My Engineering Blog" /><published>2026-02-28T00:00:00+00:00</published><updated>2026-02-28T00:00:00+00:00</updated><id>https://saper6569.github.io/blog-site/posts/2026/02/28/welcome</id><content type="html" xml:base="https://saper6569.github.io/blog-site/posts/2026/02/28/welcome/"><![CDATA[<p>Welcome to my blog. I will post random stuff about my projects and what not. This blog is more for me to keep track of stuff but maybe it will be helpful to someone.</p>

<h2 id="purpose">Purpose</h2>

<p>This blog serves several purposes:</p>

<ol>
  <li><strong>Documentation</strong>: Recording projects, experiments, and learning experiences</li>
  <li><strong>Knowledge Sharing</strong>: Sharing technical insights and solutions to engineering challenges</li>
  <li><strong>Learning</strong>: Reflecting on what I’ve learned and areas for improvement</li>
</ol>

<p>Thanks for visiting, and I hope you find the content useful and interesting.</p>]]></content><author><name>Sanija Perera</name></author><category term="welcome" /><category term="introduction" /><summary type="html"><![CDATA[Welcome to my blog. I will post random stuff about my projects and what not. This blog is more for me to keep track of stuff but maybe it will be helpful to someone.]]></summary></entry></feed>