Tips for Arduno software for Rotary Table Controllers

Discussion in 'Software and Programming' started by rodw, Feb 8, 2015.

Help Support HMEM by donating:

  1. Feb 20, 2015 #101

    TorontoBuilder

    TorontoBuilder

    TorontoBuilder

    John

    Joined:
    Jan 4, 2013
    Messages:
    357
    Likes Received:
    82
    Okay so I dont have a stepper driver hooked up yet, so maybe this is why I'm not getting conflict when I have changed the stepPin to pin 3

    I'm really not sure what you mean when you say freetronics uses pin 3, what does it use pin 3 for? I know that Freetronics uses the same pins as the sainsmart LCD; 8, 9, 4, 5, 6, 7 and A0 for the buttons.

    If I cant change the software i cant use the 3 boards I just ordered... without hacking up the board to cut traces anyway
     
  2. Feb 21, 2015 #102

    rodw

    rodw

    rodw

    Well-Known Member

    Joined:
    Dec 3, 2012
    Messages:
    1,132
    Likes Received:
    334
    I don't think its an issue to worry about if this is the LCD board you have
    http://www.sainsmart.com/sainsmart-...rduino-duemilanove-uno-mega2560-mega1280.html

    Looks like Sainsmart and Freetronics use the same pins for the LCD and the same resistor values for the buttons but use a different method for enabling the backlight.

    I pulled down the zip file and the PDF diagram shows Sainsmart has hardwired the backlight. Freetronics uses Pin 3 so you can turn it on and off from within the sketch.

    For Sainsmart users it would be a good idea to change the #define darkoford found to point to an unused pin so the LCD library does not send spurious signals to your stepper!
     
    TorontoBuilder likes this.
  3. Feb 21, 2015 #103

    rodw

    rodw

    rodw

    Well-Known Member

    Joined:
    Dec 3, 2012
    Messages:
    1,132
    Likes Received:
    334
    So tell me again why I'm writing this software?

    [​IMG]

    I started with a square piece of 6mm aluminium same size as the stepper, centred it under the mill spindle and drilled all the holes using the PCD function. I also used the tapping feature of my SX3 mill to thread the holes.

    Complete kit and the collar from the Rotary table.

    [​IMG]
    And here it is attached to my 6" Vertex Rotary table

    [​IMG]

    So now I got this far, the left button on my display has died and starts pressing buttons all on its own....

    It was changing direction in front of my eyes half way through a divisions. So I need to make sure the direction cannot be changed while doing dividing steps.
     
    TorontoBuilder, Scott_M and darkoford like this.
  4. Feb 21, 2015 #104

    TorontoBuilder

    TorontoBuilder

    TorontoBuilder

    John

    Joined:
    Jan 4, 2013
    Messages:
    357
    Likes Received:
    82
    That looks like a great set-up.

    Does this look like a vertex rotary table? The vendor doesn't list the manufacturer...

    http://www.accusizetools.com/horizontal-vertical-precision-rotary-table/
     
  5. Feb 21, 2015 #105

    TorontoBuilder

    TorontoBuilder

    TorontoBuilder

    John

    Joined:
    Jan 4, 2013
    Messages:
    357
    Likes Received:
    82
    That's the LCD shield I have, and what I modeled my own boards after, except I may use a serial interface and need to substitute a different lcd library
     
  6. Feb 21, 2015 #106

    rodw

    rodw

    rodw

    Well-Known Member

    Joined:
    Dec 3, 2012
    Messages:
    1,132
    Likes Received:
    334
    I don't think that will be an issue. Just modify the LCD class to use your board. You'll see internally LiquidCrystal.h is used. I am no expert but I think a serial interface display will just substitute different Liquidcrystal code.

    The real smarts in the libraries used is in the keyboard handling and that is all on the analog port. That is configurable in LCD.h

    Code:
    #define LCD_BUTTON_PIN          A0       // Button state is on A0
    
    I found a bug. If you just accept the default value of 3 in #steppers, nothing happens (with stepper connected) as I'm not initialising the steps per division. Working on it....
     
  7. Feb 21, 2015 #107

    rodw

    rodw

    rodw

    Well-Known Member

    Joined:
    Dec 3, 2012
    Messages:
    1,132
    Likes Received:
    334
    Thanks, Looks very similar. I got mine here so compare the dimensions
    http://www.machineryhouse.com.au/R006
    even the diagrams look the same.

    Anyway, the mounting will be much the same I am sure. The collar is held on by two grub screws.

    Pretty sure I've finished my debugging attached to a real rotary table. Found a few things. I think it is good now.

    Also added a new feature <Jog Step>
    This lets you enter the step angle (in degrees) you want to use to jog the table round in single step mode. Defaults to 30 seconds (0.5 degrees).

    I'll post up Version 5 soon.
     
    TorontoBuilder likes this.
  8. Feb 21, 2015 #108

    rodw

    rodw

    rodw

    Well-Known Member

    Joined:
    Dec 3, 2012
    Messages:
    1,132
    Likes Received:
    334
    Ok Guys Here is the latest version. I think it is pretty clean now.

    New Features
    1. <Jog Step> - Allows you to set the angle for each step. Default 30 seconds (0.5 degrees)
    2. <Contin Turn> - Turns continuously in the last direction selected. To select the direction, simply use <Jog> to choose the direction of travel

    Tested on a 6" Vertex rotary table and seems to be working well. I've run the table with an electric drill, washed it out re-oiled and aligned the stepper. I've also run it continuously in both directions to bed the table in and it seems to be stepping reliably with quite a small stepper on a 19 volt laptop supply.

    Let me know if there are any more bugs. I hope I've squashed them all.

    View attachment RotaryTableChuck5.zip
     
    Scott_M, TorontoBuilder and darkoford like this.
  9. Feb 21, 2015 #109

    Scott_M

    Scott_M

    Scott_M

    Well-Known Member

    Joined:
    Apr 13, 2013
    Messages:
    251
    Likes Received:
    76
    Location:
    Medina, Ohio USA
    Hi Rod

    Your motor mount looks good :)

    Some weirdness with the latest code. Did you upload the wrong file ? it says 4. I changed it to 5 when I downloaded. I did not see the new features.
    Also, a bunch of stuff does not work.
    First thing I did was set home
    then I went to divide# and left it at 3 neither the left or right buttons did any thing. did not move.
    went to enter angle, entered 120 hit right and it went 120. Went to "home" and hit goto and it went forward to about 155 and stopped. hit it again and it went to 180 and stopped.

    I will be setting up a job on the mill today that may take a week to finish so I may not be able to hook this up again for awhile.

    Thank you so much for all your hard work !!

    Scott
     
  10. Feb 21, 2015 #110

    cwebs

    cwebs

    cwebs

    Well-Known Member

    Joined:
    Sep 12, 2012
    Messages:
    54
    Likes Received:
    13
    I have been running the other software from Chuck's posts for a couple years and have made parts using it. This is a great upgrade but will not run on my home made controller so I will make a new one. I have just got hold of a couple Pro-Micro boards and was wondering if there was any reason this software won't run on these boards. At $7 each it beats using an Uno. If not then I can perf board up an Atmaga328 and go that way. Thanks, Carl
     
  11. Feb 21, 2015 #111

    canadianhorsepower

    canadianhorsepower

    canadianhorsepower

    Well-Known Member HMEM Supporter

    Joined:
    Oct 22, 2011
    Messages:
    1,671
    Likes Received:
    320
    Hi Rod
    her is what I get

    thanks

    Luc

    arduino lcd.jpg
     
  12. Feb 21, 2015 #112

    TorontoBuilder

    TorontoBuilder

    TorontoBuilder

    John

    Joined:
    Jan 4, 2013
    Messages:
    357
    Likes Received:
    82
    This version should work equally well on the Micro. I'd thought of using the micro myself but then settled on the nano for the onboard usb connection.
     
  13. Feb 21, 2015 #113

    darkoford

    darkoford

    darkoford

    Member

    Joined:
    Dec 9, 2014
    Messages:
    11
    Likes Received:
    3

    So you do not have a library of LCD.

    You might not be well placed lcd.h a library.

    At the beginning of the program have this:

    #include <BoolField.h>
    #include <DegreeField.h>
    #include <Field.h>
    #include <Form.h>
    #include <IntField.h>
    #include <LCD.h>
    #include <ListField.h>
    #include <TextField.h>
    #include <TimeField.h>
    #include <GetIntField.h>
    #include <TimerOne.h>

    And on the hard disk directory "Arduino" you need to set up a library of the lcd.h:

    [​IMG]

    Link is in post # 20 for LCD and TimerOne.
     
  14. Feb 21, 2015 #114

    canadianhorsepower

    canadianhorsepower

    canadianhorsepower

    Well-Known Member HMEM Supporter

    Joined:
    Oct 22, 2011
    Messages:
    1,671
    Likes Received:
    320
    I do have that at the top of my program:wall::wall:
    I can't see your picture clearly:(
    Can someone email me the program
    I'll try it on another computor

    Thanks
     
  15. Feb 21, 2015 #115

    rodw

    rodw

    rodw

    Well-Known Member

    Joined:
    Dec 3, 2012
    Messages:
    1,132
    Likes Received:
    334

    Ooops Sorry. It was the wrong file. Rather than add yet another file to confuse people, I have put the right file on Post #108

    http://www.homemodelenginemachinist.com/showpost.php?p=262304&postcount=108

    If the file name ends in 4, refresh your browser as it is now
    RotaryTableChuck5.zip
     
  16. Feb 21, 2015 #116

    rodw

    rodw

    rodw

    Well-Known Member

    Joined:
    Dec 3, 2012
    Messages:
    1,132
    Likes Received:
    334

    Luc, I've had similar problems getting libraries installed. Try moving the LCD folder out of the libraries and arduinos folders and from the Arduino IDE, try to add a new library.

    Sketch/Import Library/New Library

    Then navigate to the LCD folder

    It will copy it to the Libraries folder and should update the config internally.

    I'm sure if you google some stuff you'll get some tips to get this sorted.

    Nothing to do with the code, just a configuration error at your end
     
  17. Feb 22, 2015 #117

    rodw

    rodw

    rodw

    Well-Known Member

    Joined:
    Dec 3, 2012
    Messages:
    1,132
    Likes Received:
    334
    I started working on Version 6 of the controller which saves configuration data to the EEPROM and includes a data entry form to change the setup parameters.

    The framework is now done.
    1. Default data is created and saved to EEPROM if it does not exist.
    2. Data is retrieved from EEPROM if it exists.
    3. Designed to store multiple stepper setups so you can move the controller to multiple devices.
    4. Data entry form is tested and working.
    5. User is prompted to saves Changes to the EEPROM (Yes/No)
    6. Saving of changed data confirmed working.

    But I still need to edit the sketch to actually use this configuration data!

    I did get some stack overflow issues and the Form class is not particularly helpful here as it uses a String class and I can't see how to get it to recognise variables in program memory. I seem to have got enough memory for now so I think we'll make it without running out of dynamic memory as there is not much left to do.
     
    TorontoBuilder likes this.
  18. Feb 22, 2015 #118

    cwebs

    cwebs

    cwebs

    Well-Known Member

    Joined:
    Sep 12, 2012
    Messages:
    54
    Likes Received:
    13
    My Pro Micro are USB. Were you thinking of the Pro Mini? Carl
     
  19. Feb 22, 2015 #119

    TorontoBuilder

    TorontoBuilder

    TorontoBuilder

    John

    Joined:
    Jan 4, 2013
    Messages:
    357
    Likes Received:
    82
    ah yeah, I was thinking of the mini. You should have no problem with the pro micro
     
  20. Feb 22, 2015 #120

    cwebs

    cwebs

    cwebs

    Well-Known Member

    Joined:
    Sep 12, 2012
    Messages:
    54
    Likes Received:
    13
    Rod, did I find a bug or don't I understand correctly. When I bring up "set Speed" and set a number, I then click on Select. When I go back to "Set Speed the number is about one half the previous setting. Go back to "Select" and back it halfed again. IE... I set speed to 70% /select/set speed/50%/select/set speed/28%/select/set speed/ 13%/select/ set speed/5%. Etc. Some times after boot my set speed is 0%. Hope you understand what I am trying to point out. Carl
     

Share This Page