Week 9: Inputs¶
group assignment: • probe an input device’s analog levels and digital signals
Oscilloscope¶
Photo Light Dependent Resistor (Analog)¶
For the oscilloscope, I probed a Photo Light Dependent Resistor (analog input) and a button (digital input) using a breadboard and the general use microntroller board I made this week based on Adrian’s page.
I learned a quick overview about these components on this Electrical4U webpage. Basically, a photo light dependent resistor is a resistor that provides less resistance in the presence of more light and more resistance in the pressence of less light. This is because of photoconductivity where the semiconductor material’s conductivity is reduced when light is absorbed by the material.

Photo Light Dependent Resistor circuit set up. This has a high value 22KΩ resistor. Just power and ground are connected.

Read from the oscilloscope with just the room light levels and no interference. The light oscillates slightly up and down demonstrating how the light in the room isn’t consistent

When I covered the sensor with my thumb to block away light from the sensor, the voltage read from the oscilloscope gets higher

When I flashed more light on the sensor the voltage read gets lower
Button (Digital)¶
Next, I set up a button circuit with example code in Arduino for turning an onboard LED light on and off. Adapted version reproduced below:
/*
Button
Turns on and off a light emitting diode(LED) connected to chip pin 17,
when pressing a pushbutton attached to pin 2.
created 2005
by DojoDave <http://www.0j0.org>
modified 30 Aug 2011
by Tom Igoe
This example code is in the public domain.
https://docs.arduino.cc/built-in-examples/digital/Button/
Adapted by angela for Fab Lab Academy 2026 for XIAO RP2040 board
*/
// constants won't change. They're used here to set pin numbers:
const int buttonPin = 2; // the number of the pushbutton pin
const int ledPin = 17; // the number of the LED pin
// variables will change:
int buttonState = 0; // variable for reading the pushbutton status
void setup() {
// initialize the LED pin as an output:
pinMode(ledPin, OUTPUT);
// initialize the pushbutton pin as an input:
pinMode(buttonPin, INPUT_PULLUP);
}
void loop() {
// read the state of the pushbutton value:
buttonState = digitalRead(buttonPin);
// check if the pushbutton is pressed. If it is, the buttonState is HIGH:
if (buttonState == HIGH) {
// turn LED on:
digitalWrite(ledPin, HIGH);
} else {
// turn LED off:
digitalWrite(ledPin, LOW);
}
}

Button circuit set up. When I click and release, the onboard user controlled red LED pin on the board turns on and off.

Read from the oscilloscope. When I click the button, it goes low. When released, it returns high. You can see the rising edge as it goes from low to high.

After intentionally clicking the button not so smoothly, you can see the bounce at the microsecond scale.
Multimeter¶
Used the multimeter to measure change in voltage as well with the two circuits from above.
Photo Light Dependent Resistor (Analog)¶

The multimeter’s voltage read at regular room lighting. I have the ground probe at ground and the other probe is carefully placed touching the leg of the photo light dependent resistor that it not at ground. Here the read is about 2.41V.

The multimeter’s voltage read when I cover the sensor. As expected from the oscilloscope, it goes up to about 3.11V

The multimeter’s voltage read when I flashed light on my phone camera. As expected, the voltage read goes down to about 1.11V
Observing change in multimeter while changing amount of light to sensors
Button¶
Now onto the button…

At its regular state, the voltage read is 3.31V

When pressed, the voltage read is 0V
Pushing the button and reading multimeter
Logic Analyzer¶
FAB NODA has the Lonely binary Logic Analyzer Set which uses Logic 2 and PulseView software. It is an 8 channel, 24MHz logic analyzer. Here is a quickstart guide for installing the software.
This site describes the logic analyzer as as a tool for making sense of digital signals in electronic circuits, likening it to a stethoscope listening for a heartbeat. It displays these digital signals as waveforms.
We did a group demo with Will since this was our first time using it. We practiced using different circuits we each created from a simple blinking LED to the pong board to the accelerometer sensor.
Button (Digital)¶

I hooked up the logic analyzer to ground (black wire). And I hooked up its channel one to the button’s circuit (yellow wire).

As I pressed the button and released, the logic analyzer shows the read going from high to low.
Observing logic analyzer channel as button is pressed
Photo Light Dependent Resistor (Analog)¶
Since this is an analog sensor, I was interested to see how this would go. I noticed that simply covering the sensor on and off made no change in the logic analyzer. But when I turned my phone flashlight on it and removed it that caused the logic analyzer to put out the high and low readings. From the multimeter readings, the extra light gets the voltage down to 1V which is less ambiguous than the voltage reads when the sensor is just taking in room lightening or blocked from light.

I hooked this circuit to channel 7 in the logic analyzer (see the purple line on the screen). When the light from the camera flashed the logic analyzer read the input as low
Observing logic analyzer channel as I block the phones flashlight and then remove my finger back and forth