Cylindrical cam mechanism design with visual basic

: One of the technology products that have taken an important place in our lives from the past to the present is power and motion transfer elements. Power and motion transfer elements are very important for users in terms of facilitating work transfer, easing the workload based on people and ergonomics. One of the basic building blocks of these transmission systems is cam mechanisms. Cam mechanisms consisting mainly of followers and cams; It performs a complementary task by transmitting the follower’s movement to the cam assembly by direct contact. While cam mechanisms lighten the work load, it is a frequently preferred system because it takes up little space and contains few parts and allows for a wide range of movements. However, sensitivity to vibration and sudden shock effects and cost problems have led to the development of manufacturing methods of cam mechanisms. In this master’s thesis, design and mathematical information about cam mechanisms and cylindrical cam mechanisms are given, and the design of a cylindrical cam mechanism with a vertical multiple output limb was carried out using computer-aided drawing programs Solidworks and Autocad. The use of multiple output limb cam mechanisms is increasing day by day in terms of the width of the work area and the possibility to work with other machines. For this reason, this work is intended to be a guide resource for the reader in industry and science for both cam mechanisms and cylindrical cam mechanisms. Microsoft Excel and Visual Basic programs were used in the calculations and designs, and the design details of the mechanism were revealed with the data and formulas entered into the program.


INTRODUCTION
Cam mechanisms are composed of a follower and a cam.The mechanism transfers the movement of the running unit to the cam system by direct contact.This type of systems have less parts and so occupies less space than the other mechanisms.Considering the simplicity of the system and the significant advantages it provides; cam mechanisms are quite important.One of the most important features of these mechanisms, which facilitate the workload ergonomically and so provides work transfer, is their enabling various types of movements [1][2][3].Many movements which are hard to make with other machines and mechanisms become possible with the cam mechanisms flexible way of operation.In the design phase, these circumstances should be taken into consideration and the designs should avoid the problems caused by the dynamic forces and also the sudden shock forces.It is crucial to make the design precisely with minimum error.It should be kept in mind that a possible error in the design will negatively affect the operation of the whole mechanism.The design of the mechanism, the force analysis and the operation of the systems are based on the cam and formed according to the shape of the cam [4][5][6].Cam mechanism can be classified based on the positive drive status applied to the follower or on the applied spring load [7][8][9].
Today, cam mechanisms are used in automotive sector (valve mechanisms), printing presses (punching and taking the papers in), sewing machines (zig zag stitch), toys manufacturing, food production (filling and packing, poultry internal emptying), looms (making patterns) and many other fields where power and motion transfer is required [10][11][12].

USING EXCEL AND AUTOCAD AS AN ALTERNATIVE DESIGN METHOD
Today in engineering, besides the computer-aided design software Solidwords, various other computer design programs like Autocad and Catia are also used.In this chapter, in order to lead/guide the designers who wish to use different methods, the design types which can be made by using Microsoft Excel and Autocad together will be discussed.In these Excel-Autocad works, the sample designs for both 200 mm and 300 mm radiused systems have been made.A 2-D design was made by co-using Excel-Visual Basic-Autocad for a mechanism with a cylindirical cam with 300 mm radius.For the system with 200 mm radius, Excel free data values were integrated in tables and transferred directly into the Autocad's command line, and the design was made through the points.

