Support
0
Cart
Sign In
vention-logo
  • Design
    MachineScope icon
    MachineScope Define project requirements
    MachineBuilder icon
    MachineBuilder Design your machine
    Automate
    MachineLogic icon
    MachineLogic Program code-free
    MachineApps icon
    MachineApps Out-of-the-box software
    Order & Deploy
    MachinePortal icon
    MachinePortal Track orders & collaborate
    MachineCloud icon
    MachineCloud Deploy & monitor remotely
    Watch a demo
    Learn about our platform
    • Applications by Factory Floor
      View Vention designs by factory floor area
    • Applications by Industry
      View Vention designs by industry
    • Why automate with Vention?
      Learn about the proven benefits of automating with Vention.
    Learn more about applications
    Manufacturing
    • Bin Picking
    • Gantry Systems & Path Following
    • Machine Tending
    • Robot 7th Axis
    • Robot Pedestals & Bases
    • Sanding & Surface Finishing
    • Safety Enclosures
    Assembly
    • Jigs & Fixtures
    • Pick & Place
    • Shelves & Racks
    • Timing Belt Conveyors
    • Workstations
    Material Handling
    • AGV Top Modules
    • Conveyors
    • Industrial Carts
    Packaging
    • Box Erecting
    • Cartesian Palletizer
    • Cobot Palletizer
    • Case Packing
    • Industrial Robot Palletizer
    Learn more about applications
    Food & Beverage
    • Box Erecting
    • Case Packing
    • Cobot Palletizer
    • Industrial Robot Palletizer
    Automotive
    • AGV Top Modules
    • Gantry Systems & Path Following
    • Industrial Carts
    • Jigs & Fixtures
    Aerospace & Defense
    • Industrial Carts
    • Jigs & Fixtures
    • Machine Tending
    • Robot 7th Axis
    Medical
    • Machine Tending
    • Pick & Place
    • Robot 7th Axis
    • Timing Belt Conveyors
    Electronics
    • Pick & Place
    • Robot Pedestals & Bases
    • Timing Belt Conveyors
    • Workstations
    Industrial
    • Conveyors
    • Machine Tending
    • Robot Pedestals & Bases
    • Workstations
    Job Shop
    • Machine Tending
    • Robot 7th Axis
    • Robot Pedestals & Bases
    • Sanding & Surface Finishing
    Robotics
    • Bin Picking
    • Robot 7th Axis
    • Robot Pedestals & Bases
    • Safety Enclosures
    Fast ROI

    With Vention productized applications and self-deployment options, eliminate non-recurring cost and accelerate return on investment

    Field Proven

    Vention applications are built with hardware and software technology that have been deployed tens of thousands times

    Dependable

    Gain access to best-in-class automation expertise in one-click with dedicated customer service team and on-demand remote support options

    Future Proof

    With over 100 engineers continuously developing the Vention platform, your application will be supported over the long run

    Why Automate

    Manufacturing automation, simplified

    Scalable automation applications, built on rock-solid foundations Application Overview
  • Designs Library
    All designs
    Explore Official Designs

    Customizable Template

    Find a customizable design for your specific need, designed by Vention experts.
    Explore Official Designs
    Discover Community Designs

    Design Inspiration

    Discover design inspiration, created by Vention community members.
    Discover Community Designs
  • Hardware Technology
    MachineMotion icon
    MachineMotion Plug & play machine control
    MachineFrame icon
    MachineFrame Modular extrusion profiles
    Actuators icon
    Actuators Linear & rotary motion
    Hardware Library
    Browse all parts
    • Structural & Framing
    • Frame Accessories
    • Fixtures & Tooling
    • Panels and Table Tops
    • Robot Mounting
    • Robot End-of-Arm Tools
    • Robots
    • Safety
    • Wheels
    • Linear Motion
    • Rotary Motion
    • Pneumatics
    • Material Handling
    • Controls & Motors
    • Software
    • Cabling
    • Fasteners
    • Consumables
    • Tools
    • Merchandise
  • Resources
    • Resource Center
    • Customer Stories
    • Video Tutorials
    • Webinars
    • Blog
    Tools
    • ROI Calculator
    • Friction Joint Calculator
    • Deflection Calculator
    • Palletizing App
    • Path Following App
    • Factory Acceptance Checklist
    • Site Acceptance Checklist
    Community
    • Community Overview
    • Top Designers
    • Forum
    • Gallery
    Services
    • Support Packages
    • Technical Support
    • FAQ
    Connect
    • About Us
    • Press
    • Contact Us
    • Careers
    • Events
    • Vention Experience Center
    Tutorials
    Navigating MachineBuilder
    Navigating MachineBuilder Take a tour of Vention's Cloud-CAD platform, MachineBuilder
    All tutorials
