0
\$\begingroup\$

I've been given a project that sort of bridges the electrical/PLC and PC/software world.

I have to take a 24VDC photoeye and 24VDC encoder (1/4" to 1/2" pulse @ 540FPM ~ 1 pulse every 2.3ms-4.6ms) input and store their derived measurements in a database.

Essentially I am measuring how many pulses the photoeye is blocked to get box length, and how long it is unblocked to get gaps between. Storing both the gap in front, the length of the box and the current time in a table/database and repeating.

Program wise I know a PLC is the best solution, but storage wise, I need this to be stored preferably in a database (CSV, MySQL) so that it can easily be exported to excel and analyzed for throughput and the like.

Thus I was looking at using a compact X86 based PC communicating with some type of 24VDC IO Arduino microprocessor to receive and process the IO, and then send to the PC and the PC will take care of storing the data, calculating gaps and length and handling HMI. The Arduino would likely also take input from the PC to control outputs.

Is this the best solution? Are there lower cost PLC's that can do this type of data storage while keeping the data easy to extract? Will an Arduino be capable of accurately picking up 2-4ms signals?

Thanks for the help guys!

\$\endgroup\$

2 Answers 2

1
\$\begingroup\$

For an industrial application I would steer away from the Arduino or any hobby board solution. It won't be industrially hardened, you'll have to sort out 24V to 5V interfaces, power supplies, mounting, etc., and worst of all, you'll be the only one able to maintain it.

Standard industrial approach would be:

  • Use a small brick PLC with Ethernet comms capability.
  • Have the program measure the box length and save the value to a memory location. At the same time increment a counter in another location to indicate that a reading has been taken.
  • Use an OPC (Open Platform Communications) server to connect from your computer to the PLC. You configure the OPC device connection and "tags" (memory locations) that you wish to monitor and the OPC makes the tag data available to your operating system for reading by OPC clients.
  • Add an OPC data logger with a connection to an SQL database and you can begin logging. Trigger the logging the length "on change" of the counter.

enter image description here

Figure 1. Source: Inductive Automation.

OPC servers are similar to printer drivers in that they make the hardware available to all applications on the host computer.

Most of the major manufacturers including Siemens, Allen-Bradley, Mitsubishi, Automation Direct, etc., make low cost brick PLCs often with built-in LCDs and cursor, Enter and ESC keys.

There are many OPC vendors. The OPC servers may be available from the PLC manufacturer or third-party vendors. Have a look at Inductive Automation's Ignition SCADA package. It has extremely powerful OPC server, data historian, unlimited Java based clients, unlimited tags, browser based admin, and an excellent comprehensive series of short instructional videos at Inductive University. There is a "light" version of their product which may suit you. You can download full or light version for trial with two-hour runtime.

For the database you can use MySQL or MS SQL Express both of which are free.

Think about where this development is likely to lead in the coming years and pick a scaleable solution.

\$\endgroup\$
3
  • \$\begingroup\$ I am aware of OPC but with this being such a simple device (we call it the magic box) that won't be used other than for testing, I am not sure the cost of OPC can outweigh its reliability. I can likely do all of this for less than $1000 with Arduino, vs a PLC alone that will likely cost > $1000, an OPC license and so on. On the note of industrial quality, and getting the voltage from 5VDC to 24VDC and back, I found this: rugged-circuits.com/24v-industrial/24v-industrial-shield It's a 24VDC IO shield, and they also sell a hardened Arduino board that looks worth a shot. \$\endgroup\$ Commented Jul 14, 2017 at 12:21
  • \$\begingroup\$ Update: We are now using the 24V Arduinos all over, they are proving to be extremely reliable and capable. Combined with Monodevelop on single board PC's they can complete a whole slew of complex tasks. \$\endgroup\$ Commented Feb 6, 2018 at 16:12
  • \$\begingroup\$ Good man! Thanks for the update and glad it worked out. \$\endgroup\$
    – Transistor
    Commented Feb 6, 2018 at 17:58
0
\$\begingroup\$

As I was reading your problem statement, the solution that formed in my head was exactly what you outlined. I should note that I am probably biased, because I do not have PLC expertise. This is a pretty straightforward Arduino/serial problem. The Arduino can certainly handle that short of a pulse - they run at 16+ MHz and have digital IO operations in the range of 10,000-100,000/second in my experience. You could write a simple Python (or many alternatives) script to watch the USB port for the Arduino and then update a database (PostgreSQL, mySQL, etc) with the results that it gets. Note: you would want to do the simple computations on the Arduino, because the limit on the serial connection is going to be the bottleneck for communication (i.e., you don't want to mirror the digital signal straight through the Arduino - you want to count the pulses then send the result).

\$\endgroup\$
6
  • \$\begingroup\$ Good to know, my biggest concern was whether or not I would miss pulses with this technology. \$\endgroup\$ Commented Jul 14, 2017 at 12:31
  • \$\begingroup\$ 2-4 milli-seconds is quite a long time, in the digital world. Most people seem to be reporting that the Arduino digitalRead operation takes about 3-5 micro-seconds. But as mentioned in another answer, this Arduino option is not going to be industrially hardened and it's not a permanent solution, but you're going to be able to get it up and running in an afternoon. \$\endgroup\$
    – Will
    Commented Jul 14, 2017 at 21:12
  • \$\begingroup\$ Yep, understood. I found Ruggeduino which has a 24V shield and industrially hardened version of standard Arduino. As this solution is just a test box and not a customer bound product, the goal isn't 10yr industrial environment operation. Rather just a few hours here and there to gather data during testing. \$\endgroup\$ Commented Jul 18, 2017 at 13:47
  • \$\begingroup\$ Another option, particularly considering your database requirements, is to use a controller that can interface the database directly, given a network connection. A Raspberry Pi can both read digital inputs and interface with a database and write the data it gathers (a simple Python script could handle this). I'm really not sure about the digital read capabilities of the Pi in terms of speed, but it would be an all-in-one solution. \$\endgroup\$
    – Will
    Commented Jul 18, 2017 at 18:51
  • \$\begingroup\$ Just an update. Only a few hours of setup and a little google and I am not reading 24V IO, and communicating between Unity and Arduino. Everything is looking good. Am going to finish my scripts to measure boxes and finish up UI. Thanks for the confirmation and help brother! \$\endgroup\$ Commented Jul 20, 2017 at 19:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.