An input device is an equipment/Component used to provide data and control signals to an information processing system such as a Micro Controller. Examples of input devices include Sensors, Cameras etc.
Sensors & Transducers
A sensor is a transducer whose purpose is to detect some characteristic of its environments. It detects events or changes in quantities and provides a corresponding output, generally as an electrical or optical signal. Transducers are measurement devices used to change one kind of energy to another. Energy may include electrical, mechanical, electromagnetic, chemical, acoustic, and thermal energy
Devices which perform an "Input" function are commonly called Sensors because they "sense" a physical change in some characteristic that changes in response to some excitation, for example, heat or force and convert that into an electrical signal. Devices which perform an "Output" function are generally called Actuators and are used to control some external device, for example, movement or sound.
Analogue and Digital Sensors
Analogue Sensors
Analog Sensors produce a continuous output signal or voltage which is generally proportional to the quantity being measured. Physical quantities such as Temperature, Speed, Pressure, Displacement, Strain etc are all analog quantities as they tend to be continuous in nature. For example, the temperature of a liquid can be measured using a thermometer or thermocouple which continuously responds to temperature changes as the liquid is heated up or cooled down.
Digital Sensors
As its name implies, Digital Sensors produce a discrete digital output signals or voltages that are a digital representation of the quantity being measured. Digital sensors produce a Binary output signal in the form of a logic “1” or a logic “0”, (“ON” or “OFF”). This means then that a digital signal only produces discrete (non-continuous) values which may be outputted as a single “bit”, (serial transmission) or by combining the bits to produce a single “byte” output (parallel transmission).
Source www.codrey.com/electronics/different-types-of-sensors
What a sensor basically does is, it takes the physical change or mesures the physical change and convert that change into some voltage, that voltage undergoes some changes like may be it can be amplified or may be not,
After that there is some mathematical relation, the voltage values are raw it's not a data its fed into some function whose output is the valuable data that we the user actually want from the sensor.
How it's performed
There are various libraries for various sensors, the libraries are nothing but some line of codes which include some fucntions, from which we call those predefined functions to make our main code easy and simple. The library files mostly includes all the conversion formula from which we get the output data from the sensor.
HCSR04- Ultrasonic sensor
The HC-SR04 ultrasonic sensor uses sonar to determine distance to an object like bats do. It offers excellent non-contact range detection with high accuracy and stable readings in an easy-to-use package. It comes complete with ultrasonic transmitter and receiver modules
The ultrasonic sensor uses sonar to determine the distance to an object. Here’s what happens:
The time between the transmission and reception of the signal allows us to calculate the distance to an object. This is possible because we know the sound’s velocity in the air.
HC-SR04 Ultrasonic Sensor Pinout
Pins
Features and specs:
Source~
https://randomnerdtutorials.com/complete-guide-for-ultrasonic-sensor-hc-sr04/
Using FabModules to generates toolpath
SRM in Action
Slodering and programming
Issues
While making the board I forgot to add the Rx pin for the Ftdi to see the values on Serial monitor so I had to plug a jumper because I wanted to make the board working and not to mill another one.
The code-
#include < SoftwareSerial.h >
SoftwareSerial mySerial(0, 2);//rx,tx
const int trigPin = 3;
const int echoPin = 4;
long duration;
int distance;
void setup() {
pinMode(trigPin, OUTPUT); // Sets the trigPin as an Output
pinMode(echoPin, INPUT); // Sets the echoPin as an Input
// Serial.begin(9600);
mySerial.begin(9600);
}
void loop() {
// Clears the trigPin
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
// Sets the trigPin on HIGH state for 10 micro seconds
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
// Reads the echoPin, returns the sound wave travel time in microseconds
duration = pulseIn(echoPin, HIGH);
// Calculating the distance
distance= duration*0.034/2;
// Prints the distance on the Serial Monitor
mySerial.print("Distance: ");
mySerial.println(distance);
}
One needs to understand the circuits on signal level, which multimeters fails to do. In this case Oscilloscopes is the answer. A digital oscilloscope measures the signal, and then converts that measurement into a digital format using an ADC converter, after which the data measured is depicted as a digital waveform representation. From this representation various paramters can be evaluated. In our lab we got Scientific SMO1102E and Keysight DSO1052B Oscilloscopes.
https://in.element14.com/keysight-technologies/dso1052b/oscilloscope-2ch-50mhz-1gsps/dp/2094428