Need Help Activating an MP3 with a PIR

Thread Starter

Brianaala

Joined Feb 15, 2019
62
Hi all,
I'm relatively new to electronics and I'm trying to build an analog circuit to imbed into a Halloween prop. I want to activate a GPD2846 MP3 player with a PIR sensor using a PNP2222 transistor. The MP3 and PIR can operate from ~ 5v and the PNP2222 should be able to switch with the ~3v from the PIR output. But, it's not working. Attached is my schematic of the circuit but I'm kinda flying by the seat of my pants and I'm not sure why this doesn't work.
One thing to note is that I know the schematic lists a 5v battery power source but I'm using a 5v computer PS.
Any help would be great!!
 

Attachments

wayneh

Joined Sep 9, 2010
16,390
If the PIR can only put out 3V as the high signal, the PNP will always be on. You need 4.3V to shut it off. Is that what you’re seeing?

A pull-up resistor on the base might solve the problem. Try 1-10K.
 

Thread Starter

Brianaala

Joined Feb 15, 2019
62
Hi Wayneh,
first of all thank you so much for replying, I appreciate it! Actually the problem is that the MP3 player isn't getting any power at all. Also, I'm not quite sure what a "pull-up resistor" means (I'm pretty new to this). The schematic doesn't show the correct pinouts for the mp3 player (I made it in Fritzing) so what I have is the emitter from the pnp connected to the +5 power to the MP3.
 
There could be lots of stuff going on or not going on. If I understand, you are trying to power up the unit using the PN2222 transistor (which is an NPN not a PNP) by provide current to the base via the PIR output.

Back up for a minute and remove the PIR/PN2222 alltogether and see if you can power up the MP3 and have it play a tune on powerup.


from https://www.dfrobot.com/wiki/index.php/DFPlayer_Mini_SKU:DFR0299#Pin_Map

Using the simplest IO mode, don't you have to do something with pins 12 & 13 to get it to play on pwerup.

After that, consider how much of a load the player, including the amplifier with speaker, represents and will the 2222 handle that? Then consider how much base current the PIR can provide and the gain of the transistor. Also whether or not you have tied the grounds together.
 

Thread Starter

Brianaala

Joined Feb 15, 2019
62
Hi Raymond,
Thank you for your response!! I'm using a Gpd2846, not a DFMini. It does play the first (only) track on powerup when I just put the 5v to it. You're absolutely right; I messed up and wrote the wrong transistor! Sorry about that! As far as the load, I just have it going to a headphone right now, but even with nothing in the jack it won't power up (the LED on the player remains dark). So it might be that I don't have enough voltage going through the system. All of the grounds are connected...is that bad? I apologize, I'm such a novice at this!
 
Hi Raymond,
Thank you for your response!! I'm using a Gpd2846, not a DFMini. It does play the first (only) track on powerup when I just put the 5v to it. You're absolutely right; I messed up and wrote the wrong transistor! Sorry about that! As far as the load, I just have it going to a headphone right now, but even with nothing in the jack it won't power up (the LED on the player remains dark). So it might be that I don't have enough voltage going through the system. All of the grounds are connected...is that bad? I apologize, I'm such a novice at this!
is this it? http://www.datasheetcafe.com/gpd2846a-datasheet-gpd2846/

So, anyways, it sounds like when you power it up, it is playing as you like. Do you feel comfortable/skilled enough to have the PIR operate a relay? I mean separately from anything else.
 

Thread Starter

Brianaala

Joined Feb 15, 2019
62
Hi Raymond,
yes that is the Mp3 player. It does work on it's own but I want to get the MP3 to play when the PIR sensor detects movement.
 
Hi Raymond,
yes that is the Mp3 player. It does work on it's own but I want to get the MP3 to play when the PIR sensor detects movement.
Take a look at a search for "PIR controlled relay" - The PIR turns on the relay and the relay turns on the MP3. It is one easy way of doing it and it is pretty straightforward.
 

Thread Starter

Brianaala

Joined Feb 15, 2019
62
Hi Raymond,
that is the circuit that I based this on, but I thought that using a pn2222 would be a better way of going about this (also I didn't have any relays that would work with the ~3v coming out of the PIR).
 
IOW, you want to use the transistor as a switch. So, the MP3 Board is the load that the transistor has to turn completely on. It has to do that from the amount of current that the PIR can provide to the base. You need to calculate those values and find a transistor(s) that will do that. Can you do that?

My thinking is that using a relay might simplify things for you. In this case, you use the PIR out signal to provide a small amount of current to the base of an NPN transistor that turns the relay on. The relay turns the board on.

Can you provide a link to the PIR that you have? Do you know how much current the out signal can provide?
 

Thread Starter

Brianaala

Joined Feb 15, 2019
62
Hi Raymond,
I was pretty sure that the np2222 transistor can do that (connect the 3v to the base and the collector to the 5v from the power source and the emitter to the +5 of the mp3).
Here are the specs for the PIR:
Color: White + Green
Dimension: 3.2cm x 2.4cm x 1.8cm (approx)
Infrared sensor with control circuit board
The sensitivity and holding time can be adjusted
Working Voltage Range: DC 4.5V- 20V
Current drain:<60uA
Voltage Output: High/Low level signal:3.3V TTL output
Detection distance: 3--7M(can be adjusted)
Detection range: <140°
Delay time: 5-200S(can be adjusted, default 5s +-3%)
Blockade time: 2.5 S (default)
Trigger: L: Non-repeatable trigger H: Repeat Trigger (default)
Work temperature:-20-+80°C
Trigger Method: L unrepeatable trigger / H repeatable trigger
 
Hi Raymond,
I was pretty sure that the np2222 transistor can do that (connect the 3v to the base and the collector to the 5v from the power source and the emitter to the +5 of the mp3).
Here are the specs for the PIR:
Color: White + Green
Dimension: 3.2cm x 2.4cm x 1.8cm (approx)
Infrared sensor with control circuit board
The sensitivity and holding time can be adjusted
Working Voltage Range: DC 4.5V- 20V
Current drain:<60uA
Voltage Output: High/Low level signal:3.3V TTL output
Detection distance: 3--7M(can be adjusted)
Detection range: <140°
Delay time: 5-200S(can be adjusted, default 5s +-3%)
Blockade time: 2.5 S (default)
Trigger: L: Non-repeatable trigger H: Repeat Trigger (default)
Work temperature:-20-+80°C
Trigger Method: L unrepeatable trigger / H repeatable trigger
OK good. But, let's take a closer look at what you are saying.
I was pretty sure that the np2222 transistor can do that (connect the 3v to the base and the collector to the 5v from the power source and the emitter to the +5 of the mp3).
How much current does the MP3 board require to play? Not the voltage, but the current? How much current can the transistor switch?
You stated that you are a beginner and that is fine, but you need to have some idea of how to answer those questions before you be "pretty sure".
 

Thread Starter

Brianaala

Joined Feb 15, 2019
62
Hi Raymond,
Sorry I misunderstood. Well, I'm pretty out of my element here but this is the info I have on the pn2222a transistor that I'm using:
Collector Cutoff Current (VCE = 60 Vdc, VEB(off) = 3.0 Vdc)
(VCB = 60 Vdc, IE = 0) PN2222A
Emitter Cutoff Current (VEB = 3.0 Vdc, IC = 0)
Base Cutoff Current (VCE = 60 Vdc, VEB(off) = 3.0 Vdc)
Collector–Emitter Saturation Voltage (Note 1.) (IC = 150 mAdc, IB = 15 mAdc)
Base–Emitter Saturation Voltage (Note 1.) (IC = 150 mAdc, IB = 15 mAdc)

I have to be honest I'm not sure how to read many of the aspects of the data sheet, but these are the only references I could find to "current".
 
Hi Raymond,
Sorry I misunderstood. Well, I'm pretty out of my element here but this is the info I have on the pn2222a transistor that I'm using:
Collector Cutoff Current (VCE = 60 Vdc, VEB(off) = 3.0 Vdc)
(VCB = 60 Vdc, IE = 0) PN2222A
Emitter Cutoff Current (VEB = 3.0 Vdc, IC = 0)
Base Cutoff Current (VCE = 60 Vdc, VEB(off) = 3.0 Vdc)
Collector–Emitter Saturation Voltage (Note 1.) (IC = 150 mAdc, IB = 15 mAdc)
Base–Emitter Saturation Voltage (Note 1.) (IC = 150 mAdc, IB = 15 mAdc)

I have to be honest I'm not sure how to read many of the aspects of the data sheet, but these are the only references I could find to "current".
Yep, it gets complicated pretty quickly - and there was another measure - max IC that I think is about 500-600 mA if I remember. BTW: there are a zillion people on here that know MUCH more about this than I do [@wayneh] (and everyone of them was a beginner at some point) and I am just trying to get you to think about some of these things so that you can take the mystery out of them.

So, put that question on hold - how much current can the transistor switch before it goes *poof* and address the question of how much current it takes to run the MP3 player. Do you have a meter and do you know how to measure current?
 

Thread Starter

Brianaala

Joined Feb 15, 2019
62
I can't seem to find any info on the MP3 player's current requirements other than "it can operate from a 3.7v 600MA battery or from a 5v usb power supply"...
 

Thread Starter

Brianaala

Joined Feb 15, 2019
62
Hi Raymond,
thank you for being so helpful and understanding! The only info I have on the Transister is :Collector Current – Continuous IC 600 mAdc.
So I think it should be able to handle it?
 

djsfantasi

Joined Apr 11, 2010
6,421
Back to the basics...

First, since it is an NPN transistor, it’s used to switch a load to ground. If you want to switch the high side, you would use a PNP transistor, such as a 2N2907. Otherwise, connect the transistor between ground and the ground of your MP3.

Second, your diagram does not show a connection between the grounds of your MP3 player and the PIR sensor. It could very well exist; it’s not shown.

To use a transistor as a switch, the rule of thumb for the base current is 1/10th of the current for the load. This is why Raymond has stated that you need to know the current requirement for the load. If you’ve tested the MP3 player as he outlined in post #4, you can directly measure the current by putting a DVM in series with the +5VDC lead to the MP3 player.

Let’s call your measured current I(load). To determine the appropriate base resistor, use the following equation (I’ve used some general values here).

R(base) = (3.3-0.7) / (I(load)/10)

Is the calculated value close to the 220Ω that you have?
 
I can't seem to find any info on the MP3 player's current requirements other than "it can operate from a 3.7v 600MA battery or from a 5v usb power supply"...
Yep, not surprising. So, what you could do is hook up a meter and measure the current draw and get a decent idea of how much. Given that it has an amplifier that is driving a speaker, I am guessing that as much as 500 mA would not be out of the question, but again, I am guessing.

Now, maybe the transistor can switch a load that size without burning up, but you would have to provide enough current to the base to allow it to do so (read about the hfe or current gain) - again it gets complicated.

That little PIR is only going to provide a few mA and given the gain of that transistor, it is never going to be enough to switch that size load. That, in a haphazard way of explain complete with a bunch of simplification and constrained by my own limited understanding is why I don't think it is working.

But, could the PIR furnish enough current to the base of the transistor so that it could swicth a much smaller load - like 50mA - Yes, I belive it could. And can a relay be operated with 50Ma? Yes again. And could the relay switch the MP3 on, even if it needed 750mA - yes, absolutely.

See where I am going?

Look at the specs of this relay - it takes only 30-50mA to energize the coil and it can switch 1000mA at 24V - that is more than you need to do the job.
 

Thread Starter

Brianaala

Joined Feb 15, 2019
62
Hi Djsfantsi,
my goodness I didn't know that about the NPN! Thant may be the whole issue right there!!
As for the ground connection between the MP3 and PIR, they are indeed connected.

OK, now for the stuff that's way over my head: I have never really tested current with my Voltage Meter...so here's what I did:
I set the meter on "DCA 200m" Which I presume to mean DC Amps, up to 200mA. Then I hooked it up in series with the +5 and it maxed out at about 27.4 which I guess to mean 27.4 mA?
 

Thread Starter

Brianaala

Joined Feb 15, 2019
62
Hi Raymond,
My above reply to Djsfantasi is kinda along the path of what you needed to know about the current draw of the mp3 right? Again, I'm not too sure if I'm even reading the DVM correctly though! Yes, I totally get what you're saying about the relay...I will look into it if I can't get this to work.
Between what you folks are saying I hooked up the np2222 to the wrong pole, the PIR output might be too low to trip the transistor and the MP3 might be drawing too much current for it as well!
Jeez, I really need to confront my fear of math and figure out current laws!
 
Top