vention-logo
Sign In Get Support

Platform

  • MachineScope icon
    MachineScope Define project requirements
  • MachineBuilder icon
    MachineBuilder Design your machine
  • MachineLogic icon
    MachineLogic Program code-free
  • MachineApps icon
    MachineApps Out-of-the-box software
  • MachinePortal icon
    MachinePortal Track orders & collaborate
  • MachineCloud icon
    MachineCloud Deploy & monitor remotely
Sign In Get Support

Application

Applications by Factory Floor

  • Bin Picking
  • Gantry Systems & Path Following
  • Machine Tending
  • Robot 7th Axis
  • Robot Pedestals & Bases
  • Sanding & Surface Finishing
  • Safety Enclosures
  • Jigs & Fixtures
  • Pick & Place
  • Shelves & Racks
  • Timing Belt Conveyors
  • Workstations
  • AGV Top Modules
  • Conveyors
  • Industrial Carts
  • Box Erecting
  • Cartesian Palletizer
  • Cobot Palletizer
  • Case Packing
  • Industrial Robot Palletizer
Sign In Get Support

Applications by Industry

  • Box Erecting
  • Case Packing
  • Cobot Palletizer
  • Industrial Robot Palletizer
  • AGV Top Modules
  • Gantry Systems & Path Following
  • Industrial Carts
  • Jigs & Fixtures
  • Industrial Carts
  • Jigs & Fixtures
  • Machine Tending
  • Robot 7th Axis
  • Machine Tending
  • Pick & Place
  • Robot 7th Axis
  • Timing Belt Conveyors
  • Pick & Place
  • Robot Pedestals & Bases
  • Timing Belt Conveyors
  • Workstations
  • Conveyors
  • Machine Tending
  • Robot Pedestals & Bases
  • Workstations
  • Machine Tending
  • Robot 7th Axis
  • Robot Pedestals & Bases
  • Sanding & Surface Finishing
  • Bin Picking
  • Robot 7th Axis
  • Robot Pedestals & Bases
  • Safety Enclosures
Sign In Get Support
Sign In Get Support

Design

Customizable Template

Find a customizable design for your specific need, designed by Vention experts. Explore Official Designs

Design Inspiration

Discover design inspiration, created by Vention community members. Discover Community Designs
Sign In Get Support

Hardware

  • Browse all parts
  • Structural & Framing
  • Frame Accessories
  • Fixtures & Tooling
  • Panels and Table Tops
  • Robot Mounting
  • Robot End-of-Arm Tools
  • Robots
  • Safety
  • Wheels
  • Linear Motion
  • Rotary Motion
  • Pneumatics
  • Material Handling
  • Controls & Motors
  • Software
  • Cabling
  • Fasteners
  • Consumables
  • Tools
  • Merchandise
  • MachineMotion icon
    MachineMotion Plug & play machine control
  • MachineFrame icon
    MachineFrame Modular extrusion profiles
  • Actuators icon
    Actuators Linear & rotary motion
Sign In Get Support

Learn

  • Resource Center
  • Customer Stories
  • Video Tutorials
  • Webinars
  • Blog
  • ROI Calculator
  • Friction Joint Calculator
  • Deflection Calculator
  • Palletizing App
  • Path Following App
  • Factory Acceptance Checklist
  • Site Acceptance Checklist
  • Community Overview
  • Top Designers
  • Forum
  • Gallery
  • Support Packages
  • Technical Support
  • FAQ
  • About Us
  • Press
  • Contact Us
  • Careers
  • Events
  • Vention Experience Center
Tutorials
All tutorials
Navigating MachineBuilder
Navigating MachineBuilder Take a tour of Vention's Cloud-CAD platform, MachineBuilder
Watch tutorial
Sign In Get Support

Applications by Factory Floor

  • Bin Picking
  • Gantry Systems & Path Following
  • Machine Tending
  • Robot 7th Axis
  • Robot Pedestals & Bases
  • Sanding & Surface Finishing
  • Safety Enclosures
  • Jigs & Fixtures
  • Pick & Place
  • Shelves & Racks
  • Timing Belt Conveyors
  • Workstations
  • AGV Top Modules
  • Conveyors
  • Industrial Carts
  • Box Erecting
  • Cartesian Palletizer
  • Cobot Palletizer
  • Case Packing
  • Industrial Robot Palletizer
Sign In Get Support

