top of page

Fabricademy 2017

week 9 - E-Textiles and Wearable II

Incorporating computation into soft circuits by using microcontrollers and single-board circuits.


Create an interactive object integrating a microcontroller into a textile circuit.


Based on a suggestion given by Phillip, a student of our university who is blind, I decided to create an interactive object that would identity and warn the blind user if a glass is empty or full of liquid. This could be made as a hand accessory that would emit sounds.

fig 9.1 - attempt to use capacitive sensor.

Testing with the capacitive sensor

As a first attempt, I tried together with Luiz Bueno to build a capacitive sensor to read the level of the water. We use a plate of copper, the Arduino and some resistors. We tried adding the code that Luiz already had for capacitive sensors but in the end we noticed that this sensor didn't detect the level of the water but the proximity of the glass itself. 

My next idea was to use an ultrasonic sensor.

Testing with the ultrasonic sensor

The idea was that the ultrasonic sensor could be put on top of the glass and measure the distance to the water, emitting different sounds if the distance is big (empty glass) or short (full glass).


I searched online for the ultrasonic sensor code and tested it with glasses of water. The ultrasoni sensor has two pins which are the echopin (input) and the trigpin (output). As I tested, they work connected to both digital and analog pins of the Arduino. Once it worked and it could detect the distance to the water by reading the changing values in the serial monitor, I proceeded to add the buzzer to the code. Since my initial plan was to create a wearable, I used the lilyPad buzzer, in which the negative must be connected to the ground and the positive to a resistor and then to a pin in the Arduino. It worked well but the sound emiting was not very easy to control just by changing the values of the distance. So I had the idea of adding also a button, which the user can press to read the distance to the water once the sensor is placed above the glass. I changed the beeping speed in such way that if the distance is less than 10 it would beep faster meaning that the glass is full, and if the distance is bigger than 10 the beeping pace would be slower, meaning that the glass is empty. The code was finalized as the following:

const int trigPin = 13;
const int echoPin = 11;
const int buzzer = 2;
const int button = 9;

long duration;
int distance;
void setup() {
pinMode(trigPin, OUTPUT); // Sets the trigPin as an Output
pinMode(echoPin, INPUT); // Sets the echoPin as an Input
pinMode(buzzer, OUTPUT); // Set buzzer - pin as an output
Serial.begin(9600); // Starts the serial communication
pinMode (button,INPUT);
void loop() {
  int botao;
  botao = digitalRead(button);//Put the reading value of the switch on botao
Serial.println(botao); //Shows the logic state of the input on Serial Monitor 
digitalWrite(trigPin, LOW);
digitalWrite(trigPin, HIGH);
digitalWrite(trigPin, LOW);
duration = pulseIn(echoPin, HIGH);
// Calculating the distance
distance= duration*0.034/2;
// Prints the distance on the Serial Monitor
Serial.print("Distance: ");

if (botao == 1) // Pressed button, logic State HIGH (5V)
      digitalWrite(buzzer,1); //Switch pressed, buzzer on 
     if (distance > 10){
     tone(buzzer, 1000);
     //analogWrite (buzzer, 1000);
     delay (500);
     delay (1000);
   if (distance < 10){
     tone(buzzer, 1000);
     //analogWrite (buzzer, 1000);
     delay (200);
     delay (100);

      digitalWrite(buzzer,0); //If the switch isn’t pressed, buzzer off. 

fig 9.2 - Ultrasonic sensor .

fig 9.3 - Ultrasonic sensor testing with buzzer and button.

Creating the interactive object

To finalize the interactive object I designed a shell which would contain the circuit and microcontroller. I planned to substitute the Arduino for the LIlypad and sew the components in a textile following the scheme drawn in the fig 9.4. Then this textile would be bent to fit inside a shell as illustrated in the upper right corner of the same image.

Using the 3D modelling software I am used to, which is Cinema 4D, I modelled the shell in two parts: the cover would contain the components and a locking lid secures everything inside.

After that I 3D printed the model in PLA 0.4 nassel using Cura and the Ultimaker 3D printer.

fig 9.4 - Ultrasonic sensor testing with buzzer and button.

fig 9.5 - 3D model of the shell.

fig 9.6 - First 3D printed object.

Unfortunately the fitting of the ultrasonic sensor was not perfect. I made some adjustments and 3D printed again but this time with 0.6 nassel, which turned out to be too thick. For this reason I printed the lid for a third time with the 0.4 nassel. 

Due to time constraints I could not sew the circuit in textile as I planned.

fig 9.7 - 3 versions of the lid.

fig 9.8 - Object, with sensor inside

fig 9.9 - simulation of usage.

bottom of page