This week - I wanted to make a glove that can respond to taps and flexing of my fingers. When I listen to music sometimes I tap my fingers if I am really into a song. I wanted to convert that into some form of music visualization. I needed three different kind of sensors
A Flex Sensor - To recognize bending of my fingers. These usually cost 10$ a piece.
A pressure sensor or a knock sensor - To recognize my taps. These were pretty cheap
An accelerometer - To recognize the rotation of my hand in 3D
Things I did this week
Making my own flex sensors
Flex sensors can get expensive for a responsive glove - Since they cost 10$ per finger and for one glove, the flex sensors alone would be 50$ - I could have obviously spent the 50$ for my sanity but well - I got into trying to make these and that quickly consumed all my time. DIY flex sensors are not knew. There are so many different tutorials out there. I followed each one and tried them all. But in the end the ones that worked at least reasonably were my weird combination of pieces from knee brace and a variable resistance stretch fabric I found for 15$. Considering one of this piece can probably make about 15 flex sensors - the cost made sense to me. I also compared this to the paper, aluminum foil, copper braid ones.
Flex Sensors depend on the bend creating either a resistance change or a capacitance change. In my case, I made a voltage divider with two resistors - One as a variable resistor from my flex sensor and one as a resistor of about 49K Ohms. For testing various flex sensors I made, I made one breakout board to function as my voltage divider piece. The code uses the GPIO 12 to provide the 3.3 V voltage and reads the analog input on GPIO 34. Code for simply getting the analog print and doing a serial print is
int analog_val = 0;
const int analog_channel_pin = 34;
void setup()
{
Serial.begin(115200);
pinMode(12,OUTPUT);
digitalWrite(12,HIGH);
}
void loop()
{
digitalWrite(12,HIGH);
analog_val = analogRead(analog_channel_pin);
delay(200);
Serial.println(analog_val);
}
First I tried to use the strategy described here