NodeStar User-Programmable LAN Nodes
The master node that hosts Node-Red and links to the OutNode/SplitNode network. Node-Red can be hosted on a variety of hardware platforms but Raspberry Pi Zero is one of the favourites because of this unit's low cost and modest power demand. Node-Red can be run as a background service on the Pi Zero and powered by a simple 2A buck regulator drawing from a 7Ah gel cell. The Node-Red flow that controls the network is easily user-customised to suit local logic requirements.
Node-RED is the programming tool that makes control of the nodes possible. Node-RED's graphical designer is easy to understand and can be mastered in a short time by anyone. Node-RED can be hosted on a number of different platforms of which Raspberry pi Zero is the most favoured due to its cost and modest power requirement.
NodeWork is a Node-RED flow. It is a user-programmable template connecting all OutNode/SplitNode inputs to all available outputs. The available inputs are:
- 2 opto-isolated switches,
- Ultrasonic scanner,
- Load cell for weight measure up 20,000kg
- Flow Sensor (both Volume [Total Litres) and Flow Rate in [Litres per Minute] can be measured),
- Pressure sensor - a variety of sensors are available, from -100kPa to 700kPa,
- Local Voltage/Current meter,
- Remote Voltage Meter (up to 1km away),
- 2 Digital thermal probes.
- RSSI - The received signal strength at both ends of the LoRa radio connection
- Incoming-Power detector.
All input values available to the OutNode or SplitNode Remote can be interrogated by sending queries from the Mother Node. The schedule of the queries is entirely under the control of the NodeRed flow that is running in the Mother Node. There are 16 Query Slots in the Schedule and queries are normally sent at 1 second intervals..
The switch inputs are typically used to monitor sensors with digital outputs, such as gate and door switches, gas detectors, input power detectors, alerting pushbuttons, etc.
The relay outputs can be used to switch motors, pumps, lighting, motorised gates, fans, etc. Many of these functions will require high voltage or heavy current contactors..
OutNodes are slave node to the MotherNode. There can be any number of OutNodes. Each is identified by a static IP. An OutNode is interrogated and controlled by the MotherNode.
OutNodes take input from:
- UltraSound Scanner, range to 2 metres,
- Loadcell (50Kg to 20,000kg capacity),
- Flow Sensor (total Volume as well as Rate of Flow can be measured),
- Pressure sensor - a variety of sensors are available, from -100kPa to 700kPa,
- 2 Digital Temperature Probes (-55°C to 125°C range),
- 2 Switch Inputs. Opto-isolated digital inputs are on the top connector strip
- Power state monitoring to report last power ON or OFF event. A Power Fail or Power Restored event can trigger an SMS text message to a mobile phone.
- Local Voltmeter.
- Remote Voltmeter (up to 1000 metres distant).
OutNode can send output to:
- 2 Relays with 10A switching capacity. Changeover contact for 2 relays on the bottom strip.
- C-Node 16 x 2 LCD Display Unit.
SplitNodes have the same input/output capability as OutNodes, but are divided into 2 parts.
The SplitNode Base is a frontend that connects to the WLAN and is separated from the SplitNode Remote by a LoRa wireless link. It has only 2 switch inputs and these are wire-OR'ed with the switch inputs of the SplitNode Remote. It can display on a C-Node.
SplitNode Base can also monitor the input power supply and report a change of condition. This capability is provided because it is often not appropriate to monitor the incoming power at the SplitNode Remote location, since this is often solar-powered while the SplitNode Base is part of the controlling LAN where power monitoring and reporting is important.
All input/output functions are served by the SplitNode Remote. LoRa is a line-of-sight VHF link with a maximum range of about 1000 metres. It has inputs for:
- Ultrasonic Scanner,
- Load cells from 50Kg to 20,000Kg,
- Flow Sensor (various types and capacities can be implemented),
- Pressure sensor - a variety of sensors are available, from -100kPa to 700kPa
- 2 Digital Thermal Probes
- 2 opto-coupled switches
- Power state monitoring to report the last power ON or OFF event. A Power Fail or Power Restored event can trigger an SMS text message to a mobile phone.
- Local Voltmeter,
- Remote Voltmeter - up 1000 metres distant.
It has outputs on:
- 2 SPDT relays,
- C-Node Display
At right the SplitNode Base unit has an integrated C-Node displaying the present Temperature, UltraSonic Range, Relay States and Switch Input States.
LoRa Signal Strength
LoRa is a contraction of Long Range. However the system transmits with very little power (typically 17dBm), which can mean that received signal strengths become marginal. Signal strength as received by a node with a C-Node attached can be checked by pressing the button on the face of the C-Node. The RSSI (Received Signal Strength Indicator) will be displayed in the lower line at left, where the relay states are normally displayed. The display will not change while the button is held down.
Reception signal strength is continuously reported to the MotherNode by both the Base and Remote nodes., where they can be monitored as necessary.
Since the LoRa link is entirely point-to-point the antennas can be directional, with the main lobes pointing to each other, to increase signal strength. The most cost-effective high-gain antennas follow the helical format. When correctly made a helical antenna system can increase signal strength by theoretical 13,8dB, which will extend the range of the link considerably, and at very low cost. It requires only 2,8 metres of single-strand house wire, a couple of metres of plastic tubing to keep the spiral shape, and a steel pot stand for a ground plane.
To achieve this degree of gain the antenna's shape dimensions must conform to precise rules, based on the wavelength of the RF signal.
The 8-turn helical antenna shown at right is a travelling wave antenna made from a strand of single-core house wire, 8 wavelengths long (in this case 2,8M), coiled into a spiral where each circumference is equal to the wavelength and the helix angle is 15°, which gives a coil pitch of 0,25 wavelengths. Pieces of plastic tubing are used to maintain the shape of the coil. The LoRa centre frequency is 866MHz, making λ 346mm.
A ground plane at left can be made from a simple steel pot stand.
Both antennas should conform to the same coil handedness, in this case right hand (clockwise looking from the ground plane forwards.
The antenna to Node cabling should be by 50Ω coaxial cable and SMA, not more than 1 metre long to minimise signal attenuation. SMA connectors are used at the Node termination.
The sensitivity of the RFM95 transceiver is given as -137dBm. Using the helical antennas shown here the typical signal strength found at a line-of-sight range of 2Km is better than -113dBm. This means that communication links considerably longer than 2Km are possible, depending on topography.
C-Nodes are self-contained 16 character x 2 line LCD display units. They can be attached to OutNodes or either section of SplitNodes. The default data displayed:
- The Top line shows temperature in degrees C,
- The UltraSonic range in millimetres, or that distance converted to Litres using tank dimensions entered by the User.
- The Bottom line shows energised/de-energised status for relay 'K' and relay 'k', the open/closed status of switches 'S' and 's',
- The Local Voltage measured inside the control unit, and the Remote Voltage measured up to a 1000 metres away via an RS485 link,
- The last received RSSI (Received Signal Strength Indicator) data is displayed at the left side of the lower line as long as the button on the faceplate is pressed.
Display data can be customised by control functions in the MotherNode. There are special characters in the stream that select data placement in the upper or lower line, and start position within that line. Any available data can be displayed at any character position. (RSSI data can only be displayed on the left side of the lower line.)
To save power the display is self-dimming. After 15 seconds of inactivity to display will dim to half-brightness. Full brightness will be restored when changed data is presented or the push button is pressed.
One of the possible interventions by the MotherNode in response to an input condition is to send an SMS text message to a designated mobile phone. The number of the destination phone as well as the content of the text message can easily be varied by the user, and can vary according to input source..
Text messages are serially numbered to indicate the number of network credits used. When network credit is depleted the flow of text messages will stop.
A 2 x 16 character LCD display similar to the C-Node can be connected to the TextNode to display the destination numbers and text messages sent by SMS as they are despatched.
Mobile Phone Display
The mobile phone can display a snapshot of the current Node Parameters. No special app is required - any web browser can access the user-assigned server where the data is deposited by the MotherNode.
Because the MotherNode is often located inside a private LAN it will have a dynamic IP assigned by the ISP, making it unsuitable for service as a network server. The MotherNode is therefore given another domain name, one that has a static IP, and the output data is sent there with updates every 20 seconds. This domain then acts as a server for the mobile phone inquiry.
The mobile phone shows:
- The time the data was received,
- The time the data was generated,
- The height of the tank level, or
- The weight on the Load Cell, or
- The latest Flow Count,
- The system battery voltage,
- The temperatures measured by the digital heat sensors,
- The state of the input switches,
- The state of the output relays,
- The signal strengths at the LoRa receivers,
- The date and time of the last power ON/OFF event
A variety Flow Sensors can be accommodated with capacities up to 60 litres per minute. Each type of flow sensor has it's own divisor constant which keeps its measurement accurate. This constant is entered into the flow control by the user so that a wide variety of sensors can be successfully employed.
There are 2 opto-isolated digital inputs. They require their own 24VDC power source. They are isolated from the node's electrical components up to 5KV. The state of the switches are reported with the highest priority (1:2).
There are 2 SPDT relays with a 10A switching capacity. The SPDT contacts are voltage-free and completely isolated from the node's electrical components. Each relay my be energised or de-energised by command from the MotherNode.
The digital thermal probe is based on a DS18B20 encased in a stainless steel sleeve. It can be wetted but it cannot be immersed without additional protection. The temperature range is from -55°C to 125°C. It must be plugged in at power-on to be registered with the node. The connector cable can be extended to a maximum of 5 metres.
The ultrasonic scanner measures proximity by receiving the echo of the 40kHz sound pulse that it fires at a target. They are often fitted to the tops of water tanks to measure the level of liquid within the tank. They have an effective range of about 4 metres but are mostly used in tanks no more than 2 metres tall. The sonic pulse is triggered on command from the MotherNode and the result returned as a distance in millimetres. Algorithms in the MotherNode can then trigger a relay closure output as well as generate a display on a C-Node. The C-Node display can be either the actual measured distance in millimetres or a volume in Litres derived from user-entered tank height and diameter dimensions.
A load cell can be utilised in place of the ultrasonic scanner. A variety of load cells can be employed with a weight capacity ranging from 50Kgs, to 2000Kgs. . Due to the phenomenon of 'creep', whereby the weight reading of the load cell diminishes with time, the weight cannot be applied to the load cell for longer than a few minutes at a time. An algorithm in the MotherNode can trigger a relay output response to user-determined load measurements.
Each supported load cell has its own unique divisor parameters which align its output with the metric system. The MotherLode stores a divisor constant for a variety of load cells that are available on the open market. Additional constants can easily be added as new load cells come into use. The phenomenon of load cell 'creep' should be well understood and taken into account when a load cell is subjected to strain for an extended period of time.
To monitor the battery voltage in back-up power systems there are two available options - a Local Voltmeter that measures the state of the battery that supplies the Node itself, and a Remote Voltmeter connected via RS485 that can monitor a battery up to 1000 metres distant, using a 2-wire cable.
Power Fail Detection
There is an input dedicated to monitoring the state of input power. The monitored supply will have a relay contact maintained in the Closed state by incoming voltage. (Normally a derived low voltage is monitored, but the relay can be driven directly from the supply AC).
When the incoming power fails the relay drops out and the contact opens, triggering a Power Fail event that is recorded on the web domain and can be used to trigger other events such as, for example, SMS text messages.
Forever Power Supplies
Nodes should be completely protected against power outages and power transients. A typical nodes draws about 100mA from a 12v supply. This can increase when a C-Node is attached, but will not exceed 120mA. A power source based on a 7Ah gel cell will be sufficient to power a Node through the most severe load-shedding event. The 12V gel battery can easily be kept charged by means of a 12VDC @ 2A wall adapter that feeds a DC to DC step-up buck regulator set to an output voltage of 13,4V exactly. 12V adaptors are cheap and plentiful, though their output voltage can vary excessively, however this will not affect the buck regulator, which can be set very accurately to ensure optimum charging for maximum capacity and longest battery life.
The MotherNode is in control of the network.
The MotherNode issues queries to the OutNode or SplitNode, receives responses to those queries, and then produces output to the OutNode, SplitNode, TextNode and C-Node as determined by the logic of the NodeRed flow.
The Query Rota contains 16 slots which are filled by the user at setup time. The MotherNode advances to the next slot every 2 seconds, so the Rota is completed every 32 seconds. Possible queries are the following:
- S - for Switch inputs
- D - for UltraSonic Distance
- W - for Loadcell Weight
- F - for Flow sensor Flowcount
- K - for Relay State
- T - for Temperature probe(s)
- R - for RSSI (Receiver Signal Strength Indicators
- V - for Local Voltage measurement
- v - for Remote Voltage measurement
- Q - The Message Log Quotient.
Any Query slot can contain any query letter depending on the importance the user attaches to any given parameter. Reading the 'K" value of the relay states automatically invokes a process whereby the relay states are checked against the last commanded relay state. (A local reset at the OutNode/SplitNode may have inadvertently altered the set/reset states of the relays).
The MotherNode response to the result of any query can be:
- The setting or clearing of either Output Relay
- C-Node messages
- An SMS text message to the designated mobile phone
The mobile phone display is created in a file named NodeStar.txt which is written to the designated URL every 20 seconds.
The ultrasonic distance is often used to control a pump, but may also be converted to volume measured in litres, using user-entered tank dimensions, for ease of interpretation on the C-Node and mobile phone display.
All aspects of the NodeRed flow can be modified by the user., an example of which is shown below.