Decaf Sensor / Control WiFi Network Nodes


Last Update: Jan 5, 2019 @ 15:16 Preliminary information, subject to change.

Application Note

Placing arrays of sensors on to network nodes is feasible and inexpensive using a RaspberryPi (“RPi3”) with WiFi host. The RPi3  is ideal, but may have more capability than needed, or the physical space or power consumption may be issues. The RaspberryPi Zero-W (“Zero”) with a USB hat is a viable option, and is smaller than the RPi3.

The image above shows the Zero plus the USB expansion board with four USB2 type A ports implemented as a USB hub. The two boards are connected with a jumper pcb from the USB-OTG connector on the Zero.

One port (left side) is at present reserved for a wireless Mouse/Keyboard dongle for development work and potentially node management.

The three remaining ports could used for Decaf IOC-M modules, giving the node a maximum of 24 digital inputs, 24 digital outputs, and 6 analog inputs.

Alternatively, if more analog support is needed, one to three Decaf IOC-2xe boards could be used. This would give a maximum of 48 digital inputs, 48 digital outputs, and 24 analog inputs.

Note that there are power limitations to the power that each USB port can consume. IOC-M and IOC-2xe boards consume very little, while Decaf boards with a LCD will usually require a powered hub or external power supply. Tests show the Zero will boot with an IOC-235 connected, however the in-rush current on plugging it into a running system overloads the Zero USB power circuit and crashes Raspbian.

Enabling the WiFi on the RaspberryPi Zero-W

This takes less than a minute, via a console window, and is configured as an IPv4 node. This means that the Zero is expected to be part of a LAN with an IPv6 gateway to the Internet. The WiFi IP address can be configured via DHCP (the default mode) or with some fiddling, as a static IP address. The node does not have to have access to the Internet unless this a requirement for your project. See the notes below on using MQTT.

Display Screen Options

The Zero can boot up to a desktop in around 53 seconds, or a console boot is about 24 seconds.  An app does not have to use the Zero HDMI to have a display. Any of the Decaf boards with LCDs can be used, and a minimal User Interface displayed on it. For example, a geothermal pump system RPi3 node could transmit operating data to the Zero node, which would remotely display operating parameters. It should be noted that the RPi3 node could also send data to be presented on a Zero node HDMI display using a browser.

App Development

While this can be done on the Zero, it is probably better to use a faster RPi3 with the necessary developer libraries and tools. Once development is done, the app and end-user libraries only are deployed to the Zero.

If the app requires a user interface, the GTK framework is a suitable option. The app makes use of the Decaf SDK to access all the connected device.

What does the App have to do?

An app running on the Zero has to act as

  1. a data concentrator that acquires the input sensor data into packets, encrypted if desired, and transmitted to another master node on the network.
  2. a command processor that handles instructions for the digital outputs, and read commands for digital inputs. If an LCD is present, process LCD graphics commands, and potentially LCD touch commands.
  3. a controller to acquire data from, and send commands to, the connected Decaf board(s).

These requirements can easily be handled using the MQTT libraries that can be easily installed on the Zero. Requirement #1 above becomes a MQTT publisher, and #2 becomes a subscriber.

Network Security Issues

Encryption and other security packages are available for Raspbian. MQTT packets can be configured to be transmitted encrypted.

< More to come, check back again soon. >