The first part of this MooC (Massive open online Course) shows how you can setup a Raspberry Pi with the Raspbian operating system, MQTT and Node-RED, while the second part shows how to use the broker system and iOS app prepared from WApp. For every category we prepared a short video clip that accompanies the contents of the MooC.

Hardware

Before we can start with the programming, we have to setup the hardware components. As hardware components we will use:

  • 1 Raspberry Pi 3B (As broker and client)
    • 1 Raspberry Pi 3 power supply
    • 1 Raspberry Pi 3 case
  • 1 Sense HAT
  • 1 Router (For building a network)
  • 1 HDMI cable
  • 1 Ethernet cable
  • Keyboard, mouse and monitor
  • 1 SD-Card 32GB

Setup

As first step put the Raspberry into the case and put the Sense HAT on top of it. Connect all cables except the power supply. If you connect the power supply the Raspberry tries to boot immediately which is not possible, because no operating system is installed yet. For a more detailed description of how to fix the components you can watch the following video and work along it.

Software

To get the operating System onto the Raspberry you need to copy the contents of the NOOBS archive onto the SD-card. The archive can be downloaded from this site. For the software setup of the OS just follow the installation instructions given by the installation process of NOOBS. After the installation finished and updated properly the only thing left to do is the installation of the toolchain needed for MQTT and Node-RED. The commands used in the following video, which you can follow along, can be seen in the section Raspberry Pi installation.

Examples Node-RED Application

Before we can start with the first simple example, start the Node-RED service using following command:

 node-red-start 

Now the MQTT server should listen on the localhost and you can connect to it through the localhost if you are using the Raspberry’s browser or through the IP address of the Raspberry Pi if you are using another device in the network.

The first example is a simple string output on the LED matrix of the Sense HAT. This example is explained step by step in this video, where you can follow along. It also shows how to open the webinterface, if you have any difficulties doing that.

After this small example there are a lot more things you can test out. More examples for other Sensors can be found in the section Node-RED of this website.