Considering Arduino for showcasing an industrial-automation platform

Hello, everybody,

This will be my introductory posting (I did not see a subforum specifically for that purpose) and at the same time I'll ask my first questions in it. In case this is misdirected, I'd appreciate some guidance.

I am a professional engineer currently looking to hit a few targets at once. A little background: I started programming in the 1980's on whatever platform I could get my hands on. I first did professional work on microcontrollers a decade ago (PIC) but have mostly stuck with microcomputer programming (Windows). I am currently developing an industrial-automation platform featuring high-performance distributed processing with data acquisition, signal processing, user-defined test execution and systems control. It is almost ready and I'm entering the testing stages. We use expensive input/output devices and high-end sensors and effectors (like megawatt regenerative AC motor vector drives) but I've had some unorthodox ideas that lead me here.

It is a little inconvenient to do software verification and validation on such systems. It is also impossible to take such system to a trade show where the new software would be showcased. But the geek in me would very much like a small, versatile system with similar functionality. Having been to many trade shows, it appears that most professionals are like me - judging from how the booths with the outrageous gadgets attract the most visitors.

The ubiquity of the Arduino platform, along with its development tools and extensive libraries, and now, the addition of countless reasonably-priced accessories - sensors, controls, inputs/outputs, etc., has made many professionals take notice and I certainly am no exception. My hesitation so far is only centered on the individual time investment that would be required to deal with this new platform. I have no doubt that I have all the necessary abilities to develop an Arduino-based setup; the only issue is how much of my already-crowded brain I would need to occupy with this. You see, when I need to specify new hardware for some new physical setup, I simply call our faithful industrial-controls representative and they bring a good selection of options, with all relevant information and support resources. If I run into any challenges (and, believe me, I have caused a lot of trouble with underperforming devices), I can usually communicate with development engineers that would as much as make design changes to their products; especially when software drivers and libraries are concerned.

Then it dawned on me that I could tap on the collective wisdom and expertise of the Internet community. I wouldn't be surprised if it turned out to be even more effective than the industrial suppliers. Let's see if we can make this work.

First, let me explain what I'll need. It doesn't have to all happen at once; it could very well be an incremental project. The software platform is very complex and in order to showcase its abilities it would require little intelligence at the device-end; in other words, I do not want to put too much intelligence on the Arduino end or my software would be little more than a glorified remote controller. Let me come up with an example. As attractive a robot platform would be (I was involved with an autonomous robot project in grad school), I'll pick something similar. Maybe a two-wheeled self-balancing platform. The approach here would be to isolate communication channels between the hardware setup and the PC software for the individual inputs and outputs associated with the motion controls: quadrature-encoder inputs from each motor, accelerometer inputs for three axes (possibly already converted to the Euler angles), as well as PWM outputs to the individual motor drives.

And here's the kind of questions I need to ask from the very beginning. Whether the Arduino would connect to the PC using USB or Bluetooth, it seems it will use COM ports to do all communications. If a single COM port for all input and output is defined and the maximum speed is 115000 kilobaud, would that be enough for all those channels to achieve a smooth and reliable motion control? If feasibility is established, then the questions would be: which Arduino is best for the core? What shields would best serve as sensors, drive controls? What firmware libraries to implement those? Even some suggestions on what micro-motors to get.

Does this sound like something that makes sense? Would such project garner sufficient interest to get the support necessary so I can turn this into reality? I'd appreciate your feedback on this.

Kamen

Some of the Arduino platforms support multiple serial hardware interfaces (the Atmega328 only has one). At 115200 baud you already are sending/receiving a byte every 86.8 µS (where the clock ticks at 62.5 nS) so there is some stuff you can do between bytes but not thousands of things. That's a limitation of the baud rate/clock speed, not the processor.

If you are talking about "talking to peripherals" then you can use SPI which is very fast, or I2C which is slower but lets you have more peripherals on the same "bus".

http://www.gammon.com.au/i2c http://www.gammon.com.au/spi

Personally I find the Arduino easy to develop for, for one thing it uses C++ with an established compiler (the Gnu g++ one). The fairly extensive set of available libraries saves re-inventing the wheel, and if you do need extra functionality you can roll your own library easily enough, as I have done numerous times.

I would have thought that for something like a self-balancing robot the amount of data you need to send to it would be fairly small (ie. "do your stuff"). Thus the baud rate would not really be that limiting. After all, on the Atmega328 you have 32 Kb of program memory to write your code, you can do a decent amount of stuff in that.

