Nick Pulver Nick Pulver is an Electronics Engineer and works in new product development for an industrial magnet manufacturer. He strives each day to find news ways to integrate emerging technology with "dumb" magnets to make them come alive and greatly increase their uses. In his offtime, Nick works as a fulltime dad.

1 In the beginning

Programming with an Arduino comes with a bit of a stigma; they’re for kids. One of my first projects was building a watch kit that I picked up from SparkFun. I didn’t realize it until the kit arrived, but this was no grown-up’s watch. It was definitely for kids. No problem, however, I was proud of my accomplishment and wore that thing proudly, deflecting the razzing from my coworkers. The joking stopped short when I told them that I use the same microprocessor for the power supplies that we sell every day. Yes, that’s right. Arduinos can be used anywhere, especially in an industrial environment!

The use of the Arduino in an industrial prototype carries a great benefit. For one, they’re very inexpensive and can be used for far greater applications than robotics, hydroponic monitors and trinkets. I could build a new industrial machine concept with a MicroLogix PLC and an Allen Bradley PanelViewPlus and spend a couple thousand dollars in the process, or I could prototype with the Arduino and prove the concept for less than $100. The industrial PLCs may be necessary in final product, but to prove a concept, the Arduino works just fine. Additionally, the microprocessors used in Arduino boards are powerful, easy to program, and easy to integrate into existing applications.

Some may be thinking at this point, why do I need to build a prototype when I’ve got the design laid out and I know it will surely work?

2 Why are prototypes necessary?

2.1 Prototypes iron out potential problems

I know for a fact that some engineers out there (or at least the ones I’ve worked with) completely forgo the prototyping process and jump right in to machine design. Confidence in their abilities, short timeline, or financial gain is just a few reasons why it may be passed over. I’ve been in that situation. My first job as a design engineer was with a company that made product-handling machinery. The philosophy seemed to be that if we needed to move a stack of plates from here to there, we’re going to use expensive, complicated machinery to get it where it’s going. In this position, there was no prototyping.

It took too much time and the benefit did not out-weigh the cost. The initial design was put together while parts were being ordered. PLC programming was done before the machine was physically built. It was a nightmare and I struggled with it.

My first machine was a massive disaster in a box that cost $100,000 and took six months to build. We designed a bowl stacker that stacked bowls and indexed them down a conveyor. The biggest mistake we made was sending it to the plant without full testing because we were behind in our timeline. Once in production, we found out that the bowls didn’t index because the conveyor belt was too slippery.

In addition to that, there was a safety guard missing. Someone stuck their arm in the wrong spot to clear a jam and the machine clamped down on their arm. We had to disassemble the machine to get that person’s arm out! I then spent one week per month for the next six months at the customer’s facility modifying this thing to make it operate as advertised. As soon as I got it stabilized and working properly, I quit my job. Prototyping could have revealed these fault points. We could have learned about the slick conveyor belt and the safety hole had we built a non-production prototype and tested it thoroughly. Of course, prototyping is not going to weed out all problems, but it will reveal most of them.

2.2 Prototypes build acceptance and awareness

Developing a prototype builds acceptance of a new idea from coworkers and supervisors. It seems that whenever I present a new idea, the response is typically “Well, we’ve always done it this way, so there’s no reason to change it.” This drives me insane. Then, instead of designing something new using modern technology, we waste valuable time and money tracking down replacement parts that aren’t made anymore. When I’m hit with that resistance, I explain that I can make this problem better for less money. I’ll prove it and it will only cost about x-dollars. If I’m successful and not eating my words, the point is proven.

Prototyping also builds awareness of new technology and shares new ideas and new devices with others who may not have already known about it. After programming an Arduino Pro-Mini to act as a temperature monitor on an old oven, a mechanical engineering friend of mine had a revelation; if we can use one of those to fix this machine, we can use one to fix all of our machines! Pro-Minis are now popping up in other applications around the shop.

2.3 Prototypes prove (or disprove) the concept