Applications by Industry

  • Box Erecting
  • Case Packing
  • Cobot Palletizer
  • Industrial Robot Palletizer
  • AGV Top Modules
  • Gantry Systems & Path Following
  • Industrial Carts
  • Jigs & Fixtures
  • Industrial Carts
  • Jigs & Fixtures
  • Machine Tending
  • Robot 7th Axis
  • Machine Tending
  • Pick & Place
  • Robot 7th Axis
  • Timing Belt Conveyors
  • Pick & Place
  • Robot Pedestals & Bases
  • Timing Belt Conveyors
  • Workstations
  • Conveyors
  • Machine Tending
  • Robot Pedestals & Bases
  • Workstations
  • Machine Tending
  • Robot 7th Axis
  • Robot Pedestals & Bases
  • Sanding & Surface Finishing
  • Bin Picking
  • Robot 7th Axis
  • Robot Pedestals & Bases
  • Safety Enclosures
Sign In Get Support

  • Resource Library
  • MachineLogic
  • MQTT and HTTP Communication with MachineMotion
Download doc
Related Resources:
  • 15 - Programming with inline sequences
  • 14 - MachineLogic for robots: Combined moves
  • MachineLogic Python Programming v1.0
  • 13 - Intro to MachineLogic Python Programming
  • 12 - Intro to State Machines
See all MachineLogic Resources
Back to resource library
How to guide Updated: Thursday, August 3rd 2023

MQTT and HTTP Communication with MachineMotion

Contents

  • Overview
  • Introduction to MQTT
    • Definitions
    • Main advantages of having an MQTT broker
  • Programming
  • Wiring & Safety
  • Introduction to HTTP
    • Definitions
  • Programming

Overview

In this document you will learn how to set up your MachineMotion controller and automate your machine, while using MQTT as the message protocol.

Typical use cases of bi-directional communication with MachineMotion:

  • Robot-MachineMotion communication (e.g. 7th axis sensors sending command to a robot)
  • PLC-MachineMotion communication

Figure 1: MachineMotion

Introduction to MQTT

Definitions

  • Client: Device that can send (publish) and receive (subscribe) data
  • Packet: Data sent by a client
  • Topic: Subject line through which packets are sent
  • Broker: Piece of software running on a computer which acts as the transit between another device or another broker

Message Queuing Telemetry Transport (MQTT) is a bi-directional lightweight message protocol which consists of a set of rules that defines how Internet of things (IoT) devices can publish and subscribe to data over the Internet. MQTT is used for messaging and data exchange between IoT and industrial IoT (IIoT) devices, such as embedded devices, sensors, industrial PLCs, and now, MachineMotion.

Each client can produce and/or receive data by publishing and/or subscribing. A client can publish a packet for a given topic, and anyone who subscribes to it can receive a copy of all messages for that topic. Multiple clients can subscribe to a topic from a single broker, and a single client can register subscriptions to topics with multiple brokers. This helps in both sharing data and managing and controlling devices. A client cannot broadcast the same data to a range of topics and must publish multiple messages to the broker, each with a single topic given. With MQTT broker architecture, the client devices and server application become decoupled. This allows clients to communicate with a single common recipient, and therefore funnel all information from the same place.


Example:

Here is a simple example to illustrate a common situation in which the user wants MachineMotion to communicate with a robot.

  • Packet: Sensor’s message
  • Payload: Sensor message’s data (e.g. 0 or 1)
  • Topic: Sensor-Topic

  • Client 1: MachineMotion controller
  • Broker 1: MachineMotion’s MQTT broker
  • Broker 2: Robot’s MQTT broker
  • Client 2: Robot

Figure 2: MQTT example 1

If a sensor communicating with MachineMotion has “publish” capabilities, Broker 1 (MachineMotion’s broker) has subscribe and publish capabilities, and the robot’s broker has subscribed to MachineMotion’s broker, a change of state of the sensor will automatically be received by the robot. In this specific case, the sensor status will send the signal to MachineMotion, which will then send the message to the robot.


Main advantages of having an MQTT broker

  • Eliminates vulnerable and insecure client connections while reducing network strain
  • Can easily scale from a single device to thousands
  • Manages and tracks all client connection states, including security credentials and certificates, if configured to do so

Programming

MachineLogic allows you to easily program your machine through its graphical interface and its low-code infrastructure. When it comes to MQTT communication, the same simple programming approach applies. To create a MachineLogic program using MQTT communication, here are the main commands:

To subscribe to a given topic, the State Machine or Wait For command can be used.

Figure 3: Subscribe to a topic in MachineLogic

To publish to a given topic, the General Event output command can be used.

Figure 4: Publish to a topic in MachineLogic

For more complex applications, you can also include payloads via the Variables and Functions features.

Figure 5: Variables and functions feature on MachineLoigc


Example:

To illustrate what you learned in this document, let’s use a design where a robot is mounted on a robotic range extender using a MachineMotion controller.

For a simple use case, the range extender could alternate between 3 different states:

Figure 6: MQTT states example

