Using an Arduino in a Production environmentFollow article
The requirement was to add a digital readout to an otherwise manually bend roller machine so that we could accurately monitor the amount of material fed into the machine. The readout should be simple to use , require no setup other than initial calibration and above all be reliable.
First a little background on me, I'm a Mechanical design engineer by training but I've always had a 'thing' for software and electronics. I've dabbled in electronics at a hobby level for a number of years so as you can see I am by no means an electronics or software expert.
I thought I would document my use of an Arduino (see here for the Arduino software and hardware http://arduino.cc/ ) in an industrial production environment as I felt it demonstrated what it is possible to achieve with limited experience. Traditionally this sort of project would have been prohibitively expensive and would require both electronics hardware and software experience but by using an Arduino Mega and some off the shelf components it is possible to produce a usable solution to the problem without excessive cost.
The main unit is mains powered via a Traco TXL SMPSU this feeds a 12V DC to a small matrix board containing a 5V regulator circuit to power the Arduino and LCD. The encoder was powered from the 12V DC.
The encoder is a Hewlett Packard panel mount optical encoder with 360ppr (pulse per rev) and is available from RS Components. The documentation is the usual concise HP offering and gives all the relevant details of the device.
The display I selected was a 20 x 4 Black/Green LCD with a selectable Serial / I2C interface. This was chosen to simplify the interfacing with the Arduino (only 4 wires required)
12V IN Generic female header - 2 pins
5V IN Generic female header - 2 pins
5V Reg Voltage Regulator - 5V
C1 Electrolytic Capacitor
C2 Electrolytic Capacitor
I2CLCD Generic female header - 4 pins
J1 - ENCODER Generic female header - 4 pins
Power LED Red LED - 5mm
R1 220Ω Resistor
U1 Arduino Mega
(Schematic produced using Fritzing :- http://fritzing.org/ )
How it works
The workpiece is setup in the rollers and the display is zeroed using the Reset button, the workpiece is fed through the bend rollers until the required distance has been travelled.
The Arduino counts the pulses coming from the encoder and increments or decrements a counter , the Arduino converts the counter value to a linear measurement and displays it on the screen. The conversion factor needed a little tweaking in the final unit but this was covered by the simple one off calibration process during commissioning.
To zero the display I originally intended to have the reset button connected to one of the digital input pins and then reset the pulse counter to zero, however as I was writing the code I noticed that the start-up time of the Arduino was so fast that I might as well just use the on-board reset function and reset the entire Arduino. So I connected my external switch across the on-board reset button, a little crude perhaps but it works.
Problems were surprisingly few , once I had the encoder connected and working the pulse counting routine worked first time, albeit backwards !!
The only real problem was with an offending piece of code which gradually caused a heap overflow forcing the Arduino to reset itself, certainly not a desirable situation.
I managed to find some very useful code which streamed memory stats to the serial port where I could display the results on my PC. With this I could debug the code until I found the offending section (part of the i2c display code I had imported) and replace it.
The code is a little crude but the whole idea was to produce a functioning display for a piece of equipment not a perfectly written piece of code !
I have left the memory streaming code in the final version (commented out) as you never know when you might need it !
On the whole the project went well , it allowed me to fulfil a production requirement without tying up valuable electronics design engineers on a non revenue earning internal project.
If you'd like a copy of the code please drop me an email and I'll send it to you .... the code is supplied as is, with no warranty or guarantees as to its suitability or stability.