skip to Main Content

RPi Node-Red: Button + Buzzer

Authors: Chester

Goal:
The push-button, RGB-LED, and buzzer lessons have all presented input and output separately, but in this lesson we'll be combining them for the first time. Composing input with output and vice-versa is one of the things that makes node-red so powerful!

What you will learn:
How to link Input (Push-button) with output (Buzzer) using node-red. Also how the buzzer and button can be wired to the pi at the same time.

Parts List:

 

Video Tutorial:

NOTE: YOU MUST PROGRAM AND DEPLOY THE BUZZER IN NODE RED BEFORE YOU CONNECT THE BUZZER TO THE PI OTHERWISE THE BUZZER WILL OVER HEAT

 

Node-Red

Setting up the button and the buzzer is much the same as in their standalone tutorials, the major difference here is that we’re going to have the button linked up to the buzzer instead of a debug node.

First you’ll need a GPIO Input, and output node.

Just like the push-button tutorial we’ll configure the input node to read the button.

Double click on the Raspberry Pi input node to open its configuration menu.

Set the Pin to GPIO24.  Set Resistor? to pulldown.  You can Name the node anything, I chose “button”.

 

 

Before moving on you can verify that your button works by using a debug node

Make sure you hit deploy whenever you’ve made any changes, or nothing will happen.

 

Next we’ll setup the GPIO node for the buzzer.

These are the same settings as in the standalone buzzer tutorial, except we’re using a different pin to control the buzzer.

PWM output means we’ll be sending the buzzer a pulsing signal that peaks 100 times a second, instead of just holding the pin at 3v.

 

Finally we just have to connect the nodes together

 

Make sure you deploy first, but as long as both the nodes are setup correctly and the wiring is correct the buzzer should buzz whenever you press the button!

Connections for the button:

  • VCC -> 3.3V
  • OUT -> 18#24
  • GND -> GND

Connections for the buzzer:

  • VCC -> 3.3v
  • I/O   -> PIN36 #16
  • GND -> GND

Wiring Diagram of Push Button + Buzzer

What’s next

Using this flow as a base we can explore several possibilities

  1. How can we change how the buzzer sounds, what kind of frequency is it buzzing at?
  2. Can we use this same flow to activate a RGB LED instead of a buzzer?
  3. What kinds of input device could we use other than a push-button to activate the buzzer?
  4. What else could we output too that isn’t a buzzer, how about something purely digital.
WP2Social Auto Publish Powered By : XYZScripts.com
Back To Top