Using Visual Basic for Cylindirical Cam Design
In recent years, computer programming languages have been being frequently used in designing 2-D and 3-D models.With their suitability of using computer aided drawing and spreadsheet softwares simultaneously, programming languages provides the users with advantages.These programming languages give the designer the chance to draw the designed form automatically on drawing softwares with the help of the codes written in the system modules.At this point, it is ultimately important the codes to be written and be processed correctly.Because, any minor mistakes may cause the system to malfunction and hence will yield no result.
Among the programming languases, Visual Basic is one of the most frequently used along with drawing softwares.Visual Basic for Applications (VBA) give the users the opportunity to work with numerous interfaces like Excel, Autocad, Solidworks etc. together.By their libraries inserted into the VBA, all operations in the aforementioned interfaces can easily be done on VBA as well.
In this section, the designs of the cylindirical cam mechanism with 200 mm radius, which was discussed in the previous chapters, were made by using VBA, Excel and Autocad.As it can be seen in the designs occured, when the coding is done correctly, the 2-D and 3-D models designs can be made much more easily by use of VBA.VBA interface can be accessed via ''Developer'' tab in Microsoft Excel.In the VBA window opened, the page name on the left is right-clicked and then by clicking ''insert'', VBA's code screen can be reached and new modules can be inserted.
In Aotucad, VBA interface can be accessed via ''Tools'' tab.Under this tab, the user can view the design codes or can directly shift to the VBA module as well.In VBA, system starts with the insertion of the module where the codes to be written in just like Excel.The first difference of using VBA with Autocad than using with Excel is the library.In using VBA on Excel, for the drawings to be transferred into Autocad, the users need to activate the Autocad library by clicking ''Refarences'' button under the ''Tools'' tab in the VBA screen.Otherwise, the system coded in Excel-VBA can not be transferred into Autocad.Another point to be considered while using Autocad and VBA is that although VBA was already installed in Autocad in the past, today this feature is not active/valid anymore.Therefore, VBA is readily installed in the old versions of Autocad.On the other hand, in the new versions, the Autodesk company provides free access to the VBA modules on their web site.The users can download the VBA modules they require from the official web site.Although the Autodesk company tries to eliminate the problem this way, there can be differences between the codes in the integrated and non-integrated VBA modules.The users should take this special situation into consideration.
In this section, in order to demonstrate how the designs are made by VBA-Excel and VBA-Autocad, VBA-based designs were studied both on Excel and on Autocad.To form the groove profile of the cylindirical cam mechanism in the system, the design was made on Autocad 2018 computer-aided drawing software using the codes written on VBA with the X,Y,Z coordinates and radius values which were transferred into Excel.Furthermore, in order to show the operations made on the VBA module through Autocad, Autocad 2006 version, in which the VBA module is integrated in the system, was used.In this design, the form, shown in Fig. 1 was resulted by transfering the Rx, Ry and Rz point values (calculated under the previous sections), which were given in Table 1 for the cylinder profile and in Table 2 for the groove profile of the 200 mm cylindirical cam that is moving with 1.047 rad/s.The profile of the follower's route of the 200 mm radiused cylindirical cam mechanism, which ascends for 1 second and descends for 1 seconds during it's 6 seconds motion, is as shown Figure 1.The coordinate values in the system were transferred into an Excel table in round figures.To facilitate the user's work, in the table in Figure 2., ''Create Drawing'' and ''Clean Table'' buttons were inserted in the code in the VBA module.
With the VBA macro defined for ''Create Drawing'' button, the drawing shown above was automatically created in Autocad when the button is pressed.In order the new coordinate values to be inserted in the table, ''Clean Table'' button was added.Lastly, when the drawing is succesfully generated with this system, the completion of drawing is reported, with the created codes, as shown in the Figure 2 .The codes written in the VBA module are given in Table 3 and Table 4.In the second stage of the design, the 200 mm radiu- sed cylinder block was generated.The 3-D view of the designed cylinder is shown in Figure 3.In the design created in the VBA module within Autocad, ''AddCylinder'' command was used.Firstly, the initial point of the coded design is chosen on Autocad and then cylinder form is generated according to the radius value entered.The designs of many other forms in the Autocad library like cube, elliptical cylinder, sphere etc. can be generated with VBA-based studies.The codes of the system made for designing the camshaft and the cylinder in the VBA module are shown in Table 3 and Table 4.
Today, Visual Basic operations made through Microsoft Excel can be used not only in engineering, but also in many other fields like banking, companies carrying out statistical calculations, mathematics etc. From the engineering point of view, the most advantageous feature of this system is the ability of creating the drawing automatically in Autocad, where the calculations and coordinates of the system are generated by using a spreadsheet and a drawing software.Nowadays, in many engineering applications of 2-D and 3-D systems, Excel and design programs integrated with Visual Basic language are preferred [13].

