My next step was to create a zipper slider that would be used as a low-pass filter between the microcontroller and the mini-jack to provide the user with some kind of volume control for the headphones (and also filter any possible noise). After experimenting with different materials and techniques I decided to go with Kobakant's "zipper slider", but instead of using resistive thread 66 Yarn 22+3ply 110 PET (4 K Ohms/20 cm resistance) and Lame Life Saver conductive thread, I have used Plug and Wear's resistive tape (3.2 K Ohms per linear meter/yard) form one side of the zipper and Spark Fun'sConductive Thread 60g (Stainless Steel) (28 Ohms/30 cm resistance) on the other side. The side with the resistive tape is hooked up in the microcontroller and programmed to play a square wave 800 Hz tone, using the internal pull up resistor of the board, while the side with the conductive thread passes through a 47uF capacitor and ends at the speaker. Unzipping produces a higher pitch and when the zipper is completely open you get the highest pitch (in this case 880 Hz).
This is the code that I used for testing:
// Low-pass filter that uses a zipper slider instead of a potentiometer
int speaker = 12; // speaker connected to digital pin 12 (on Flora, D12 and A11 are the same pin)
void setup() {
pinMode(speaker, OUTPUT); // initialize speaker pin as an output pinMode(A11, INPUT_PULLUP); // use the internal pullup resistor
}
void loop() {
tone(speaker, 880); // play a square wave of 880 Hz
}
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.