COMPILATIONNR
COMPILATIONNR
COMPILATIONNR
RED GENERATE
Click icon to add picture
• Plugs into a TV or
monitor
• Inexpensive
• Capability:
• Programming
• Electronic Projects
• Office
• Play HD Videos
• Etc.
ANATOMY OF RASPBERRY PI
MODEL B/B+
FUNCTION SPECIFICATION
1 DSI The Display Interface (DSI) is used to connect the display
directly to the Raspberry Pi board.
1. DSI 2 GPIO PINS
2. GPIO PINS 3 ARM It's the heart of the Raspberry Pi, the Broadcom
PROCESSOR BCM2835 900MHz quad-core ARM Cortex-A7 CPU with
3. ARM PROCESSOR 1GB RAM.
4. USB PORTS 4 USB PORTS
5. ETHERNET PORTS 5 ETHERNET
PORTS
6. 3.5mm A/V 6 A/V
CONNECTION CONNECTION
7. CSI 7 CSI
8. HDMI 8 HDMI
USES OF RASPBERRY PI
USES OF RASPBERRY PI
OFFICE PROGRAMMING
USES OF RASPBERRY PI
GAME CONSOLES
WEB SERVER TOR ROUTER
USES OF RASPBERRY PI
SUPER COMPUTER
BIRD HOUSE HTPC
USES OF RASPBERRY PI
1,17 3.3V
6,9,14,20,25,30,34,39 GROUND
23 FOR SCLK
FLOW CANVAS
OUTPUT PANE
NODE RED
Double click the tab to rename it.
CONNECT THEM
NODE RED
NODE RED
LED ON/OFF USING INJECT NODE BUTTON
NODE RED
LED ON/OFF USING INJECT NODE BUTTON
1. INPUT PALLETE
2. INJECT NODE
STRING RENAME
ON = 1 THE
OFF = 0 NODE
NODE RED
LED ON/OFF USING INJECT NODE BUTTON
1. RASPI PALETE
2. RPI-GPIO OUT
EDIT RPI-GPIO
NODE
NODE RED
LED ON/OFF USING INJECT NODE BUTTON
CONNECT THE NODES
THEN CLICK DEPLOY
CLICK BUTTONS TO
TURN LED ON/OFF.
NODE RED
ADDING A BUTTON TO YOUR FLOW
Add a Raspberry Pi
GPIO input/output node.
*INPUT
*OUTPUT
NODE RED
ADDING A BUTTON TO YOUR FLOW
CONFIGURE THE INPUT NODE THEN CLICK DONE.
NODE RED
ADDING A BUTTON TO YOUR FLOW
• CONNECT NODES THEN CLICK DEPLOY.
• TEST IF YOUR FLOW IS WORKING.
NODE RED
ADDING A BUTTON TO YOUR FLOW
• MODIFY THE FLOW.
NODE RED
ADDING A BUTTON TO YOUR FLOW
• MODIFY THE FLOW.
• EDIT THE NODE PROPERTIES.
• SWITCH NODE – DOUBLE CLICK SWITCH NODE.
CLICK TO ADD
CONDITION
NODE RED
• MODIFY THE FLOW.
• EDIT THE NODE PROPERTIES.
• CHANGE NODE – DOUBLE CLICK CHANGE NODE.
CLICK DONE.
CLICK DONE.
NODE RED
ADDING A BUTTON TO YOUR FLOW
• CONNECT THEM THEN CLICK DEPLOY.
• TEST YOUR MODIFIED FLOW.
NODE RED
CHALLENGE!!!!
• MODIFY THE FLOW SO THAT WHEN THE BUTTON IS PRESSED, LED WILL LIGHT UP
AFTER 10 SECONDS THEN WILL TURN OFF AFTER 5 SECONDS.
Click icon to add picture
DASHBOARD
often provide at-a-glance views of KPIs (
key performance indicators) relevant to a particular
objective or business process.
-In the other, "dashboard" has another name for
"progress report" or "report."
-It can be use as a monitoring device.
(Temperature, Water level etc.)
PRE-REQUISITES
• You need a Raspberry Pi board
• You should already be familiar with Raspberry Pi
• You should have the Raspbian or Raspbian Lite
operating system installed in your Raspberry Pi.
• You should have Node-RED installed on your Pi
• Optional: Sense HAT
LET’S GET STARTED
NODE RED: USING THE DASHBOARD
• To start, let’s wire up a simple flow that sends a random number between 0 and 99 to a simple chart.
• For that you’ll need an inject node to repeatedly fire every few seconds, a function node to generate
the random number and one of the node-red-dashboard nodes – in this case the chart node.
NODE RED: USING THE DASHBOARD
NODE RED: USING THE DASHBOARD
Linux commands are basically commands executed
using the Linux Shell (commonly known as terminal).
It works like Windows’ command prompt.
LINUX INTEGRATION
Having the dashboard palettes installed, we can
create programs that execute Linux commands
via Node-RED.
LINUX INTEGRATION
Having the dashboard palettes installed, we can
create programs that execute Linux commands
via Node-RED.
EXAMPLE 1: CHECKING THE CPU
TEMP
1. Create a new flow and put the following nodes on your
workspace: inject, exec, function, and gauge. (Note: The
nodes are under input; advanced; function; and dashboard,
respectively.)
2. Connect the nodes in the order they were mentioned earlier.
(Note: In order for the program to work, connect the exec
node’s stdout from its output side to the function node’s
input.)
EXAMPLE 1: CHECKING THE CPU
TEMP
3. Double-click the inject node to edit it. Click the drop-down for Repeat and
choose “interval” (Note: 1 second intervals). Click “Done”.
4. Double-click the exec node to edit it. Uncheck msg.payload and type this
command on the command section:
vcgencmd measure_temp
(This command checks the current temperature of your CPU in celsius. You can
try it on the terminal.)
EXAMPLE 1: CHECKING THE CPU
TEMP
5. Rename the node to “Temperature” and click “Done” when
you’re finished.
6. Double click the function node and rename it to “CPU
Temp”. Type the following command on the Function
section and click “Done”:
str = msg.payload
msg.payload = str.substring(5, 9);
return msg;
EXAMPLE 1: CHECKING THE CPU
TEMP
7. Double-click the gauge node and click the pencil icon to make a new dashboard group
(Note: Dashboard nodes that are on the same group will appear together.).
8. Set the units to C or celsius and the range to 0-80 (min 0, max 80). Rename it to “CPU
Temp” (label and name) and click “Done”.
9. Copy the link provided by Node-RED at the beginning and paste it on another tab. DO
NOT PRESS ENTER.
10. Replace everything from #flow with ui/#/0 and press Enter (eg.
192.168.1.11:1880/#flow/6fc8a82c.95e318 to 192.168.1.11:1880/ui/#/0). This will open your
dashboard.
EXAMPLE 2: RESTART OR SHUT DOWN
USING NODE-RED
1. On the same flow as example 1, put the following nodes: button and
exec. Connect the button node’s output to the exec node’s input.
2. Double-click the button node. Choose the group you used in
example 1.
3. Rename the button node to “Shut Down” or “Restart”, depending on
what you want to do at this point (label and name). Click “Done.”
EXAMPLE 2: RESTART OR SHUT DOWN
USING NODE-RED
4. Double-click the exec node, uncheck msg.payload, and type one of
these commands on the command section:
a) sudo shutdown -h now
b) sudo shutdown -r 0
The first command will shut down the device and the second one
will restart it.
EXAMPLE 2: RESTART OR SHUT DOWN
USING NODE-RED
NOW START NODE-RED
FOR NEWLY INSTALLED NODE-RED, YOU SHOULD
INSTALL THE NODE FOR ARDUINO FIRST TO BE
ABLE TO USE IT.
FOR THE NODE-RED SETUP : (DIGITAL TYPE)
Connect a “switch” to the “Arduino out
node” and set the necessary description,
value,groupings, etc
Note : be careful when setting the serial port
and the pin assignment.
Deploy
it!
FOR THE NODE-RED SETUP : (ANALOG
TYPE)
Connect the “Arduino Input node” to a
“gauge” and set the necessary
description, value,groupings, etc
Note : be careful when setting the serial
port and the pin assignment.