Interrupt Driven Rotary Table controller

Discussion in 'Software and Programming' started by rodw, Nov 30, 2015.

Help Support HMEM by donating:

  1. Aug 4, 2019 #101

    rodw

    rodw

    rodw

    Well-Known Member

    Joined:
    Dec 3, 2012
    Messages:
    1,140
    Likes Received:
    335
    Did you uncomment the definition in LCD.h as per my instructions in Post#93? As far as I know the Sainsmart is identical to the DFRobot in relation to resistor values used.
    You should be able to create a new device in settings and define a linear device and swap between your brake and your rotary table.

    The menu options are there, take the time to fully explore each menu option. There is no need to change #defines in the code.
     
  2. Aug 4, 2019 #102

    MarkHar123

    MarkHar123

    MarkHar123

    New Member

    Joined:
    Sep 17, 2014
    Messages:
    4
    Likes Received:
    0
    Yes. I uncommented #definef and it made no difference.
     
  3. Aug 4, 2019 #103

    rodw

    rodw

    rodw

    Well-Known Member

    Joined:
    Dec 3, 2012
    Messages:
    1,140
    Likes Received:
    335
    Could try these LCD files instead of the ones provided earlier?
    DFROBOT is enabled
    It looks like I did not finish off the code so LCD.cpp was not selecting code based on the #define you uncommented and always used DFROBOT settings. Sounds like that is wrong for your screen..
    Tested on a DFRobot. If this does not work, comment the #define out again and try again
    If it still does not work, you need to compare your resistor values against the ones here
    https://www.dfrobot.com/product-51.html

    Once you have a keyboard working.,
    left arrow to <config>
    press down arrow
    To create a new device, from <config> left arrow to <Devices> press down arrow and add a new device (up arrow to yes and select).
    Devices are numbered from Zero
    Left arrow to get to <Setup> down Arrow to select.
    Find DevTyp option in this menu and set to Linear and select.
    Then configure your device and save it.

    If you get stuck, bump the CONFIG_VERSION up by 1. This will force the script to erase the EEPROM on the next startup but it can be erased from the device menu. We usuualy only need to do this if the globals structure changes.
     

    Attached Files:

  4. Aug 4, 2019 #104

    MarkHar123

    MarkHar123

    MarkHar123

    New Member

    Joined:
    Sep 17, 2014
    Messages:
    4
    Likes Received:
    0
    I think I'll take a break from this for awhile. I've spent hours trying to get this to work. I went back to version 10 of your software and installed the old Libraries to get the Rotary part working again. Has anybody used the Linear feature before?
     
  5. Aug 7, 2019 #105

    MarkHar123

    MarkHar123

    MarkHar123

    New Member

    Joined:
    Sep 17, 2014
    Messages:
    4
    Likes Received:
    0
    I am able to get into the setup parameters but can not change some of them for the Linear function. When I do get into the Setup parameters there are no numbers there for Dis/Rv, T/Rat and JgMM. I can cursor left and right but clicking Up and Down does nothing. Adds no numbers. Am I still doing something wrong here?
     
  6. Aug 13, 2019 #106

    stragenmitsuko

    stragenmitsuko

    stragenmitsuko

    Well-Known Member

    Joined:
    Jan 19, 2016
    Messages:
    222
    Likes Received:
    78
    A bit of feedback :

    RotaryTable11.zip downloaded from post#93 compiles and uploads as it should .
    I have made my dfrobot board sainsmart/freetronics compatible by modifying the hardware and all works as expected .
    The backlight pin is still dfrobot , and as expected does not work with the freetronics settings .
    Did not try the dfrobot settings as I no longer have a real dfrobot board .

    Then I downloaded the LCD11.zip and commented the define dfrobot .
    That gives me a compile error . Somthing like { expected .
    Did not persue this .

    To my knowledge sainsmart and freetronics use thesame resistor values , but sainsmart has a different backlight pin .
    Dfrobot has a 2K2 resistor instead of the 2K and thesame backlight pin as the sainsmart does .


    That aside , I mentioned a nano problem when writing to eeprom .
    I noticed when compiling and uploading the sketch :
    Uno : 28478 bytes ( 88%) of memory
    Nano : 28478 bytes (92%) of memory .
    Altough they both use thesame processor , something is different .
    I also have to set my nano to "old bootloader" otherwise it will not upload .
    But it does work .


    Pat
     
  7. Aug 14, 2019 #107

    rodw

    rodw

    rodw

    Well-Known Member

    Joined:
    Dec 3, 2012
    Messages:
    1,140
    Likes Received:
    335
    Ooops on line 353 of LCD.cpp, I should have deleted one more comment.
    It should read as per the second last line
    Code:
    #ifdef DFROBOT
    static uint8_t const buttonMappings[] PROGMEM = {
        2, 0, 3, 3, 0, 0, 0, 4, 4, 0, 0, 0, 1, 1, 0, 0,
        0, 0, 0, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
    };
    #else
    static unsigned char const buttonMappings[] PROGMEM = {
        2, 0, 0, 0, 3, 0, 0, 0, 0, 4, 4, 0, 0, 0, 0, 1,
        1, 0, 0, 0, 0, 0, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0
    };   // deleted the comment
    #endif
    
    These mappings are created with a utility in the original LCD library as mentioned earlier.

    Also the backlight pin should be able to be enabled on different hardware with a change to around line 31 (// = comment)
    Code:
    //#define LCD_BACK_LIGHT         3        // Default LCD backlight is on D3 - Freetronics
    #define LCD_BACK_LIGHT          10        // Default LCD backlight is on D3 - DFROBOT and others
    #define LCD_BUTTON_PIN          A0        // Button state is on A0
    
    So you just need to uncomment one line and recomment the other.

    And the memory usage of the nano is probably going to break the script due to memory overruns. The bootloader must be bigger.

    The bootloader is burnt to the chip using am Atmel Risp programmer. I have used one of these to download a script when I've busted the USB on an Arduino. There will be instructions around on how to do this and also how to make your own Risp programmer. This may increase available RAM as the bootloader is no longer there but I really don't know.

    And yes, most boards except Freetronics use the 2k2 resistor.
     
  8. Dec 9, 2019 #108

    curtistdc

    curtistdc

    curtistdc

    Member

    Joined:
    Dec 28, 2015
    Messages:
    11
    Likes Received:
    0

    Rod, This is Scott and I am back to playing around with this project again. I am done farming for the year and can dedicate some time to getting this to work with my Milling machine with the fanuc control. I have successful got it wired up the the mill and am able to make it index wit a m40 signal from the fanuc control. After the indexing operation finishes the delay pulse I sent from within the code sends a pulse that cancels the M40 comand and the mill continues with the program. It work about 80% of the time and as I suspected there is a problem with using the delay command in the arduino code. Occasionally it triggers the end of m40 during a indexing movement. So I came back to the forum and read the posts since I got busy with work. It sounded like you had been working on this problem while I was busy.

    So right now I am piggybacking on the right button push switch with a m40 index command from the fanuc relay. The command to cancel m40 comes from a dfrobot relay shield that is hooked to the d10 pin. It sounds like you are doing the same thing with pin 2 (start) and pin 13 (index done). My problem is my poor coding with the delay function i believe. I would appreciate if you could share the work you had done so I could try it out. I am assuming I could change from pin d10 to d13 in the code and use pin 2 instead of my piggyback on the right button. I really appreciate all of the trouble you have gone to with this project
    Thanks
    Scott
     
  9. Dec 10, 2019 #109

    rodw

    rodw

    rodw

    Well-Known Member

    Joined:
    Dec 3, 2012
    Messages:
    1,140
    Likes Received:
    335
    Scott, I'll have to dig out the code to see what I ended up doing. I only ever bench tested it. I was trying to incorporate a rotary encoder into the menu but it really is designed for a keyboard so I don't think I could make it work nicely.
     
  10. Dec 10, 2019 #110

    curtistdc

    curtistdc

    curtistdc

    Member

    Joined:
    Dec 28, 2015
    Messages:
    11
    Likes Received:
    0
    Thanks rod, I tried implimenting what you had mentioned a couple of posts prior to the one I replied to but ended up with compiler errors. I appreciate your help thanks
    Scott
     
  11. Jan 9, 2020 #111

    metalrus

    metalrus

    metalrus

    New Member

    Joined:
    Apr 1, 2017
    Messages:
    3
    Likes Received:
    0
    My system consists of CW250 controller,HF100W-SF-24 power supply,57BYG-310D stepper motor, Arduino Uno,Sainsmart LCD,and used rotary table 10 . The LCD display shows the menu for the program, but the steppermotor makes a noise and doesn't rotate. When i tested the stepper with a independent circuit it rotates just fine. What can i look for? Need Help.
     
  12. Jan 10, 2020 #112

    RM-MN

    RM-MN

    RM-MN

    Well-Known Member

    Joined:
    Feb 25, 2017
    Messages:
    83
    Likes Received:
    19
    I'm no expert but two things come to mind for why a stepper motor makes noise and doesn't rotate. One is too fast of pulses and the motor can't keep up. The other is reversed leads on one of the coils so the motor steps one way and then tries to step back. I'd try reversing the polarity of one set of motor leads first.
     
  13. Jan 11, 2020 #113

    rodw

    rodw

    rodw

    Well-Known Member

    Joined:
    Dec 3, 2012
    Messages:
    1,140
    Likes Received:
    335
    I suspect you are trying to drive the stepper faster than it is able to do so. In frequency. settings, reduce the frequency. Too many people have used this script for it to be a software issue. It has to be a configuration or wiring issue.
     
  14. Jan 12, 2020 #114

    metalrus

    metalrus

    metalrus

    New Member

    Joined:
    Apr 1, 2017
    Messages:
    3
    Likes Received:
    0
    Rod i sent the company my proposed wiring diagram before i built this wooden turntable, like a lazy susan and they said everything looks ok. Could it be the rotary table 10 code? I could go through the entire menu on the sainsmart lcd. rotary indexer2.jpeg
     

    Attached Files:

  15. Jan 12, 2020 #115

    rodw

    rodw

    rodw

    Well-Known Member

    Joined:
    Dec 3, 2012
    Messages:
    1,140
    Likes Received:
    335
    What is the value in the setup menu for MaxHz?
    Try halving it and make sure MinHz is less than that number.
    This is what determines stepper speed and at the beginning of a move, it ramps up from minHz to MaxHz then ramps down the other way at the end. Low speeds have more torque.

    The other possibilities are:
    1. Not enough Torque to turn your table.
    2. Stepper Voltage too low (which causes 1)

    So looking at your parts, it looks like you have a Stepper driver that will handle 60 volts which your NEMA23 stepper will easily handle but you are only feeding it 24 volts. If you double the power to 48 volts, you will more than double the torque.
     
  16. Jan 12, 2020 #116

    Rickus

    Rickus

    Rickus

    Active Member

    Joined:
    Aug 12, 2009
    Messages:
    40
    Likes Received:
    3
    Good Lord! Bunch of rocket scientists. The only stepper I know of is the Two Step!!!:)
     
  17. Jan 12, 2020 #117

    metalrus

    metalrus

    metalrus

    New Member

    Joined:
    Apr 1, 2017
    Messages:
    3
    Likes Received:
    0
    Rod i am new at this code stuff, can you tell me where i can find this MaxHz. Is there a line number in the Rotary Table 10 code? I removed the stepper from the turntable and have the same results.
     
  18. Jan 21, 2020 #118

    curtistdc

    curtistdc

    curtistdc

    Member

    Joined:
    Dec 28, 2015
    Messages:
    11
    Likes Received:
    0
    I have got my 5C HAAS index head working with the mill! I have implemented a M40 command from the Fanuc 0mc control to activate an index move. an arduino driven relay then resets the m40 index move and continues on with the code. I am going to try and ad a link to a video of it at work. The part is a 72 to 1 worm gear being cut with a thread mill. Thanks Rod for all your work on this project what used to take me an hour and now be done in 8 min.
     
  19. Jan 21, 2020 #119

    jdurnya

    jdurnya

    jdurnya

    Member

    Joined:
    Sep 7, 2018
    Messages:
    17
    Likes Received:
    1
    Gender:
    Male
    Location:
    New Jersey USA
    very nice is that hardinge indexer cnc ? or did you convert it ... would love to see more pics / specs of that

    JOe
     
  20. Jan 21, 2020 #120

    curtistdc

    curtistdc

    curtistdc

    Member

    Joined:
    Dec 28, 2015
    Messages:
    11
    Likes Received:
    0
    Its a Haas 5c indexing head. I think they were a copy of the Hardinge one. Its driven by a stepper motor and was originally controlled by a haas driver. My system uses the Arduino code from this thread and a relay shield. With some small changes to the code the arduino sees a relay cycle generated by the cnc with a M40 command in the code. when the index is done it then sends a signal back to the cnc to cancel M40 and continue. The driver is a Gecko controller driven by a 48 volt power supply.
     

Draft saved Draft deleted

Share This Page

Group Builder