Week 9: Input Devices
This week describes my understanding of how to use Input Devices. It also includes how to generate an analog output (PWM) using pin 9, how to use an oscilloscope and multimeter for analysis, and how to integrate different sensors with the microcontroller.
Objectives for the week
Probe an input device(s)'s analog levels and digital signals
Document your work on the group work page and reflect on your individual page what you learned
Interpret a Signal
We generate an analog output (PWM) using pin 9. A LED is connected to see the signal effect, and the oscilloscope and multimeter are used for analysis.
1. Understanding DSO Components
- Power Button: Turns the DSO ON/OFF.
- Display Screen: Shows the waveform.
- Probe Inputs (CH1, CH2): Connect the oscilloscope probes here.
- Time/Div Knob: Adjusts the time scale (horizontal axis).
- Volts/Div Knob: Adjusts the voltage scale (vertical axis).
- Trigger Controls: Helps stabilize the waveform.
2. Connecting the Oscilloscope to Arduino
A. Connect the Probe Correctly
- Turn OFF the oscilloscope before connecting anything.
- Take one oscilloscope probe and connect:
- Probe Tip: To Arduino PWM Pin 9 (or any analog pin you are testing).
- Probe Ground (Clip): To Arduino GND (Ground).
- Power up the Arduino and DSO.
3. Configuring the Oscilloscope for Basic Signal Viewing
A. Set the Channel
- Press the CH1 button to activate Channel 1 (where we connected the probe).
- If using two probes, press CH2 for the second channel.
B. Adjust the Voltage Scale (Vertical Setting)
- Use the Volts/Div knob to set the voltage range.
- Start with 1V/div and increase if needed.
- For a 5V Arduino signal, set it around 2V/div for better viewing.
C. Adjust the Time Scale (Horizontal Setting)
- Use the Time/Div knob to set the time range.
- If measuring PWM signals (~500Hz), start with 1ms/div.
- If measuring fast signals (above 1kHz), use 100µs/div.
D. Set the Trigger for a Stable Display
- Press the Trigger Menu and set:
- Mode: Edge
- Source: CH1
- Slope: Rising Edge
- Level: Adjust until the waveform stabilizes
4. Running the Oscilloscope & Viewing the Waveform
- Press AUTOSET (if available) to let the DSO automatically adjust settings.
- If AUTOSET doesn’t work well, manually tweak Volts/Div and Time/Div.
- Observe the waveform:
- If using PWM output, you should see a square wave.
- If using an analog sensor, the waveform may look more irregular.
- Use Cursors or Measurements (if your DSO has them) to check signal values.
5. Capturing & Analyzing the Waveform
- If your oscilloscope has a Save function, take a screenshot of the waveform.
- Compare the output with the expected Arduino signal.
- Adjust your Arduino code if needed to modify the signal.
void setup() {
pinMode(9, OUTPUT);
}
void loop() {
for (int u = 0; u < 255; u++){
analogWrite(9, u);
delay(50);
}
}
Video Demonstration