Glue machine
I am having trouble writing the program for a machine I designed that applies glue on a wood veneer so that the amount of glue used will be consistent. It will essentially, through the use of compressed air and two moving axises, squeeze wood glue through a perforated PVC pipe onto a veneer leaving behind lines of glue that can be easily spread with paint rollers.
the machine consists of a table approximately 9 feet long(x-axis) by 4 feet wide(y-axis). There is an armature that spans across the y-axis and rolls forward and backward over the length of the table (x-axis). Mounted on the armature is a 12 inch PVC pipe with a single row of 12 equally spaced nozzles screwed into it that moves positively and negatively along the y-axis. Motion is made by two 12vdc motors. The x-axis motor makes the entire armature move along the x-axis and the y-axis motor makes the pvc pipe with the nozzles move along the y-axis.
To determine the position of the armature there are two instant on/off switches. One is permanently located at “zero” or “home” on the x-axis and the other can be moved to the appropriate distance depending on the length of the veneer being glued. On the y-axis there are 4 permanently mounted instant switches. These switches will be used in sequence depending on the width of the veneer being glued. The first switch is located at “zero” or “home”, the second is on the 12 inch mark along the y-axis, the third at the 24 inch mark and the fourth is at the 36 inch mark.
There are four possible programs for the glue operations. The operations are determined by the width of the piece of veneer being glued because each time the armature makes a pass along the x- axis it will leave behind a glued area 12 inches wide. If the piece of veneer is 48 inches wide the armature will have to make four passes. The length of the veneer doesn't really matter because the second stop switch on the x axis is movable and will be set to the needed distance depending on the veneer's length.
What I want to do in the case of a veneer 24 inches wide and 48 inches long is set the x-axis stop switch at 48 inches and press a button for “2 passes”. The machine will then turn on the air pressure to the PVC pipe containing the glue and turn on the x_axis motor in the positive direction until the x-axis switch is reached. At that time the air pressure would be turned off and the y-axis motor would be turned on in the positive direction until the the second y-axis position switch is reached. When that happens I want the air pressure to turn on and the x-axis motor to turn on in the negative direction until the x-axis home switch is reached. At that point the air pressure is turned off and the program is finished.
I guess a finite state machine would be the best way to go here but I am really unsure how to make that work because I have done a lot of coding with a test setup and haven't been able to make all the things I said work properly. Basically only one of the two motors will be on at any one time so at the time of that motion the machine is only looking for the input of a single switch. I can't seem to get the program to forget about the state of the other switches.
I'm sorry if this is a super long post, I tend to ramble on but I want to be as specific as possible so everyone can understand what I mean. Its really a pretty simple machine and any help you guys and gals could give would be very much appreciated.