Hello World! Industry 4.0 with xTuple ERP and our old friend the serial port

What is Industry 4.0?

Since the dawn of the first Industrial Revolution (i.e., Industry 1.0) welcomed mechanization and steam power, a numbering system was been created out of necessity to delineate each "time period." Industry 2.0 came about with mass production enabled by assembly lines. Industry 3.0 saw the age of computers and robotics in manufacturing technologies. Industry 4.0 ushers in automation and data exchange with cyber-physical systems as they communicate and cooperate with each other and with humans in real time, the Internet of Things (IoT) and cloud computing. Industry 4.0 creates what is today called the "smart factory."

According to Forbes, we've all got some Industry 4.0 prognostications to look for by 2020:

  • Business-to-business (B2B) spending on IoT technologies, apps and solutions will reach $267B
  • 50% of IoT spending will be driven by discrete manufacturing, transportation and logistics, and utilities
  • Spending on IoT applications is predicted to generate $64.1B
  • IoT Analytics spending is predicted to generate $21.4B
  • Predictive maintenance, self-optimizing production, and automated inventory management are the three top uses cases driving IoT market growth

xTuple has been talking about Industry 4.0 at manufacuring industry conferences, including a technology panel last year at FABTECH Expo, North America's Largest Metal Forming, Fabricating, Welding and Finishing event. xTupleCommerce Product Manager Josh Fischer presented a product overview and case study entitled “Is Your Manufacturing Company Ready to Go Digital?

"Hello, World!" 

With the dust settled on xTuple ERP version 4.10.0 — and version 4.10.1 fast approaching — the time has come to dive head-first into some of the hidden serial port scripting features related to Industry 4.0 that we snuck into the 4.10 release.

I recently wrote an article for xTuple University about the addition of QSerialPort and QSerialPortInfo to xTuple's scripting environment and what that means for users. If you are not familiar with serial ports in general, I would suggest taking a ride down Serial port "memory lane" on Wikipedia. While originally standardized as an "Interface between data terminal equipment and data communication equipment employing serial binary data interchange" in 1969, serial port communication lives on in many forms  from USB devices and virtual serial ports all the way back to the 25 or 9 pin connector that exists on many industrial weighing solutions and other industrial machines. While I focused on serial ports in this first article, I will discuss QSslSocket (and QTcpSocket) as well as QTcpServer and QUdpSocket in upcoming articles — protocols you will come across on modern machinery that provide a network connection.

For demonstration, I chose this 16x2 Character RGB LCD from Adafruit. The code discussed in the article is structured to make working with other LCDs possible with few changes, but with most low level devices every vendor implements their own command set. In the case of serial communication I am talking about specific bytes you send over the wire that make your LCD do the things that you want it to do, such as the position of the text, the brightness or contrast, and in this case even the three separate bytes that control the red, green, and blue values of the backlight. And, of course, the bytes before which tell the screen that you are about to send it those three bytes!

Here's a demonstration video. Read my article on Serial Port Scripting for Industry 4.0 for all the details.

I hope this gives you some ideas of what you can do with the xTuple ERP scripting environment and QSerialPort. While this is just scratching the surface, be on the look out for a more complex example in the coming weeks covering bi-directional communication with a MSR-605 magnetic stripe card machine.

Note: For anyone who is wondering, the phrase "Hello, World!" has been used to describe a simple computer program that outputs or displays "Hello, World!" to the user. Often it's the very first program people write when they are new to a programming language. We can also expand the meaning to encompass Industry 4.0 — to include how machines literally communicate with each other and their humans in smart factories.

Industry 4.0 image credit: ChristophRoser under CC BY-SA 4.0, Image Link

David Beauchamp

Software Implementation Engineer

The primary directive of the Professional Services Team — made up of xTuple staff and the xTuple Partner global community — is to ensure experts are available to assist in the execution of your new system using the established xTuple implementation methodologies and to optimize the benefits of your new enterprise application. As part of the professional services team, David's deep-dive technical and operational knowledge helps xTuple customers maximize the benefits of ERP in their business. A long time xTuple user, David joined the team after implementing PostBooks® at a multi-national manufacturer. A self-described hardware hacker, David spends his free time in the embedded world voiding warranties, contributing to the open source ARM development community and helping automate life using a plethora of connected devices.