Node-RED Tutorial: How to Play Audio in your Raspberry Pi based PLC / Panel PC
Get effectiveness reproducing sounds in the automation industry
13 December, 2021 by
Node-RED Tutorial: How to Play Audio in your Raspberry Pi based PLC / Panel PC
Boot & Work Corp. S.L., Fernandez Queralt Martinez

Introduction

Are you working near your monitor and do you have to go to it to see the results of the processes running on your machine? Would you go faster if the results of your Dashboard were reproduced with sound?

In this blog post, we will learn how to reproduce sound with Node-RED and your open source Raspberry Pi PLC, Touchberry Pi panel or Panel PC to optimize processes in your production line and wherever you want!

Latest Posts

Steps

Node-RED is an easy-to-use tool for those of you who already have some logic in programming, and at Industrial Shields we often use it to program our hardware and carry out all kinds of applications.

In this post, we will show how to play audio messages with a Node-RED tutorial, thanks to Raspberry Pi automation. In this way, you will be able to optimize processes. You will have to use your sense of hearing to listen to the data you have in your control panel, without having to physically go to the screen to see it with your own eyes.

Node-RED Node

So, we will use the audio node that comes with the nodes of node-red-dashboard.

audio out - Node-RED Node - Node-RED Tutorial: How to Play Audio in your Raspberry Pi based PLC / Panel PC

To install the dashboard nodes, do the following:

1. Make sure you have an internet connection with the industrial Raspberry Pi PLC controller.

2. Go to the Node-RED menu > Manage Palette > Install > Type: node-red-dashboard > Click Install.

3. Once the nodes are downloaded, drag and drop the audio node into your flow.

4. Double-click to set it: set a group and select the TTS Voice language.

5. Add a dashboard switch node and connect it to the audio out node.

6. Double-click on the switch node and configure a group, set a label, and set a message for when clicked to send the on and off payload.

Industrial Shields input value - Node-RED Node - Node-RED Tutorial: How to Play Audio in your Raspberry Pi based PLC / Panel PC

Finally, go to your dashboard, change the state of the switch node, speakers on and listen!

If you want to compare your flow with ours, go to the Node-RED menu > Click on Import > And paste this flows.json:

