0

PIR + soundboard question
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

PIR + soundboard question

by JRL on Sun Aug 18, 2019 11:53 pm

Bought your PIR - works good. Motion turns on an LED for a set time. Question is, how can I use it to trigger the sound board?

Not sure I understand this power low/ power high business. So the PIR powers-on for a set time (3V at certain # of seconds)

But the activate pins on the sound board are not looking for power-on. They're looking for go to ground.

Question is this: Will the soundboard trigger activate when the PIR powers off? And will the 3volts power on from the PIR damage the sound board? (this is what I'm really worried about).

Somebody said just add an NPN transistor as a switch. Got a bunch of those (2222 and BC 547 and TIP31's and a whole bunch of others with a vague idea how to use them...LOL, they seem pretty simple)

I don't want to wreck the sound board by doing something stupid now that I finally got it playing great sound clips, but I don't want to use push buttons to activate.

Thanks!

JRL
 
Posts: 7
Joined: Mon Jul 08, 2019 9:25 pm

Re: PIR + soundboard question

by adafruit_support_mike on Mon Aug 19, 2019 1:03 am

JRL wrote:Question is this: Will the soundboard trigger activate when the PIR powers off?

Yes, and it will keep triggering the same track over and over until the PIR's output goes high again.

JRL wrote:Somebody said just add an NPN transistor as a switch. Got a bunch of those (2222 and BC 547 and TIP31's and a whole bunch of others with a vague idea how to use them...LOL, they seem pretty simple)

The ones you listed are all NPN transistors, and the major difference is their sweet spot for the amount of current they handle: the BC547 is happiest around 10mA and maxes out around 100mA, the 2222 prefers to work around 100mA and maxes out at 1A, and the TIP130 is a power transistor that can handle up to 3A.

The current through the FX Board's trigger pins is less than 1mA, so the BC547 would be a good choice.

BJTs have two main current paths: one from the base to the emitter, and one from the collector to the emitter. For switching applications, it's easiest to think of them as current amplifiers: if you send current through the base-emitter path, about a hundred times as much current can flow through the collector-emitter path.

The exact ratio of collector current to base current is called 'beta', and varies from one kind of BJT to another (and from one current level to another in the same BJT). For design purposes, it's safest to choose a minimum value and assume you'll get at least that much current gain. In most cases, it's safe to assume beta=100.

The base-emitter path is a diode, so the voltage between the base and emitter (called Vbe) will always be somewhere near 0.7V while you send current through it.

With those two assumptions.. beta=100 and Vbe=0.7V.. you can design most transistor switch circuits: If your PIR's maximum output voltage is 3V, a resistor between the PIR and the base of the BJT would have 3v-Vbe=3V-0.7V=2.3V across it. If you want the collector current to be at least 10mA (overkill is good for switch calculations), you'll need at least 10mA/beta=10mA/100=100uA of current to flow into the base. Ohm's Law says R=V/I, so 2.3V/100uA=23,000 Ohms.

That's a maximum value for the resistor, so using a 10k between the PIR and the BJT's base would work. Then you can connect the BJT's collector to the FX Board's trigger pin and the BJT's emitter to GND, and you'll have the PIR-driven switch you need.

adafruit_support_mike
 
Posts: 58799
Joined: Thu Feb 11, 2010 2:51 pm

Re: PIR + soundboard question

by JRL on Mon Aug 19, 2019 10:28 pm

I tried it! Not with the sound board, but with a tiny little led control chip I stole from a dogs toy to integrate into my build! (heheh) I knew it was the same type = (power off = activate) because it had a tiny motion sensor (little wee spring that contacted ground) to activate the chip. When I just jumped the contact = nothing. It was looking for the go to ground. I think I get it now!

Sure enough, the leds came on when the PIR activated, then when the PIR powered off the little chip activated and went through it's programmed led routine. Awesome!

Thanks so much for your help! - I will try the BC547 transistor as a signal switch w/resistor and see what happens.

PS: I'm a newbie at this stuff with no background in programming (other than basic html back in the day) and none in electronics so I'm just winging it as I go along. This is just hobby electronics for me. (Background was CNC machine programming at work - before retirement). I got into this because I bought one of those singing fishes at the junk store for 5 bucks, took it apart and was totally fascinated with the electronics!

Thanks again!

JRL
 
Posts: 7
Joined: Mon Jul 08, 2019 9:25 pm

Re: PIR + soundboard question

by adafruit_support_mike on Mon Aug 19, 2019 11:51 pm

JRL wrote:PS: I'm a newbie at this stuff with no background in programming (other than basic html back in the day) and none in electronics so I'm just winging it as I go along.

AKA: our target market. ;-)

Everyone has to pick up the basics sometime, and this is a friendly place to do it. Ladyada has described Adafruit as "an education company that happens to have a gift shop at the end".

JRL wrote:I got into this because I bought one of those singing fishes at the junk store for 5 bucks, took it apart and was totally fascinated with the electronics!

Yeah, that's how it starts. You'll know you're firmly in the Maker mindset when you find yourself buying stuff specifically to tear it apart when you get home.

adafruit_support_mike
 
Posts: 58799
Joined: Thu Feb 11, 2010 2:51 pm

Please be positive and constructive with your questions and comments.