At the most basic level, the prototype proves or disproves an idea with minimal impact. In the example of my product-handling machinery, the idea didn’t work. Nearly $100k was spent on a machine that ultimately ended up as scrap and had to be redesigned completely. Still, more money was lost in the product that we couldn’t produce. Our next step should have been to build another machine using a new design and using only parts that we already owned and tested it until we were confident that our new product handling method would work. Then we could have taken the proven prototype design and modeled it in to a final product that could be implemented in the plant. Instead, we bought more stuff and wasted more time.

Whether it’s time or money, I don’t like waste. Had I continued down the path I was trained to take, I don’t think I would have ever really completed a project. Too much waste! I now try to focus on minimalism in my projects; taking the simplest approach to solving a problem by utilizing the least amount of parts, spending a minimum amount of money and taking a minimum amount of time to implement the idea. Taking a minimalist approach to prototyping, I use the following guidelines to create something new and amazing.

3 My method of prototyping

3.1 Figure out the problem

The first step is to really understand what the problem is. I currently work with several machine operators who have been working on the same machine for 20+ years. They know what they like and don’t usually say anything until we’ve reach total machine failure. The information I typically get is: “This quit working years ago, but if I press this while holding down this, I can get it going. Been that way for years, don’t need to fix it.” Well, no, it does need to be fixed or even replaced.

One of our operators uses an epoxy heating/mixing machine. The heat control quit working several years ago and he had been judging the temperature with his “calibrated hands.” The floor supervisor didn’t think there was a problem so it was never fixed. That operator was out sick for a couple weeks and a replacement operator stepped in. The broken controller wasn’t manufactured anymore and a refurbished unit cost $1500. We had to scramble to get a new temperature controller installed and figure out how to use it.

The point is, the initial report about a problem is not always the full story. Ask lots of probing questions and even run the machinery or test the process to gain a full understanding of how things are currently running and how they should be running. Make it a point to work in the shop at least one day per month if you don’t already. This keeps you familiar with the operation of all of the machinery so that when something breaks down you already have a working knowledge of how it is supposed to operate.

I take time out of each day to read articles on wired.com, sparkfun.com and adafruit.com. These sites promote and sell all types of microcontrollers, LCDs, sensors, and anything you may ever need to build pretty much anything. I find inspiration in these sites and quite often purchase new sensors or controllers just to learn how they work. Then, when I'm faced with a broken machine that needs a creative solution, I have a good idea of what tools are available to me.

3.3 Declare the solution

Put into simple terms what the solution is. An example would be: “My cup counter doesn’t count cups accurately.” The solution declaration is: “Make the cup counter more accurate.” It’s that simple and this step is by far the easiest. This declarations is your starting point on a new project outline.

3.4 Figure out how to get from the problem to the solution

Now that the easy part is out of the way, we need to figure out how to solve the problem. Do whatever works for you to outline a path. You could create a functional block diagram, you could free-write, you could brainstorm with your coworkers on a whiteboard, you could doodle on a napkin, whatever. Just get your thoughts and ideas onto something you can look at. With your solution path divided out, you can fill in each block with hardware or software to complete each segment. I prefer to sketch out what I need. The act of drawing each block by hand rather than dragging and dropping shapes in a Microsoft Visio document allows me to really think through what I’m doing.

When I get stuck or need some inspiration, I utilize open-source hardware forums quite often. In the case of an inaccurate cup counter, I would go to http://forum.arduino.cc/ and search “high speed counting” and would hopefully find a similar project that some else has already worked through. That’s the beauty of an open-source community. There is a good chance someone has solved a similar problem. And if it’s a new problem that no one has seen before, the experts at AirPair are eager to help!

##4 The project

Let us now apply this process to a real-world application. A quick disclaimer; the software code in this example was taken from SparkFun tutorial. The variables declared in the code as well as the comments have been modified to apply to this specific project, but the general idea is the same.

4.1 The problem

I work in a plant that mixes recycled, ground-up plastic material with raw polyethylene bead. We use a gravimetric feeder that mixes equal parts of new and recycled materials and then feeds the material to an extruder. The hoppers for the gravimetric feeder are mounted at the top of a 50 ft catwalk, high above the extruders. It’s a hazardous environment on the catwalk due to rising heat and fumes from the machinery below. Plus it takes a lot of time and energy to walk up three flights of stairs to get to the controls.

