Testing out Tentacle PLC
Table of Contents
- Introduction
- Hardware
- Software
- Documentation
- Installation Steps Taken
- PLC Programming Steps
- Summary
- Next Steps
Introduction:
What is Tentacle PLC?
Tentacle PLC is a modern Soft PLC runtime with the basic features of a traditional programmable logic controller platform, but the process logic is written in Javascript.
Excerpt from Tentacle PLC Guide
Why am I testing Tentacle PLC?
- I am taking a full-stack engineering program and learning JavaScript. So, I thought this would be a good opportunity to continue developing my skills while testing out what I believe is a great soft PLC project.
Hardware:
Hardware I used:
- Advantech UNO 2271G
- USB Hub
- 24Vdc Power Supply
- USB Flash Drive
Software:
- Ubuntu 22.04
- Information below is from the Tentacle PLC Guide - Getting Started Section
- Node.js v14+
- Docker Engine for Linux
- Docker Compose Note: Apparently this is installed with the Docker Engine. Need to confirm that.
- Docker Compose file from the Tentacle PLC Repository
Documentation:
Steps Taken:
Ubuntu Set-up:
- Download Ubuntu 22.04
- Follow the Install Ubuntu desktop tutorial
Docker Set-up:
- Follow the docker engine installation tutorial
- If you already follow the instructions to install Docker Engine, Docker Compose should already be installed
Container urls:
- Tentacle PLC
http://localhost:4000
- Tentacle PLC UI
http://localhost:3000
- Code Server
http://localhost:8080
- Note: I got this message when I tried accessing the Code server:
- See Determine Code Server Password to learn how I retrieved the password
Determine Code Server Password:
- I followed the instructions on this link
- Identify the container id with
sudo docker ps
: - Pass /bin/bash as the argument with -it option to docker exec
docker exec -it [CONTAINER_ID] /bin/bash
: - Change directory to config.yaml file location
cd ~/.config/code-server
: - Print config.yaml file contents to terminal
cat config.yaml
: - Copy the password from the terminal
PLC Programming Steps:
- The goal was to get a simple PLC program working and connect to a MQTT broker.
- After the installation and configuration, it didn’t take long to achieve this goal
- To start programming I went to the code-server url
http://localhost:8080
and enter password. See determine code server password - Followed the Tentacle PLC Guide to create a test program
Configure config.json:
- I copied the example config.json code in the Tentacle PLC Guide
- I modified the MQTT configuration and put in the credentials for my HiveMQ Cloud Broker
- I left the modbus section empty as I don’t have a modbus device at the moment. This section is for configuring the connection to a Modbus Remote IO device
Configure variable.json:
- I copied the example variables.json code in the Tentacle PLC Guide
- I commented out the modbus variables and motor variable (lines 14-85) as I don’t have a modbus device connected
Configure programs:
- I created 2 files:
- main.js
- secondary.js
Files used in program:
Summary:
- The initial installation and configuration took the most time as I am not too familiar with docker
- After this project, I am definitely more confident but have much more to learn
- I am sure others will find the configuration process quite straightforward
- After the installation and setup, the programming portion was very nice and straightforward
- The PLC programming portion is well documented and I was able to get a simple PLC program running
- I like the GraphQL API capabilities
- The PLC stopped running and I was able to restart the PLC using the
restartPlc
GraphQL mutation
- The PLC stopped running and I was able to restart the PLC using the
- I like that each variable in
variables.json
is published using the Sparkplug B specification - The UI is nice. See image below:
Next Steps:
- Integrate the Tentacle PLC with Ignition
- Create a more complex PLC program for a real world application
- Connect Remote IO
Comments
Feel free to comment, provide constructive feedback, or report an error/typo in the post.
All comments can be accessed via the issues page.