Lab Session #1
- Time
- People
- Tyler, Jacqueline, Sun
- Tyler planned on making breakout boards for the phototransistor so we used one of them to test the device behavior
- The board had a 10kOhm resistor in series with the phototransistor where the output was measured between the two
- We used the supply to send 3.3V and 5V as two different tests to the board wile the oscilloscope was conencted to the output
- We observed that covering the phototransistor raised the output voltage on the oscilloscope, while shining a light on it brought it to 0
- The different voltage levels just changed the magnitude of the 'dark' sensing voltage of the device
Group Session #2
- Time
- People
- Ben (CBA), Claire (ARCH)
Using a Saleae, we probed the following signals running between a computer, an Adafruit Feather M0 Adalogger and an Adafruit Soil Moisture Sensor.
- On Soil Sensor
- Analog - TP3 (SENSOR Pin)
- Between Soil Sensor and Adalogger
- Digital - I2C, SCL
- Digital - I2C, SDA
- Digital - SERIAL, SDA
- Between Adalogger and Computer
- Digital - UART, Adalogger TX
Session #3
- Time
- People
- Dimitar, Ceci, Saetbyeol, Eitan, Rui, Matti, Sophia
We used an
Adafruit PT100 RTD Temperature Sensor Amplifier
hooked up to an Arduino running
example code
to take measurements.
The board communicated with the microcontroller over SPI.
We used the Saleae Logic 8 from 043 with the Logic 2 software to capture and decode transactions
over the SPI channel (using 4 digital channels for CLK, MOSI, MISO and CS).
One full transaction is shown below:
The example code reported measurements over serial.
While we interfaced to the Arduino over USB,
the ATmega on the Arduino doesn't have native USB support,
so the board uses a second microcontroller as an adapter
(another ATmega, not an FTDI chip).
The two ATmega's communicate over RS-232-style UART.
We used a fifth digital on the logic analyzer to probe the outbound path.
As expected, we were able to decode (as ASCII) the same messages that appeared on the console:
Eitan's Notes
Analyzer Overview
A logic analyzer allows us to “spy” on the communication between a microcontroller and its connected components. By connecting to different channels—such as chip select, clock (SCL), and data lines—we can see how data moves between devices in real time. This helps us decode communication protocols, understand timing, and debug signal issues.
The main communication protocols we use in embedded systems are SPI and I2C (sometimes written as I²C). Each has its own way of managing data transfer and device coordination.
SPI (Serial Peripheral Interface)
SPI works with one manager (previously, and no longer, called a “master”) and several subordinate devices (previously, and no longer, called “slaves”). These are all connected through a small set of shared wires.
The key SPI connections are:
- MOSI: Manager Out, Subordinate In – the manager sends data out to all subordinates.
- MISO: Manager In, Subordinate Out – the manager receives data back from the subordinates.
Unlike TX/RX (transmit/receive) lines used in UART, MISO and MOSI are clearer because they define the direction relative to the manager. If both devices attempt to drive the line at once (one high, one low), it can create a short circuit on the shared line—called a “crossbar current.” To prevent this, SPI includes a chip select pin for each subordinate. The manager sets the chip select low to enable one device at a time.
SPI also includes a clock signal that continuously ticks. All devices listen to this shared clock, using it to agree when to read and write data. This ensures all communication stays synchronized.
I2C (Inter-Integrated Circuit)
I2C is a simpler alternative to SPI—it only needs two lines instead of four or more. It doesn’t use chip select or separate MISO/MOSI lines. Instead, it operates with:
- SCL: Signal Clock
- SDA (or SCA): Signal Data
I2C uses an open-drain system, where each device can only pull the line low but never drive it high. Pull-up resistors bring the line back to a high state when nothing is pulling it down. This allows multiple devices to share the same two lines without interfering too much, though if two devices try to write simultaneously, their signals may overlap. Handling this conflict is part of what makes communication protocols (like WiFi and Ethernet) complex to design.
Each device on an I2C bus has a unique address, which the manager uses to specify who to talk to. In circuit diagrams, VCC/VDD usually indicate high voltage (drain), while VSS/VEE indicate low voltage (source).
UART (Universal Asynchronous Receiver-Transmitter)
UART is another common communication method, used for serial data transfer. It’s slower than SPI or I2C but simpler to use. In Arduino, the Serial library communicates through UART, which is also used for uploading programs to the chip via the serial port. Data travels in ASCII form in both directions.
Thermocouple and Thermistor
A thermocouple is a type of temperature sensor that converts a temperature difference into voltage. It consists of two wires made from different metals. When these two metals meet, the junction produces a small voltage that depends on temperature. Because the metals have different bandgaps (potential energy wells for electrons), the difference in how electrons move through them creates a measurable signal.
The sensor must be long enough for electrons to accumulate potential differences as they move along the wire. The breakout board connected to the thermocouple amplifies this small voltage difference so that the microcontroller can read it easily. The microcontroller then converts this analog signal into a digital value for display or processing.
A thermistor is another type of temperature sensor. Unlike a thermocouple, it’s a resistor whose resistance changes with temperature. Both measure temperature, but they rely on different physical principles.
System Setup
In our setup:
- Channel 0 = Enable. The Arduino signals the thermocouple board that it’s about to communicate. This is necessary because the MISO lines are shared across devices.
- Channel 1 = MISO. The line the Arduino uses to receive data from the thermocouple (it reads only, doesn’t write).
- Channel 2 = MOSI. The line the Arduino uses to send data to the thermocouple.
- Channel 3 = Clock. This line pulses consistently while communication is happening. The thermocouple can’t trigger communication—it only responds while the manager’s clock is active.
Data Transmission
Every cycle of the clock corresponds to data being transferred. Typically, 8 clock ticks equal one byte of data, which ranges from 0x00 to 0xFF in hexadecimal.
For example:
00000000=0x0000000001=0x0100001010=0x0A00001111=0x0F00010000=0x1011111111=0xFF
Each “blip” of signal encodes a number in binary, and the device’s datasheet defines what each pattern means. The Arduino sends a series of numbers (commands) to the chip, which interprets these signals based on its own internal rules. The meaning of each number depends on the specific device, so decoding that relationship is key to proper communication.
Using the Logic Analyzer
A logic analyzer acts as a middleman, recording and decoding the signals exchanged between devices. It helps visualize which commands the Arduino is sending and what responses the sensor provides. By observing these waveforms and data bytes, you can confirm whether communication protocols like SPI or I2C are functioning correctly and troubleshoot issues in timing or logic.
Session #4
- Time
- People
- Ben, Edward, Sara
Lab Session #5
- Time
- People
- Miranda, Ben (Miranda's notes)

I learned that I2C is both a hardware unit and a communication protocol. We discussed the nice metaphor that I2C is how microcontrollers talk to each other, and to “talk” to another one needs:
- a transmitter (a mouth)
- a receiver (ears)
- an agreed-upon protocol (shared language)
He showed me with the Saleae logic analyzer how a very simple I2C protocol he was running between a capacitive sensor for soil moisture dectection and a RP2040. I observed the three lines: clock, data, and ground. Ben explained that they do a sort of choreographed handshake and then dance in order to maintain the reliability of data transfer. First there is a SYN / ACK exchange to indicate that data is about to be sent. Then, the clock line pulses low / high while the data line sends bits. When the clock line returns to 1, there is no more data to be sent.
It was so fun seeing this extremely low-level logic and communication in action – one of the last courses I took at my previous university was Compilers, and it was really cool to see the layers below the lowest layers I had previously encountered! I’m getting closer and closer to the wires, it seems…