We purchased a new feeder at a great discount from the local technical training center. Since it came from a learning lab, the controls are mounted on the face of the machine rather than in a remote location. It proves treacherous and inefficient to send an operator up the stairs to enable the machinery, and it costs too much money and machine down-time to move the controls to a remote location. My task is to prototype an inexpensive method of enabling the feeder from a remote location and we need to prove the concept quickly.

4.2 The Solution

Create some type of a handheld remote that sends a start signal to the feeder controls from anywhere in the vicinity of the machinery.

Dang, that was easy. Now comes the more complicated part; how do I do that?

4.3 Developing the Prototype

On paper, I write or draw a diagram that outlines the process of getting a signal from here to there. What is the minimal hardware I need to complete this? For this application, I need two devices; a Wi-Fi-enabled signal-sending device and something else to receive the signal and pass it along to the machine. It just so happens that I carry my iPhone with me wherever I roam and the company just installed a new Wi-Fi network on the shop floor. This is a perfect opportunity to integrate new technology with an old process using minimal hardware and spending only a couple dollars. Minimalism at its best!

4.3.1 The hardware

The goal is to send a control signal from my iPhone over the plant’s Wi-Fi network. Something on the machine needs to receive that signal and send it to the control circuit. Next, I need to use a microcontroller attached to the same Wi-Fi network to receive the signal from the iPhone. I already have an Arduino Uno, but I don’t have a Wi-Fi Shield. The Wi-Fi Shield can come later since I’m merely proving a concept, so I’ll leave the Uno attached to my laptop for now. The laptop will act as the Wi-Fi relay point and we can use software to handle the signal processing. The output pins on the Arduino output 5V, but I need a 24V signal to enable the Start command on the feeder. I need a prototype board that attaches to the Uno and a 24V relay. The output of the Uno fires off the 24V relay which is connected in parallel with the “START” BIT on the Feeder’s PLC.

The following list is compiled and parts are purchased:

+ Microcontroller: Arduino Uno

+ Output Device: 24v general purpose relay

+ Arduino ProtoShield

+ iPhone, 4th generation

+ Computer running Windows 7

4.3.2 The software

With the hardware out of the way, I need to figure out what software needs to be running in the background of this operation. My first task is to enable my iPhone to send a signal. Creating apps on an iPhone normally means you must have a developer’s license, a Mac and a working knowledge of Objective C programming language to write an App and install it on the device. Not in this instance. I found an app in the Apple App Store that allows me to create an interface using an interface editor on my Windows PC. My custom interface can then be downloaded to my device. While I’m not an app developer, I can create a user interface on my iPhone using TouchOSC.

Touch OSC Editor

The TouchOSC Editor sets up the visual interface for your iPod, iPad, iPhone or any other smartphone or tablet and can be downloaded at http://hexler.net/software/touchosc. It is very easy to use. Open the editor and simply select the device you want to use. If you are using an Android or Windows phone, then select “custom” from the device drop down list. Next, right-click anywhere in the interface window to select your operator. In our example, all we need is one toggle button. This is a latching button, so a logic “HIGH” sends a start signal, “LOW” sends a stop signal. To download the layout to the device, click the “Sync” button. This essentially sends a “Ready For Download” signal out over Wi-Fi. Next, we need to set up the iPhone to sync with the editor and load the new layout.

Touch OSC App

The Touch OSC app costs $4.99 and can be downloaded from the App Store. This is well worth the price because you can create custom layouts and reuse them in innumerable applications. To sync with the editor and download the new layout, click on the connections icon in the TouchOSC app and enter the IP address of your computer. Next, the “Outgoing Port” should be 8000 and the “Incoming Port” should be 9000. Then under “Layout”, press the “Add” button. Your computer should pop up as the Editor Host and the new layout should automatically upload to the iPhone. Back out of this menu and hit the “Done” button. Our new layout should appear on the iPhone.

