Arduino RPM Application for Sieg Lathes and Mills

Discussion in 'Software and Programming' started by Jennifer Edwards, Nov 27, 2018.

Help Support HMEM by donating:

  1. Nov 27, 2018 #1

    Jennifer Edwards

    Jennifer Edwards

    Jennifer Edwards

    Well-Known Member

    Joined:
    Aug 9, 2018
    Messages:
    63
    Likes Received:
    23
    Gender:
    Female
    Occupation:
    Retired E-Commerce Sytems Architect
    Location:
    Bridlington, East Riding of Yorkshire, UK
    I recently purchased from Axminster a Sieg SC2 Lathe, and SX2 Milling Machine. To my dismay there was no way to tell how many RPM's the spindles were turning. When I looked at the price of the add on LCD display, I was shocked to learn that they sell for £150 each!

    Thinking that a simple chip and LCD display in a tacky white plastic box should cost more like £15 I set off on a quest to build my own.

    I began by posting a thread on this forum inquiring about the "pinout" of the RPM port on these machines and was lucky enough to get a response that directed me to "macpod.net" where a guy named Jeffery Nelson had done the grunt work of analyzing the data on the seven pin "RPM" port located on a number of Sieg machines including mine. BTW he sells an Arduino kit to make your own for £50. Alas me being the cheapskate I am decided to go it on my own,

    So I started by hitting up Amazon and purchasing an Arduino R3 clone, an LCD display, a couple of enclousures for them, a few Arduino jumpers, and a seven pin plug to match the port on my machines.

    My next issue was learning how to program in the Arduino language, which was suprisingly easy as I spent the last 20 years of my career working in the "C++" language which is very similar.

    I began by taking a bit of code that Jeffery had written and modified it to write to the I2C type LCD I had chosen, which used two wires for data as compared to the many that the older LCD's use. It was an interesting journey thru the world of port addresses and interrupts. Having that sorted I uploaded the code to my Arduino R3 clone, and to my amazment it looked as though it may work. I had added some debugging display statements in the code that output to the LCD at each step and to my amazment it ran!

    Here is the Pinout from Jeffery's web site:

    sx2_cn2_tachometer_port_pinout.jpg

    This is the "pinout" of the RPM port on the Seig machines. The drawing is as if you were looking into the port. As you can see there are three data lines, pins 1,2, and 3, and two sets of 5V DC power on pins 4 thru 7. Which Arduino pins to jumper from the Seig RPM port to your Arduino board are defined in the documentation included in my code.

    I scoped out the power on pins 4 & 5 and determined it is very clean regulated power at 4.96 Vdc on my lathe and 4.98 Vdc on my mill, perfect to power an arduino board, which solved the issue of needing an external power source to run the board and LCD.

    So I hit up good old Amazon and searched for a GX16 type 7 female plug. To my dismay it was the only part of the project I could not find there. Fortunately good ole E-Bay came thru for me, I was able to purchase two of them for a mere £3.

    While on Amazon I purchased te remainder of the hardware needed for the project including an Arduino UNO R3 clone, Some arduino jumpers, a bit of heat shrink tubing, an LCD display, and enclosures for the board and display. the total investment for everything was just shy of £30. I am sure you can do even better if you shop around.

    This is everything I purchased for the project:

    fullsizeoutput_de2.jpeg

    First I tackled soldering the five Arduino jumpers to the seven pin connector, which turned out to be tedious. I am sure some choice expletives echoed around my shop while using my antique underpowered soldering iron.


    q%INoa+iRCav0QBltnPQnA.jpg

    Before assembling the plug I placed a dab of hot glue in the center of the soldered wires and also placed a strip of electrical tape around the outside to insulate the wires from one another and the metal casing on the plug. I finally used a little heat shrinkable tubing to make it pretty.

    The next step was to assemble the LCD enclosure, which to be honest I do not like as the back is open to the elemens, which in my shop can incluse flying metal chips. it will be replaced when I re-engineer this prototype and build a single enclosure for the whole project.

    VJuXj%ohQBeemEQvy4+EqQ.jpg

    Following this step I placed the R3 clone into its enclosure, attached all the jumpers to the proper pins (which are defined in the code I will place at the end of this post). I put a dab of hot glue on the enclosure where the jumpers were attached just to keep them in place, but still be removable when I disassemble this prototype and build the final enclosure.

    wSvnEypRSRiz7An2+8%dWw.jpg

    I was now ready to test my code for the first time, a scary moment for any progrmmer. for the forst test i chose t use my lathe. I inserted my seven pin plug into the port which is labeled "RPM" and to my amazment the boards LED lit, the display came to life, and displayed my first step message "LCD Found":

    msbYIuhBSy62ahqPEhdaKw.jpg

    Things were looking good. After another second or so the program header message which is displayed when all the pins are defined and the program is ready to begin looping scanning the port was dislayed:

    kH187MoBT56l3bK0nC3NTg.jpg

    I just had to see my name in lights! Now the program entered its looping and began reading the four packet groups theat are sent by the Seig controller board. the first message i saw was the "Stopped" message, which I have since changed to "Spindle Stopped" for clairification:

    View attachment 105574

    I was really getting excited, the program was behaving as it should, but could it actually read the spindle speed when the packets began to fly? I gingerly twisted the speed control knob a little and to my great pleasure recieved the following:

    7B3oCrplRW+AakHVp2pDbw.jpg






    I was in business! the darn thing worked like a charm. Just to be certain I Checked the spindle speed with the strobe application that i mentioned in an earlier post and clocked it at 322 RPM's not too shabby.

    The Sieg controller board transmits the thousands, hundreds and tens column out the RPM port and always leaves the fourth "ones" column at zero. By playing with the strobe I had determined that The controller board rounds the RPMs up the tens column when the ones column speed gets to a six, so from one to 5 rpm you would see a zero displayed, from six to sixteen you would see 10 dispayed and etc... so accuracy of the Sig data is never more than 5 RPM's in error. Way more than accurate enough for the model engineer.

    Here is an image of the final product. I attached the Arduino board on the back side of the lathes motor enclosure (visible on back left) and the LCD on top where I can easily see it. Notice the port on the Arduino enclosure is facing upwards, so I can easily attach my printer cable to it when and if I apply updates to the program.

    %5SRgRNLTteGtIbGxLGEBg.jpg

    Conclusion:

    This is one way you can beat the high price of the ready made RPM display available from Axminster and other supliers, and have some fun learning to use the Arduino system.

    This project was to build myself a prototype to verify that I had the coding to run the two wire I2c type LCD and that the code I located on the net was still viable. With this done I will now build a permamant home for my little Arduino project. I will post the final product when i have built its permamant enclosure.

    Thank you to Jeffery Nelson for making all the information needed to buld this project on his web site: www.macpod.net available under his "Hacking the SX2 mini mill" heading.

    here is the latest non inclusive list of machines that this code works with:

    Finally, I attempted to list the code here in this forum but it was too long to post here.

    If you want a copy of the code please e-mail me at: jen_edwards@rocketmail.com

    Thanks for reading, I look forward to your coments,
    Jenny

    I have added the code as an attachment.
     

    Attached Files:

    Last edited: Nov 28, 2018
    Swat likes this.
  2. Nov 27, 2018 #2

    chucketn

    chucketn

    chucketn

    Senior Citizen

    Joined:
    Dec 17, 2009
    Messages:
    1,259
    Likes Received:
    146
    Occupation:
    Fully retired
    Location:
    Near Jonesborough, TN
    Well done, Jenny!
    Do you have a rotary table? I used an Arduino Uno to control my 4" RT. The same circuit/sketch can be altered to automate a dividing head. I also designed a case for the Arduino, LCD, keypad, and stepper driver board, but haven't printed it yet.
    The RT controller setup is detailed on this forum, including the code.
     
  3. Nov 27, 2018 #3

    Jennifer Edwards

    Jennifer Edwards

    Jennifer Edwards

    Well-Known Member

    Joined:
    Aug 9, 2018
    Messages:
    63
    Likes Received:
    23
    Gender:
    Female
    Occupation:
    Retired E-Commerce Sytems Architect
    Location:
    Bridlington, East Riding of Yorkshire, UK
    Thank you for the nice comment.

    Yes I do have a rotary table, but alas and alak it is but a manual one. I have done a lot of CNC work in the past so perhaps one day I will attach a stepper motor and play with it. i use it so infrequently that it is not high on my "to do" list.
     
  4. Nov 27, 2018 #4

    Jennifer Edwards

    Jennifer Edwards

    Jennifer Edwards

    Well-Known Member

    Joined:
    Aug 9, 2018
    Messages:
    63
    Likes Received:
    23
    Gender:
    Female
    Occupation:
    Retired E-Commerce Sytems Architect
    Location:
    Bridlington, East Riding of Yorkshire, UK
    I tried to post the code here but it was too long to fit in the post, there is a thousand character ( or is it word?) limit for a single post.
     
  5. Nov 27, 2018 #5

    Scott_M

    Scott_M

    Scott_M

    Well-Known Member

    Joined:
    Apr 13, 2013
    Messages:
    225
    Likes Received:
    72
    Location:
    Medina, Ohio USA
    Hi Jenny
    Nice work !
    You should be able to add the code as an attachment. A .txt file should work and just tell folks to copy and paste into the Arduino IDE.

    Scott
     
  6. Nov 27, 2018 #6

    Jennifer Edwards

    Jennifer Edwards

    Jennifer Edwards

    Well-Known Member

    Joined:
    Aug 9, 2018
    Messages:
    63
    Likes Received:
    23
    Gender:
    Female
    Occupation:
    Retired E-Commerce Sytems Architect
    Location:
    Bridlington, East Riding of Yorkshire, UK

    Thanks scott, I deleted one of my images and that made room for an attachment. I appreciate the help!
     
  7. Nov 27, 2018 #7

    AndrewMcW

    AndrewMcW

    AndrewMcW

    Member

    Joined:
    Dec 27, 2017
    Messages:
    5
    Likes Received:
    0
    Hi Jenny,

    I did a similar display for and SC3 (and SX2P mill) and shared the design with a YouTuber called Andrew Whale. Here is the video he did about it:


    Both of us used an Arduino Nano (clone) for it's small size, and a 4 digit "Digital Tube" display; but otherwise similar to yours. I shared some drawings and my Arduino sketch with Andrew Whale - if anyone wants them just ask either here, or I think the other Andrew will forward them out too.

    Thanks to MacPod/Jeff Nelson for doing the really hard work of figuring it out!

    Cheers - Andrew
     
    Last edited: Nov 27, 2018
  8. Nov 28, 2018 #8

    oldboy

    oldboy

    oldboy

    Well-Known Member

    Joined:
    Nov 10, 2013
    Messages:
    52
    Likes Received:
    3
    Would love a copy of the diagrams & code please. You are both doing a great job developing this, as Jennifer points out the cost of buying one is over the top. Thank you both. I tried to get the diagram from Andrew in the video, I think my request got lost in the electronic maze.

    Barry
    Australia
     
  9. Nov 28, 2018 #9

    AndrewMcW

    AndrewMcW

    AndrewMcW

    Member

    Joined:
    Dec 27, 2017
    Messages:
    5
    Likes Received:
    0
    Hi Barry - I started a "conversation" with you - hopefully did it right! Just need your email...

    Cheers - Andrew
     
  10. Nov 28, 2018 #10

    Jennifer Edwards

    Jennifer Edwards

    Jennifer Edwards

    Well-Known Member

    Joined:
    Aug 9, 2018
    Messages:
    63
    Likes Received:
    23
    Gender:
    Female
    Occupation:
    Retired E-Commerce Sytems Architect
    Location:
    Bridlington, East Riding of Yorkshire, UK
    Thanks Andrew,

    Yes I have thought about using Nano and a NIXIE tube display, which would look really cool, but I did not want to get in to an external power supply the nixies require. In fact the original code that I left intact can be un-remarked and it will work with that type of display without removing mine.

    I chose this display because I would like to expand on the program to allow input of material and diameter and display a suggested speed. Perhaps from a menu of materials and diameters you could scroll thru. Maybe use a Bluetooth board and mobile phone combo for input. The possibilities are endless.

    It is the reason that I chose a two pin two line display. Got extra character space and to lessen impact on the boards limited I/O capabilities.

    Currently I am trying to decide what sort of input device to employ.

    Yes Jeffery saved me me lot of work, it would have been a much longer project without his help. I made an appropriate donation to his cause and have corresponded with him.

    Thanks again,
    Jen
     
    Last edited: Nov 28, 2018
  11. Nov 28, 2018 #11

    Jennifer Edwards

    Jennifer Edwards

    Jennifer Edwards

    Well-Known Member

    Joined:
    Aug 9, 2018
    Messages:
    63
    Likes Received:
    23
    Gender:
    Female
    Occupation:
    Retired E-Commerce Sytems Architect
    Location:
    Bridlington, East Riding of Yorkshire, UK

    Barry,

    Thank you for the kind words,

    I placed everything you need to wire it in the code at the bottom of my post.

    Jenny
     
  12. Nov 28, 2018 #12

    AndrewMcW

    AndrewMcW

    AndrewMcW

    Member

    Joined:
    Dec 27, 2017
    Messages:
    5
    Likes Received:
    0
    Hi again Jenny,

    Regarding the name "digital tube", it's a bit misleading! It's just what the chinese ebayers call the 4 digit LED display. I've no idea why, as it's simply a 4 digit LED display with a TM1637 chip to make it I2C addressable. I guess it's intended for use in a clock, but in this application we can just use the 4 digits. There is no separate power supply required - in fact the connection to a Nano is very neat: just using 4 wires to the ICSP header.

    Personally I like the big LED display....but your 16x2 display is more flexible if you want to do other things with it.

    Cheers - Andrew
     
  13. Nov 29, 2018 #13

    Jennifer Edwards

    Jennifer Edwards

    Jennifer Edwards

    Well-Known Member

    Joined:
    Aug 9, 2018
    Messages:
    63
    Likes Received:
    23
    Gender:
    Female
    Occupation:
    Retired E-Commerce Sytems Architect
    Location:
    Bridlington, East Riding of Yorkshire, UK

    Yes I gathered that. And I have used the two line display with an eye to some fun improvements in the future.

    I left the four digit code intact, so it will output either way without raising an error,

    The code actually outputs to both streams The I2C and the serial four digit display originally used by Jeffery.
     
    oldboy likes this.

Share This Page