Designing by Transferring the Excel Data to Autocad Command Line
Another way of generating drawings in Autocad by trans-ferring the free data values from Excel is transferring the displacement coordinates of the follower onto Autocad.The X-Y-Z coordinate values given in Table 1 can be gathered in a single column with ="PO "&X1&","&Y1&","&Z1 command in a different column in Excel.The coordinate values there are copied and pasted to the command line in Autocad.''PO" is chosen on account of Autocad's 'point' command.The same method can be used with other computer-aidedd drawing programs and for different mechanisms.For a correct design, knowing the positions in x-y-z coordinate system will be enough.The computer-aided drawing software Autocad enables this type of 3-D drawings with Excel.
The X-Y-Z coordinate values of the system with 200 mm radiused cylindirical cam mechanism, given in Table 1, which represent the movement plane of the follower in the groove, were transferred into Autocad by the method explained above and the form in Figure 4 was obtained.
After transferring to Autocad, as the points are very small, they might be difficult to observe.with ''Zoom'' and ''Extents'' commands to be written in the command line, a closer inspection of the points will be possible.Besides, by writing ''DDPTYPE'' into command line, the format of the points can be changed.Finally, connecting all points will yield the 3-D design as shown in the figure below.

FINDINGS
In the design works by using Excel, Autocad, Solidworks and VBA programs [6], the cylindirical cam mechanisms used in poultry processing units were taken to be the model as the cylindirical cam mechanisms are frequently utilized in these machines which are used for poultry sla-ughtering, defeathering and eviscerating processes.On these process lines, the work stations are connected with conveyor systems and with the help of cylindirical cams, the flow direction of the stations can be altered when required.Furthermore, thanks to the suitable structure of the cylindirical cam mechanism for working together with other mechanisms, the aforementioned operations can easily be carried out with additional apparatus attached on the mechanism.The radiuses of the cylindirical cams used in these machines, the production capacities of which varies from 2000 pcs/hour to 13500 pcs/hour, changes between 90 cm and 600 cm.Depending on the operation conditions, number of followers on the mechanism can vary between 8 and 28 pcs.The followers in the system are enabled to be supported with hydraulic apparatus and they should be placed with 15-25 cm intervals being in conformity with the synchronous operation of the followers.In poultry processing machines, the followers operate with a speed between 2 rpm and 10 rpm depending on it's function.
As an example for designers and users, in order the data to be analyzed and to be compared correctly, analytical calculations were made for two different cylindirical cam mechanisms with 200 mm and 300 mm radiuses, in accordance with the given intervals, and the scaled designs were generated for these two radius values by using computer-aided programs.After the analytical calculations have been completed, the 3-D design of the cylindirical cam with 200 mm radius was made by co-using Excel-Autocad and Visual Basic language together; while 3-D design on Solidworks computer-aided program was utilized for the system with 300 mm radiused cylindirical cam.
During the design and calculations, the contact of the cam and the follower should be permanent for a proper motion.This continuous contact is analyzed through the pressure angle.In order the cam mechanisms to operate properly and safely, the pressure angle is chosen to be 30 degrees or less.Cam's radius, the speeds of the cam and the follower, and cam angle are the most important factors afeecting the pressure angle.The effect of these variables on the pressure angle is analyzed in detail in Table 2.
From the two systems with two different radiuses, of which the analytical calculations have been completed and the working parameters were analyzed, 7.93 degree for 200 mm radius and 11.8 degree for 300 mm radius were obtained to be the presure angle values.As these figures are below 30 degrees the angle value for steady operation of the cam mechanism, they are sutiable for steady running of the system.Besides, these results also prove that the pressure angles of the cylindirical cam mechanisms are quite less than 30 degrees.
Within this study, after scrutinizing the design details of the cam mechanisms, the advantages and superiorities of the cam mechanisms are also discussed.On the contrary of many other cam mechanisms, different analytical and graphical designs, derived from the classical motion diagrams by David Myszka, have been used for cylindical cam mechanisms, which moves in three dimensions.
In recent years, technological developments impacted also in the design and production of the cam mechanisms.Today, computer-aided drawing softwares like Autocad, Catia, Solidworks are used efficiently in designing cam mechanisms.Transferring the free data onto Excel tables and using the programming languages like VBA ease designing for users.In the analytical design step, the users can also use ''BorlandDelphi7'' (as in the post-graduate thesis ''Computer Aided Cam Design and Produtciton of a Sample Cam Mechanism'' of Murat Koyunbakan) or ''Fortran IV'' (as in the post-graduate thesis ''Cam Mechanisms and Designing Them by Computer'' of Günay Emirdağ) programming languages.These computer-aided designs provide the users with more reliable, safer and more accurate results by an easier method.

