Node RED data processing II

From Sensors in Schools
Jump to navigation Jump to search

Overview

  • This lesson will demonstrate how Node-Red can be used to process data from a sensor.
  • In this lesson we will learn how to process the output from a python file using the function node in Node-RED.

Learning Objectives

  • Learn how to run a Python program using the Terminal.
  • Learn how to run a Python program using the Execute node in Node-RED.
  • Learn how to extract data using the Function node in Node-RED.

learning to process data using Node-RED

  • Node-RED makes it very easy to display data using a Dashboard, but first we need to get the data we need.
  • Luckily, we have experience retrieving data from sensors using Python.
  • Reading and processing data using Node-RED is not very different.

Open the file peter_hopper_get_data5.py

  • From the main Raspberry Pi menu navigate to Programming and open Python3 IDLE.
  • Navigate to the /home/pi/peter-hopper-t3 directory. (t3 is short for term 3).
  • Open up the file peter_hopper_get_data5.py and review to make sure it is the same as the code below.

  • Run the file and check that it can retrieve sensor data and send the standard output to the Python Shell.