Serial Communication (Node-RED ~ TPS)
Serial Tibbit #01, #02
Connector Tibbit #19
Power Tibbit #09 and #18
Router for Network LAN
TPP2-G2 TiOS firmware (3.80.18)
TDST (Tibbo Device Server Toolkit)
TIDE (Tibbo Integrated Development Environment)
Virtual Machine Node-RED installed (Virtual Box) or User's PC with Node-RED
Additional modules in Node-RED “serialport”
- Install Node-RED in VM and add additional modules like “serialport”
- Upload the TiOS firmware in TPP2G2 board
- Download the basic project from CODY
- Add logic to your project using TIDE
- Create the flow in Node-RED
Install Node-RED in VM and add additional modules like “Dashboard”
To install Node-RED on a Linux machine you need to have node.js support
sudo npm install -g --unsafe-perm node-red
npm i node-red-node-serialport
More information on the web links below:
Upload the TiOS firmware in TPP2G2 board
You can download the TDST and TPP2G2 firmware from the Tibbo website here.
Install the TDST on your PC and access Device Explorer to get the visibility of the Tibbo devices in your LAN.
Add the Tibbits to the TPP2G2 board on the respective sockets.
Connect the TPP2G2 board to LAN and power the board.
To upload the firmware, click on “Upload” and use the LAN network to transfer the file.
Download the basic project file from CODY
Use CODY to build the configuration and download the project to your PC.
Enable DHCP or keep the Static IP addressing as per your requirements on the Ethernet connection.
Set the Serial COM port parameters, for demonstration purposes I use Tibbit#02 and RS232, you can even use Tibbit #01 too.
Serial Parameters are 115200-8N1(RTS/CTS)
Add logic to your project using TIDE
Add the logic on the serial side of communication.
ser_data_arrival function is used when Node-RED sends the data to TPS, print the data on TPS console output to verify.
Add the logic when you send the data from TPS to Node-RED, for demonstration purposes I used the on_button_pressed function.
Create the flow in Node-RED
Access the Node-RED in Chrome using the VM IP (http://VM-IP:1880) and port 1880.
You will need the nodes like “Inject”, “serial in”, “serial out” and “debug”.
The “Debug” node is used to display the serial data coming from TPS.
The “Inject” node is used to send data to TPS.
But to achieve the data flow, you need to create the serial COM port in Node-RED.
“Inject” node properties:
I just inserted the data in “string” format for demonstration purposes.
Data will send an interval of every 5 seconds to TPS.
“Debug” node properties:
Serial COM Port properties:
I enabled the flow control, make the changes accordingly to RTS and CTS lines in Node-RED COM port, connect the USB-to-Serial cable to the PC (Node-RED) using USB-Serial connector cable (drivers installed).
Node-RED will recognize the COM port as you connect the serial, the only thing you need to do is to set the parameters Baudrate, Data bits, Parity and Stop bits to match with what you did in TPS for uninterrupted data flow.
Results of the Project: