meet-the-industrialized-arduino-hero
meet-the-industrialized-arduino-hero
meet-the-industrialized-arduino-hero
meet-the-industrialized-arduino-hero
meet-the-industrialized-arduino-hero

Meet the industrialized Arduino

Feb. 11, 2022
How to make a single-board controller fit for the factory

[Editor's note] Read the related content regarding this project: Tips for using an industrialized Arduino controller and Why use an industrialized Arduino controller?

In two previous project articles, we set out to prove that single-board controllers, common to the maker community, can be adapted to industrial applications. Or it might be as accurate to say industrial applications can be adapted to work with such controllers. In the first project, an Arduino was able to control a flow loop using PID control (www.controldesign.com/arduino). And, for the second, a Raspberry Pi was able to perform model-based temperature control (www.controldesign.com/raspberrypi).

Also read: PLC vs. Arduino for industrial control

Some of the problematic characteristics of these devices have proved to be their physical fragility and the difficulty of making connections. These small controllers are, for the most part, naked boards with exposed contacts, and protecting them sufficiently to survive in an industrial environment is the responsibility of the user (Figure 1).

To solve this issue, there are now industrialized versions of these controllers, built into the kinds of housings and form factors more typical of conventional PLCs and supporting modules. These provide much simpler assembly with DIN-rail-mounted modules and power supplies. One example is from AutomationDirect, offering the ProductivityOpen P1AM-100 Arduino MKRZero-compatible controller in an industrial enclosure. The ProductivityOpen interfaces with other AutomationDirect communication and I/O devices to support connectivity common to industrial control panels.

So, the challenge for this project was to create an industrial type of application using an industrialized Arduino and associated components, to see what advantages they offer over conventional maker hardware.

Figure 2: The demonstration project is designed to heat the workpiece and facilitate soldering components to a large copper piece by using a hot-air gun positioned under the table as the heat source. Hot air blows up from below onto the workpiece.

A high-wattage soldering station

This industrialized Arduino project has the advantage of demonstrating the hardware concept while also providing a useful piece of equipment. As part of another project, I have been designing and building a power supply that needs a transistor soldered to a copper heat spreader that is far too large to heat with a soldering iron. A propane torch could do the job, but is difficult to control and could easily destroy the transistor.

Considering some other options, a common hot-air heat gun has a lot of output—about 1,500 Watts—which is substantial compared with a 50-to-200-Watt soldering iron. By building a tabletop with some stainless-steel hardware cloth in the middle, it was possible to mount the heat gun underneath to direct heated air directly on the copper plate (Figure 2). This gets it hot enough, but the problem is providing a controlled, steady temperature. This application could be solved using a conventional temperature controller, but, for the sake of the demonstration, we’re building it from scratch using the Arduino-type controller.

As one of the demonstration objectives, we used conventional proportional-integral-derivative (PID) control, which is common for all manner of closed-loop applications, including temperature control. Proportional control drives the temperature to a desired setpoint. Integral control compensates for errors due to limited proportional gain. Derivative compensates for thermal lag between the heater and the temperature sensor, avoiding overshoot.

Hardware selection

Figure 3: The thermocouple sensor signal is processed by a temperature input module that sends characterized data to the main controller CPU, while a prototyping shield enables other display and I/O functionality.

An Arduino-based controller can easily handle the data-processing needs of this system when provided with an accurate temperature measurement of the copper plate using a thermocouple or resistance temperature detector (RTD). In this case, we are using the former, but it needs precision signal processing to provide a useful temperature reading.

The ProductivityOpen P1AM-100 CPU is supported by the Arduino integrated development environment (IDE). This means the CPU interfaces with the Productivity1000 series communication and I/O modules, as well as the maker-oriented interfaces (shields), so hardware can be mixed as needed.

Adding a P1-04THM temperature input module provides the interface and data processing for a type J thermocouple (Figure 3). The sensor attaches directly to the copper plate to provide robust and responsive temperature data. The P1AM-PROTO prototyping shield is used to support additional bits of circuitry, and adding a bracket and two DB-9 connectors simplified the necessary connections. Since all these modules mount on a standard DIN rail and have integrated interconnects, packaging is neat, modular and sturdy.

Figure 4: The system block diagram shows all the operational components.

The heat gun is controlled using a zero-voltage switching solid-state relay, driven by a digital output pin from the CPU to turn the gun on and off on a cycle-by-cycle basis to throttle its output. To keep an accurate account of cycle-by-cycle control, the ac power line phase needs to be sensed by an input pin to the CPU, to time driving the solid-state relay. Optoisolators protect both of the CPU pins from transients and external faults.

To maintain workshop safety and prevent the system running unattended, there is a footswitch in series with the solid-state relay control signal, so the operator must be physically present with a foot on the switch for the heat gun to operate.

Finally, a mechanism for data display and control is included to avoid the need to have a laptop available when operating. For this, a maker-community device works with the industrial hardware, proving the ability to mix sources. An Adafruit 772 16 x 2 LCD display, with pushbuttons and an inter-integrated circuit (I2C) interface connects to the CPU using only two digital pins to drive the display and scan the pushbuttons. A block diagram summarizes the hardware arrangement (Figure 4).

Control code

ProductivityOpen offers two approaches for programming. ProductivityBlocks is a graphical front-end to the Arduino IDE, allowing the programmer to drag and drop control to CPU I/O and Productivity1000 modules. It generates a sketch, or program, in the IDE, which gets compiled and uploaded to the CPU. Using ProductivityBlocks avoids common syntax errors, such as missing or extra braces or a missing semicolon.

The alternative is to write directly in C or C++ within the IDE. Based on familiarity and experience with this method, this is our choice for the project.

A series of functional software blocks were developed incrementally. The first controls the heat gun, including power line sensing and solid-state relay control. Since zero-voltage switching is used, the heat gun must be either on or off for a whole cycle of the ac power line. The power line discrete input generates an interrupt for each cycle of the 60 Hz ac, and the throttle code executes in this interrupt routine 60 times per second. We can define the range of the throttle for 0% to 100%.

The throttle setting defines how many cycles the heat gun is on out of 100 cycles, which is also known as time-proportioned control. A table with 100 entries maintains a count of the most recent number of cycles the heat gun was on. For each new cycle, if the desired throttle is greater than this count, then the heat gun is turned on for that cycle, and the count and table are updated. Similarly, if the desired throttle is less than the count, then the heat gun is turned off, and the table and count are similarly updated. If the count and throttle are equal, then the gun is turned on or off based on the table contents. In operation, the heat gun pulses on and off in an odd way but quickly enough to provide reasonably steady heat.

The thermocouple interface uses a program from the standard library provided with the CPU extension to the Arduino IDE. The thermocouple input module is very flexible and requires a set of numeric parameters to use. Rather than reading a detailed manual to figure out how to choose each parameter, a website (www.controldesign.com/thermoparameters) includes a tool to determine the necessary parameters based on the type of temperature sensor and its operation. These can be copied and pasted into the Arduino sketch yielding a very simple program that works in a matter of minutes.

The last interface is the LCD display and pushbuttons. The CPU doesn’t reserve the pins used for the I2C interface, so the standard Arduino Wire library for I2C communication can be used. Adafruit supports it using Adafruit RGB LCD Shield Library to control the display via I2C using the Wire library.

Figure 5: A simple display shows the actual temperature, setpoint, heat-gun output and operational state. The pushbuttons allow the operator to change all parameters.

One common challenge when mixing industrial and maker hardware is resolving voltage mismatches. The LCD display operates at 5.0 V and uses 5 V signaling on the I2C interface. The P1AM-100 interfaces to 3.3 V and can’t handle 5.0 V signals. Shifting level in this situation is critical since I2C signals are bi-directional, without explicit signals to control the direction.

Fortunately, a low-threshold metal–oxide–semiconductor field-effect transistor (MOSFET) can be used to provide the necessary level shifting function. SparkFun electronics sells a suitable level shifter (BOB-12009), but, for the project, we chose to build the level shifter from scratch, in the prototyping module. An old Philips Semiconductor application note AN97055, which is available at www.controldesign.com/AN97055, goes into the electronic details. With the level shifter in place, the HelloWorld.ino example program in the LCD library runs nicely.

Application code

With all the control interfaces working, the next step was creating application code. This involved creating some code to perform the PID algorithm. As anyone who has tried to tune a PID loop knows, loop effectiveness depends entirely on the coefficients used for the proportional, integral and derivative values of the control equation. Given the imponderables in this system—the thermal coupling from the heat gun to the object; the thermal capacity of the object; the delay in thermocouple response—an easy way to adjust these coefficients is needed. Otherwise making a change to the program itself requires rewriting, recompiling and reloading the software for each adjustment. Also, the desired temperature setpoint must be adjustable.

Figure 6: A thermocouple attaches to the copper piece using an alligator clip to measure its temperature during the heating and soldering process. The plate’s desired temperature was maintained properly after some PID adjustments within the controller.

Once these factors are set up, the operator starts and stops the control algorithm as required. By writing a simple state machine, it is possible to cycle through each of the settings via the left and right buttons, while adjusting parameters with the up and down buttons. The select button is used to start and stop the PID control.

Two lines of 16 characters can display all the necessary information (Figure 5). This includes the actual temperature at the top left, with the setpoint shown immediately below. The throttle setting is shown at bottom center, along with the current state of the state machine in the bottom right. If a parameter is being set, its value is shown on the top right.

With all the software working, full operation was now possible. The heating system worked as expected, but with a significant lag common to temperature control applications (Figure 6). With the initial PID factors in place, the loop routinely overshot the setpoint by 7-8 ºC. Recovery from the overshoot resulted in a subsequent temperature undershoot, and oscillation of several degrees Celsius around the desired setpoint.

Fine-tuning the PID loop and making some adjustments to optimize control for this application required some additional work, which would have been required regardless of the type of controller used.

About the Author

Doug Reneker | circuit designer

Doug Reneker is a retired electrical engineer and circuit designer who worked for Bell Labs, Recon/Optical and Arris. He has a BS and MS in electrical engineering from Iowa State University. Contact him at [email protected].