Skip to content

Input devices

Group assignment:

  • Probe an input device(s)’s analog and digital signals

We’ve decided to measure the voltage level of a push-button in two different states. We have the depressed state, corresponding to the 0v level (numerically low), and we have the button in its normal state, in which case the voltage level will be 5v. We’re going to use the digital multimeter we have at the lab to measure these different voltage levels.

Principle

a pushbutton is used to close or open a circuit. connecting the pushbutton to a development board indicates whether it is pressed or not. the information is binary and is either 0V (low state) or 1V (high state). in principle, the low state corresponds to ground and the high state should correspond to a measurement of 5V.

here is the button in question

the voltage value is about 5v

When the button is held down, the voltage tends towards 0v

Digital signal probing

Siglent Oscilloscope

For probing the digital signal we used an oscilloscope as shown below. we’re going to measure the output signal of an Hc-SR05

we’re going to use the oscilloscope to read the analog siganl of the sensor. for this, we’ll use the GND and the Echo pin.

  • connect the GND pin on the HC-SR05 to oscilloscope ground

  • connect the ECHO pin on the HC-SR05 to the oscilloscope probe

First of all, we need to generate a TRIG signal, one before using our card designed on the work of DROH to send a signal.

download the base code on your card

#include <Ultrasonic.h>

/*
 * Pass as a parameter the trigger and echo pin, respectively,
 * or only the signal pin (for sensors 3 pins), like:
 * Ultrasonic ultrasonic(13);
 */
Ultrasonic ultrasonic(25, 26);
int distance;

void setup() {
  Serial.begin(115200);
}

void loop() {
  // Pass INC as a parameter to get the distance in inches
  distance = ultrasonic.read();

  Serial.print("Distance in CM: ");
  Serial.println(distance);
  delay(1000);
}