Acoustics

Enter Your Electronics & Design Project for a chance to win an $200 Shopping cart of product!

Back to The Project14 homepage

Project14 Home
Monthly Themes
Monthly Theme Poll

 

Table of Contents



Introduction

Hard of hearing people face all sorts of problems beyond the basic problems of communicating. One of these problems, which is potentially fatal, is not hearing sounds like someone blowing a horn as warning. I’m partially deaf in one ear and I understand the problem a little because I often hear things but can’t tell what direction they come from.
I started thinking about solutions to the direction problem and ended up with the idea of 2 microphones connected to vibration motors embedded into a baseball cap or hair band. Something like the diagram below.



So hopefully if a loud noise occurred, the user would get a buzz on either side of the cap, depending upon which direction the noise was coming from. In order for this to be useful I figured it would have to fit into a baseball cap or Alice band so it needs to be a relatively small circuit. Also I want to keep it as simple as possible.

Experimenting

I have some electret mics that I have had for a while but I don’t have the data sheet. I looked at the data sheet of a similar mic and it showed a basic connection diagram like this.

I knew that I couldn’t just connect a microphone to a vibration motor, because I figured the output from the microphone would need amplifying, plus I needed to control the ouput, but I tried it anyway. Obviously I was right. I needed to do something to read the output and trigger the vibration motor. The question was how could I do that?

Some time ago I made a clap switch using an electret microphone and an Arduino UNO which turned on and off an LED. I dug out the little drawing I always do when I make a circuit.


It was something I found on the internet  and it is very simple circuit and sketch. Connect the electret mic’s output to one of the UNO’s analogue pins and an LED to one of the digital pins. If a sound goes above a certain value, send the digital pin high, or low if it is already high. All I had to do was swap out the LED and swap in the vibration motor. Then I made a few simple changes to the sketch namely getting rid of the switching function and making the vibration motor vibrate longer according to how loud the detected sound was. Once completed I had something that at least worked.

The only problem really was that using an uno made it too big to fit in a hat. The actual mic circuit is quite small so I started thinking how to make it smaller.

At first I wondered if I could just amplify the output from the mic and I tried hooking up a transistor as per the  following diagram but that didn’t work because whilst I could light an LED I couldn’t get enough power to make the vibration motor work.

I saw circuits that have two transistors as per the diagram below.

The result seemed no better than the single transistor. I suspect that this can be done but my ignorance defeated me here and the other circuits I found on the internet had too many components (I guess to correct whatever is wrong with the simple circuit) and as I am trying to keep this fairly simple I looked elsewhere for the solution. This is something for me to come back to in the future. All too often I find myself wanting or needing to know something but the investment in time to achieve that knowledge is too great at that point in time. I need to know everything NOW!!!

Next I tried an LM386 because I figured the components I didn’t want to add were already built inside. Again I just tried hooking the mic up as per diagram below and again I got the same results; it lights an LED but won’t make the motor work. Again I know I’m missing something here but at the moment I don’t know what.

So at this point I thought about adding an L293 or a relay into the circuit to drive the motor but as I said earlier I want this to be relatively simple and ultimately small and fairly light.

So  I have some ATTINY85 chips and I swapped one of these into the Arduino circuit. Then I loaded the ArduinoISP sketch which comes with the built in examples into my UNO. Then I connected the UNO to the breadboard in order to make the connections as per the diagram below.

I then selected the appropriate board. See screen shot below.

And then I  loaded my sketch into The ATTINY85 and it worked!  The photo below shows it all set up for programming the ATTINY85.

This is my code

unsigned long stopMills;          //upper value for Mills the point at which the rquired time has elapsed
unsigned long currentMills;       //current value of Mills
void setup() {
  pinMode(0, OUTPUT);             // Out put pin for vibrating motor
  stopMills = millis();
}
void loop() {
  int mic_val;                 // analog value read from the microphone
  int buzzlength;                // buzz lengthe based on value mic_val read from the microphone
  
  mic_val = analogRead(A2);   // read value from microphone and store in 
  buzzlength = mic_val ;     // manipulate value if buzzlength required to be longer i.e.buzzlength = mic_val * 2;
  if  (buzzlength >200){     // limit the buzzlenth so loud noises don't buzz too long
    buzzlength = 200;
    
  }
  
  if (buzzlength > 10) {             // don't buzz if the value is too low otherwise it would buzz all the time
    digitalWrite(0, HIGH);          // start the buzz
    currentMills = millis();        // store current ills value
    stopMills = currentMills + buzzlength; // add the buzz length to Mills to get a future mills value at which to stop buzzing
    currentMills = millis();               // keep checking to see curerntMills 
    
    while (currentMills < stopMills){     // check to see if stopMills has been reached
        currentMills = millis();
    }
    digitalWrite(0, LOW);                 //stop buzzing
  }
}

So now I had a circuit small enough to fit in my hat but I didn’t want it to be a chunky lump of circuit board. Something flexible would be nice that would sit around the head band. I wasn't sure how best I could do that, I thought about small pieces of veroboard linked by wires; one piece with the mic, a piece with the ATTINY and a piece with the vibrating motor on. Putting the vibrating motor on something solid came from the discovery that if the motor was free to move the wires eventually broke away. I didn't much like the idea of bits of Veroboard in the cap as I thought they would still be felt regardless of how small they were.

Eventually I came up with the idea of using copper tape and flexible plastic as a circuit board.
So I cut a piece of plastic (actually OHP film) and I attached some sticky backed copper tape to it. I then soldered a resistor to it and was pleasantly surprised to find that it didn’t melt the plastic. all I had to do now was build a full circuit.

Final build

I made a drawing of how I thought the circuit should look.


I want the mic to be above or slightly behind the ear and the vibrating motor to be towards the temple. So a distance of 100mm should be about right.

 

I bought some SMD resistors and capicitors and started making a circuit on the plastic. Not very neat to be honest and the way it was evolving was pretty experimental but it was working. First problem was the electret mic just soldered on to the tape wasn’t stable and broke away. A blob of hot melt glue seemed to fix that okay. That SMD components were fiddly but I managed using a pair of tweezers. I got an IC socket and splayed the pins out so it would lay flat against the plastic and then arranged some copper tape to match the circuit and meet the pins. The addition of a coin cell holder and my circuit was finished. I checked as best I could with my multimeter that everything was soldered okay.

I slipped a CR2032 into the battery holder and it worked. Well sort of anyway. It seemed a bit unpredictable as to whether or not it would work. On the breadboard I had used 5v from the UNO I had used to program the ATTINY85, so now it was only getting 3v. I wondered if that was the problem. So I soldered on a battery snap connector and connected 3 AAA batteries to the circuit and it seemed to work as it should. In order for you to see it working I soldered in an LED.

Conclusion

It works! I'm not sure I would trust it to save my life but it does buzz at loud noises. Unfortunately, due to the nature of the mic, the sounds picked up from different directions and the eventual buzzing are too similar to allow me to pinpoint the direction the sound is coming from but you do know a sound is there. Maybe with different components the result could be improved.

As far as the build is concerned  I am thinking that circuit boards are rigid in order to prevent the joints from cracking, so I imagine at some point in time, if used to any degree, the circuit would fail.

From a personal point of view it is sometimes difficult to decide what you have learned.  What I know I have learned Is that I need to understand transistor behaviour better!