We start by probing an IR sensor and we observe it's signal using oscilloscope.
we supplied the IR sensor with 5V and probed the output pin and we observe the
oscilloscope
The signal changes as we interact with the IR sensor high or low
Check our
Group assignment page to see more of our assignment.
The Step Response is a sensor that is made with two sheets of copper. It can be used to
calculate the value of force, weight, resistance...etc.
I have followed Robert Hart's
tutorial as well as Adrian's Example.
long result;
int analog_pin = 27;
int tx_pin = 26;
void setup() {
pinMode(tx_pin,OUTPUT);
Serial.begin(115200);
}
long tx_rx(){ //Function to execute rx_tx algorithm and return a value
//that depends on coupling of two electrodes.
//Value returned is a long integer.
int read_high;
int read_low;
int diff;
long int sum;
int N_samples = 100; //Number of samples to take. Larger number slows it down, but reduces scatter.
sum = 0;
for (int i = 0; i < N_samples; i++){
digitalWrite(tx_pin,HIGH); //Step the voltage high on conductor 1.
read_high = analogRead(analog_pin); //Measure response of conductor 2.
delayMicroseconds(100); //Delay to reach steady state.
digitalWrite(tx_pin,LOW); //Step the voltage to zero on conductor 1.
read_low = analogRead(analog_pin); //Measure response of conductor 2.
diff = read_high - read_low; //desired answer is the difference between high and low.
sum += diff; //Sums up N_samples of these measurements.
}
return sum;
} //End of tx_rx function.
void loop() {
result = tx_rx();
Serial.println(result);
delay(100);
}
The Capacitive Touch is a sensor that is made with one sheets of copper. That can be used
to detect the touch by sensing the change in voltage as the plate charges up. The closer
the grounded object is to the plate, the larger the capacitance, and the longer it takes
to charge.
I made a tiny Capacitive Touch to use with my Xiao board
I have followed Robert Hart's
tutorial.
#include <FastCapacitiveSensor.h>
#define send 27
#define receive 26
FastCapacitiveSensor sensor1;
void setup() {
pinMode(send, OUTPUT);
pinMode(receive, INPUT);
Serial.begin(115200);
sensor1.begin(send, receive, 1.85, 500, 500, 0.3);
}
void loop() {
Serial.println(sensor1.touch());
}