summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorthing1 <thing1@seacrossedlovers.xyz>2025-04-02 10:26:21 +0000
committerthing1 <thing1@seacrossedlovers.xyz>2025-04-02 10:26:21 +0000
commitfef6d2cc76518eee75fc0d95e765bd2be8a660ee (patch)
treed9886424f7d18d86ad1f4c73613b7e23b64b0434
parent5b73c7157aad4d65eee7af41fd4b4ded1a434b96 (diff)
did comp sci and some electronics
-rw-r--r--comp/work/53/sheet68
-rw-r--r--comp/work/54/#hash.py#21
-rw-r--r--comp/work/54/#ques#4
-rw-r--r--comp/work/54/hash.py21
-rw-r--r--comp/work/54/ques3
-rw-r--r--comp/work/54/rpn.py21
-rw-r--r--electronics/cw2/writeup.tex98
7 files changed, 214 insertions, 22 deletions
diff --git a/comp/work/53/sheet b/comp/work/53/sheet
new file mode 100644
index 0000000..45058ac
--- /dev/null
+++ b/comp/work/53/sheet
@@ -0,0 +1,68 @@
+12.1)
+head | 1
+tail | [2, 3, 4]
+
+12.2)
+[2, 4, 6, 8]
+
+12.3)
+I fisrt put the list into the function map, because the list was not empty, I used the second definition.
+I applied f to the head of the list, then I applied map onto the tail of the list.
+Because the tail was not empty I repeated this again.
+I repeated this until I got an empty list
+Then the most recent call to map returns, and gets conncatinated to the second to last function calling f on x.
+This repeates as the call stack collapses, leaving behind the list, with all values having f applied to x
+
+8.1)
+WHO KNOWS
+
+8.2)
+36
+
+8.3) to apply a function onto a list in a specific order.
+
+6.1)
+10
+
+6.2)
+map square a | [1, 9, 25]
+filter (<10) b | [1, 5]
+fold (+) 0 c | 18
+
+6.3)
+A function that takes another function as an argument or a returns function as a result
+
+15.1)
+3
+
+15.2)
+fw [4, 3] | 12
+fx sales | [20, 50, 32]
+fz sales | 102
+
+15.3)
+This is the total of sales, the amount sold in a day perhaps
+
+7.1)
+NO CLUE
+
+7.2)
+4
+
+7.3)
+plus4 = add 4
+result = plus4 6
+'
+11.1)
+head | "Blackpool"
+tail | ["Paris", "New Brighton", "Toronto"]
+
+11.2)
+A function that takes another function as an argument or a returns function as a result
+
+11.3)
+(((1 * 2) * 3) * 2)
+((2 * 3) * 2)
+(6 * 2)
+(12)
+12
diff --git a/comp/work/54/#hash.py# b/comp/work/54/#hash.py#
new file mode 100644
index 0000000..ad4859c
--- /dev/null
+++ b/comp/work/54/#hash.py#
@@ -0,0 +1,21 @@
+def hash(string):
+ chunks = []
+ for i in range(0, len(string), 3):
+ tmp = ""
+ for j in range(i, i + 3):
+ try:
+ tmp += string[j]
+ except:
+ break
+ chunks.append(tmp)
+
+ chunks = map(int, chunks)
+
+ print(sum(chunks) % 50)
+
+
+inp = input("input a number: ")
+if (len(inp) <= 10):
+ hash(inp)
+else:
+ print("string is too long")
diff --git a/comp/work/54/#ques# b/comp/work/54/#ques#
new file mode 100644
index 0000000..4b586e3
--- /dev/null
+++ b/comp/work/54/#ques#
@@ -0,0 +1,4 @@
+1) address bus
+2) Sending multiple bits of data down multiple wires, all at the same time, ensuring each bit is recieved at onces, it will be synced with a clock
+3) Because it only required one wire (and a clock) to send data down it. This means the cables can be cheaper, smaller and simpler. It also means the deviecs can be simpler to make as they don't need to sync multiple line
+y \ No newline at end of file
diff --git a/comp/work/54/hash.py b/comp/work/54/hash.py
new file mode 100644
index 0000000..6fae0ec
--- /dev/null
+++ b/comp/work/54/hash.py
@@ -0,0 +1,21 @@
+def hash(string):
+ chunks = []
+ for i in range(0, len(string), 3):
+ tmp = ""
+ for j in range(i, i + 3):
+ try:
+ tmp += string[j]
+ except:
+ break
+ chunks.append(tmp)
+
+ chunks = map(int, chunks)
+
+ print(sum(chunks) % 50)
+
+
+inp = input("input a number: ")
+if (len(inp) <= 10):
+ hash(inp)
+else:
+ print("string is too long")
diff --git a/comp/work/54/ques b/comp/work/54/ques
new file mode 100644
index 0000000..ea3f92e
--- /dev/null
+++ b/comp/work/54/ques
@@ -0,0 +1,3 @@
+1) address bus
+2) Sending multiple bits of data down multiple wires, all at the same time, ensuring each bit is recieved at onces, it will be synced with a clock
+3) Because it only required one wire (and a clock) to send data down it. This means the cables can be cheaper, smaller and simpler. It also means the deviecs can be simpler to make as they don't need to sync multiple lines.
diff --git a/comp/work/54/rpn.py b/comp/work/54/rpn.py
new file mode 100644
index 0000000..053a256
--- /dev/null
+++ b/comp/work/54/rpn.py
@@ -0,0 +1,21 @@
+def eval(expr):
+ s = []
+ for i in expr.split():
+ if i.isdigit():
+ s.push(int(i))
+ else:
+ a = s.pop()
+ b = s.pop()
+ match i:
+ case '+':
+ s.push(b + a)
+ case '-':
+ s.push(b - a)
+ case '*':
+ s.push(b * a)
+ case '/':
+ s.push(b / a)
+
+ print(s.pop())
+
+eval("1 2 +")
diff --git a/electronics/cw2/writeup.tex b/electronics/cw2/writeup.tex
index 0d3852b..aeaae5f 100644
--- a/electronics/cw2/writeup.tex
+++ b/electronics/cw2/writeup.tex
@@ -67,6 +67,23 @@ The product I would like to build for this project is a simple radio receiver, i
The design should focus on simplicity, as less points of failure should result in something reliable. I have in the past, owned a radio for hikes, however it had multiple dials which all clogged with mud, and now it doesn't work; I would much rather have something that is pre tuned to my desired values and left as is.
+\subsection{Design objectives}
+To evaluate my system at the end, I will comapre it against the following goals
+
+\begin{center}
+ \begin{tabular}{ |c|c| }
+ \hline
+ objective & how \\
+ \hline
+ Outputs sound based on the input, that is equivalent to the input & The full system\\
+ Displays the intensity of the volume output by the signal & Use a micro controller \\
+ in & out \\
+ in & out \\
+ \hline
+ \end{tabular}
+\end{center}
+
+
\section{System design}
\subsection{Subsystem designs}
@@ -106,7 +123,22 @@ This system will receive data from from the radio waves from an antenna, here is
\includegraphics[width=0.5\textwidth]{diagrams/receiver.png}
\end{center}
-To test this system, I can use a signal generator to create an AM wave, then put the output into a large wire, and finally I can compare the outputs of the signal generator, and the output from the inductor and capacitor, and check if they are the same.
+To test this system, I can use a signal generator to create an AM wave, then put the output into a large coil wire, and finally I can compare the outputs of the signal generator, and the output from the inductor and capacitor, and check if they are the same. I will hook the input and output to an oslioscope.
+
+Here is the the table I will use to test the output:
+
+\begin{center}
+ \begin{tabular}{ |c|c| }
+ \hline
+ signal in & signal out\\
+ \hline
+ in & out \\
+ in & out \\
+ in & out \\
+ in & out \\
+ \hline
+ \end{tabular}
+\end{center}
\subsubsection{The initial amplifier}
This amplifier's job is to increase the voltage of the input, as the revive will only output at ~1V-3V, which is not enough to trigger my other components, it should have a gain of around 5. Here is its circuit diagram:
@@ -117,7 +149,21 @@ This amplifier's job is to increase the voltage of the input, as the revive will
I have used inverting amplifiers throughout this build as they are generally less noisy than non-inverting amplifiers and I can control the input impedance.
-To test this system I will put a voltage of around ~1-3V and test if it multiplies the voltage by the desired gain.
+To test this system I will put a voltage of around ~1-3V and test if it multiplies the voltage by the desired gain. I will put the output of the sub system through an osiloscope, and compare the inputs.
+Here is the table of results that I will use to test my system.
+
+\begin{center}
+ \begin{tabular}{ |c|c| }
+ \hline
+ signal in & signal out\\
+ \hline
+ in & out \\
+ in & out \\
+ in & out \\
+ in & out \\
+ \hline
+ \end{tabular}
+\end{center}
\subsubsection{The demodulation system} % can probably show an alternative to this
This system will convert the AM wave to a unmodulated regular wave, it will also use a decoupling capacitor to remove any DC offset that is caused by the previous components. Here is its circuit diagram:
@@ -126,16 +172,35 @@ This system will convert the AM wave to a unmodulated regular wave, it will also
\includegraphics[width=0.5\textwidth]{diagrams/AM demodulation.png}
\end{center}
-To test this I will put in a modulated sine wave into it and confirm that I receive the original wave as an output.
+To test this I will put in a modulated sine wave into it and confirm that I receive the original wave as an output. Yet again I will use and oslioscope to test the two traces against each other.
+
+Because I would expect this to produce a very different output wave from the input, I will not make a diagram for this, however I would expect the output to look like this.
+
+\begin{center}
+ \includegraphics[width=\textwidth]{diagrams/AM-demod.png}
+\end{center}
\subsubsection{The volume boost amplifier} % perhaps show an alternative for here
-This is just another op amp, but with different resistor values. Here is its circuit diagram:
+This is just another op amp, but with different resistor values. Here is its circuit diagram:
\begin{center}
\includegraphics[width=0.5\textwidth]{diagrams/volume boost amplifier.png}
\end{center}
-Like the previous amplifier it can be tested by putting into a wave into it and checking it was multiplied by the correct gain.
+Like the previous amplifier it can be tested by putting into a wave into it and checking it was multiplied by the correct gain.
+
+\begin{center}
+ \begin{tabular}{ |c|c| }
+ \hline
+ signal in & signal out\\
+ \hline
+ in & out \\
+ in & out \\
+ in & out \\
+ in & out \\
+ \hline
+ \end{tabular}
+\end{center}
\subsubsection{The audio normalisation filter}
This is a filter that will only show the peaks of the output from the previous systems, this will allow the micro controller to properly poll the input for the next subsystem. Here is its circuit diagram:
@@ -144,7 +209,8 @@ This is a filter that will only show the peaks of the output from the previous s
\includegraphics[width=0.5\textwidth]{diagrams/audio peak finder.png}
\end{center}
-To test this, I can put a sine wave in as input, and then I will check if I see a sine-like wave with smaller troths.
+To test this, I can put a sine wave in as input, and then I will check if I see a sine-like wave with smaller troths. I will use a scope to read the values, and then plot them on this table:
+
\subsubsection{The audio intensity meter}
This system will consist of a micro controller and a bar graph, it will use the output of the volume boost amplifier as an input and will display the amplitude of the output on 4 bits of a bar graph. Here is its circuit diagram:
@@ -187,20 +253,6 @@ To test my system, I will put values into each subsystem individually, then put
The receiver was tested by putting a signal through a signal generator, that AM modulates the input, and putting that through a large antenna in the room, then using the large inductor as a receiving antenna. I can then use an oscilloscope to compare the inputs, to the outputs.
Here is a table of the inputs Vs the outputs I received. I read these values of an oscilloscope.
-
-\begin{center}
- \begin{tabular}{ |c|c| }
- \hline
- signal in & signal out\\
- \hline
- 0v & 0v \\
- 1.25v & 1.20v \\
- -1.25v & -1.21v \\
- 0.5v & -0.48v \\
- \hline
- \end{tabular}
-\end{center}
-
The result show that, there is a little bit of noise, however there is a clear resemblance on the input, so I would say this works. There is also, on average, a drop in voltage, which is most likely signal drop off, this is a very small drop so it is of no significance
\subsection{The initial amplifier}
@@ -232,8 +284,6 @@ This system, should have a response curve that looks something akin to this, not
\includegraphics[angle=270, width=0.5\textwidth]{diagrams/pics/IMG_20250312_140141.jpg}
\end{center}
-
-
Mine had slightly larger distorted dips in the signal, however it achieved the same thing.
\subsection{The volume boost amplifier}
@@ -461,9 +511,13 @@ Here is the scope trace of the input at 3.3Khz.
\includegraphics[width=\textwidth]{diagrams/pics/finaloutput.jpg}
As the trace shows, it is negative, a DC offset has been applied. I originally believed, that my amplifiers were causing the signal to be negative as they are inverting, however I have an even amount of them so it wasn't them. I then realised that it had to be a DC offset. I fixed it but putting a capacitor before the input, however I removed this as it was distorting the input signal. It doesn't have any effect on the output as the speaker still moves in the same way.
+\subsection{User Manual}
% did it work, how well, compare to original goal
\section{Evaluation}
\subsection{What went well?}
+My system worked as intended, it did play the input signal, through the speakers, atfer passing through all the subsystems and the speaker.
+I will compare, line by line, to my design objectives here:
+
\subsection{What didn't go well?}
}
\end{document}