just triggering on the title, have you seen the industruino? - http://forum.arduino.cc/index.php?topic=146866.0 -

I'm not clear from your OP whether you want the Arduino to help to demonstrate some PC control software such that the fact that an Arduino is doing the stuff is irrelevant;

or

whether you want to demonstrate the ability to do real work with an Arduino and the PC software is incidental?

...R

Thank you for your response, Nick. I'll need to clarify my intentions a bit. The reason I brought up the serial link's limitations is because I had communication between the Arduino and the host computer in mind. The appeal of the Arduino platform is the availability of cheap peripherals with available libraries that could make it a sort of an intelligent interface between the accessory and the host computer. For example, if I wanted to interface an accelerometer to my system in a production environment, I'd have a sensor with some industrial output (e.g., 4-20mA) and an input channel on a bank of industrial I/O for a total of hundreds of dollars (and that's just the used portion of the I/O, otherwise it's in the thousands). It's even worse if I wanted to drive a motor, even a simple brushed DC (a dyno-grade motor drive is in the thousands). But I could get an accelerometer shield for $20 and an Uno for another $30 or so, identify a decent software library to interface the sensor and even pre-process the raw data, and feed it to the PC as three channels of orientation of a rigid body in 3D space. Similarly, I could get a milliwatt motor, add a motor drive shield and with the appropriate libraries I could have the Arduino accept, say, a PWM channel for speed and a Boolean channel for direction, and drive that motor in a simple way. As long as it is fast enough so that the PID loops in my software can operate it well enough to achieve some respectable real-world results. Which leads me to my next point.

The reason I don't want any intelligence on the Arduino is because otherwise it would not leave anything to do to my software and the whole purpose of this exercise is to help debug, on one hand, and to showcase its abilities (and not the abilities of the Arduino platform), on the other. The role of the Arduino, with its peripherals, is to simulate our industrial controls in a cheap manner. Remember, it is not as much that I can't have the main office ship me a full setup for testing (I don't want to get into details, but I'm working in a home office, away from the headquarters), but it is also about marketing - a demonstration that involves cheap hardware is the best way to attract customers: everybody loves cheap and they extrapolate ("imagine what it could do with some proper hardware!")

Rob, I appreciate your suggestion, too, but, as I hope it has become apparent with my explanations above, I am not looking to use the Arduino platform for production; and ceratinly not looking for the Arduino to "steal the show". I'd like someting raw, yet established, tested and debugged, so that I can minimize my efforts, but it will be for internal testing and for "geek effect" at trade shows.

I think I will have some specific questions here as the thoughts are settling down in my head. I do appreciaet your feedback.

Kamen

P.S. Robin, I saw your post after I just made mine. I hope it makes it clear and answers your question (it is the former). K.

Then am I right in thinking that the quantity and format of the input/output is determined by the "real world" need for the PC software to control "stuff" and the Arduino will have to pretend that it is the "stuff".

If there is a lot of I/O data maybe it could be processed by one Arduino which distributes bits to others to do the "work"?

On the other hand minimizing the data flow to suit the Arduino might also be useful for the real project :)

...R

Well, Robin, I'm not 100% positive I understand your question but I think your assumption is correct. But maybe I'll try and clarify with a more specific example.

Let's say I want to build the simplest device that would make sense - it would help me with some debugging and will give me some performance metrics, but it won't do much for trade show demos: a velocity-controlled servomotor. Again - not because I need an actual servomotor for some general purpose (I could buy an intelligent servomotor and be done with it), but because the controls involved are very indicative of all sorts of real-world feedback-loop scenarios, ones for which there is no solution (e.g., the device under test being the one) and/or the problem is being defined dynamically and has to be resolved in the software.

First, let's start by assuming I have some I/O in the computer (which I have) that has a number of voltage inputs and outputs, as well as some digital I/O (non-waveform). So, I'd start with a simple DC brushed motor with a basic drive (a current amplifier and an H-bridge for directionality) that takes a PWM signal for speed and a bit-flag for direction. Let' say that I want to control this in my software with a simple voltage signal, say, 0V is 0% duty cycle and 5V is 100%. In this case I would want the Arduino to take the voltage signal (I believe it can be a direct analog input) and convert it to the required PWM signal (switching frequency, voltage, minimum current and all). The direction flag can be taken from a digital output on the DAQ board in the PC, unless it needs to be amplified. Then, the software can send 2.5V and expect the motor to be driven at up to half its rated load. This for the control side.

