Skip to content

RPi Node-Red: PIR + RGB LED or Buzzer

Authors: field_5dd42fd9200b2

Parts List:

1x RGB LED
1x PIR
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 GPIO20.  Name the node “PIR”.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 PIR has detected movement.  To deactivate either the buzzer or LED simply delete the wire in Node-Red connecting the associated node with the PIR node.

Whats Next?

  • What other combinations can you make with items in your kit?
Back To Top