PIR sensor to MP3 shield to 30w amplifier

Discussion in 'The Projects Forum' started by allenpitts, Apr 1, 2015.

  1. allenpitts

    Thread Starter Active Member

    Feb 26, 2011
    77
    7
    Hello ACC Forum,

    Started working with a PIR sensor to turn on a circuit.
    Then the PIR circuit was connected to an Arduino microprocessor,
    first to operate an LED and then to play a track on
    the SparkFun MP3 shield thru headphones.
    https://www.sparkfun.com/products/10628

    Yesterday I incorporated a couple of SparkFun mono amplifiers
    https://www.sparkfun.com/products/11044
    This works well and fires atrack on the MP3 shield
    when one walks by the motion detector.

    But the amplifiers are 1.4 watt and not very loud. The
    mono amp Quick Start Guide
    https://www.sparkfun.com/tutorials/392
    has a hack for increasing the amplifier amplitude
    (loudness) by decreasing the gain resistors but
    a volume pot is a preferred solution because it is
    more flexible.
    [​IMG]
    Unfortunately I purchased a Velleman amplifier
    K4003 before I saw the SparkFun Audio Amplifer Kit
    STA540.
    http://www.vellemanusa.com/products/view/?id=350530
    The instructions on the K4003 show three ways of connecting
    the amplifier to power: A ring-core transformer,
    two twelve volt batteries, and a center tap transformer.
    I have the center tap transformer.
    [​IMG]
    The question is about grounding the signal from
    the SparkFun MP3 shield.
    The Velleman instructions show a ground wire coming
    in from the audio source, in this case the MP3 shield
    and the Arduino Uno, to a 22K pot and out to a ground pin on the
    K4003 amplifier.

    But the K4003 amplifier is grounded to the transformer
    so it seems like the amplifier system has two different
    grounds: one at the transformer and one at the
    Arduno/MP3 shield. (But the Arduno/MP3 shield is powered by
    the SparkFun Product number TOL-00298
    Wall Adapter Power Supply - 9VDC 650mA. So is
    the Arduno/MP3 shield grounded to the house mains
    just as the transformer is grounded to the house mains?)

    Or should I set up a little voltage regulator circuit like
    [​IMG]
    between one side of the center tap transformer to create
    a power supply for the Arduino/MP3 Shield so the amplifier and the Arduno/MP3 shield
    are both grounded to the transformer?

    Is there a better solution?

    Thanks.

    Allen Pitts, Dallas Texas
     
  2. Søren

    Senior Member

    Sep 2, 2006
    472
    28
    Hi,

    The nmain thing is to connect the two grounds, but if the transformer has got power for driving the rest , the best option would be to use two diodes, one from each "side" of the transformer (i.e. VA abd VB), with the anodes pointing away from the transformer, connect up a large electrolytic cap (say 2000..3000µF, but it really depends on what the transformer voltage vs. the Arduino++ voltage.
    This way you only have to feed the monster from one source.

    If you run the PIR and MP3-module from the Arduino anyway, you won't need another voltage regulator - just connect the positive node (two anodes plus positive end of cap) to V+ of the Arduino and the center tap of the transformer goes to 0V/ground of the Arduino.
    But... Measure the voltage over the cap first, to assure it's compatible with the input range of the Arduino - and beware that the mains can swing +/-10% or more.
     
  3. alfacliff

    Well-Known Member

    Dec 13, 2013
    2,449
    428
    the simplest way would be to go to wally world or similar and get a car stereo power amp, they are made to be driven off the speaker output of a car stereo. I made a pa amp out of one, it ran about 15 watts per channel, even though the box said "300 watt power booster".
     
  4. allenpitts

    Thread Starter Active Member

    Feb 26, 2011
    77
    7
    Hello Seren, alfacliff and ACC forum,

    Because the output from the wall wart recommended by SparkFun
    for the Arduino Uno rev3
    [​IMG] TOL-00298
    Wall Adapter Power Supply
    is - 9VDC 650mA it was thought that 9 volts was what was needed
    for the microprocessor board which anchors the MP3 shield.

    But reading the specs on the Arduino
    http://arduino.cc/en/Main/ArduinoBoardUno
    its is discovered that recommended input voltage for the
    Arduino is 7- 12 volts and the input limits are 6-20 volts.

    So it looks like one side of the center tap could be used
    to power the Arduino. If that is done the Arduino and the amp
    would both be grounded at the tranformer. But I will
    take your advice and us the DMM to measure the voltage
    between VA and ground.

    If the Arduino is connected to
    VA it seems that side of the stereo amp would be a little
    less loud than the VB side. But this could be adjusted
    by simply increasing the volume on the VA side with the pot to
    compensate.

    Will have to wait until this weekend to fire up the
    soldering gun. And Easter bunnies may have stole my
    solder. Will advise when complete.

    Thanks.

    Allen in Dallas

    PS. Alfacliff. Not ignoring your excellent solution to simply purchase a
    car stereo amp since they are 12 volts. But
    1. The advice I got from Brandon at Tanner Electronics
    was the amplifier wants two separate 12 volt sources. In fact,
    the transformer is a 24 volt center tap which sends two
    independent 12 volt supplies to the amp. So to duplicate that
    with the car stereo amp I think I would have to get two
    car stereo amps.
    And
    2. I already purchased the transformer and the two
    22k pots so will try to make these work before I warm
    up the Am Ex for more gear. Thanks
     
  5. MrChips

    Moderator

    Oct 2, 2009
    12,447
    3,363
    There is difference between Earth Ground and Circuit Common.

    Your transformer GND is not necessarily connected to Mains Earth. This is a safety function.
    Your transformer GND could be "floating".
    Similarly your Arduino power supply and your audio amp GND could all have "floating" GND.

    What is more important is your transformer GND, Arduino GND and audio amp GND must all be connected to a COMMON GND (i.e. connected together).
     
  6. Søren

    Senior Member

    Sep 2, 2006
    472
    28
    Hi Allen,

    The Arduino Uno specs that you linked to are a bit exaggerated in places (to put it mildly), but going by the schematic, it needs 5V after the regulator and you'll need at least 1.5V for the regulator (2V to be absolutely sure) plus 1.1V for the diode protecting against supply reversal - so a minimum of around 8V, which makes a 9V wall wart a sensible choice, provided the 9V is guaranteed, even when the mains are on the low side - like in a switch mode supply.
    At 12Vin, the regulator will have to get rid of twice the power as on 9Vin.
    If it hasn't got a heat sink, a small one wouldn't go amiss.
    If needs be, a string of 1N400n diodes could be used to drop an excessive voltage (around 0.7V a piece)


    Do not use one side only, as that would load the transformer asymetrically and give you a lot more variation of output voltage, since you effectively remove every other half wave!

    Do it like this instead, only one more diode:
    [​IMG]
    Use eg. 4700µF for the cap.


    When you have shot all the bunnies and regained control, please post the output voltage from the diodes/cap node - I'd assume it to be a bit over 16V, given a 12V transformer.

    Happy Easter :)
     
  7. allenpitts

    Thread Starter Active Member

    Feb 26, 2011
    77
    7
    Hello Soeren,

    Taking a break from machine gunning the relentless, suicidal waves of Easter bunnies at the ramparts,
    to post this diagram. I know you electrical engineering types
    much prefer schematics to pictorials but I am a web programmer not a double E
    so its the best I can do.
    [​IMG]

    The excellent schematic that Soren posted on April 2 is incorporated (hopefully correctly) on the PCB marked
    21-117. I was a little worried because on page ten of the k4003 instructions, on the amplifier PCB it says
    http://www.vellemanusa.com/downloads/0/illustrated/illustrated_assembly_manual_k4003_rev1.pdf
    "VA12VAC" and "VB12VAC" which made me concerned that the amp wanted AC but page 8 shows the amp power
    source as two 12 volt batteries which definitely is not AC.

    Back to Easter Bunny battle. Hopefully later on today will get to put this together and post
    1. The voltage read by putting one clip from the DMM on the plus side of C1 and another clip
    on ground
    2. A video of the whole thing working.

    Thanks.

    Allen in Dallas
     
  8. allenpitts

    Thread Starter Active Member

    Feb 26, 2011
    77
    7
    Hello Soren and ACC forum,

    The transformer is connected to the power circuit suggested by Soren.
    [​IMG]
    Its a little hot at 19.04 volts but still less than the 20 volts max posted in the Arduino specs.
    Used 1N4007 instead of 1 N4004 and a 2200uF electrolytic capacitor instead of the 4700uF
    shown by Soren. This is where I don't know enough about components. I know diodes have resistance
    and have read the data sheet on the 1N4007
    http://www.diodes.com/datasheets/ds28002.pdf
    but not sure what effect using the 1N4007 instead of the 1N4004 has. I believe they are very similar
    and the difference is how much reverse voltage they will take before they break down.
    Also I know that capacitors store and release energy but not sure what effect using the smaller cap has
    on the power output. Or the function of the cap in the circuit.
    But hoping to get some feedback to see if I am on the right track.

    Thanks.

    Allen Pitts, Dallas Texas
     
  9. Søren

    Senior Member

    Sep 2, 2006
    472
    28
    Hi Allen,

    Sorry for the delay. I had begun answering your last post when my browser crashed (with more than a hundred tabs open of course :( I better find a screwdriver and install the 16GB chunks lying right next to it).
    To begin with that post... The amplifier module has got on-board rectifiers and caps, that's why you feed it AC.

    As you've already figured out, 1N400n's only differ in the max. voltage they can handle. it's 400V for 1N4004 and 1kV for 1N4007. Since the lowest voltage handled by that series, you can use any of them.

    The cap is there to store the voltage in between the peaks which would look like this drawing if no cap was involved.
    [​IMG]
    With the cap in place, it charges to the peak voltage (minus the diode drop) and with a load it starts to fall immediately, as shown here (bottom of pic).
    [​IMG]

    The larger the cap, the less the voltage is falling before recharging and the voltage regulator you are feeding must be able to keep regulation at the lowest point, or you will have trouble with the (thus not very) regulated output. The larger the current draw, the larger the dips (all else being equal)
    In your case, there's plenty of headroom, so 2'200µF shouldn't give you any trouble (dips will probably be 3V..3.5V max).

    I agree that it's a bit high at 19V - a 12V pre-regulator (7812 or LM317 + 2 resistors) could (should) be added to slice the top 7V off and run the Arduino regulator in a decent way. Remember a small(ish) heatsink on the pre-regulator.
    If you use the A/D-C, this will also nix any supply noise by around 90dB IIRC extra, compared to just using the Arduinos on-board regulator and if that's around 90dB as well, you're looking at 180dB of noise suppression and that's a lot. I've used this technique in high end audio preamps (won't cut the digital noise generated by the Arduino and support circuitry though).

    Apart from that, I'd say you're done :)
     
  10. ebeowulf17

    Active Member

    Aug 12, 2014
    678
    79
    Agreed on the pre-regulator. Every time I look into supply voltage options for Arduino, all I find is warnings about them not really handling much more than 12V effectively. Obviously it depends a lot on how much current is running through the Arduino regulator and you're not powering much through the Arduino, so you might be ok... but if it were my Arduino I'd definitely drop that voltage some!
     
  11. allenpitts

    Thread Starter Active Member

    Feb 26, 2011
    77
    7
    Hello Soren, ebeowulf17 and the ACC forum.

    Soren, sorry about the browser crash. What a pain.

    The replies from Soren and ebeowulf17 made me very happy because as I thought about the project I remembered reading about a 12 volt regulator
    that has thermal overload and short circuit protections. So besides cutting the power to 12 volts one gets a lot of insurance for a dollar and
    a half. So I was going to post to get your reaction to
    https://www.sparkfun.com/products/12766
    Voltage Regulator - 12V De scription: This is the basic L7812 voltage regulator, a three-terminal positive regulator with a 12V fixed output voltage

    What this means is I think I am starting to acquire a critical mass of knowledge so that solutions to problems are at least heading in the right direction.

    Thanks for the excellent explanation of the cap function.

    Will post a a YouTube when I get it working.

    Allen in Dallas
     
  12. ebeowulf17

    Active Member

    Aug 12, 2014
    678
    79
    Looks great to me. Be sure to check the data sheet application notes. You'll need two caps to go with that regulator and you should be in great shape at that point!
     
  13. allenpitts

    Thread Starter Active Member

    Feb 26, 2011
    77
    7
    Hello Soren, ebeowulf17 and AAC forum,

    Revised pictorial herewith below. Incorporated the LM7812. Wasn't exactly sure what ebeowulf meant by "You'll need two caps to go with that regulator" but some research on the LM7812 datasheet turned up
    [​IMG]
    There is already a 2200uF cap on the input side so will include the .1uF cap like this
    [​IMG]

    Waiting for voltage regulator to come from Mouser.
    Will post finished product.

    Thanks.

    Allen in Dallas
     
  14. ebeowulf17

    Active Member

    Aug 12, 2014
    678
    79
    One issue, maybe two:

    1) The 0.1uF capacitor on the output needs to go from the 12V regulator's output to ground. Right now you're showing it in series with the regulator output and the Arduino power input, which would not allow any current flow (capacitors block DC)

    2) I may have this wrong, and hopefully more knowledgeable people will confirm or correct me on this, but I think different capacitors respond differently to different frequencies and different types of transients. Because of that, I think you may still need the recommended 0.33uF capacitor from regulator input to ground even though you also already have 2200uF connected to the same points.

    On the other hand, even if I am technically right about this, it may be less critical in this case, since the 12V regulator output just feeds directly into another regulator on the Arduino, so minor ripples in the voltage will get filtered there anyway.

    Expert opinions, anyone?
     
  15. Søren

    Senior Member

    Sep 2, 2006
    472
    28
    Hi Allen,

    If the 2200µF is more than an inch or so from the regulator, you should include it anyway!

    C2 should go to ground (from the output), as in the excerpt from the datasheet, to work.
    As you drew it, you're trying to get the DC through C2 and that isn't gonna happen.
    The Arduino should be connected directly to out of the regulator :)

    (Please dont call it VR1 - VR is used for Variable Resistor (and trimmer pots, which are used for variable resistors). The voltage regulator is an integrated circuit and hence should be nominated ICn. Not that it changes the function of course, but it may introduce a bit of confusion).
     
  16. allenpitts

    Thread Starter Active Member

    Feb 26, 2011
    77
    7
    Hello Beowulf17, Soren and AAC forum,

    Moved C2 to ground.
    C1 directly adjacent the LM7812 so I think it should be ok.
    But the upper end spec on the PIR sensor is 20 volts so I think the voltage source
    should be the LM7812 to keep a momentary spike from the transformer from frying the PIR.

    I don't believe the drop in voltage caused by the drain to the PIR will prevent
    the source for the Arduino from being sufficient.
    What think you?

    Result:
    [​IMG]
    Thanks.

    Allen in Dallas
     
  17. Søren

    Senior Member

    Sep 2, 2006
    472
    28
    Hi Allen,

    As far as I can see on the Adafruit site, 20V would be too much.
    One page says "5V-16V" and another says "3V-9V, 5V is ideal", so unless you have a definitive source on the "20V max", I wouldn't go above 16V (or even close to). So, either the 12V from the 7812, or better, from the Arduinos 5V line.

    Layout seems fine now.


    Me neither, although I couldn't find any specifics on the site, I think it will take less than 10mA (perhaps 5mA is nearer to the actual drain) and the rise/fall times aren't problematic either.
    The lowest current will be taken when operated from the 5V line.

    Be aware, that as far as I could read, it has got an output voltage of only 3.3V and will probably need a transistor for level conversion to 5V logic.
     
  18. ebeowulf17

    Active Member

    Aug 12, 2014
    678
    79
    According to this page on the Arduino website, the threshold for a digital input pin to be read as "high" is 3 volts, so a 3.3V output should probably work, although it's a bit close.
     
  19. ebeowulf17

    Active Member

    Aug 12, 2014
    678
    79
    Also, good catch Allen on the PIR input voltage. I completely missed the fact that it was still running on the unregulated voltage on that previous drawing I commented on. I'm sorry I missed that, but glad that you caught it!
     
  20. allenpitts

    Thread Starter Active Member

    Feb 26, 2011
    77
    7
    Hello Soren, ebeowulf and the AAC forum,

    Reworked the power to the PIR per revision 150411.
    The LED from Arduino pin 10 indicates that the 3.3 volts from
    the PIR seems to be enough to trigger the Arduino input.
    (I was pretty sure this would work because it worked
    reliably with 1.4 watt mini mono SparkFun amplifiers.
    See pictorial above marked 150329.)

    The system works as designed: The MP3 track from the
    Arduino plays when my hand is moved in front of the PIR.

    But sound is coming thru one speaker only.

    So now I have to figure out how
    to trouble shoot the sound out. A clip was placed on the
    ground at the transformer and at the left audio out from
    the MP3 shield and the DMM reads
    1.9 volts. But when the clip was placed on the right
    audio out from the MP3 shield the DMM reads 0
    volts. And when the clip is put on the right audio
    the right speaker hums at a level that is adjustable
    with pot. So I think there is a problem with the solder
    joint.

    If anyone has ideas experience with troubleshooting
    audio systems I am open to suggestions.

    Thinking about taking an MP3 player and rigging
    it to feed the amplifier and see if it can be made to work that
    way.

    Thanks.

    Allen in Dallas
     
    Last edited: Apr 12, 2015
Loading...