Week 12: Input Devices


Step Response

According to the need of my Final Project, I decided to use the Step Response as my input device for this week. On the Global Lecture, Adrian shared his experiment with Step Response from last year. I learned a lot from it.

To start my assignment as soon as possible, I milled my board with the trace provided by Adrian.


I tore off 2 of the cables to fit them into the 2.54mm pitch connector which has blades to cut through the Over Sheath.


With a pair of copper sheets soldering with the cables, and then my sensor was done!


Once I tried to connect the sensor to my helloboard, I realized that I don’t have any female headers on my helloboard… Adrian designed his Adrianino to multiple functions and compatible with most situations. I need my own board with a microcontroller as well.

1 1

Design my Step Response

To design my own step response sensor, I followed Ardian’s experiment, Robert Hart’s tutorial, and Neil’s examples.

?How does it work


A series of electric pulses are sent through the TX electrode, and it allows some of the pulses to pass the electric field. Depends on what kind of material in between the amount of passing electronic is different.

?Voltage Divider

The (optional) resistors between 5V and GND make the signal stabler. The input to the ADC is attached to the point halfway between 5V(3.3V) and ground, and is therefore at 2.5 volts, except for the transient blips that occur at the tx electrode changes voltage. These resistors should be equal and should have values of 1 mega-ohm or larger.

The further calculation could be found from Khan Academy


Base on the different microcontrollers we used, we could connect the TX and RX into different pins. In the Step Responsee sensor case, we need an Analog pin to send and receive the pulse. Adrian chose PA5 and PA6 from ATtinyX14. It is also presented in his code.

1 1 1

I chose ATtiny412 as my microcontroller and changed the pins in my schematic and code according to the datasheet and SpenceKonde.


Bypass Capacitor (Decoupling Capacitors)

Decoupling Capacitors, also referred to as Bypass capacitors, are a pair of capacitors we usually put besides microcontrollers to stabilize the incoming voltage. It acts as an energy reservoir. In the reality, the voltage would have some noise which would lead to the unstable performance of the microcontroller and also shorten the lifetime in the long term.

When a decoupling capacitor is in place, it will do one of two things:

  1. If the input voltage drops, then a decoupling capacitor will be able to provide enough power to an IC to keep the voltage stable.
  2. If the voltage increases, then a decoupling capacitor will be able to absorb the excess energy trying to flow through to the IC, which again keeps the voltage stable.

(picture from Eagle Academy)

In our case, we only use one capacitor (10uF) to simplify the circuit but also keep the stabilizing function.

Further explanation could be founded from Eagle Academy.

!Analog-to-Digital Converter (ADC)


Microcontrollers can’t read values unless it’s digital data. This is because microcontrollers can only see “levels” of the voltage, which depends on the resolution of the ADC and the system voltage.


The ADC’s resolution can be tied to the precision of the ADC.


Further information could be found from Engineering Resources: Basics of Analog-to-Digital Converters

?Vcc vs Vdd

In the datasheet and a lot of schematics, we can see Vcc and Vdd almost everywhere. I was so confused what the difference between them. The answer from What is the difference between Vcc, Vdd, Vee, Vss? explains that “In practice today Vcc (collector or common collector voltage) and Vdd (drain) mean the positive voltage (+), and Vee (emitter) and Vss (source) means the ground (-)."

?Direction of LED

There are two ways to recognize the direction of LEDs. One is from the top view to see the green line of LED, which is ground. Another one is to check the datasheet directly.


Step Response Schematic

1 1

Create the .rml with mods, there is the new version of Mods Projects.

1 1

5x Speed Up




Arduino Code

//tx_rx03  Robert Hart Mar 2019.
//Step Response TX, RX by Adrián Torres Omaña
//Fab Academy 2021
//Step Response TX, RX

//Modified by Russian Wu
//Fab Academy 2021
//Step Response TX, RX

//  Program to use transmit-receive across space between two conductors.
//  One conductor attached to digital pin, another to analog pin.
//  This program has a function "tx_rx() which returns the value in a long integer.
//  Optionally, two resistors (1 MOhm or greater) can be placed between 5V and GND, with
//  the signal connected between them so that the steady-state voltage is 2.5 Volts.
//  Signal varies with electric field coupling between conductors, and can
//  be used to measure many things related to position, overlap, and intervening material
//  between the two conductors.

long result;   //variable for the result of the tx_rx measurement.
int analog_pin = 2; //  PA1 of the ATtiny412
int tx_pin = 3;  //     PA2 of the ATtiny412

void setup() {
pinMode(tx_pin,OUTPUT);      //Pin 2 provides the voltage step

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();
result = map(result, 6000, 11000, 0, 1024);  //I recommend mapping the values of the two copper plates, it will depend on their size

Serial Communication between Arduino and Processing (From Adrián)

To open the communication between Arduino and Processing in the same computer, we could use serial numbers to transfer the Serial printing data. Same baud rates are also essential to make sure they are at the same frequency.

1 1

Step Response Performance


In this video, you can see the transmit-receive effect between a sponge.


In this video, you can see the distance affects the number we got. The weight of the stuff we put on the copper sheets could also be measured.


  1. No symbol and footprint of 02x02 Connector

    The latest version KiCAD for mac excluded the default library, thus I couldn’t find the symbol of 02x02 Connector.

    !! Solution:

    Download the KiCAD library from the official GitHub. And add the components in the symbol and footprint library.

    1 1

    Assign the correct footprint to the connector.

  2. The Clearance and Track Width is too small to mill clearly.


    !! Solution:


    In the PCB Layout editor increase the clearance and track width to 0.4mm. And the press, the following shortcut to edit the previous layout.

    • E for edit
    • I for select all
  3. The trace on PCB was too thin to take off.


    !! Solution: Decrease the offset setting in Mods, to increase the thickness of the connection path on PCB. 1

Group Assignment

This week Kitija and I managed to use a motion sensor, OpenPIR to collect the data from movement. Find further information from Kitija’s documentation!


The Week 12 zip file includes:

1 1