This takes care of the signal-sending device. Now we need to set up the software for the receiving device.

Arduino IDE

Arduino is the open-sourced integrated development environment for Arduino microcontroller programming. The software can be downloaded from http://www.arduino.cc/

/* The purpose of this sketch is quite simple. All we're doing here is opening a serial port and continually listening for a message. When the correct message is received, the output BIT is set, which will enable the 24V relay and ultimately take the place of the start button on the machine. */ int message = 0; // This will hold one byte of the serial message int machineStartBIT = 11; // This is the output from the arduino to the 24V relay that is connected in parallel to the enable BIT of the machine controls int enableBIT = 0; // This output BIT is a logic HIGH or LOW. When HIGH, machine is running. When LOW, machine is off. void setup() { pinMode (machineStartBIT, OUTPUT); Serial.begin(9600); //set serial to 9600 baud rate, which is the same data transmission rate as the "Processing" sketch. These baud rates must be the same. } void loop(){ if (Serial.available() > 0) { // message = Serial.read(); // If the incoming message on the Serial port is any value other than zero, put the serial input into the message if (message == 's'){ //If a lower case “s” is received, that tells the machine to “Start.” Messages on the Serial line are case sensitive. enableBIT = 1; // Set enableBIT to 1 (on) } if (message == 'x'){ // If a lower case "x" is received, that tells the machine to "Stop." enableBIT = 0; // Set enableBIT to 0 (off) } } digitalWrite(machineStartBIT, enableBIT); // Writes the StartBIT to the value of the enableBIT }

To upload the sketch to the Arduino microcontroller, select Tools-Board and select the board that you are using. In this case it is the Arduino Uno. Then select Tools-Serial Port and select the COM port that the board is attached to. Pressing the “Upload” button loads the program to the board.

Processing IDE

Processing is another open-source IDE with a large supporting community. We need to use the “Processing” program to act as the relay between the incoming iPhone signal and the Arduino and can be downloaded at https://www.processing.org/download/. Again, we’re setting up a serial port, but this time we’re listening for a signal from the iPhone. When that signal is received, a message is written on another port, which is sent to the Arduino.

import oscP5.*; // Load OSC P5 library. This allows us to receive messages from the TouchOSC app on the iPhone. import netP5.*; // Load net P5 library import processing.serial.*; // Load serial library Serial arduinoPort; // Set arduinoPort as serial connection. This sets the port as the output to the Arduino. OscP5 oscP5; // Set oscP5 as OSC connection. This sets the port as the input from the iPhone. int redLED = 0; /* redLED lets us know if the enableBIT is HIGH or LOW. More on this later.*/ int [] led = new int [2]; /* Array allows us to add more toggle buttons in TouchOSC. When you're ready to add more buttons, you add them here. */ void setup() { size(100,100); /* Processing screen size. This creates the outline for a visualization window that can be used for troubleshooting. More on this later.*/ noStroke(); // We don’t want an outline or Stroke on our graphics oscP5 = new OscP5(this,8000); /*Start oscP5, listening for incoming messages at port 8000, which is the incoming message from the iPhone.*/ arduinoPort = new Serial(this, Serial.list()[0], 9600); // Set arduino to 9600 baud. }

One note that was hard for me to figure out; Serial.list()[x] points to the COM port that your Arduino is attached to. My Arduino is attached to COM3, so I had to change to Serial.list()[1] . If this is wrong, you won’t get an error message, your output will simply not be enabled.