On the feedback side (the process variable), I would have an incremental quadrature encoder (to keep things simple - we're only doing velocity control, we're not concerned with positioning). I would like to receive the feedback in the form of an analog signal, say, 0V for no motion, -10V for CCW rotation at maximum speed (let's say, 15% over rated, for some reserve), and +10V for max CW. Normally I would never want to do that - why would I give up a nice, noise-free digital signal, with absolute mapping to speed, in favor of an inaccurate, noisy signal that will require calibration to obtain an absolute speed value? But this would require quadrature signal inputs, which I don't have on my current board, but most importantly, it would be less relevant for what I'm trying to test, which would be the performance of the control software. Like I said, I could just get an actual servomotor and send it digital commands for velocity and be done with it. Or have the Arduino take care of it, but thats not what I'm after.

So, the question here would be: what would it take to build something like that: specific edition of Arduino, shields, code libraries to support those transforms, and the biggest one - how fast would it run? That is, how frequently would it update its analog output in response to the change in rotation of the encoder? And how fast could it react to commanded changes in the voltage outputs sent by the PC? Just to get you in the ballpark, our old software could run PID loops at up to 200 Hz and that worked for most systems. I'd want to test my new software at much higher rates - at least 1 kHz, hopefully 10kHz. How much of that kind of work could the Arduino realistically do in those 100µs?

I hope this gets you in the right direction. I can be even more specific, and plan to be if this appears feasible.

Kamen

I think you are saying that you want the Arduino to figure out the voltage on a line from the PC (0-5v) and run a motor at a speed proportional to the voltage. That is pretty basic Arduino stuff - it's very similar to controlling the speed of a motor with a potentiometer.

And I think you are saying that you want the Arduino to detect the speed of the motor and generate a voltage proportional to that speed on a line that can be monitored by the PC. Again that should be straightforward, especially if a smoothed PWM signal is suitable for the voltage. The only "snag" is that the Arduino can only generate voltages between 0 and 5v so if you need to transform that to -10v to +10v you will need some external circuitry.

However the processes I have described don't use the Serial port for communication so I'm unclear why you were concerned about baudrates in an earlier post.

I come back to the piece that is not clear to me - is there a pre-existing PC program that can't be changed with which the Arduino must comply or are you free to amend the PC program to simplify the comms with the Arduino - in which case why bother with voltage signals?

...R

I my example I was presenting an alternative to the original plan, which was (instead of using voltages) to have the digitized values sent over a numeric link (serial appearing to be the only viable option). However, if the data stream would be too much to handle (several input and output channels, at 2 bytes per sample, at a few kHz), then an analog "communications" alternative could be considerd. But then the question becomes, assuming there is enough computing power to satisfy the requirements I laid out earlier, how accurate would this be? And, yes, no need to go +/- 10V, I could use 0-5V, but how accurate would that be? I don't quite need 16-bit resolution but I doubt that 10 bit would be enough. How accurate can the Arduino get in its analog I/O? Reading the Atmega328 datasheet, it appears that its ADC has an accuracy of +/- 2LSB at 10 bits, this would mean a nearly +/- 0.2% error. As far as output, would it be possible to combine two counters and produce a 16-bit PWM? Are there any shields that improve on this accuracy (e.g., take two bytes and send it to a 16-bit ADC and/or DAC)?

As far as the software that will be running this... It is a vastly complex industrial automation control package that interfaces an unlimited kind and number of intelligent and dumb I/O to a computer while allowing users to create comlpex programs, using an easy to understand graphical programming interface. The software, which replaces the one currently in use, is in its advanced testing stages where correctness, performance and other aspects are validated. It is an extremely flexible platform that can interface to any hardware by the use of dedicated device drivers. The goal here is to build a suitable test platform using the Arduino and if something "cool" can be built, then it could also be used at trade shows as a demo. I am trying to see if I could get some help in establishing the feasibility and, if so, identifying the best aprpoach to do that.

Kamen

Thank you to all who contributed. I may still revisit this venue, but for now I decided to stay with industrial-grade I/O - had the office ship me some components, ordered the rest and will put it together next week. This will do for the debugging and performance testing but I still have hopes for a cool Arduino-based demo setup some day. Kamen