Mastodon and Ignition for Manufacturing

With Elon Musk buying out Twitter recently, the social platform Mastodon is in the news cycle once again. Mastodon has popped up a couple of times over the past few years since it is an open source, self-hostable social media platform very similar to Twitter.

Mastodon’s main difference as compared to other platforms is that it is decentralized or “federated”. Unlike Twitter, Instagram, Facebook, or other social media platforms (where you sign up with an account on that platform’s servers), Mastodon allows users to sign up on any server and communicate with users on any other server instance as well. This is very similar to how email works. You can sign up for Gmail and still communicate with users on any other email system, or who have a self-hosted email server. No single company owns “email” or requires all email communication to go through them the way all the information on Facebook must go through servers owned by Facebook.

Using a tool like Mastodon gives you access to a modern timeline based feed. You can create users for your processes, equipment, and analytics datastreams, let your employees create their own accounts and curate their feeds to the data and information they need to see on a regular basis.

You can do the same thing with Twitter although it is much more difficult to keep things private. Mastodon solves this problem by letting you host it yourself.

Mastodon’s Interesting Implications for Manufacturing

  • First, you can host a Mastodon instance yourself—on your own servers and network. This gives you the complete functionality of the platform without having to do any extra work to implement it.

  • Secondly, you can lock down the instance in terms of user accounts so that it can only be accessed by people on your domain or whoever you grant access.

  • Lastly, Mastodon has a terrific API built in making it trivially easy to integrate with a SCADA system to display important information like Alarms. You can even take it beyond alarms and post images, video clips, and files for a very powerful information dissemination platform with very little effort or overhead.

Setting Up Mastodon

The first step for getting Ignition alerts into Mastodon is to set up a Mastodon server. Mastodon has an excellent getting started guide for this step. You can either host your Mastodon installation internally on your network or in the cloud. For our purposes, we used a 1-Click Digital Ocean instance to simplify the process. Then, we tied it into our domain, mastodon.corsosystems.com with DNS settings configured per Mastodon’s documentation.

Once you have Mastodon installed, you can go into the server to configure it. For our example, we ran through the wizard on our Digital Ocean instance:

Mastodon's first time setup wizard running on a cloud server, step 1 setting up the domain name
Configuring Mastodon with the first-time setup wizard on a cloud instance - step 2, email settings

Creating a User

The next step is to either access your server in a web browser and sign up for an account, or create an account in the command line. This process exactly like signing up for an account on nearly any social media site through a browser!

 
Signing up for a Mastodon user account using a web browser
 

Once you have set up a user account, you can assign it the role of Owner. This will allow you to configure the server settings, user management, etc. After you have created your account, you can also log in and post directly to the timeline from the browser!

For the purposes of this tutorial, we will only create a single user. If you were to use Mastodon for internal communications, you would want to create users depending on how you want to use the system. You may want to use it with Ignition as a whole, or have a user set up for different production lines, pieces of equipment, or even different servers.

Once you have your user set up as an owner you can also send out the Mastodon server URL to your employees and they can create their own accounts as well.

Create a Client, Authenticate, and Post a Status From Ignition

Next, you will need to use the command line or a tool like Postman to create a client for authenticating to Ignition. The Mastodon Docs explain this process in more detail. In our example, we will name the client Ignition.

When creating the client, you will receive a client-id you will use for authenticating users. Copy this client-id down and save it in a file system, a database, or create a tag in Ignition to store it for future use.

After registering the app, you need to return to your browser and obtain a user code. This will allow you to authenticate against the client for a particular user. Once you do this, you will get a token for posting status updates as that user.

Once you have created the client you will authenticate the user with the client-id to get a user access token. More detail on doing this in in the Mastodon documentation.

When you have the authorization token, save it for future use. You might also find it useful to write some Ignition scripts to handle the various authentication actions in case you need to do them again in the future.

Once you have the authorization token, all it takes are a couple of lines of code to post a status to your Mastodon server! You can then go into the browser and see the post on the timeline!

headers = {"Authorization": "Bearer ......"} data = {"status":"Posted from Ignition"} url = "https://mastodon.corsosystems.com/api/v1/statuses" httpClient = system.net.httpClient() httpClient.post(url=url, data=data, headers=headers).json

The code necessary to post a status to your Mastodon server from Ignition!

Place the few lines of code above in a script package, pass in the status text as a parameter (along with the authorization code if you are using more than one user) and you can then post statuses from anywhere in your Ignition application. Common status examples might be alarms, tag changes, or periodic scripts for posting relevant analytics from your Ignition gateway to Mastodon.

In our example we are using tags to store the authorization token for ease of development.

Advanced Use Cases

Mastodon also allows you to attach media files to your status posts. These can be images, video, GIFs, or audio.

This feature allows you to do some very interesting things with Ignition and your plant floor systems. One easy example would be exporting a trend screen to an image, then posting it to help your process engineers analyze data as it is coming off the floor.

If you have cameras in your facility where you can capture video with a trigger you could easily embed video of a particular process operation into a status update to provide context to an alarm.

Using the power of Ignition it is very easy to generate media you can post to Mastodon to give your users as much context as possible when Ignition is alerting them.

Wrapping Up

The power of social media provides many potential benefits for a manufacturing company. You can send out real-time alerts to your team. Or you coudl allow users to follow particular pieces of equipment, production lines, or business systems giving them a bespoke view of the data they need to see at any given time.

You can post media content, giving you pertinent context about any particular alert. This can aid in operator training, process troubleshooting, or might even simplify the overall reporting strategy by taking reports out of email and putting them directly into the timeline.

You can give your team a real-time, play-by-play view of your system in the palm of their hands!

As the world moves into a more connected ecosystem, it is time to start leveraging tools like Mastodon for manufacturing. The added benefit of Mastodon over other platforms is that Mastodon simplifies keeping your data private by hosting it on your own servers so you can control who can see your content.

Please reach out and let us know if you have any questions on how you can leverage Mastodon at your facility or if you want to see more examples of what you can do with it!

Previous
Previous

Map-Based SCADA with Ignition Perspective

Next
Next

Historical Playback in Manufacturing