In order to communicate with the robot, the range extender must subscribe and publish different topics using TCP/IP communication:

Figure 7: Publish and subscribe MQTT example

In this situation, having a range extender communicating with a robot allows the user to easily program a sequence in which the range extender reacts to a few inputs from the robot and vice versa. Digital I/O communication could have been used in this example, but the transfer of payload for specifications such as distance, speed and acceleration would not have been straightforward. Please keep in mind that this example is for training purposes, and it would probably require adjustments to meet your specific needs.


Wiring & Safety

MachineMotion has a Mosquitto MQTT broker. It can therefore publish and subscribe to MQTT topics to send/receive packets of data. Through a single Local Area Network (LAN) cable connection, you can connect your MachineMotion to the other controller or a router. As a reminder, MachineMotion runs on a server 192.168.7.2

Figure 8: MQTT ethernet wiring

In terms of safety, the Robot Safety Module is the interface between Vention’s MachineMotion 2 controller & robots’ safety interfaces. The Robot Safety Module manages the safety fault events that happen on the machine to safely stop both the MachineMotion 2 controller and the robot. Please find below the wiring table for a typical use case in which bi-directional safety is required when it comes to a project using MQTT:

Figure 9: MQTT safety wiring

The client would have 2 requirements to be compatible with this solution: an MQTT broker and a safety interface (for bi-directional safety). For the latter, here are the minimum requirements:

  • 2 x dry contact inputs for STO (to be connected on the TO ROBOT connector of the RSM)
  • 2 x 24V safety output (to be connected on the FROM ROBOT connector of the RSM)
  • 1 x RJ45 connector (to communicate with MMv2 and pendant via Ethernet and the RSM)

Please refer to the Robot Safety Module technical documentation for more details.


Introduction to HTTP

Definitions

  • Client: A software application or a program such as a web browser that initiates requests to web servers.
  • Requests: the request from the client to the server specifying the URL of the resource it wishes to retrieve as well as the request method (GET, POST, PUT, DELETE).
  • Servers: A software application or a program that listens for incoming requests from clients, processes those requests, and sends back corresponding HTTP responses.
  • Response: Message sent by the server to a client. An HTTP response contains the status line, the response header and response body.

HTTP stands for Hypertext Transfer Protocol. It is an application layer protocol used for data communication on the World Wide Web. HTTP facilitates the transfer of various resources, such as HTML documents, images, videos, and other types of data, between a client (usually a web browser) and a web server.

The basic concept behind HTTP is the request-response model. When a client wants to access a resource hosted on a web server, it sends an HTTP request to the server. The server processes the request and responds with the requested resource, along with an HTTP response containing the status of the request (e.g., success, error, redirection) and additional metadata about the resource. HTTP operates on top of the TCP/IP (Transmission Control Protocol/Internet Protocol) network stack and typically uses TCP as its transport protocol.

Programming

MachineLogic’s Code-Free programming allows you to easily program your machine through its graphical interface and its low-code infrastructure. When it comes to HTTP communication, the same simple programming approach applies. To send a HTTP request from MachineLogic, use the Add Message command and select URL in the Send message to field:

Figure 10: Add Message command

Example:
In the following example, we will show how to format application variables so they can be sent using a POST request from MachineLogic Code-Free programming interface. This can be used to send a log of an actuator’s position to an express server:

Step 1: create the application variables:

Figure 11: Creating application variables

Step 2: Format the application variables in json format using lambda functions:

Figure 12: Formatting variables using Lambda Functions

Step 3: Send the HTTP request using the Add Message command:

Figure 13: Send application variables as HTTP Request

This examples assumes a server is running on port 3169 of the user’s machine listening on the route logPositionData. The server response is encapsulated in the UNPACK_MESSAGE.

Was this information helpful?

Still need help?

Ask the User Forum Contact support
vention-logo
Simplified Machine Design for Everyone.
Book a demo Get support
Email: info@vention.cc
Call: +1-800-940-3617
Platform
  • MachineScope
  • MachineBuilder
  • MachineLogic
  • MachineApps
  • MachinePortal
  • MachineCloud
Hardware Technology
  • MachineFrame
  • MachineMotion
  • Actuators
Applications
  • Browse All Applications
  • Manufacturing
  • Assembly
  • Material Handling
  • Packaging
Hardware Library
  • Browse All Hardware
Designs Library
  • Browse All Designs
Resources
  • Resource Center
  • Customer Stories
  • Video Tutorials
  • Webinars
  • Blog
  • FAQ
Tools
  • Browse Tools
Community
  • Community
  • Top Designer
  • Forum
  • Gallery
Learn & Connect
  • About Us
  • Press
  • Contact Us
  • Careers We're hiring!
Vention 2023
Terms Privacy Security