Files
Drone-FabAcademy-2025/docs/Assignments/week_6_electronic_design/electronic_design.md
2025-03-03 15:26:43 +01:00

6.6 KiB

Electronic design

For this week we are making a start at designing pcb's. Im excited for this week because I can finally make my own circuits instead of using unreliable breadboards. With designing I'm starting out with KiCad.

No symbol table

When I first tried to start a project for kicad it asked for a symbol table.

alt text

Apparantly KiCad doesn't come with it on Linux systems (I don't know about windows). So I needed to install an extra package called kicad-library. After that I could use the standard symbol library. Later on I also found out I needed to install the 3D-models libary. Everything of KiCad on Linux comes separately.

The assignment

For this weeks assignment henk wanted us to design a pcb with at least a led, a switch and then we had a choice between a speaker and a sensor. I wen't with a speaker because I could use that for my final project.

KiCad

I'm going to do this in KiCad because it is the only software I know thanks to the lecture on thursday. I first started out dragging all the parts I needed onto the schematic editor.

alt text Using the A key while in this screen you can open the component selector and search for the components needed.

alt text

After that I needed to think how I wanted to connect everything. I wanted to use the switch as a power switch and the led as some sort of status indicator. wiring up the speaker is going to be the hardest part.

I first started off with the easier parts. So I started with the LED. I accidentally found out when you hover click a part and press D you directly go to the data sheet of the part so that's a nice shortcut.

Connecting a LED

When reading the datasheet I found this graph. With a relation to voltage and mAh of the LED.

alt text

If I supply the LED with 20 mA it should run at 1.8V. The supply voltage is 3.3V so.

R = V / I \\

R = 3.3 / 0.02 \\

R = 165 Ohm

So I will need a 165 Ohm resistor.

alt text

This is how I connected my LED. I chose to use the MCU as a ground because Henk once explained how it's better for the MCU and that it could handle more led's or other connections that way.

Connecting the speaker

Now I wanna drive the speaker. But to do that we need some sort of driver because I don't think the mcu's has enough power to drive the speaker.

When searching online and on older fab academy projects I found that people everywhere use IC's to drive them. I wanted to try to make one without an IC because I have seen my friend make one when he was doing electrical engineering. When looking around online all the circuits look super confusing. For example the one on this forum doesn't have any ground symbols.

After searching for a while I found this on Instructables alt text

Understanding resistors

The only step I needed to figure out is why it work like this and why doesn't the speaker blow up when connected because there is 9 volt on the circuit and the speaker is rated for 1 volt. I still have a lot of trouble wrapping my head around how voltage drops because of a resistor.

Voltage can be seen as the speed of water traveling through a tube. A resistor makes the tube smaller for a small part so the water slows down. So the voltage drops.

Resistors always cause a voltage drop. How big the drop is depends on the amount of current going trough it and the resistance (Ohm)

V = I * R

This is Ohms law. So to keep a constant voltage you need to make sure your current is also constant and not changing constantly. In that way you can keep a constant voltage.

Back to the speaker

I watched this video and now understand the fundementals of a amplifier. The only thing necessary is something that can make an small signal big. For that I can use a MOSFET. I also need to make sure the MOSFET doesn't over current the speaker so that's why it needs a resistor before the gate pin. And I need some sort of buffer for the speaker once it needs a lot of power.

alt text

When I was looking for MOSFET's through the Fab library I found 2 type of MOSFET's P channel and N channel. I quickly searched what it does.

alt text

So for my use case I will need a N channel MOSFET that can work output a linear voltage based on what is supplied on the gate.

alt text

I first had this setup. But then I asked AI for feedback and it told me I used the wrong transistor because it could only be on or off and not anything in between.

alt text

After a while I realized it's way easier to use an IC for this use case. So that's what im going to do.

I am going to use the OPAMP_AD8615 as my amplifier. According to its data sheet it has a input voltage from 0 to 5 volts and an output from 7.5 mV to 5 volts. After some time researching on how to use it I decided to use the LM4871M because I couldn't find any good examples using the AD8615.

alt text This was my last result using the AD8615.

I think this is correctly connected but I still need to add a bypass.

alt text A bypass is to filter the noise from the power supply. To filter noise a capacitor is used.

alt text

In the documentation of the IC I found how to connect the bypass. I needed to connect the pin to the ground with a capacitor between it.

alt text

It is also recommended to add a input capacitor in the event the chips requires a lot of power and it can't be deliverd from the source.

alt text

So I added a 10 μF capacitor at the VDD. So my circuit now looks like this.

alt text

alt text I still need to make sure there isn't too much power going to the pcb. According to these graphs if you change the input power you can make sure it doesn't output too much. So according to the graph I need 2 volt Supply voltage. Because my speaker has a 8 Ohm impedance and the rated watt is 0,25 mW. alt text

R = V * I

After a while of struggling with all the connections I asked Henk and he said I was thinking too complicated. I don't need a amplifier at all

Sources