Transistor as a switch off of audio signal

Discussion in 'The Projects Forum' started by Mike Bedford, Feb 19, 2015.

  1. Mike Bedford

    Thread Starter New Member

    Feb 10, 2015
    18
    0
    Hello all,

    I am looking at ways of driving a load from a pre-amp audio signal, for example from the headphone jack of a phone or iPod playing music. The load is not too large, about 200mA or so. I know i am being vague about the load and that is for two reasons; first I am not 100% sure what my final load will be. Right now it is an array of LEDs but I may change that. Second, I know how to drive the load with my transistor already (using general purpose NPN) and i can turn the load on and off just fine using an Arduino for example.

    The main question I have is how to take the base of the transistor off of the Arduino which currently turns it on and off and apply it to the audio pre-amp output? For example, if I want to pulse the load to the beat of the music? First of all, I measured the audio output with my scope at around .5 Vpp and that was with the volume all the way up which is still a bit low to turn on a transistor reliably. Second, I am going to want to apply a passive low pass filter using a simple RC so i get just the bass or the beat but this likely will cut my voltage more. So, given all of this, what is the best or easiest approach to switch my load so it pulses to the beat? I know it can be done somehow as I see some audio products in the past that can pulse things like lights or vibrating motors, etc....

    Thanks!

    Mike
     
  2. #12

    Expert

    Nov 30, 2010
    16,345
    6,828
    You can add a common emitter transistor amplifier stage to jack the input wave up to 5 volts peak to peak and use that to drive the low pass filter.
     
  3. djsfantasi

    AAC Fanatic!

    Apr 11, 2010
    2,812
    834
    I used an op amp to scale the signal to 0-5V and fed it into an RC filter to smooth out the signal, getting an envelope of the sudio signal. The project is here.

    The Arduino then read it with an analog read, and the returned value used to drive my load.
     
    #12 likes this.
  4. #12

    Expert

    Nov 30, 2010
    16,345
    6,828
    TS did not say he has an Arduino, but the op-amp stage can be used for this job.
     
  5. djsfantasi

    AAC Fanatic!

    Apr 11, 2010
    2,812
    834
    I took this as there was an Arduino in the mix.
     
  6. #12

    Expert

    Nov 30, 2010
    16,345
    6,828
    Darn, missed again. :oops:
     
  7. Mike Bedford

    Thread Starter New Member

    Feb 10, 2015
    18
    0
    Thank you all for the replies last week. Just for clarification, I am using the Arduino right now for other things but I am hoping to not need to use it if at all possible for what I want to do. It seems to me that it adds another layer (components and software) to achieve what I want and if I can just find a way to drive my load directly from the audio, that would be preferred.

    So, here is an update, I am thinking about driving a very small vibration motor as my load (as I mentioned, it is now an array of LEDs that pulse to the music). The motor should act similar to a speaker. It is the one sold on Sparkfun here: https://www.sparkfun.com/products/8449

    The main issues are that the motor is reading about 64 ohms on the coil AND that the voltage requirement in the datasheet says 2VDC to 3.6VDC. Having said that (again, be easy on me as I am new to this stuff and this is for a personal project) I don't see why it won't work like a speaker. Aren't both the speaker and the motor a form of a coil?

    Regardless of the debate of whether or not it is similar to a speaker, how can I drive this directly from the audio? Here are my thoughts so far, some of which are based on the feedback I got previously:
    1. Use an op amp to amplify the signal so instead of phone/iPod headphone levels of around 400mV, I can get somewhere in the 2.5V - 5V range.
    2. Use either a passive (RC) or active low pass filter to get just the beat (I am thinking below 300Hz or so, don't need to vibrate to the whole frequency range but rather, the lower ranges).
    3. After this is where I am stuck. Can I just feed the amplified and low passed audio right into the motor? Should I go through a NPN switching transistor where the op amp output drives the base of the transistor?
    4. Should I DC bias the audio so I am 0-5V, centered around 2.5V first? If I do this, do I still use a transistor or can I feed it right into the motor?

    Any other ideas or thoughts?

    Thank you very much!

    Mike
     
  8. Mike Bedford

    Thread Starter New Member

    Feb 10, 2015
    18
    0
    As an update from testing I did tonight, I built the schematic below. As you can see, it has basically three stages. First is the typical op amp audio amplifier to boost my headphone output. After this stage, the audio sounds really good and I am getting around 2.4Vpp on the scope (after I played with the gain pot, I can get alot more but it gets distorted). Second stage is the simple, passive RC low pass filter so I only send the bass/beat to the load. Later I can refine this a bit and/or go to active but for now it works as I verified with the scope and my headphones. Last stage is the DC bias using a cap and a simple 100k voltage divider. Since I am using 9VDC to run the op amp, for now I also have a second power source of 3.3VDC that I fed into this voltage divider. As expected, this stage works too and I get mostly DC bias on my scope that is anywhere between 0 and 3.3VDC (although at times it does drift outside of 0-3.3VDC depending on the audio I am sure) and it is centered right around 1.65VDC.

    So, all this sounds and looks good so far. Except when I put my vibration motor in place of the load. It sort of works as I do get a very faint vibration and even hear audio coming from it. However, it is just that, very very faint. Also, I noticed on the scope that when I apply this load to the output, it severely cuts my output that is running average of 1.65VDC and peaking around 3.3VDC down to 500mV. If I remove the load, looks good again. So, the load must be too much for the output? Also, when I hook up my headphones to the output of all of this, even the DC bias part, the audio sounds fine.

    So, I am thinking two obvious things:
    1. Do I need to add more things after the DC bias stage? Protection Diode across the motor for example? Any other components?
    2. The motor is too much load for the circuit and drags it down? Could this be why it is so faint? Any ideas on how to fix this issue?

    Any other thoughts or things I might be missing?

    Test is hopeful so far as I did hear something and it did move the motor ever so slightly.

    Thanks!

    Mike

    Schematic.jpg
     
  9. Reloadron

    Active Member

    Jan 15, 2015
    967
    232
    What exactly are you wanting or expecting this little vibration motor to do? Looking at the data sheet for the motor it would seem to be just a tiny DC motor. It has the following specifications:

    Voltage [V]: 3
    Frame Diameter [mm]: 10
    Body Length [mm]: 3.4
    Weight [g]: 1.2
    Voltage Range [V]: 2.5~3.8
    Rated Speed [rpm]: 12000
    Rated Current [mA]: 75
    Start Voltage [V]: 2.3
    Start Current [mA]: 85
    Terminal Resistance [Ohm]: 75
    Vibration Amplitude [G]: 0.8

    The final voltage divider 100K & 100K effectively has a 75 ohm motor coil in parallel with the lower resistor making the lower resistor pretty close to 75 ohms. Nowhere do I see the 75 to 85 mA required to get the motor to start or run? If you want to drive this motor you will need a transistor to drive it capable of the required current. You can't use a motor as a speaker just because they each use a coil and a magnetic field to work. So I am wondering exactly what the goal is here, as in exactly? Once the exact goal is known I am sure people can help you with your project.

    Ron
     
  10. Mike Bedford

    Thread Starter New Member

    Feb 10, 2015
    18
    0
    Ron and all,

    Thank you for the replies thus far. I understand the issue of putting the motor on the output of the voltage divider and that it effectively breaks the voltage divider by bringing the lower resistor down to 75 ohms. Guess I missed that one. 85mA of start current does not seem like alot. However, I agree that I may not have that here and that is likely a big part of the problem.

    Here is what I am trying to do exactly, I am trying to vibrate the motor to the low end frequency of the music. Similar to the way a sub-woofer does it. For example, these are in place on gaming chairs where you play video games and the chair will vibrate or rumble to the action or the music to provide a haptic feedback. I know that this motor is far too small and weak to rumble a chair or something like that but I want to try it on my headphones. Same concept as the chair but on a smaller scale. I understand that some of those may use a PWM to drive the motor. Others may also use a special track in the audio that is dedicated to the vibration and they aren't actually doing it off of the low frequency of the music track.

    So, I would like to test the theory that I can vibrate the motor to the beat of a music track, by beat I mean the lower frequencies or bass. I would like to keep components to a minimum which is why I am avoiding PWM at the moment (PWM adds components and software if I use Arduino). I got really close last night where I actually did get a little something out of the motor. I think I was just shy of the current/voltage needed to start the motor and I also effectively broke the DC bias volatge divider. If I solve those issues, based on what I saw/heard last night, I think it will work.

    So, I guess the question is now, what is the best way to solve those final issues?
    1. Do I need DC bias and if so, how do I implement it without it being broken when I introduce the motor?
    2. How do I get the DC bias on the right scale to drive the motor. Meaning, now I am sitting at 0-3.3VDC biased with a center of 1.65. Can I get it to 2.5-3.8VDC instead, centered on 3.15VDC which should drive the ranges of the motor.
    3. How do I get at least 85mA current to it?
    4. Is all of this solved by simply adding a NPN transistor in place of the motor now (at the output of the voltage divider) and then using the transistor to switch my motor on and off?

    I believe that if those 3 questions are answered, it will work.

    Any ideas? Thoughts?

    Thanks!

    Mike
     
  11. djsfantasi

    AAC Fanatic!

    Apr 11, 2010
    2,812
    834
    Personally, I'd modify a color organ circuit, only utilizing the base stage. They often have transistor driven outputs, to drive LEDs or whatever, which could drive your motor. Just don't forget a snubber diode across your motor leads.

    Here's one such circuit, for example.
     
  12. Reloadron

    Active Member

    Jan 15, 2015
    967
    232
    Exactly, that would also be my suggestion now that I "get it" as to the game plan and goal. A Google of Color Organ Circuits will bring up dozens of hits. I would just use the bass section and you could even tweak that filtering better. There are low voltage versions that drive small incandescent lamps. Here is an example of a 4 channel version using MOSFETS to drive 12 volt lamps. Actually the MOSFET could be likely eliminated and just the final transistor used to drive the motor. You could likely derive a mini prototype from that design.

    Ron
     
  13. Mike Bedford

    Thread Starter New Member

    Feb 10, 2015
    18
    0
    Great idea guys! Thank you very much! I have all the stuff on hand and will be trying it right now. I will keep you all posted on how it works.

    As I am getting ready to test this, I still have one last question. Should I still use the DC bias part of the circuit before I feed into into this new approach so the base of the transistor only gets positive DC voltage?

    I was also going to ask about the op amp before hand too but I think I will leave that in as well to boost the signal.

    Thoughts on those items?

    Thanks!

    Mike
     
  14. Reloadron

    Active Member

    Jan 15, 2015
    967
    232
    If you look at the circuit provided by djsfantasi the DC bias is taken care of by the two 10K resistors and the diode at the base of the first transistor. The link I posted uses an op amp which is offset. So both circuits have offset. I would just work from either design.

    Ron
     
  15. Mike Bedford

    Thread Starter New Member

    Feb 10, 2015
    18
    0
    As an update and a cry for additional help with this....

    First thank you for the ideas on the LED organ to get my project working. I copied the exact same makezine LED organ circuit that djsfantasi suggested here: http://makezine.com/projects/easy-led-color-organ/

    The LED organ works by pulsing the LED to the beat of my music. I then tried to take that base circuit and get it to drive my vibration motor since that is my ultimate goal. Here are my notes/questions:
    1. The collector of the final transistor that drives the LED will NOT drive the motor. It does just fine driving the LED but it will not drive the motor. Using the scope, I verified the voltage is correct (average about 3.2VDC when triggered) so there must be an issue with current. Enough current to drive the LED but not enough to drive the motor (I guess)? Even though the motor is only 80mA?
    2. Because of number 1, I left the LED in place so I can see it pulse to the beat still and then tapped off of that same collector that drives the LED and ran it into another NPN (2N3904) transistor that will be used to switch the motor seperately. I first go through a 120 Ohm resistor before the base of my new transistor. Good news is that this now drives the motor......sort of (but getting really close). Here are the two new issues I am having even though I can now drive the motor.
    a. The motor does not react all the time. I used a signal generator and found the reason for this. It does not turn on or get up to speed quite fast enough. I can hear it with the signal generator. When I first apply the wave, it is real faint for a split second (I would guess about 250-500ms) and then it gets to full vibration. So, during the music test, if the low note is extended long enough, that is when I see it working. If the low note is too short (as it seems most of them are) the motor doesn't really do much. I am thinking maybe a cap is needed somehow to help start the motor up to full speed immediately? Any ideas on this?
    b. I noticed when playing with the signal generator that the LED organ itself (as witnessed both with the LED and the vibration motor) is not doing any low pass crossover or at least not doing a good job at it. I know in the LED organ article there are three stages. I used the 3rd and last stage as that one was listed as the low pass stage (uses a 1uF cap and 2.2k resistor between emitter and base). I am getting down to 50hz which is good but I also ran all the way up to 10khz and the LED and motor still run. Any ideas on this?

    Besides a and b above, I would like to know if there is something I can do still to run the motor straight off of the same transistor the LED runs off of so I don't have to add a third transistor as I have done for the moment. If I need to add a third transistor, that is fine, just trying to cut down on parts. Maybe the issue has to do with the 270 Ohm resistor that is used for the LED. I think I went after the resistor just as it hooks up to the LED. Maybe I should try to go straight off of the transistor before the 270 Ohms?

    Thank you everybody!

    EDIT --- I just tried to put the vibration motor right off of the transistor BEFORE the 270 Ohm resistor that drives the LED and it works. So, I don't need to add the additional transistor just to drive the motor. However, the same issues still apply where the motor takes a split second to get fully up to speed so it misses most short notes AND the crossover still does not seem to be working. So, I just need to fix those two issues now. I am still guess that a cap is needed to help the motor start I just don't know how to implement and not sure what is going on with the crossover. However, getting closer...almost there!

    Thanks!
     
    Last edited: Mar 2, 2015
  16. Reloadron

    Active Member

    Jan 15, 2015
    967
    232
    <QUOTE>EDIT --- I just tried to put the vibration motor right off of the transistor BEFORE the 270 Ohm resistor that drives the LED and it works. So, I don't need to add the additional transistor just to drive the motor. However, the same issues still apply where the motor takes a split second to get fully up to speed so it misses most short notes AND the crossover still does not seem to be working. So, I just need to fix those two issues now. I am still guess that a cap is needed to help the motor start I just don't know how to implement and not sure what is going on with the crossover. However, getting closer...almost there!</QUOTE>

    Well some good news in there. Here is something you may want to try. Just apply about 3.2 volts to the motor and see if it spools up to speed instantly. Let's just make sure the motor, stand alone, can spool up to speed quick enough. As to the circuit they use a 2.2 Kohm base resistor and you can try decreasing that. Try about 1.0 Kohm. As to the bandpass? Circuits like this do not use very fancy bandpass filters. In time a better filter can be developed. The circuit design using 4 channels I linked to is a little better but still nothing great. Anyway I would start by making sure the motor itself spools up fast enough.

    Ron
     
  17. Mike Bedford

    Thread Starter New Member

    Feb 10, 2015
    18
    0
    Ron,

    Thank you for the response. I tried applying 3.2 volts to the motor directly and it does appear to spool up quickly if not instantly. I don't have a good way to measure this to give exact results and I am sorry about that but I can say it does not seem to be an issue when applying power directly and when then putting it back into the circuit it is noticeably worse. Given that, I would draw the conclusion that the circuit is the issue.

    As for the comments on the filter, I agree, I would like to solve the motor issue first. After that, I also agree that there are things that can be tweaked or at least done better.

    Thanks!

    Mike
     
  18. Reloadron

    Active Member

    Jan 15, 2015
    967
    232
    OK, now in the circuit let's try a 220 Ohm base resistor, I believe you have around 2.2K Ohm as it is now. Using 220 Ohms should drive the transistor into saturation real hard and fast.

    Just to be sure on my part you are using 3.3 volt power correct?

    Ron
     
  19. Mike Bedford

    Thread Starter New Member

    Feb 10, 2015
    18
    0
    Okay, going to try the different resistor value in a little bit. Will let you know.

    As for the power....it starts out as a 9 volt battery/supply per the LED organ schematic. However, I measured 3.2 volts at the collector of that transistor just before the LED. Have not measured the base.
     
  20. Mike Bedford

    Thread Starter New Member

    Feb 10, 2015
    18
    0
    Okay, So here are some preliminary results:
    1. When I changed the resistor to 220 Ohms, it did drive the transistor into saturation but it did it a little too much and it was on all the time (the LED and the motor both powered up). I then tried a value in between and went with 1k Ohm. That prevented the transistor from being on all the time but didn't seem to make much difference with the issue.
    2. In playing around with everything on the breadboard, I have started trying to just change or take out components. If I completely remove the base resistor (meaning instead of using 220, 1k or suggested 2.2k) AND the 1uF cap between base and emitter, it actually seems to act a little better. Don't know if that helps figure things out or makes it worse.
    3. I am starting to think the low pass issue needs to be dealt with as well since that is sometimes skewing my results possibly and exacerbating this issue. However, I think the base resistor and the 1uF cap that I just removed were SUPPOSED to be part of the low pass filter, right?

    Right now I am going to try leaving them out and researching a better low pass filter that I can maybe put at the front end on the audio input until I hear of any other possible ideas or things to try.

    Thanks!
     
Loading...