WEEK 11 - INPUT DEVICES

TODOs for this week

☑ Measure something: add a sensor to a microcontroller board and read it.
☑ Describe the design / fabrication processes.
☑ Explain the programming process and how the MCU datasheet helped.
☑ Outline problems faced and how they were fixed.
☑ Include design files and code


Step response



Arduino code for step response

After understanding the code from Neil's code I wrote a simplified Arduino code and visualise the output using Processing. In the code, transmit (tx) pin is made alternately high (5V) and low (0V) which charges and discharges the tx electrode. On the rx electrode there is a small 'blip' up or down as the tx pin toggles. These blips are measured by the Arduino analog input (ADC), and "low" subracted from "high" gives a result that varies depending on how closely the two plates are coupled by the electric field. It increases as the distance decreases and also changes with the amount of overlap and the material between the plates.



//Mystepresponce Embafrsh Solomon
//Fab Academy 2021

//  Program to use transmit-receive across space between two conductors which are attached to digital pin and another to analog pin.
//
//
//  This program has a function MystepResponce() which returns a long integer value.

long value;   //variable for the result of the tx_rx measurement.
int analog_pin = A3;
int tx_pin = A2;
void setup() {
pinMode(tx_pin,OUTPUT);
Serial.begin(115200);
}


long MystepResponce(){
  int read_high;
  int read_low;
  int diff;
  long int sum;
  int SampleTaken = 100;    //Number of samples to take. As much sample as possible to reduce scatter.

  sum = 0;

  for (int i = 0; i < SampleTaken; i++){
   digitalWrite(tx_pin,HIGH);              //Step up voltage on conductor 1.
   read_high = analogRead(analog_pin);        //Measure response  on conductor 2.
   delayMicroseconds(100);            //wait untill steady state.
   digitalWrite(tx_pin,LOW);               //Step down voltage on conductor 1.
   read_low = analogRead(analog_pin);         //Measure response on conductor 2.
   diff = read_high - read_low;       //the difference on high and low readings of condutor 2.
 sum += diff;                       //Sums up N_samples of these measurements.
 }
  return sum;
}


void loop() {

value = MystepResponce();
value = map(value, 8000, 11000, 0, 1024);
Serial.println(value);
delay(100);
}


This is the video showing how the processing script responds with the touch from the input sensor.

Reflection

I learned the basic principles of how sensors in general work. I used great amount of time finding explanation and examples how to interprate the data and how it relates to actual measurments ( calibration and Mapping are all new and Vast sea for me to explore more in the Future. I wasn’t able to compare my input device to anything else as Step Response is a bit different sensor than for example a temprature sensor where you can actually compare the result with another device. This week I also I learned to write a code with Python using Neils example and I think that is very useful skill of building interface that I can use to build my own data visualiser.

Group assignment

Our group assignment can be found here.



DOWNLOAD FILE

Eagle File - Eagle File
RX-TX board Trace- RX-TX board Trace
RX-TX board cutout- RX-TX board cutout
8 PIN INPUT board Trace- Trace
8 PIN INPUT board cutout- cutout
STRIPE CAPACITIVE SENSOR - Trace cutout
Stepresponce Python Code ( From Neil's code)- code
Stepresponce Arduino Code - code
Stepresponce Processing code- code