void oscEvent(OscMessage theOscMessage) { // This runs whenever a message is received from the iPhone. String addr = theOscMessage.addrPattern(); // takes the iPhone message and turns it into a String. if(addr.indexOf("/1/toggle") !=-1){ // Filters out any toggle buttons int i = int((addr.charAt(9) )) - 0x30; // returns the ASCII number, so convert into a real number by subtracting 0x30 led[i] = int(theOscMessage.get(0).floatValue()); // Puts button value into led[i] // Button values can be read by using led[0], led[1], led[2], etc. } } void draw() { background(50); // Sets the background to a dark grey, can be 0-255 if(led[1] == 0){ // If led button 1 if off do.... arduinoPort.write("x"); // Sends the character “x” to Arduino, which Stops the machine. redLED = 0; // Sets redLED color to 0, can be 0-255 } if(led[1] == 1){ // If led button 1 is ON do... arduinoPort.write("s"); // Send the character “s” to Arduino, which Starts the machine. redLED = 255; // Sets redLED color to 255, can be 0-255 } fill(redLED,0,0); // Fill rectangle with redLED amount ellipse(50, 50, 50, 50); // Creates an ellipse at 50 pixels from the left... // 50 pixels from the top and a width of 50 and height of 50 pixels } //----------------------------------end processing code------------------------------------

This method creates the visualization window mentioned previously. It’s creating an image of a red button. When the enableBIT is set, the button illuminates, indicating that a “Start” message was sent from the iPhone, to the Arduino, to the machine. If this indicator illuminates, yet the Arduino output does not fire, you can conclude that the iPhone and the Processing sketch are working normally, but something is wrong on the Arduino side of the circuit. Pressing the “Run” button in the Processing window verifies the sketch much like the Arduino IDE. If any issues are found, an error message appears at the bottom. If all is well, the visualization window opens.

It’s now time to test the prototype. Close the Arduino sketch and close the TouchOSC editor. The only software running should be the Processing sketch. Pressing the button on the iPhone should immediately enable the output of the Uno which fires off the 24v relay and the machine should start running. Success? I sure hope so. The only issue I ran into in setting this up was a conflict with the serial port. I had to go into the advanced settings of the USB port and force it as COM3. Once I made this change, the interface worked flawlessly. We’ve now successfully prototyped a solution to a problem with only purchasing a few, inexpensive components. The boss is happy with the improved efficiency, the minimal downtime and the minimal cost. We’ve now received approval to implement a permanent solution.

Again, this is an adaptation from the above referenced tutorial; please refer to it if you get stuck. Several users have posted solutions to common problems in the comments section.

4.4 Where to go from here

If you’ll note, this is running with a laptop attached to the feeder. Obviously, this is not an ideal situation. We’ve proven the concept and we can take it one step further. What should we do? Can we feasibly attach a Wi-Fi module to the Uno? Should we use BluTooth? Should we forget the iPhone and use an RF transmitter instead? Proving the concept is the first hurdle to overcome. The implementation process is another beast. Questions to ask going further would be: Is the plant Wi-Fi signal strong enough for this to work reliably? Is there any interference that would cause a false start?

5 Final Thoughts

The benefits of prototyping, especially with the Arduino as the brains of the operation, are immeasurable. Taking the minimalist approach, outward thinking allows you to solve common problems in unconventional ways and inspires creativity in yourself and among the team you’re working with. This is an important skill that should be exercised at every opportunity. I would encourage everyone to continually look at the machinery and the processes around you and think about ways to either improve or replace them.

There are several prototyping platforms to choose from including Raspberry Pi and Intel microcontrollers. Each comes with different functionality and different benefits, but I chose the Arduino platform in all of my prototypes because for me, Arduinos are very easy to program and very easy to implement into existing machinery. Plus the open source community is a wealth of information and assistance when I’m having trouble figuring something out. The brains behind your prototype are up for your choosing.

One final thought; your prototypes will fail. I promise. Don’t get discouraged; however, it’s all a part of the process. When the prototype fails, all you can do is make the improvement and implement it into Version 2. I had a problem where I continually blew up my Arduino Pro-Mini. I couldn’t figure it out. Each time I made a change to the circuit, the micro controller would burn up when power was applied. I got very discouraged and cringed every time I had to ask my boss for money to buy another board. After about the 5th order, my boss said “Why don’t you go ahead and buy 20 this time. After all, we’re paying for you education as well.” Each time a board was destroyed, I learned a little bit more until eventually the prototype worked flawlessly. We’re now working on a production model.

My best advice is to never give up on a new design, learn from your mistakes, and always follow the path to a solution by taking the least amount of steps.