RPi Node-Red: Push Button+ RGB LED or Buzzer

Parts List:

1x RGB LED

1x Push Button

1x Piezoelectric Buzzer

Getting Started:

Setting up the Hardware

Setting up Node-Red

Start Node-Red and navigate to 127.0.0.1:1880.  Drag one Raspberry Pi input node and five Raspberry Pi output nodes into the flow area.

Double click on the Raspberry Pi input node to open its configuration menu.  Set the Pin to GPIO25.  Name the node “Button”. Set the Resistor to “pulldown”.

Button Input Node

 

Double click on the unmodified Raspberry Pi output node.  Set Pin to GPIO16.  Set Type to PWM output.  Set Frequency to 100.  Name the node “buzzer”.

Buzzer Out Node

For this step, we are going to setup the output nodes for each RGB node. Double click on one of the Raspberry Pi output nodes.  Set the Red Pin to GPIO13Green Pin to GPIO19, and Blue Pin to GPIO26. Check the box to Initialise pin state?  select low (0) from the drop down menu.  Name each node with its respective “Red, Green, Blue”.

Red Out Node

Green Out Node

Blue Out Node

Wire each output node to the single input node and deploy the flow.

If everything is working properly the LED should illuminate and the buzzer should activate for a short period of time after the button has been pressed.  To deactivate either the buzzer or LED simply delete the wire in Node-Red connecting the associated node with the Button node.

Whats Next?

  • What other combinations can you make with items in your kit?
image_pdfGenerate PDFimage_printPrint
Posted in Node-Red, Raspberry Pi.

Leave a Reply