stepper motor driver TB6600

Hi
its been a long time since I've been on this forum.
I have a little project in my head to control a Dividing Head or rotary table on my milling machine with a stepper motor. (specifically to make clock gears).
the only info I can find is related to Arduino. I have managed in the past to write programs for other projects by starting with some code that I have found here
from other similar projects and making it fit mine by trial and error. not the best I know but it works for me!
Can anyone point me in the direction of some code that I can get started with. Looking at the driver (TB6600) I have three inputs to control ENA (on/OFF) I guess,
DIR, (direction) and PUL ( pulse ). At this stage all I need is to be able to do is input a number of pulses to achieve a precise amount of rotation.
Arduino seems to have all that I need but I know nothing of C and C++. plus I have several picaxe project boards and a passable knowledge of what I am doing with the editor!
Many thanks in advance
 

oracacle

Senior Member
How do you want to input the numbers? And display them? Providing the driver will accept 5v signals driving it should be easy.

The other part is how do you intend to work out the value. Just put in desired tooth count and circumference. Or just tooth pitch....

Got some link to the Arduino ones, I maybe able to reverse engineer them.

Also have you seen the episode clock spring on YouTube did about cutting gears? He's got some cracking videos
 
Thanks so much for your reply.
For the moment I would just input the numbers as part of the program i.e. if each tooth requires 245 steps for a particular gear, then that is all the program will do so for a different gear with more or less teeth I would change the number of pulses in the program.
Its been a while since I have cut clock gears but from memory my dividing head is ratio of 40:1. diameter is dependent on the module of the gear.
I cut nearly a whole set of gears for a copy of an astronomical clock my father was making about 30 years ago, (quite fancy finishing this) but most pressing is a new escapement for a grandfather clock I've got. (very simple gear with 30 teeth) Having digital control of my dividing head is really an indulgence on my part. I would love to build a mini version of Mach 3 but for the moment it really is just a case of making the idea work.
One of the things we discovered doing the clock project was that we spent more time making the tools to make the parts than we did making the parts. I'm just going down that rabbit hole again 30 years later!!
 

oracacle

Senior Member
Give some time to have a look at the tb6600 specs. But if your or calculating the steps it should be an absolute doddle
 

oracacle

Senior Member
had a quick look at the specs, and the enable can be set in a couple of way. you could hardwire it, or you could have the picaxe control it. The motor should stay energised while the tool is being passed throught the work piece.

Code:
;;enable pin is dependant on setup you want so that will be ignoreed here
;;going to assume in one direction and direction is hard wired

symbol steps_between    = 245            ;;are you using microstepping - make usre you take that inot account
symbol num_teeth        = 30            ;;are you going to count teeth or valeys - 1 less valey than teeth

symbol step_counter    = w0            ;;counter the number of pulses sent
symbol teeth_counter    = w1            ;;count the number of cuts

init:
    ;;do initialisation here if its needed
    
main:
    for teeth_counter = 1 to num_teeth                        ;;assume we start at position 0 - there is 1 less valey than number of teeth
        do while pinc.1 = 0
            ;;hold here until user determines its ok to move
        loop
        for step_counter = 1 to steps_between                ;;double check this and if you want ot start at 0 or 1
            ;;send pulses to driver here
            ;;make sure you use a long enough pulse
            ;;depending on the driver you may need a pause or pause us here after the pulse
        next step_counter
    next teeth_counter
    ;;once the loops are finished exit and end
    end
There are a few different ways to get the disired output. This is a nested loop arrangement.
step counter and teeth_counter don't have to be words, but ensure that you don't exceed the capacity of the byte varaible if you go that route.
I doubt you will make many gears with mor the 255 teeth, however if you include micro stepping then exceeding 255 steps between a tooth is definietly possible.
You maybe also need to consider torque specifications for micro stepping
 
Dear Oracacle

Thank you so much.
I will have a go with this over the week end. I know that the motor I am playing with is not powerful enough but once I have proved that the electronics work I will roughly measure the torque required and get a bigger one. The torque required for microstepping is an interesting one as I assume that it is well reduced the higher the number. I will have a look at some likely tooth numbers and see how far down that road i may need to go.
Just watched some of Clickspring's videos he obviously spends as much time making the tools etc as we did!! very envious of his workshop its obviously warm dry and well lit, mine due to the agricultural nature of my business is cold and damp at this time of year so I spend more time with electronics and my computer in my office.
Again many thanks, I have had so much help from this forum over the years
 
Top