2. Raspberry Pi Interfaces
• One powerful feature of the Raspberry Pi is the row of GPIO
(general purpose input/output) pins along the edge of the
board, next to the yellow video out socket.
• These pins are a physical interface between the Pi and the
outside world.
• At the simplest level, you can think of them as switches that you
can turn on or off (input) or that the Pi can turn on or off (output)
3. Raspberry Pi Interfaces
• Seventeen of the 26 pins are GPIO pins; the
others are power or ground pins.
• It could be input from a sensor or a signal from
another computer or device
1
2
25
26
4. How GPIO Pins Work : Output
• When we use a GPIO pin as an output, pin can turn
on or off,or go HIGH or LOW in computing terms.
• When the pin is HIGH it outputs 3.3 volts (3v3).
• When the pin is LOW it outputs 0 volts (ground)
5. How GPIO Pins Work : Input
• When we use a GPIO pin as an input switch, pin
have to “pull up” or “pull down”.
pull up pull down
6. Node-RED Pi GPIO
• There are two main ways of interacting with a
Raspberry Pi using Node-RED
• rpi-gpio nodes, provided in the palette for
monitoring and controlling the GPIO pins. This is
the simplest and recommended way.
• wiring-pi module, this provides complete access
to the GPIO pins, and other devices, within
Function nodes.
24. Create Flow for Binary Sensor Input
• Add a rpi-gpio node (in part “Raspberry Pi”) and
double click to change pin number and resistor.
Pin 11
no resistor
25. Create Flow for Binary Sensor Input
• Add a function node and double click to edit
function with 2 output.
Set function name
and output
26. Create Flow for Digital Out
• Add a rpi-gpio node (in part “Raspberry Pi”) and
double click to change pin number.
Pin 16
Digital Output Mode
27. Create Flow for Binary Sensor Input
Add debug node and
wiring node and click deploy
29. Special Input Interface
#Open new Putty to connect R-Pi 10.10.11.X using SSH!
User : pi!
Password : raspberry!
!
pi@thethingbox$ls /sys/bus/w1/devices!
!
!
!
!
!
- Copy the number (Sensor ID) in rectangular for use with Node-
RED!
!
pi@thethingbox$exit!
30. Create Flow for 1-Wire Bus
• Add a inject, debug nodes and change parameter of
inject node, by double click
31. Create Flow for 1-Wire Bus
• Change inject node properties
• Payload : blank, Topic : Sensor ID, Name : DS1820 , Repeat :
30 Second
Changed
Properties
32. Create Flow for 1-Wire Bus
• Add a 1-Wire and change node (in part “function”)
and double click on change node.
• Set retain last value of sensor data
Retain last
value
33. Create Flow for 1-Wire Bus
• Add a mqtt node (in part “output”) and double
click to change mqtt broker, and Topic.
Set mqtt broker