[{"id":"df93bc2e.84af5","type":"tab","label":"Industrial Shields","disabled":false,"info":""},{"id":"9b345c1a.1d50e","type":"ui_base","theme":{"name":"theme-dark","lightTheme":{"default":"#0094CE","baseColor":"#0094CE","baseFont":"-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif","edited":true,"reset":false},"darkTheme":{"default":"#097479","baseColor":"#097479","baseFont":"-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif","edited":true,"reset":false},"customTheme":{"name":"Untitled Theme 1","default":"#4B7930","baseColor":"#4B7930","baseFont":"-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif"},"themeState":{"base-color":{"default":"#097479","value":"#097479","edited":false},"page-titlebar-backgroundColor":{"value":"#097479","edited":false},"page-backgroundColor":{"value":"#111111","edited":false},"page-sidebar-backgroundColor":{"value":"#333333","edited":false},"group-textColor":{"value":"#0eb8c0","edited":false},"group-borderColor":{"value":"#555555","edited":false},"group-backgroundColor":{"value":"#333333","edited":false},"widget-textColor":{"value":"#eeeeee","edited":false},"widget-backgroundColor":{"value":"#097479","edited":false},"widget-borderColor":{"value":"#333333","edited":false},"base-font":{"value":"-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif"}},"angularTheme":{"primary":"indigo","accents":"blue","warn":"red","background":"grey","palette":"light"}},"site":{"name":"Node-RED Dashboard","hideToolbar":"false","allowSwipe":"false","lockMenu":"false","allowTempTheme":"true","dateFormat":"DD/MM/YYYY","sizes":{"sx":48,"sy":48,"gx":6,"gy":6,"cx":6,"cy":6,"px":0,"py":0}}},{"id":"e0bb0cc5.a214f","type":"ui_spacer","name":"spacer","group":"9d731610.1cf498","order":1,"width":1,"height":1},{"id":"8d78289a.07f5f8","type":"ui_spacer","name":"spacer","group":"9d731610.1cf498","order":3,"width":17,"height":1},{"id":"f8c8af2a.1eb2b","type":"ui_spacer","name":"spacer","group":"9d731610.1cf498","order":4,"width":1,"height":1},{"id":"c0efb76a.fd24b8","type":"ui_spacer","name":"spacer","group":"9d731610.1cf498","order":5,"width":17,"height":1},{"id":"d8d15dc2.13e1e","type":"ui_spacer","name":"spacer","group":"9d731610.1cf498","order":6,"width":1,"height":1},{"id":"d7805eb1.a8f4e","type":"ui_spacer","name":"spacer","group":"9d731610.1cf498","order":7,"width":17,"height":1},{"id":"e3f78709.1c14f8","type":"ui_spacer","name":"spacer","group":"9d731610.1cf498","order":8,"width":1,"height":1},{"id":"9ae0e15d.9364e","type":"ui_spacer","name":"spacer","group":"9d731610.1cf498","order":9,"width":17,"height":1},{"id":"65e51c3a.7ea864","type":"ui_spacer","name":"spacer","group":"9d731610.1cf498","order":10,"width":1,"height":1},{"id":"be4a7a82.e1a678","type":"ui_spacer","name":"spacer","group":"9d731610.1cf498","order":12,"width":1,"height":1},{"id":"e121ea75.3ca078","type":"ui_spacer","name":"spacer","group":"9d731610.1cf498","order":14,"width":17,"height":1},{"id":"4eb5da0d.379ac4","type":"ui_spacer","name":"spacer","group":"a5d3c52e.1b2358","order":2,"width":1,"height":1},{"id":"7e795593.19741c","type":"ui_spacer","name":"spacer","group":"a5d3c52e.1b2358","order":4,"width":2,"height":1},{"id":"14699a4a.35b1b6","type":"ui_spacer","name":"spacer","group":"a5d3c52e.1b2358","order":6,"width":3,"height":1},{"id":"f90ac726.3b7118","type":"ui_spacer","name":"spacer","group":"a5d3c52e.1b2358","order":7,"width":1,"height":1},{"id":"5570bb70.d1b064","type":"ui_spacer","name":"spacer","group":"a5d3c52e.1b2358","order":8,"width":2,"height":1},{"id":"5f1c4fe7.6daee","type":"ui_spacer","name":"spacer","group":"a5d3c52e.1b2358","order":9,"width":3,"height":1},{"id":"41222097.5c802","type":"ui_spacer","name":"spacer","group":"a5d3c52e.1b2358","order":10,"width":1,"height":1},{"id":"91570f1f.4187b","type":"ui_spacer","name":"spacer","group":"a5d3c52e.1b2358","order":11,"width":2,"height":1},{"id":"1df33d9b.ef00d2","type":"ui_spacer","name":"spacer","group":"a5d3c52e.1b2358","order":12,"width":3,"height":1},{"id":"986e3229.fc1fc","type":"ui_spacer","name":"spacer","group":"a5d3c52e.1b2358","order":13,"width":1,"height":1},{"id":"34e16163.c3770e","type":"ui_spacer","name":"spacer","group":"a5d3c52e.1b2358","order":14,"width":2,"height":1},{"id":"6062839a.7aaaac","type":"ui_spacer","name":"spacer","group":"a5d3c52e.1b2358","order":17,"width":3,"height":1},{"id":"37ed1ac7.a5b7a6","type":"ui_spacer","name":"spacer","group":"a5d3c52e.1b2358","order":20,"width":1,"height":1},{"id":"6be32079.6d42b","type":"ui_spacer","name":"spacer","group":"a5d3c52e.1b2358","order":21,"width":11,"height":1},{"id":"304458d9.645498","type":"ui_spacer","name":"spacer","group":"a5d3c52e.1b2358","order":22,"width":16,"height":1},{"id":"dc581f10.223cc","type":"ui_spacer","name":"spacer","group":"a5d3c52e.1b2358","order":25,"width":3,"height":1},{"id":"22fb0f9e.ab81d","type":"ui_spacer","name":"spacer","group":"a5d3c52e.1b2358","order":27,"width":19,"height":1},{"id":"f1a9ad63.3586c","type":"ui_tab","name":"Industrial Shields","icon":"dashboard","disabled":false,"hidden":false},{"id":"43c76c13.1918a4","type":"ui_group","name":"Inputs","tab":"f1a9ad63.3586c","order":1,"disp":true,"width":"6","collapse":false},{"id":"6571e08e.a389","type":"ui_audio","z":"df93bc2e.84af5","name":"","group":"43c76c13.1918a4","voice":"Google US English","always":true,"x":420,"y":100,"wires":[]},{"id":"81cf12c1.bfbcc","type":"ui_switch","z":"df93bc2e.84af5","name":"","label":"INPUT VALUE","tooltip":"","group":"43c76c13.1918a4","order":2,"width":0,"height":0,"passthru":false,"decouple":"false","topic":"topic","topicType":"msg","style":"","onvalue":"ON","onvalueType":"str","onicon":"","oncolor":"","offvalue":"OFF","offvalueType":"str","officon":"","offcolor":"","animate":false,"x":200,"y":100,"wires":[["6571e08e.a389"]]}]


 Now, incorporate the audio out node in your Node-RED flows, and start optimizing all processes as possible!

Node-RED Tutorial: How to Play Audio in your Raspberry Pi based PLC / Panel PC
Boot & Work Corp. S.L., Fernandez Queralt Martinez
13 December, 2021
Share this post
Archive

Looking for your ideal Programmable Logic Controller?

Take a look at this product comparison with other industrial controllers Arduino-based. 

We are comparing inputs, outputs, communications and other features with the ones of the relevant brands.


Industrial PLC comparison >>>

Do you want more information?

Just fill the form!

Tell me more!