# R pi PIR triggering playing mp3 file

**URL:** https://discourse.nodered.org/t/r-pi-pir-triggering-playing-mp3-file/91194
**Category:** General
**Created:** [23 September 2024 02:16 UTC](https://discourse.nodered.org/t/r-pi-pir-triggering-playing-mp3-file/91194 "2024-09-23T02:16:06Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![thecybo](https://avatars.discourse-cdn.com/v4/letter/t/d9b06d/32.png) [@thecybo](https://discourse.nodered.org/u/thecybo)
#### Post date: [23 September 2024 02:16 UTC](https://discourse.nodered.org/t/r-pi-pir-triggering-playing-mp3-file/91194/1 "2024-09-23T02:16:06Z")

</div>

I am new to node-red and have spent days trying to get a simple project to play a sound file when triggered from a PIR and turn on a light with a Raspberry Pi.

 ![Screenshot 2024-09-21 at 5.45.25 PM](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/9/390cf667003789a72d9b11145cf0542893d463a7.png)

I have tried all the nodes that deal with audio. Even tried to install Contrib-audio only to have the install fail.

The file plays great in VLC so it is not hardware  
If someone can help me with an example of this flow or a link to how I can learn to do this.

Thanks

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [23 September 2024 09:12 UTC](https://discourse.nodered.org/t/r-pi-pir-triggering-playing-mp3-file/91194/2 "2024-09-23T09:12:46Z")

</div>

Welcome to the forum @thecybo

> [@thecybo](#):
>
> I am new to node-red

If you have not already done so then I recommend watching this playlist: [Node-RED Essentials](https://www.youtube.com/playlist?list=PLyNBB9VCLmo1hyO-4fIZ08gqFcXBkHy-6). The videos are done by the developers of node-red. They're nice & short and to the point. You will understand a whole lot in about 1 hour. A small investment for a lot of gain.

First make sure that your PIR input is working as expected. Connect a Debug node to it and check that it is sending the messages you expect.

Are you trying to play the file on the pi running node-red or in the browser, which may be on a different machine?

---

<div class="post-metadata">

### Author: ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)
#### Post date: [23 September 2024 14:52 UTC](https://discourse.nodered.org/t/r-pi-pir-triggering-playing-mp3-file/91194/3 "2024-09-23T14:52:30Z")

</div>

> [@Colin](#):
>
> Are you trying to play the file on the pi running node-red or in the browser, which may be on a different machine?

This is the first thing to check. I've lost count of the number of times Linux sound has let me down. If it doesn't "just work" I generally don't even bother. The first step is to use a Linux command-line tool on the Pi to output a sound and make sure that is working.

If that works, I'd try doing the same from Node-RED using an exec node.

Once you know that that is working, then you can move on to any custom sound nodes.

---

<div class="post-metadata">

### Author: ![thecybo](https://avatars.discourse-cdn.com/v4/letter/t/d9b06d/32.png) [@thecybo](https://discourse.nodered.org/u/thecybo)
#### Post date: [23 September 2024 15:38 UTC](https://discourse.nodered.org/t/r-pi-pir-triggering-playing-mp3-file/91194/4 "2024-09-23T15:38:54Z")

</div>

Hi Colin

Thanks for the reply

I think that my biggest problem is that I don't do this enough to get good at it.  
I had the same set up a couple of years ago and it worked just find, but I lost that flow and now have to start all over again. I also had a dashboard to select three different videos. Gone

I mentioned in my post that I could get the mp3 to play outside node-red but did not say that it had to play on the Pi. I installed MPG321 as required in one of the nodes and I am able to run the MP3 from the command line so I ruled out problems with Linux.

I am not familiar with exec nodes but a quick search looks like that might be the anaswer. I will dig into it and get back with you.

Thanks a lot!

Richard

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [22 November 2024 15:39 UTC](https://discourse.nodered.org/t/r-pi-pir-triggering-playing-mp3-file/91194/5 "2024-11-22T15:39:16Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
