Project type: Individual (but feel free to help each other)
Grading for this project is a simple pass/fail. You have until the end of the afternoon lab session to figure out your individual code, type it into the online validator, and upload a screenshot of the validator confirmation to the Brightspace assignment - either you get it right or you don't!!!
Introduction
Your objective is to figure out a secret 4-character code that has been encoded as an optical binary signal in the form of a flashing region of pixels in a video.
Each of you has been assigned a unique 4-character code, which is encoded in your own individual video file.
Build an optical detector circuit to measure the binary signal and display it on the oscilloscope.
Analyse the signal on the oscilloscope to figure out your secret 4-character code.
Each character is encoded as a single byte (8 bits) using the ASCII system.
Each byte is transmitted least significant bit (lsb) first.
Each byte is preceded by a start bit, which is always 1.
Each byte is followed by a stop bit, which is always 0.
In the video, bits equal to "1" are represented by the colour white.
In the video, bits equal to "0" are represented by the colour black.
The following example signal encodes the word “Demo”:
Note: To see the video for the example signal shown above, type the student number "C12345678" into the validator.
Instructions
Build a photodetector to convert light intensity to voltage - a suggested circuit is provided below.
Use an oscilloscope to check that the output voltage of the photodetector changes when the intensity of light falling on the LED(s) changes.
Retrieve your individual video by typing your student number into the online validator.
Play your individual video on the computer screen (or phone screen), on a continuous loop if possible.
Hold the photodetector LEDs up to the flashing area in the video and use the oscilloscope to record the binary waveform.
Once you have the complete 4-byte transmission displayed on the oscilloscope screen, press pause so that you can decode the signal.
When you figure out your individual 4-character secret code, type it into the online validator to see if it's correct.
There is no penalty for checking incorrect guesses in the online validator. It doesn't matter how many times you get it wrong, as long as you eventually get it right.
When you find the correct code, upload a screenshot of the online validator's confirmation message to Brightspace to secure a 100% grade for the project.
Photodetector circuit
A suggested photodetector circuit is provided below.
Explanation
Each of the reverse-biased LEDs acts as a photodiode. When light strikes it, a tiny reverse current is allowed to pass through it. The more intense the light, the larger the current (although it’s always very small).
Because the LED's reverse current is tiny, two LEDs are connected in parallel to double the magnitude of the current.
Each of the two NPN bipolar junction transistors (BJTs) acts as a current amplifier. A smaller base current controls a larger collector current.
The tiny LED current arriving at the base of Q1 controls the much larger collector current of Q1 that flows down through resistor R.
The current flowing out of the emitter of Q1 arrives at the base of Q2, which in turn controls the larger collector current of Q2 that also flows down through resistor R.
The voltage across resistor R depends on the magnitude of the collector currents and therefore depends on the intensity of light falling on the LEDs.
Note: Transistors Q1 and Q2 are connected as a so-called Darlington pair, which results in an overall current gain that is approximately equal to the product of the individual transistors’ current gains.
OPTIONAL: Alternative signal capture method using an Arduino
Note: If an oscilloscope is available, this part is not required. It is only included here in case anyone needs to complete the project without access to lab equipment.
The following Arduino code can be used to record a voltage signal on pin A0 and display the resulting waveform on the computer screen using the Serial Plotter tool in the Arduino IDE. An example signal is shown below.
//
// Signal viewer - written by Ted Burke - 17-Apr-2023
//
void setup()
{
Serial.begin(9600); // open serial connection at 9600 bits/second
Serial.println("\ngnd[V] Vdd[V] Vout[V]"); // signal labels
}
void loop()
{
Serial.print("0.0 5.0 "); // print ground and supply voltages
Serial.println(0.0048876 * analogRead(0)); // print signal voltage
delay(25); // short delay to reduce sampling rate
}