RESULT
The objective of this study is to provide an informative manual for the researchers about cam mechanisms and cylindirical cam mechanisms; and to present the superiorities of the cylindirical cam mechanisms over other cam mechanisms.The previous studies in the literature have been surveyed, and further on, computer-aided programs, which yield more detailed, more reliable and more accurate results, were preferred.With two design demonstrations generated by using them, it was shown that the designs made with Excel, Autocad, Solidworks and VBA programs have advantages with better possibilities.mechanisms, the vibrations and shocks in the system are in minimum.Hence, the pressure angle value of cylindirical cam mechanisms are quite below 30 degrees when compared with other cam mechanisms.The obtained values also verify this fact.
In cylindirical cam mechanisms, under the same operation speed, the pressure angle value changes in parallel to the radius of the cam.The respective figures of 7.93 and 11.8 degrees for the systems with 200 mm and 300 mm radiused cylindirical cams attest this conclusion.In the cam mechanisms of poultry processing units, cam radius standards of which varies from 90 cm to 600 cm, as the radius increases, the negative effects of the cam angle on the pressure angle is observed more apparently.For the radiuses above the standard values or for the high cam angle values of the 600 mm radiused systems, the pressure angle goes beyond the safe values.
Some of the numerical values, obtained from the turning of the cylindirical cam, designed with computer-aided programs, one degree at a time, are given in Table 1 and Table 2. Poultry processing lines were taken as model for the two cylindirical cam mechanisms, design details of which are given.In the systems analyzed within the frame of these data, it was observed that the pressure angle is mostly affected by the cam's angular velocity and the cam angle.Among the systems studied, the ones with radiuses above the standard and with too high cam's angular velocities were found to have the maximum pressure angle values.
All numerical results, which are nor seen in Table1 and Table2, provide us with a foresight for the steady operation intervals for cylindirical cam mechanisms.In the light of these tables, the most important variables affecting the operation of cam mechanisms are cam radius, cam angle, and the speeds of the follower and the cam.The effects of these variables to the operation of the mechanism are analyzed in Table1 and Table2 with different values.As seen in the tables, in order to avoid the increase in the pressure angle which is caused by the increase in the cam radius, the linear speed of the follower can be increased or the cam angle can be reduced.The pressure angles of the systems, where the radius is chosen as small as possible and the choice of speeds are made properly, considering the synchronous motion of the follower and the cam mechanism, give the user an advantage by means of safe operation of the cylindirical cams.
The most important problem encountered in the cylindirical cam mechanisms is the slips which occur during ascending and descending of the follower in the groove.To avoid this complications, the cams with conical cylinders can be used or the groove profile can be reduced.These topics are recommended for the further studies on cam mechanisms and cylindirical cam mechanisms.
It is important to choose the pressure angle value to be 30 degrees or less for the stability and safety of the system.Harold Rothbard mentioned in his ''Cam Design Handbook'' that under light loads and in the working environment with low friction, this safe operation pressure angle value may go up to 47.5 degrees.For the future experimental studies on cam mechanisms, verification of these figures is recommended.
In our country, the production of both cylindirical cam mechanisms and cam mechanisms is not sufficiently developed.High setup costs of CNC and special cam machines, used in the production of cam mechanisms, can be mentioned as the main cause of this situation.Considering the production accuracy and convenience of these machines, this high cost load on the manufacturers might be reduced by governmental incentives in the future.As mentioned also in this study, when compared with many other mechanisms; with their easy designing, simple functioning and wide field of usage, the financial support for the cylindirical cam mechanisms can be foreseen to be considerably feasible.

Figure 2 .Figure 3 .
Figure 2. Excel table reflection of the 3-D groove profile

Figure 4 .
Figure 4.The cylindirical cam design generated by Excel and Autocad.

Table 1 .
Values obtained upon variables of cylindirical cam mechanisms

Table 2 .
Variable values obtained for 200 mm radiused cylindirical cam Figure 1.The groove profile generated on Autocad with Excel-VBA interaction