# Electronic Dividing Head using the Arduino



## cfellows (May 20, 2012)

I've made some strides on my Arduino powered dividing head the past few days. Here's a little background for what I am doing. First, the Arduino micro controller. 







Available online for under $30, has 32K memory, numerous analog and digital inputs and outputs, including serial and PWM.

Next, the Sainsmart LCD display and keyboard shield






This board is called a shield because it is pin compatible with and piggybacks right on top of the Arduino board. It has a 2 line x 16 character display and 5 input keys plus a reset. The keys are configured like the cursor keys on a PC having a left, right, up, and down as well as a select. So, with this shield in place, the microcontroller can be used with only a power supply and doesn't have to be tethered to a computer. The keys provide input and the LCD provides the display.

Here is the Sainsmart shield mounted on the Arduino...






The Sainsmart gets its power from the Arduino.

Another picture






The Arduino is programmed by hooking it up to your PC through a USB cable. This also provides power to the Arduino board. A free programming environment is available for the PC and allows you to develop programs in a language that looks almost exactly like C. There are a host of standard libraries for interfacing to LCD's, keyboards, wireless, serial devices, and others. You write the programs and compile them on the PC. The compiler then automatically downloads the program to your Arduino. Once the program is loaded on the Arduino, you can decouple it from the computer and run it off a separate power supply from 9 - 12 volts. The program will stay in the Arduino memory even when the power is switched off.






So this is the basis for controlling my electronic dividing head. The up and down arrow keys will be used to set the number of divisions I want, then the left and right arrow keys will be used to step forward or backward one division at a time. The program I have written will calculate the number of stepper steps need for each division and keep track of the position I'm on. The display shows the number of divisions and the current dividing head position. 

I have purchased a stepper driver board that is about the size of a postage stamp and will power a stepper of up to 2 amps, 35 volts. I still have to select the stepper motor I want to use and build the mechanical part of the dividing head. Still have a few challenges ahead of me.

Chuck


----------



## stevehuckss396 (May 20, 2012)

That is a great idea Chuck! I wonder if you could just send step and direction pulses to a Gecko drive. They can source 7 amp. Not so much for the driving force but for the holding power.

Anyway, awesome project.


----------



## Blogwitch (May 21, 2012)

Chuck, or in fact anyone else who is going along the electronic RT route. here are a couple of links on to how I did things to mount the stepper to the RT.

You don't need to follow religiously, but they will give you an idea of what is required to get a backlash free with smooth movement RT, and to keep the swarf out. Once assembled, the slot in the tube is covered over with tape.

Vertex type

http://madmodder.net/index.php?topic=4040.msg44911#msg44911

Arc Euro type

http://madmodder.net/index.php?topic=4730.msg52166#top

Hope it helps someone


John


----------



## Jeremy_BP (May 21, 2012)

Looks really nice so far Chuck. 
The stepper board you're looking at sounds like a Pololu driver. Is that the case? The A4988 version is quite good (certainly good enough for a dividing head), and really difficult to kill. By which I mean the short protection actually works. I tried it.

I'm not sure too much holding torque will be needed, because of the worm drive. The one thing you will need to be careful of is that the pololu driver will get extremely hot if you don't give it a good heat sink, and even then will roast if you feed the motor more than about 1.25A. I have some heat sinks that work marvelously on the pololu drivers (if those are what you are using), and would be happy to send one your way.

Best of luck.


----------



## cfellows (May 21, 2012)

stevehuckss396  said:
			
		

> That is a great idea Chuck! I wonder if you could just send step and direction pulses to a Gecko drive. They can source 7 amp. Not so much for the driving force but for the holding power.
> 
> Anyway, awesome project.



Thanks, Steve. I don't see why this wouldn't work with pretty much any stepper driver, incluing the Gecko. There are two outputs from the Arduino... direction and step start/stop.



			
				Bogstandard  said:
			
		

> Chuck, or in fact anyone else who is going along the electronic RT route. here are a couple of links on to how I did things to mount the stepper to the RT.
> 
> You don't need to follow religiously, but they will give you an idea of what is required to get a backlash free with smooth movement RT, and to keep the swarf out. Once assembled, the slot in the tube is covered over with tape.
> 
> ...



John, I'll have a look at your thread. I'm sure there are number of issues you have thought of that I will miss otherwise. 



			
				Jeremy_BP  said:
			
		

> Looks really nice so far Chuck.
> The stepper board you're looking at sounds like a Pololu driver. Is that the case? The A4988 version is quite good (certainly good enough for a dividing head), and really difficult to kill. By which I mean the short protection actually works. I tried it.
> 
> I'm not sure too much holding torque will be needed, because of the worm drive. The one thing you will need to be careful of is that the pololu driver will get extremely hot if you don't give it a good heat sink, and even then will roast if you feed the motor more than about 1.25A. I have some heat sinks that work marvelously on the pololu drivers (if those are what you are using), and would be happy to send one your way.
> ...



Yes, it is the pololu driver. I've sent you a private message regarding the heat sink. I haven't selected a stepper motor yet, but with a 30:1 worm reducer and no real load on the dividing head, I'm guessing it won't take much of a stepper.

Chuck


----------



## Blogwitch (May 21, 2012)

Chuck,

I don't know what sized RT you have, but both I have converted (a 6" and a 4"), plus my dividing head when I get around to it, all or will use the recommended 180N steppers, which are rated at 2.5amps.

OK, go small if you only want to move the table, but if you are going to use it for machining, even the 2.5 amp one that I use is a little underpowered, and I have to be careful on my depths of cut and feed speeds to stop them stalling. 

I would have preferred something around 4.5 to 5 amps to work really comfortably, but my unit just won't give that amount out.

John


Sorry, should have shown location of stepper motors

http://www.arceurotrade.co.uk/Catalogue/Stepper-Motors/Stepper-Motors

2nd or 3rd one down. They work out to approx 18kg/cm holding power.


----------



## Jeremy_BP (May 21, 2012)

I've used these motors before, and they're really quite nice. http://www.phidgets.com/products.php?category=23&product_id=3302_0

Bogs brings up a good point about torque, and these will probably be inadequate for machining. I would recommend a NEMA 23 sized motor with some more "oomph", maybe this one, which has more torque at a lower current. http://www.phidgets.com/products.php?category=23&product_id=3308_0


----------



## cfellows (May 21, 2012)

I have two candidate steppers in my surplus stepper motor box. Both are bipolar and smaller than the NEMA 23, but I think either would suffice for my needs. This will strictly be a dividing head, not a rotary table and will be used just for positioning, not for machining. 

One motor is a 7.5 degree, 48 step motor with 16 oz in holding power. It requires 12 volts and the resistance per phase is approximately 28 ohms which works out to little less than half an amp. The other motor wants 5.2 volts at 0.9 amps and the resistance per phase is about 6.2 ohms. This second motor is a 1.8 degree and has a holding power of 30.2 oz in.

At the moment, I'm leaning toward the first motor because I think 48 steps per rev is more than adequate for a dividing head geared down 30 : 1. This gives me an overall resolution of 1440 : 1. I'm also thinking that the Pololu driver I have will easily handle half an amp with no problem. And, finally, both the Arduino and the motor will operate off 12 volts which means I only need one power supply. Anybody see a flaw in my thinking?

Thx...
Chuck


----------



## Jeremy_BP (May 23, 2012)

I'd go for the motor with more steps/rev and more torque. You'll get smoother, (and more importantly) faster motion.


----------



## stevehuckss396 (May 24, 2012)

Jeremy_BP  said:
			
		

> I'd go for the motor with more steps/rev and more torque.




You need the high torque to hold position while you do your work. More torque the better


----------



## cfellows (May 24, 2012)

Help! :-[

Not having so much luck getting my stepper motor to work. 

I have the following loop to step the stepper forward.

write direction pin HIGH Forward (or Backward depending on direction setting);
loop:
 write step pin HIGH;
 delay (10);
 write step pin LOW;
 delay (10);
repeat the loop n times (n=33 in this case)

It will step one step forward, then nothing unless I press the back button twice, then the forward button again in which case it moves one step forward. It never moves backward...

I know this is probably pretty fundamental stepper motor operation, but I can't make it work!

Thx...
Chuck


----------



## Jeremy_BP (May 24, 2012)

I'm assuming the delay is in milliseconds?
Things to check:
Are the leads wired correctly?
Is the separate motor voltage connected to the driver, and does it share a common ground with the controller?
What is the current pot set at?

Upload the code, maybe it's something subtle there.


----------



## cfellows (May 25, 2012)

Jeremy_BP  said:
			
		

> I'm assuming the delay is in milliseconds?
> Things to check:
> Are the leads wired correctly?
> Is the separate motor voltage connected to the driver, and does it share a common ground with the controller?
> ...



Yep, Jeremy, it was subtle! I took a picture of the arduino and driver chip to upload and when I got to looking at it, I discovered my error. I thought I was using pins 3 for direction and 4 for step, but I got caught by the old zero base problem. The third pin is really pin 2 and the fourth pin is really pin 3. I just changed the program to work with 2 and 3 and it works great! I do have a bug when the position rolls over the top and back to zero that I need to work out but that will be simple.

Since I took the picture of the circuit, here it is. Not too pretty, but I will tidy up the wiring when I finalize the whole thing.






The resistors are 12K pull-down resistors. The leads from the stepper driver are soldered to the LCD / Keypad shield to pins which are carried through from the Arduino. I don't have the stepper leads hooked up in this picture. I'm also not using the half step, quarter step, enable or sleep functions. Don't think I'll need them.

The 12v, .5 amp stepper has a lot of torque and holding power. And even though it's 7.5 degrees per step, I'll be driving the dividing head through a 24 pitch, 60 tooth worm gear. That will give me a huge amount of torque and holding power, not to mention 2880 steps of resolution.

I'm Pumped!!! :big: I'll fix my program bug then take video to upload, maybe tomorrow or this weekend.

Chuck


----------



## Jeremy_BP (May 25, 2012)

Glad to hear everything is working now. I can't wait to see this working!


----------



## cfellows (May 25, 2012)

The worm wheel I want to use for my dividing head is a 60 tooth, 24 pitch bronze worm gear. Turns out I don't have a worm for it and I'm too impatient (and cheap) to order one from SDP. So, guess I have a go at making one. I figured if I replace the 48 tooth gear on my lead screw with a 46 tooth and set the quick change gear box to 8 TPI, that should get me 7.66 TPI which is very close to the 7.64 required for 24 pitch. I've got a tungsten carbide acme threading insert which I ground back to the right depth profile so we'll see how this goes.






I'll be using the ER16 spindle for my dividing head spindle.

Chuck


----------



## cfellows (May 26, 2012)

Here's a video of the preliminary setup. This doesn't include the dividing head, but does have the Arduino, the stepper motor driver and the stepper. You can see how I'm able to control the divisions per rotation of the stepper. I can change the program to work with any resolution by changing one variable.

http://www.youtube.com/watch?v=ZRcPKY3APM0&feature=youtu.be

Chuck


----------



## craynerd (May 28, 2012)

Hi Chuck

Excellent idea and this has been needed for some time with an Arduino. 

I recently did something similar to make a small dividing head for my horizontal milling machine: http://www.raynerd.co.uk/?p=1578

Good luck with the build and I look forward to further updates! PM sent to you as well.

Chris


----------



## cfellows (May 28, 2012)

Here's some pictures of the dividing head. I've hooked it up to the arduino and it works. More than enough torque and holding power using the NEMA 23 motor. The ratio of the timing pulleys is 12 : 60 or 1:5.
















The spindle is an ER20 with a 3/4" shaft running in sealed ball bearings. 

Chuck


----------



## Jeremy_BP (May 28, 2012)

Looks great! When do we get to see it working?


----------



## Maryak (May 29, 2012)

Nice one Chuck, :bow:

At least you won't be confused by all the hoohaa associated with a mechanical one. 

Best Regards
Bob


----------



## John S (May 29, 2012)

Chuck,
Are you sure it can hold against cutting forces ?
I built one some years ago, similar design but far bigger and heavier but on splines you could see it cogging and producing helical splines.
Scrapped it and went to worm and wheel.

John S.


----------



## cfellows (May 29, 2012)

John Stevenson  said:
			
		

> Chuck,
> Are you sure it can hold against cutting forces ?
> I built one some years ago, similar design but far bigger and heavier but on splines you could see it cogging and producing helical splines.
> Scrapped it and went to worm and wheel.
> ...



I'm never entirely sure about these things until I actually try it. Other than radial drilling, I hadn't planned on using it to do any kind of milling operation other than maybe gears. Since that doesn't put any rotary torque on the spindle I can't see that there would be a problem with that. In the end I went with this design because 1) I had all the parts needed, and 2) turning the spindle through a worm gear takes a lot of steps. If it turns out not to work, it will be easy enought to convert it to a worm gear.

One thing I've discovered on these bipolar motors is that you can get the motor wiring wrong and it will still work, but with far less torque. Once I got the wiring right, I couldn't turn the spindle by hand, even grasping the large timing pulley.

Chuck


----------



## fcheslop (May 29, 2012)

Hi Chuck, I have been watching with a lot of interest as its a future job.Would it be possible to fit a locking pin to the shaft as per the Harold Hall indexing head that was built on here recently?
Thanks for posting its giving me some idea
kind regards Frazer


----------



## Blogwitch (May 29, 2012)

Frazer,

As already mentioned in another post on here about the same sort of project.

Once you put a manual lock into the system, it can cause major problems.

If you forget to remove the stop when going to the next point, the stepper will stall, but will still count on the electronics as the next numbered step, with all the consequences of what that means, usually, starting from the beginning all over again with a new blank.

John


----------



## fcheslop (May 29, 2012)

Thanks John,thats me back to the drawing board
best wishes frazer


----------



## n4zou (May 29, 2012)

How about a brake that's operated via another stepper motor?


----------



## johnmcc69 (May 29, 2012)

Maybe use a solenoid with a detent?
Could be programmed to lock?


----------



## Blogwitch (May 30, 2012)

John,



> Maybe use a solenoid with a detent?



Major problem if you are stepping to all different settings.

How do you have a detent for 27 positions, then one for say 39 and another at 76, you would have to have thousands of holes for your detent to drop into to cover every situation.

It is for this reason you use the stepper and it's associated drive system to automatically hold for you as you carry out the machining. 

That was why John S came in about Chucks belt drive. 
Even though rigid to the feel, when you get cutting forces on there, not maybe for drilling holes, but say for gear cutting, the belt WILL flex backwards and forwards, causing all sorts of weird cutting effects, and if you tighten the belt up to get rid of it, the stepper won't have enough torque to move and will stall. A catch 22 situation.


John


----------



## John S (May 30, 2012)

How about just using a worm drive box that's been used for years and not reinventing the wheel with a puncture ?


----------



## Ken I (May 30, 2012)

Speaking from ignorance here - but why not add one of those small DC motor brakes - the software will ensure its turned on (brake off) before attempting to move the stepper.

This only for static machining not for NC interpolation of helixes or rotary machining.

2c

Ken


----------



## johnmcc69 (May 30, 2012)

Bog, you're absolutely correct, that would be VERY ugly.
Even if you "stacked" multiple rings with alternated (staggered
Holes & additional solenoids.)

I'm looking forward to seeing how Chuck handles this...
He never ceases to amaze...

John


----------



## ddmckee54 (May 31, 2012)

If I got a vote, and Chuck I realize I don't, I would vote for a mechanical brake on the indexing spindle with a feedback signal to the Arduino for Go or No Go. You already have the indexing code written, a Go/No Go signal would be a simple modification to that code. That way you could lock the indexer and if you forgot to unlock it the Arduino would not try to move until you unlocked the indexing spindle.

Just my 2 cents,
Don


----------



## cfellows (May 31, 2012)

ddmckee54  said:
			
		

> If I got a vote, and Chuck I realize I don't, I would vote for a mechanical brake on the indexing spindle with a feedback signal to the Arduino for Go or No Go. You already have the indexing code written, a Go/No Go signal would be a simple modification to that code. That way you could lock the indexer and if you forgot to unlock it the Arduino would not try to move until you unlocked the indexing spindle.
> 
> Just my 2 cents,
> Don



I like your idea, Don. I had already decided that if I needed more braking power for some reason, and I'm not yet convinced I do, that a mechanical brake would be easy to add. I don't like the extra step of tightening and loosening a brake between steps but it is an option. Adding a go/nogo switch would be an easy addition. First I want to try some drilling and maybe hobbing a gear and seeing if the motor will hold. Unfortunately, more home improvement tasks have been set before me so it'll be a few days before I can get back to this. 

Chuck


----------



## cfellows (Jun 2, 2012)

This has me thinking about my electronic dividing head on a whole new level...

[ame=http://www.youtube.com/watch?v=ZhICrb0Tbn4]http://www.youtube.com/watch?v=ZhICrb0Tbn4[/ame]

Chuck


----------



## Rayanth (Jun 3, 2012)

what an amazing amount of control and precision, to get a gear blank to come out that nicely in such a fashion. Impressive for a home-brew.

- Ryan


----------



## cfellows (Jun 7, 2012)

Did a live test on my dividing head today. I ran two tests, milling evenly spaced flats across a piece of 1/2" aluminum round. On the first test, I cut 9 evenly spaced flats and it worked flawlessly, even holding the piece rock steady during the cutting pass. However, on the second test which I was doing for a video, the stepper started "letting go" during the stop / hold phase. I'm pretty sure the driver was overheating causing it to shut down current to the stepper for short durations. Uploading a video will have to wait for awhile until we get our house put back together (putting down wood flooring).

Chuck


----------



## cfellows (Jun 8, 2012)

Here's a video of my dividing head in operation. I took the slack out of the belt and put a makeshift heatsink on the stepper driver chip so now it works consistently and reliably. The holding power of the stepper is enough for me to satisfactorily tighten the collet chuck with a crescent wrench. I can get it to slip with the wrench but not easily.

[ame=http://www.youtube.com/watch?v=ODf9sJzXHzA&list=UUZB8pRNp9Plbd0-T9RmyR9g&index=1&feature=plcp]http://www.youtube.com/watch?v=ODf9sJzXHzA&list=UUZB8pRNp9Plbd0-T9RmyR9g&index=1&feature=plcp[/ame]

I've got an Arduino Nano on order that I plan to use in a finished version of this dividing head. I'll also use a separate LCD display and input keys to put the whole thing into an attractive and more robust case. I believe this is going to be a really nice little addition to my shop. Next I might tackle my rotary table. 

Chuck


----------



## Don1966 (Jun 8, 2012)

Very nice Chuck, are we going to see any plans in the download section upon completion?
I like the idea of just keying in the divisions.

Don


----------



## Blogwitch (Jun 8, 2012)

Chuck,

I am truly surprised at how this has turned out, I honestly thought that the belt would flex too much, but you have proved me wrong.

Have you tried doing a bit of machining on the run?


John


----------



## cfellows (Jun 8, 2012)

Don1966  said:
			
		

> Very nice Chuck, are we going to see any plans in the download section upon completion?
> I like the idea of just keying in the divisions.
> 
> Don



Yep, I can probably throw something together. I assume any kind of plans would have to include wiring diagrams and part numbers for the absolute newbie.


----------



## cfellows (Jun 8, 2012)

Bogstandard  said:
			
		

> Chuck,
> 
> I am truly surprised at how this has turned out, I honestly thought that the belt would flex too much, but you have proved me wrong.
> 
> ...



Thanks, John. I doubt you are any more surprised than I am! I'm truly pleased with how well it works, and how convenient it is. I haven't tried any machining on the run. However, I do have the programming set up so I can adjust the speed of rotation as slow as I want.

The ER20 collet will only take work up to 1/2". My main purpose for building this was just for indexing for gear cutting, radial drilling, etc. And of course, the learning process. I've always wanted to be able to use stepper motors and to write my own programs. Now I know how easy it is. I'm kind of itching to get my hands on a NEMA 34 or even NEMA 42 stepper. I think something that powerful could really have some possibilities. Of course, those require a whole other level of driver electronics not to mention power supplies.

I've just ordered several different types of rotary encoders and gap sensors to make my own encoders. I see a lot of possibilities with those. Been thinking about an electronic gear hobber somewhere down the road...

Chuck

Chuck


----------



## Blogwitch (Jun 9, 2012)

Chuck,

I basically have very little knowledge about steppers, only that the Nema quote is the physical size of the mount not the power of the motor.

I have been using these Nema 23 mount, 180 Ncm ones off here (2nd & 3rd ones down) and my power supply is a second hand (new old stock) 24 volt 3.5 amp waterproof power supply off an external security camera costing 8 pounds off eblag. They drive my 6" RT just great, and I am destined to do the same for my dividing head using the same size. If you have watched my vid, you will see that even fairly small ones like these can cut on the run very well.

http://www.arceurotrade.co.uk/Catalogue/Stepper-Motors/Stepper-Motors


John


----------



## rabdouglas (Jun 9, 2012)

hi there

      when you have connected your stepper motor to your RT via your divison master can you control the rotational speed of the RT thro the division master for machining.

regards rab


----------



## Blogwitch (Jun 9, 2012)

Rab,

You can adjust the speed of rotation, ramp up and ramp down (the speed when starting and stopping the rotation), even set up an overshoot then auto wind back to take into account of any backlash in the RT gearing system, for when drilling holes.

You can even control the RT very accurately, manually from the keyboard, very handy when you are given odd degree measurements between say a set of holes around an arc or circle. I used that feature fairly recently when making a Canon lens mount, all the holes were different degree settings between them.


John


----------



## rabdouglas (Jun 9, 2012)

hi john thanks for the infomation

rab


----------



## John S (Jun 9, 2012)

A remark from Chuck jogged a memory when he mentioned the Nano.
Didn't realise the Nano was related to this beast because a while ago I had a guy write a program similar to the divisionmaster that was software based and ran on a PC with USB port.

This was to go into a camera system and the PC that ran the camera could control the rotary table that had the part on for scanning. can't say much more as it is proprietary but i had the guy alter me one that I controlled, not the camera.

This was a little box with a nano in it, USB type B in and a cable with 7 leads out of which I only used step direction and ground.

This is the box and screen shot.







Can be altered to suit a ratio and hold 4 different profiles.

I don't own the rights or source code to this but may be able to get it.

John S.


----------



## salzburg (Jun 20, 2012)

Question to cfellows:

 Do you have any plans to publish the program for this divider here?


----------



## cfellows (Jun 20, 2012)

Yes, I can upload the program. I assume a text file would be best so it can be cut and pasted into the arduino IDE?

Chuck


----------



## salzburg (Jun 21, 2012)

That would be realy great and generous , thanks.


----------



## cfellows (Jun 21, 2012)

I've uploaded the Dividing Head Program to the file repository. I'm also attaching it to this posting. It's a zip file in the download area. Here it is just a text file.

Chuck 

View attachment Arduino_Dividing_Head_Program.txt


----------



## salzburg (Jun 23, 2012)

Chuck, thanks again for the program. I have ordered the arduino and sainsmart components. Am I right in assuming that your program

  works only with a 60:1 rotary table.

  John.


----------



## cfellows (Jun 23, 2012)

I have the program set up to work with my rotary table which is 72:1 or my dividing head which is 5:1. The program can easily be changed to work with any ratio and stepper motor combination. Have you tried to load and compile the progam yet? You can download the IDE here:

http://arduino.cc/hu/Main/Software

You can compile programs without an Arduino attached. It will just give you an error when it tries to upload the code to the Arduino. 

Chuck


----------



## kf2qd (Jun 23, 2012)

With the Arduino IDE there is a "Verify" button that will compile without downloading to the Arduino for checking your program.

I have done some work on using the Arduino as a Stepper Driver wound up putting the code in an ATtiny2313. I then go to some MOSFETs to drive a unipolar stepper. The driver uses Step & Direction inputs. Here's the link to the driver so far -http://arduino.cc/forum/index.php/topic,84809.0.html. I started developing the code on the Arduino board and then used the Arduino to program the ATtiny2313.

I have an stepper attached to a 10:1 gearbox - should be able to get 4000 steps per revolution using half-steps.

Depending on just what you are wanting to compile you can download version 0.23 and version 1.01 as there are a few things that work better with the older version.


----------



## salzburg (Jun 25, 2012)

Yes, I have downloaded the arduino software and while I am waiting for the arduino I am checking all the tutorials I can find
 on the net. The ratio of my rotary table I have to find by counting the screw turns for 1 turn of the table because there are no
 markings on it.

 kf2qd, I am going to check out your project. Sounds interesting.


----------



## cwebs (Nov 8, 2012)

I want to thank you for posting this code. I have played with the Arduino and have a hard time grasping the code. I guess I'm getting to old to retain and understand code. This will be used on my RT project.
 I do have a couple questions.

How do you get the program to reset so as to change the number of Divisions?

And, this shows your RT and Divideing head steps. How do you switch between them?
float stepsDiv = 0;  // Steps per Division
float numSteps = 1000.0;          // Holds either Rotary Table or Dividing Head steps per rev. 
#define stepperDiv 1000.0  // Stepper Resolution.
#define rotaryDiv 14400.0

I have the ide working just haven't got the stepper driver board yet. It's in the mail.
Thank you again for the work you have in this info, Carl


----------



## cfellows (Nov 8, 2012)

cwebs said:


> I want to thank you for posting this code. I have played with the Arduino and have a hard time grasping the code. I guess I'm getting to old to retain and understand code. This will be used on my RT project.
> I do have a couple questions.
> 
> How do you get the program to reset so as to change the number of Divisions?
> ...


 
Hi Carl,

First, pressing the reset button on the Arduino board will cause the program to start over just like when you first apply power.  However, the program is also written in such a way that you can change the number of divisions at any time by pressing either the up or down button.

When the program first starts up, pressing the up or down buttons toggles back and forth between 1000 steps for the dividing head and 14,400 steps for the rotary table.  Then, pressing the Select button, on the far left locks in the number of steps.  After that, pressing the up or down buttons, at any time, will increment or decrement the number of divisions.  Pressing the left or right buttons will move the stepper backward or forward one division.

Hope that helps.  If not, don't hesitate to ask for clarification.

Chuck


----------



## cwebs (Nov 9, 2012)

THanks you for the info and it works as advertized. 
I also found out from playing with the numbers that if I put in another number in.

 float numSteps = 1000.0; 
Like; float numSteps = 2000 gave me 400 steps per stepper revolution. Would that work if drive board is set for half stepping?

 That gave me  three differant stepper counts to use. Just didn't click on the up or down button, just the select button. Didn't seem to screw any thing up. Don't know what I'm doing but it worked. Carl


----------



## cfellows (Nov 10, 2012)

Yeah, the program defaults to 1000 steps per rev.  You only need to press the up / down buttons to change this value.  If you press the select button without pressing either the up or down button, it uses the preset value in numsteps.

In my current version of the program, pressing the select button a second time will let you use the up and down keys to set the stepper speed, that is, the delay between commands to step.  Pressing the select button again will then go back to letting you set the number of divisions.

You might try pressing the select button a second time and see what your version of the program does.

You should get back into playing with programming the Arduino.  It's a fascinating little micro controller and lots of fun to do different things with.  One of the projects I have on the drawing board is to build a MIDI controller that I can plug into the iPad to control various synthesizer and music apps I've downloaded.  I want to build a breath controller, like a flute, and a ribbon controller, like a steel guitar.  

Chuck


----------



## cwebs (Nov 10, 2012)

cfellows said:


> Yeah, the program defaults to 1000 steps per rev.  You only need to press the up / down buttons to change this value.  If you press the select button without pressing either the up or down button, it uses the preset value in numsteps.
> 
> In my current version of the program, pressing the select button a second time will let you use the up and down keys to set the stepper speed, that is, the delay between commands to step.  Pressing the select button again will then go back to letting you set the number of divisions.
> 
> ...


Thanks, Chuck. I wondered what the S and the 5 was for. I was thinking it would be nice to control the speed just yesterday and "there you go".

I have a draw full of Arduino stuff and found no REAL use for them untill your project. That is partly the problem of not getting into the code and understanding it better. Now look at what you have done to me! Carl


----------



## chris (Nov 10, 2012)

Chuck: having little knowledge of Electronics etc. Am I correct in assuming that if I obtain all the stuff mentioned in this thread and ask many questions. I will eventually have something which will give me fairly precise divisions for cutting clock wheels. I know I have over simplified this ,but am interested.
                                                                                            Chris


----------



## cfellows (Nov 10, 2012)

chris said:


> Chuck: having little knowledge of Electronics etc. Am I correct in assuming that if I obtain all the stuff mentioned in this thread and ask many questions. I will eventually have something which will give me fairly precise divisions for cutting clock wheels. I know I have over simplified this ,but am interested.
> Chris


 
The short answer is yes, although accuracy is determined by the number of stepper divisions it takes to turn the work spindle one entire revolution.  The more steps, the higher the precision and the higher the number of teeth that can be accurately cut.  Mine consists of a 200 steps per revolution (sometimes referenced as 1.8 deg per step) coupled to the spindle through a timing belt and pulleys with a 1:5 ratio, which results 1000 stepper steps to complete one complete spindle revolution.  

This gives me dead on precision for any number which divides evenly into 1000.  And it is probably close enough for any other number up to at least 50.  Increasing the ratio will proportionately increase the number of teeth that can be accurately cut.  For example, using a 30:1 worm gear would increase the overall resolution to 6,000.  This would probably let you cut anything up to around 300 teeth accurately enough.

Chuck


----------



## chris (Nov 11, 2012)

Chuck: Thanks for the reply. I went to my local Radio Shack and got the Arduino book. Which will keep me occupied for a few days. I am definately going to pursue this.    Chris


----------



## cfellows (Nov 11, 2012)

chris said:


> Chuck: Thanks for the reply. I went to my local Radio Shack and got the Arduino book. Which will keep me occupied for a few days. I am definately going to pursue this.    Chris


 
Here is a great series of video tutorials for the Arduino... one of the best I've seen for beginners learning about it.  It's a series of 12 or so videos, each pretty short but with enough detail to really help you understand what's going on.

[ame]http://www.youtube.com/watch?v=fCxzA9_kg6s&list=PL2F6A9BCA925C1F18&feature=plcp[/ame]

Don't forget the Arduino website which has a wealth of information, particularly these links:

http://arduino.cc/en/Tutorial/HomePage

http://www.arduino.cc/playground/

I'm also more than willing to answer any questions (if I know the answer ).  Be careful, though.  It's pretty easy to get wrapped up in a whole bunch of other projects which you may or may not have time for! 

One other note.  Although I have no personal affiliation with this company, I find they are a good resource for Arduino accessories and electronic parts.  Their pices are reasonable and shipping is fast.

Chuck


----------



## cwebs (Nov 20, 2012)

Hay, Chuck. I plan on trying this timer on the RT to give it a jog function. It is on a very slow boat from China so I haven't got it in my hands yet. Jog speed and direction. Carl
http://www.ebay.com/itm/Stepper-mot...946?pt=LH_DefaultDomain_0&hash=item2a24195742


----------



## Limo (Mar 31, 2013)

Hi Chuck,
I've been reading your post on the dividing head and decided to follow your example. I know hardly anything about arduino and am starting to learn. I bought an Uno and the Sainsmart display and the pololu driver. I downloaded your text file and loaded it into my uno. It doesn't display the Div and Pos. All that pops up is 1000 and 14400 by using the up and down keys. And it resets good. Maybe I have to get the same board you used?
Maybe the uno doesn't have the same pin arrangement? Any help you could give would be appreciated. And I greatly appreciate what you have contributed already.  I'm going to be driving a sherline RT.(hopefully)

Wil


----------



## cfellows (Apr 1, 2013)

Limo said:


> Hi Chuck,
> I've been reading your post on the dividing head and decided to follow your example. I know hardly anything about arduino and am starting to learn. I bought an Uno and the Sainsmart display and the pololu driver. I downloaded your text file and loaded it into my uno. It doesn't display the Div and Pos. All that pops up is 1000 and 14400 by using the up and down keys. And it resets good. Maybe I have to get the same board you used?
> Maybe the uno doesn't have the same pin arrangement? Any help you could give would be appreciated. And I greatly appreciate what you have contributed already.  I'm going to be driving a sherline RT.(hopefully)
> 
> Wil



Wil, you have everything you need and the program is working as I designed it.  I use my Arduino not only to run my dividing head but also to run my motorized rotary table.  The Dividing head has an overall ratio of 1000 steps per revolution and the rotary table has 14400 steps per revolution.  So, the first screen that comes up wants me to select either 14400 or 1000 steps depending on which device it's running.  The up and down cursor keys select the divisions and pressing the enter key then takes you to the next screen which displays divisions and position.  You may have to modify the program for your own dividing head depending on what your gear ratio is and the number of steps per revolution of your stepper motor.  Let me know if you have any other questions.

Chuck


----------



## Limo (Apr 2, 2013)

Hi Chuck,
Yes, the 14400 and 1000 come up on the screen by buttons but my select button does nothing. I will have to watch those videos again and try to figure this out. I don't have this hooked up to anything at this point right now. (except the computer)
Thanks for replying to me.

Wil


----------



## de_das_dude (Apr 2, 2013)

cfellows said:


> I've made some strides on my Arduino powered dividing head the past few days. Here's a little background for what I am doing. First, the Arduino micro controller.
> 
> 
> 
> ...




unfortunately photobucket is a bad image host and none of the pictures are showing up! Even though i can view them after i copy paste their links into the address bar!

please use imgur if you post any more pictures in the future  !


----------



## cwebs (Apr 22, 2013)

Hi Chuck. I have my Arduino rotary table working using your code but need to add debounce to the buttons. You had any problem with bounce? I am confused with the debounce code. Mostly because 5 of the buttons are realy only one button. Do you have any idea how to add debounce to the code? Thanks, Carl


----------



## rodw (Apr 23, 2013)

Chuck, I know I am late to the party here but it might be worth checking the power specs on the Arduino you are using. When I last played with one, best practice was not to exceed 9 volts because the power supply has a limited life at 12 volts. You might be better off adding a voltage divider off your main power supply to reduce the voltage.



cwebs said:


> Hi Chuck. I have my Arduino rotary table working using your code but need to add debounce to the buttons. You had any problem with bounce? I am confused with the debounce code. Mostly because 5 of the buttons are realy only one button. Do you have any idea how to add debounce to the code? Thanks, Carl



Carl, plenty of stuff on denouncing. Here is one link. http://arduino.cc/en/Tutorial/Debounce


----------



## cfellows (Apr 23, 2013)

cwebs said:


> Hi Chuck. I have my Arduino rotary table working using your code but need to add debounce to the buttons. You had any problem with bounce? I am confused with the debounce code. Mostly because 5 of the buttons are realy only one button. Do you have any idea how to add debounce to the code? Thanks, Carl


 
Hi Carl,

There is already some debounce logic in the code.  Here is the code snippet that reads the keys.  The "delay(200)" command on about the 9th line down provides a 200 millisecond delay for the key to settle down.  It's not the most sophisticated debounce logic, but has worked OK for me.  I occasionally get a button read error, but that's pretty seldom.



> /********************* read the buttons **************************/
> int read_LCD_buttons()
> {
> adc_key_in = 0;
> ...


 
Chuck


----------



## cwebs (May 3, 2013)

cfellows said:


> Hi Carl,
> 
> There is already some debounce logic in the code.  Here is the code snippet that reads the keys.  The "delay(200)" command on about the 9th line down provides a 200 millisecond delay for the key to settle down.  It's not the most sophisticated debounce logic, but has worked OK for me.  I occasionally get a button read error, but that's pretty seldom.
> 
> ...


 
Hi chuck. It turns out that most of the bounce problems was not bouncing switches but dirty switches. I saw that when I pushed "Right" the divisions would change or the speed would change telling me that there was resistance in the switches changing the voltage divider readings. I got a can of contact cleaner and sprayed the crap out of the switches. That made a big difference and cleaned up the problem. I also got a new 1602 display and tried it. It also worked great. This is not the first time I have had trouble with these type of button switches. Keep your switches clean and covered. Carl


----------



## rodw (May 24, 2013)

Chuck, I hope you don't mind me posting here but I have been playing with an Arduino to do this over the last couple of weeks making my own version of a table controller after getting inspiration for you.

I finally got the menu system up and working last night but still a long way to go.

[ame="http://www.youtube.com/watch?v=pFAD4D4-VJM"]http://www.youtube.com/watch?v=pFAD4D4-VJM[/ame]

I have included an SD card in the mix and hope to be able to build in scripting functionality. I played with a Polou stepper driver but thought my stepper was missing steps when it got hot so I have got a Gecko G251X 3.5 amp controller which I will fire up soon.


----------



## cfellows (May 25, 2013)

Hey Rod, not a problem.  Glad you got something going.  The pololu driver does need a heat sink and/or fan cooling.  I made a heat sink for mine and never had a problem after that.

I have great big stepper that I'm going to attach to an Arduino one day and it will require a much bigger stepper driver.  First I need to figure out what I'm going to use it for.

Chuck


----------



## cwebs (Jun 8, 2013)

Hi, Chuck. I have finished my Rotary Table project and finaly solved the bounce problem. I tried three differant keyboards and had problems with internal resistance and bounce . Found some
   code that finaly worked. Here is the new code I used.

```
int read_LCD_buttons()
{
  adc_key_in = analogRead(0);      // read the value from the sensor 
  delay(5); //switch debounce delay. Increase this delay if incorrect switch selections are returned.
  int k = (analogRead(0) - adc_key_in); //gives the button a slight range to allow for a little contact resistance noise
  if (5 < abs(k)) return btnNONE;  // double checks the keypress. If the two readings are not equal +/-k value after debounce delay, it tries again.
  // my buttons when read are centered at these valies: 0, 144, 329, 504, 741
  // we add approx 50 to those values and check to see if we are close
  if (adc_key_in > 1000) return btnNONE; // We make this the 1st option for speed reasons since it will be the most likely result
  if (adc_key_in < 50)   return btnRIGHT;  
  if (adc_key_in < 195)  return btnUP; 
  if (adc_key_in < 380)  return btnDOWN; 
  if (adc_key_in < 555)  return btnLEFT; 
  if (adc_key_in < 790)  return btnSELECT;   
  return btnNONE;  // when all others fail, return this...
}
```
 
Here are some pictures of the control box.
http://i268.photobucket.com/albums/jj30/cwebs_photos/004-1.jpg
http://i268.photobucket.com/albums/jj30/cwebs_photos/001-4.jpg

There are three switches. Power, Enable, and Reset.  I hid the reset next to the fan out of the way.

I am running the pololu driver using a NEMA 17 Stepper running 1.25 amps. 2:1 into the 8 inch turntable at 72:1. Sounds small but is working very well. I loaded the table with 70# and it turned it with no problems.
In the back of the box you will see a plug I added to be able to reprogram the chip from the Arduino board. No chip in the Arduino. 

The power supply is a computer psu conected to the 12 volts. I found that if there is a short the psu will shut down fast enought to prevent damage. Don't ask how I know, but, I'll bet your first guess will be right.
Thanks for the code. I will never be good at coding but I learned alot of code from this project.  Carl


----------



## gcude (Jun 8, 2013)

Thanks for your update Carl.  I look forward to trying your code.  I got a SainSmart clone and I'm having trouble with bounce on the keys as well, so hope this works for me as well.

Gary


----------



## rodw (Jun 8, 2013)

Your control box looks awesome!

It is not good practice to use delay() as it is a blocking code so nothing happens for the duration. That can create problems. You should save the time with millis() and the last key press  in global or static variables and then write some code something like

```
now = millis();
if ((now <= lastime + bouncedelay) && adc_key_in == adc_prev_key ){
  return btnNONE;
else{
   lastime = now;
   adc_prev_key = adc_key_in;
}
// rest of code follows
```

I gotta figure this out and add it to my own code.... This probably has bugs as it stands.


----------



## cwebs (Jun 9, 2013)

rodw said:


> Your control box looks awesome!
> 
> It is not good practice to use delay() as it is a blocking code so nothing happens for the duration. That can create problems. You should save the time with millis() and the last key press  in global or static variables and then write some code something like
> 
> ...


 
Thanks Rod for your comment. However, I don't understand your code as to what it does. I am an old man and while I am a very capable guy C/CPP is my weakest link. As for the code change in my setup I copied it from some one else. It came with a LCD/keypad. Because this code had to be added it tells me this is a common problem.  I tried two LCD/keypads and the keypad that I am using and had button press problems with all three.

 BUT, it did get my setup working with no errors as of yet. Until I understand coding better I will have to set buy and wait that delay(). LOL

Thanks again, Carl


----------



## rodw (Jun 9, 2013)

Carl, delay() will probably work fine. You can run into problems because everything stops when delay() is running so if you are trying to do two things at once using interrupts this can pose a problem. The better alternative is to read the time using millis() which returns the number of milliseconds since reboot and just do nothing until  the time period expires. Here is the official Arduino example of denouncing inputs using this method I tried to outline.

http://arduino.cc/en/Tutorial/Debounce

In your case, I was trying to return when the debounce delay was not expired before you code was processed to simplify code modifications.

I will add that using delay() was never good practice on any platform, not just Arduino but it is convenient!


----------



## vidio1 (Jul 27, 2013)

I need a little help please. I'm a first time user of an Arduino so bear with me. I have a Uno, Sainsmart LCD shield, but i'm trying to use an H-bridge stepper driver. It uses 4 wires instead of 2 like the Pololu. I tested it through the LCD shield using "stepper_onestepatatime" from the Arduino library. I used pins 2,3,12,13. It works as it should. I thought it might be a simple matter of just adding another "#define stepGo and #define stepDir" to the shetch. No such luck. The LCD program works, but it just causes the stepper to buzz until it gets to where it would go if it were moving, if that makes sense. What else would I need to change? Attached is a copy of what the 2 lines I've added. 

View attachment rotary_controller_copy.zip


----------



## cfellows (Jul 28, 2013)

vidio1 said:


> I need a little help please. I'm a first time user of an Arduino so bear with me. I have a Uno, Sainsmart LCD shield, but i'm trying to use an H-bridge stepper driver. It uses 4 wires instead of 2 like the Pololu. I tested it through the LCD shield using "stepper_onestepatatime" from the Arduino library. I used pins 2,3,12,13. It works as it should. I thought it might be a simple matter of just adding another "#define stepGo and #define stepDir" to the shetch. No such luck. The LCD program works, but it just causes the stepper to buzz until it gets to where it would go if it were moving, if that makes sense. What else would I need to change? Attached is a copy of what the 2 lines I've added.



The LCD program, which I wrote, requires a stepper controller.  A stepper controller provides all the logic necessary to energize the motor coils in the proper sequence and polarity to make it turn in the desired direction.  Most stepper controllers also provide current limiting so you don't need to use a specific voltage to get the proper current through the stepper.  All the LCD program does is tell the stepper controller when to turn the motor 1 step and in what direction.

Example:

1.  Set direction to Forward.
2.  Step

The H-Bridger driver is a much lower level device and requires the arduino sketch to provide the stepping logic to the individual coils in the proper sequence to make the motor turn.  All the H-Bridge does is amplify the voltage/current and set the voltage polarity.  The arduino has to individually tell the H-Bridge which coil(s) to energize and in what polarity.

Example:
1.  Energize Coil A, forward.
2.  Energize Coil B, Forward,
3.  Energize Coil A, Reverse.
4.  Energize Coil B, Reverse.
5.   Etc...

This is just an example and is not necessarily the right sequence.  A different sequence is required to make the motor turn the other direction.  You would have to modify the LCD program to incorporate the forward and reverse logic from the "stepper_onestepatatime" sketch to make it work.

Chuck


----------



## vidio1 (Jul 29, 2013)

Well that would certainly make sense. I guess I should have said first time Arduino and stepper user, but that was probably evident. Looks like I need to learn some C. Thanks again for the reply and sharing your sketch.


----------



## cfellows (Jul 29, 2013)

If you are truly interested in learning C, in figuring out how to make steppers work at a low level, and expanding your knowledge of steppers and electronics in general, modifying the LCD program and getting it to work would surely be the way to go.

On the other hand, if your main goal is to build an Arduino controlled dividing head, it would be far easier to simply buy the Pololu (or equivalent) stepper controller for under $12 + shipping and hook it up.  That is, assuming your stepper motor will run on about 1.5 amps...

http://www.pololu.com/catalog/product/2128

No changes to the LCD program would be necessary, although I do have a newer version that is a little more user friendly.


----------



## vidio1 (Jul 29, 2013)

I thought about getting the correct driver just to have it working, and probably will. About 8 or 9 years ago I started with an Oopic microcontroller, not sure if you've heard of them or not. 

Anyway I was just getting started with it when I was deployed to Iraq. Long story short, by the time I came back from Iraq support had fallen off to next to nothing. There were some internal issues with the company and it dissolved. It made trying to learn from scratch all but impossible. I tossed it and all the sensors, breakout boards, motors, etc. in a small tote in stuck it on a shelf in the garage. 

I've been looking for an excuse to get back into microcontrollers and have been looking at the Arduino for about a year or so, just to make sure this one doesn't fall by the wayside. Your project was the scapegoat I suppose. 

It's easy enough to copy a sketch someone has made, but I still don't know enough about the nuts & bolts of why it works like it does. I need to learn at least some C if I'm ever going to. 

I've been watching a video series on C++ that's about as Noob friendly as it gets, so I'll pursue that until I know enough to be able to ask an intellegent question.........

Thank again.


----------



## RonGinger (Jul 29, 2013)

All of your Oopic sensors and such should be useable with Arduino.

Learning C++ is a worthy goal, but thats a big jump to start. I would start by learning more about Arduino and its programming. There is a HUGE amount of good material on the net for free. The Arduino is programmed in something that is very close to C, but with all the tedious stuff removed 

I think one of the best ways to learn is to pick some existing program that you have an interest in, and the dividing head wold be a good one, and read it and study it until its clear. Then try to add some improvements to it. Its lots better to start with a working example than a blank sheet.


----------



## starnovice (Jul 29, 2013)

Being a professional software engineer I have learned more programming languages then I can count, several of them not even in use anymore.  Almost all of them I learned through self-study.  I agree with Ron the quickest way to start is to read other people's code and figure out what they did while at the same time having a basic reference book on the language near by,


----------



## vidio1 (Jul 30, 2013)

cfellows sorry for the thread hi-jack. I'll leave it with this; 

I chose the Arduino because it has a ton of support. There are shields and sketches everywhere I look. That's probably the single most important thing to have for someone getting started, short of a mentor standing over your shoulder. 

Almost all microcontrollers can use a version of C for programming. If I can learn enough to be usefull it will make it easier to program almost anything I might pickup in the future. I have some lofty future goals that include an Autonomous rover with multiple controllers talking to a main controller to get things done. There seems to be more free learning resources for C++ than most others worth learning. These are the reasons for my choice of C++.

I've actually been looking over sketches, changing bits here and there to see how and what it changes. That's helped get my toes wet. I believe I'm going to buy a programming Arduino book written by Simon Monk. After looking at a few Arduino books I think his might be a decent starting point. 

There are a few projects out there using the Arduino that might make a contribution to this site if there were a sub-forum available. I've seen digital scale readers, a DRO, electronic lead screw, and of course this dividing head. Just an idea.


----------



## rodw (Jul 30, 2013)

C is just another language, C++ just extends it by adding Object Oriented Programming (methods, classes etc). If I mention C below it includes C++.

I think the main thing to understand with learning a new programming language is to get your head around the normal programming constructs (if, do..while, while, switch, if/else, how functions and procedures work.

The next most critical part of learning C is to get your head around pointers and also pointers to pointers.  The most useful tip I have read is to think of an * as being a star and when you see it it means the variable starred (stored) at that memory location. Once you get this and how it works with pointers to structures you will set the world on fire. Once you grasp these basics, you can move on to the more advanced concepts of C++ and define classes and their methods. Pull down some open source code like Ghostrscript and work your way through some of the code until you understand what is going on.


----------



## _Paul_ (Nov 16, 2013)

cfellows said:


> I have the program set up to work with my rotary table which is 72:1 or my dividing head which is 5:1. The program can easily be changed to work with any ratio and stepper motor combination. Have you tried to load and compile the progam yet? You can download the IDE here:
> 
> http://arduino.cc/hu/Main/Software
> 
> ...



Chuck,

Very nice work, but I have a question if I may, if I wanted to modify your program to use with a 40:1 dividing head and a 90:1 rotary table which variable/s would I need to alter?
is this change correct:

*#define stepperDiv 8000.0	 // Stepper Resolution
#define rotaryDiv 18000.0*

Regards

Paul


----------



## cfellows (Nov 16, 2013)

_Paul_ said:


> Chuck,
> 
> Very nice work, but I have a question if I may, if I wanted to modify your program to use with a 40:1 dividing head and a 90:1 rotary table which variable/s would I need to alter?
> is this change correct:
> ...


 
 Yes, assuming your stepper motor has 200 steps per revolution.  Unfortunately, my program doesn't use ramped acceleration and deceleration so you can probably grow a beard while waiting for that rotary table to reach the next stop... ;D.


----------



## _Paul_ (Nov 16, 2013)

Thanks Chuck,

Perhaps for the dividing head only then!

Many Thanks

Paul


----------



## Swarfing (Dec 21, 2013)

Hi Chuck, i think i have missed something from the thread. Do you have a wiring diagram for the driver to the Arduino Uno. I have the sainsmart setup and single axis tb6560 driver.

Thanks

Paul


----------



## cfellows (Dec 21, 2013)

Swarfing said:


> Hi Chuck, i think i have missed something from the thread. Do you have a wiring diagram for the driver to the Arduino Uno. I have the sainsmart setup and single axis tb6560 driver.
> 
> Thanks
> 
> Paul


 
 Here's the wiring diagram...







Hope this helps...

 Chuck


----------



## Swarfing (Dec 21, 2013)

Thanks Chuck that helps me out a lot. The Reset/ Sleep connection is that just specific to pololulu driver? i.e i don't need to worry about that with my TB driver?

Thanks

Paul


----------



## Twizseven (Dec 24, 2013)

Chuck,

I have been following your various builds with interest over the last 6 months or so.  I am interested in making CNC stepper setup for my rotary table.  You mentioned in one of your earlier posts on this topic about posting up a list of components used and plans.  I know your busy but did you ever manage to do this and if so where would I find them.
Many Thanks,

Colin


----------



## cfellows (Dec 24, 2013)

Swarfing said:


> Thanks Chuck that helps me out a lot. The Reset/ Sleep connection is that just specific to pololulu driver? i.e i don't need to worry about that with my TB driver?
> 
> Thanks
> 
> Paul



Yeah, those connections are specific to the A4988.  

Chuck


----------



## Swarfing (Dec 26, 2013)

Thanks Chuck, code now loaded wires connected to test. Just need to decide whether to mangle up the rotoary table or build something from scratch, the later probably being the bet for now. Thm:


----------



## cfellows (Dec 27, 2013)

Swarfing said:


> Thanks Chuck, code now loaded wires connected to test. Just need to decide whether to mangle up the rotoary table or build something from scratch, the later probably being the bet for now. Thm:


 
 Yeah, if you are planning on using it just for dividing operations like drilling holes or cutting gears, etc., a rotary table really has too high a gear ratio.  My dividing head has ratio of 1:5 from motor to spindle.  My Arduino program doesn't have stepper acceleration and deceleration, so it's kind of slow, just to make sure it doesn't skip any steps.  

 Chuck


----------



## Swarfing (Dec 27, 2013)

Chuck my rotab has a 90:1 wormdrive which would work out well for this. Chances are i would go with a worm drive on a scratch build as well. With the driver at 3.5amps and use full volts, run bipolar on the windings and keep micro steps down to a minimum then the holding torque should be sufficient for my needs. Not planning to do any fast turning with mine.


----------



## Twizseven (Dec 30, 2013)

First of all thanks to Chuck for his arduino stepper motor code in download section. This runs happily on my arduino uno with Sainsmart 1602 LCD. I am waiting for delivery of Pololu DRV8825 and a stepper motor but in meantime am looking to see what spare pins there are available on LCD module. I would like to use the stepper in microstep mode. I think that D11, 12 and 13 are free. On the DRV8825 schematic they are marked as D11/MOSI, D12/MISO and D13/SCK. Does anyone know what they mnemonic mean. The DRV8825 docs say that to get particular microstep values MS1, MS2 and MS3 need to be set HIGH as appropriate. Can this be done by linking them together (as nec) and providing an input from one of the (hopefully) spare digital pins to set them HIGH.

Hope this makes sense.

Many Thanks,

Colin


----------



## rodw (Dec 31, 2013)

Pin 13 has the on board LED tied to it. Some digital pins have additional uses that allow them to work together to drive specific hardware but you can still use them (and pin 13)  as an ordinary digital input/output.

Also any of the analog pins can be used as digital I/o pins provided they are correctly initialized in accordance with the documentation. This means you may have more pins than you Think! 

I would try and use separate pins for the stepper parameters just in case you change your mind down the track. If you tie the pins together, be mindful the you don't exceed the maximum  current that can be supplied. You could also consider tieing the pins straight to the arduino 5 volt rail to avoid using up any pins at all in your case.


----------



## cfellows (Dec 31, 2013)

Twizseven said:


> First of all thanks to Chuck for his arduino stepper motor code in download section. This runs happily on my arduino uno with Sainsmart 1602 LCD. I am waiting for delivery of Pololu DRV8825 and a stepper motor but in meantime am looking to see what spare pins there are available on LCD module. I would like to use the stepper in microstep mode. I think that D11, 12 and 13 are free. On the DRV8825 schematic they are marked as D11/MOSI, D12/MISO and D13/SCK. Does anyone know what they mnemonic mean. The DRV8825 docs say that to get particular microstep values MS1, MS2 and MS3 need to be set HIGH as appropriate. Can this be done by linking them together (as nec) and providing an input from one of the (hopefully) spare digital pins to set them HIGH.
> 
> Hope this makes sense.
> 
> ...


 
 You don't really need to use an I/O pin at all.  You can just tie MS1, MS2, and MS3 to the 5V output from the Arduino.  These pins don't draw any current to speak of, so you don't need to worry about overloading the 5V supply.

 Chuck


----------



## Twizseven (Jan 1, 2014)

Chuck, Rod,

Thanks for the quick responses. I had not realised I could connect the pins directly to the 5v and get same effect.

Chuck, you show Reset an Sleep linked to each other, the Pololu site appears to show them linked and also connected to the 5v. What is the difference between these two approaches.

You also show "Pulldown resistors" on your breadboard in your Post#13.  What is the function of these and where are they connected.  The DRV8825 schematic shows a 100microfarad electrolytic capacitor between VMOT and GND (across feed to stepper motor).  Is this in your circuit?

Forgive the simple questions, the last electronic kits I built were crystal sets and a two valve radio back in early 1960's.

Thanks,

Colin


----------



## rodw (Jan 2, 2014)

Twizseven said:


> Chuck, Rod,
> 
> Thanks for the quick responses. I had not realised I could connect the pins directly to the 5v and get same effect.
> 
> ...



Colin, You need to research both the hardware and the Arduino documentation and you get the answers.
1. reset and sleep are tied together in accordance with the Pololu documentation for the break out board Chuck used here http://www.pololu.com/product/1182

2. The purpose of the pull down resistors is that digital circuits have an on or off state (eg 0 or 1, or 0v or 5v). If there are no clearly defined values, the voltage can float either way which can lead to spurious triggering of the logic values seen on the ports. By placing a resistor between the pin and the negative rail, the voltage on the pin is Pulled down to 0 volts when it is not receiving any signal. See http://en.wikipedia.org/wiki/Pull-up_resistor
The alternative is to use a pull up resistor that pulls the signal up to +5V in exactly the same manner. The Arduino has pull up resistors on board which can be enabled within the software. I would just use these rather than external components. See http://arduino.cc/en/Tutorial/DigitalPins

Think of Pull up and Pull down resistors as a defensive design measure that enforces a known value if nothing is connected to the pin in the same way as defensive programming methods provide error handling for  an error that cannot possibly occur.... without Murphy's Law intervening.


----------



## cfellows (Jan 2, 2014)

What Rod said.  I think I later removed the resistors because they didn't make any difference one way or the other.  The capacitor in their design was probably just reduce spurious noise, which, again, doesn't seem to be a problem.

 Chuck


----------



## ivanhoe161 (Jan 4, 2014)

Hello Chuck,

             sorry to bother you but I have nil experience with Arduino's, however I have managed to actually copy and paste the program into the Arduino uploader, but at the bottom of the attempted upload into the Arduino a message in red comes up on the bottom which says;

Liquid crystal does not name a type, 

and then under this, up comes 10 seperate lines' and a couple of these states,
sketch_jan04a:3:Liquid Crystal does not name a type.Then under this, again 
sketch jan04a.ino:in function 'void step (int)': and then another 8 of these sketch things with different messages. Could you help with what I'm doing wrong please ?. I do realise my age is against me , however I would love to get this up and running. Regards Ed Steel


----------



## vidio1 (Jan 4, 2014)

You have to add it to your Library....

http://arduino.cc/en/Guide/Libraries


----------



## ivanhoe161 (Jan 4, 2014)

Vidio1,

       after a lot of frustration and hair tearing out (didnt have much anyway ) I can report "SUCCESS"  and I would like to say thank you for pointing me in the right direction. 

Regards Ed


----------



## cfellows (Jan 5, 2014)

ivanhoe161 said:


> Vidio1,
> 
> after a lot of frustration and hair tearing out (didnt have much anyway ) I can report "SUCCESS" and I would like to say thank you for pointing me in the right direction.
> 
> Regards Ed


 
 So, Ed, how far along are you?  Have you actually finished the dividing head or just gotten the software to compile and run or ...?

 Just interested...

 Chuck


----------



## ivanhoe161 (Jan 7, 2014)

Hi Chuck, sorry I've been a little slow in replying. I have a large rotary table ( about 340 mm )with out any plates and I chanced upon this thread started by yourself and thought what a great idea !. While I had heard of the name "Arduino" I had absolutely nil experience with them as you probably gathered with my earlier question. I have bought a Geko 210x, a 48v 7.5 amp power supply and a 570 oz-in nema 24 stepper with a dual shaft and I will try to get it all working in the near future. I'ts not as easy these days as it used to be because my wife has the dreaded dementia and a lot of time is needed to look after her which limits my time to do things I like. This will be a fairly slow build because of that but I will keep trying, a bit at a time. I'ts possible I may have to ask other stupid questions in the future and I hope everyone understands. Regard Ed.


----------



## cfellows (Jan 8, 2014)

ivanhoe161 said:


> Hi Chuck, sorry I've been a little slow in replying. I have a large rotary table ( about 340 mm )with out any plates and I chanced upon this thread started by yourself and thought what a great idea !. While I had heard of the name "Arduino" I had absolutely nil experience with them as you probably gathered with my earlier question. I have bought a Geko 210x, a 48v 7.5 amp power supply and a 570 oz-in nema 24 stepper with a dual shaft and I will try to get it all working in the near future. I'ts not as easy these days as it used to be because my wife has the dreaded dementia and a lot of time is needed to look after her which limits my time to do things I like. This will be a fairly slow build because of that but I will keep trying, a bit at a time. I'ts possible I may have to ask other stupid questions in the future and I hope everyone understands. Regard Ed.



No problem, Ed.  Looks like you got all the materials you need.  I'm available for any questions, no matter how seemingly trivial.  I wouldn't say the Arduino is overly complicated, but, then again, I've worked in computers my whole life so my perspective is likely different from others.  You will probably want to make some changes to the software such as number of steps per revolution and maybe the stepper speed.  Happy to help when you come to that.

Chuck


----------



## ivanhoe161 (Jan 8, 2014)

Thanks Chuck , very much appreciated.

Ed


----------



## gld (Aug 5, 2014)

Something screwy going on with the math in this dividing head program. Hope you can explain.

I have a 200 step stepper connected to a Geckodrive 210 10micro step driver.
This makes 2000 steps per revolution.

My rt is 90:1   that's 180,000 steps per revolution.

Plug those number into the program for 1 division, and it comes out with 16608 steps.

With some experimentation, I found 30,000 for 1 division works, but 35,000 will show 30536 for 1 division.

:wall::wall::wall:


----------



## SixSixSevenSeven (Aug 6, 2014)

gld said:


> Something screwy going on with the math in this dividing head program. Hope you can explain.
> 
> I have a 200 step stepper connected to a Geckodrive 210 10micro step driver.
> This makes 2000 steps per revolution.
> ...


well he is currently using floating point math which could be the source of the issue (oh there are plenty of "fun" rounding errors in floating point math, never use it to track money, some bank tried that once and found that suddenly there was a defecit somewhere which eventually ended up being a floating point error). Otherwise I can't see any source for the error, and even if that was the case that is an unusually large floating point error.



Did occur to me that a good improvement for this setup would be to add encoder feedback. It would both solve the manual lock issue mentioned in some of the first pages (internal step counter incrementing when locked and causing you to start again, with encoder feedback the microcontroller would be aware of whether the step was successful or not) and just add some general position sensing feedback, if it started to move while being worked on then the motor could be stepped back or forth to counter.


----------



## cfellows (Aug 6, 2014)

The problem is I used integer types for many of the variables, never imagining that values greater than 32768 would ever be encountered.  Changing the variables to float seems to fix the particular problem you identified, but also seems to introduce some other issues.  It clearly requires some further testing and debugging with float variables to accept values greater than 32768.

Chuck


----------



## SixSixSevenSeven (Aug 6, 2014)

dunno how I missed that (probably to do with me using the specifically sized datatypes on microcontrollers and saving the plain short/int/long notation for windows and linux where an int is 32 bit not 16 as on arduino), switching to unsigned int or a long would alleviate that restriction.


----------



## rodw (Aug 6, 2014)

cfellows said:


> The problem is I used integer types for many of the variables, never imagining that values greater than 32768 would ever be encountered.  Changing the variables to float seems to fix the particular problem you identified, but also seems to introduce some other issues.  It clearly requires some further testing and debugging with float variables to accept values greater than 32768.
> 
> Chuck



Chuck, an unsigned long would be a better choice which can count to 4,294,967,295 which should be enough steps for most! I would try and avoid floating point maths altogether as it will bloat the code and slow execution times....

Also consider using casts in the maths eg

unsigned long x = (unsigned long) ((float) y / (float) z));

Other languages do type conversions for you but C is not forgiving in this regard so you have to tell it what you want.


----------



## Swifty (Aug 6, 2014)

I've thought about making an electronic dividing head for cutting gears, but I have not the faintest idea what you people are talking about. Obviously electronics are not in my field.

Paul.


----------



## cfellows (Aug 7, 2014)

I used floating point numbers in the calculations to get proper rounding.  Integers, unfortunately, just truncate making it hard to get repeatable results.  I wanted to make sure that advancing the specified number of divisions would end up back at the exact starting point.  I'm sure the code could be improved or expanded to make this work with a larger number of steps per revolution.

 Chuck


----------



## Blogwitch (Aug 7, 2014)

Swifty,

If you don't understand any of it, and have the cash, then this is what you need.

http://divisionmaster.co.uk/divisionmaster.html

I made mine from the kit with no real problems, just solder the components into the board and assemble as it says in the very good instructions, and it works perfectly.

[ame]https://www.youtube.com/watch?v=hWpVdQDV4fw&index=11&list=UUbmnXOvtxx1wUp4fFjFLsfA[/ame]

[ame]https://www.youtube.com/watch?v=P1ifPuImERA&list=UUbmnXOvtxx1wUp4fFjFLsfA[/ame]


----------



## Swifty (Aug 7, 2014)

Blogwitch, that's the kind of device that I need. I will look into it.

Paul.


----------



## n7gtb (Dec 11, 2014)

cfellows said:


> Here's some pictures of the dividing head. I've hooked it up to the arduino and it works. More than enough torque and holding power using the NEMA 23 motor. The ratio of the timing pulleys is 12 : 60 or 1:5.
> 
> <photos snipped>
> 
> ...



Hi Chuck,

I purchased a similar ER20 spindle (collet chuck?) that measures 0.788" (+ or - a half thou), and am looking for sealed bearings...which ones did you use?  I have a Timkin 204PP, but looks to be about 0.003" too small for the spindle shaft (or is this press-fit?)...

Thanks,
-Vern


----------



## Swifty (Dec 11, 2014)

Vern, that would be a 20.00mm shaft, so you will have to use metric bearings.

Edit. I just checked the bearing that you specified, 204PP, that's a 20mm bore. The bearing won't be .003" small on the ID, the shaft should fit that bearing.

Paul.


----------



## n7gtb (Dec 11, 2014)

n7gtb said:


> Hi Paul,
> 
> The info I have for the P204PP is that the ID is 20mm...(OD is 47mm)  Am I in error on this?  Ref: http://www.timken.com/en-us/products/Documents/Timken-Ball-Bearings-Catalog.pdf  (see p. 4)
> 
> ...



...so converting my inches measurement back to metric, I get a spindle diameter of 20.0152mm...  I don't know what tolerance should be for that item, but seems a bit large to me ... but then again, I'm also not used to working (or thinking) in metric.

Thanks,
-Vern


----------



## n7gtb (Dec 11, 2014)

Swifty said:


> Vern, that would be a 20.00mm shaft, so you will have to use metric bearings.
> 
> Edit. I just checked the bearing that you specified, 204PP, that's a 20mm bore. The bearing won't be .003" small on the ID, the shaft should fit that bearing.
> 
> Paul.



Hi Paul,

The info I have for the P204PP is that the ID is 20mm...(OD is 47mm)  Am I in error on this?  Ref: http://www.timken.com/en-us/products/Documents/Timken-Ball-Bearings-Catalog.pdf  (see p. 4)

Thanks,
-Vern

I just hit submit, and then noticed your edit...  Thanks for the clarification.   -Vern


----------



## Swifty (Dec 11, 2014)

Don't know what's going on, I have an ER20 straight shank holder and it measures 19.99mm Dia. May be worn a bit as I have used it a lot.

Maybe you have one that's slightly oversize, might have to polish it down.

Paul.


----------



## TorontoBuilder (Dec 11, 2014)

Swifty said:


> I've thought about making an electronic dividing head for cutting gears, but I have not the faintest idea what you people are talking about. Obviously electronics are not in my field.
> 
> Paul.



Haha I've felt the same way... I'm making really simple to follow plans for a control box. 

The plans will include precise parts list, a clear diagram and pictures for the wiring of a perma-proto breadboard (or perhaps custom PCB board) to hold the power supply regulator & power output to the arduino board, cooling fan, stepper driver, and a few capacitors. I've spec'd a variable output step up/down regulator to allow the box to be tuned to match requirement of stepper motor selected. all anyone needs to adjust is a multi-meter.

I'm basically only waiting for my arduino Uno R3 and LCD/keyboard shield to arrive so I can get the final assembled depth dimensions in order to finalize the laser cut box design. It's a pain since I wanted button extensions and have completely enclosed unit.

Once done I'll upload it. That way anyone can make one regardless of knowledge of electronics. 

I wonder if people would kindly post what torque motor they have been using, I can only find one affordable motor (~$50) thats 190 ounce/inch that's under the current limits of the driver chip. Otherwise its about double the price for a motor with greater torque under 2.2 amps per phase.


----------



## Swifty (Dec 11, 2014)

I bought a book on basic arduino, started to read it, but it's still sitting where I left it months ago. Must get back to it soon.

Paul.


----------



## goldstar31 (Dec 11, 2014)

Moi aussi- which is not French for I am an Australian


----------



## TorontoBuilder (Dec 11, 2014)

goldstar31 said:


> Moi aussi- which is not French for I am an Australian



me too... except there are so many great arduino instructions, videos and forums online it makes printed books superfluous. You just gave to dive in


----------



## goldstar31 (Dec 11, 2014)

I'm sitting with 4 pages of what seems gobbledegook with a little Arduino flashing. I'm supposed to have a sort of IQ which would get me into MENSA if I knew what it meant. 

In another world, I ran- amongst other things a Technical Library for a whole operational RAF station- which is now the RAF Museum-----and I am struggling.

Somewhere on my Kindle is Mrs Beetons world famous cookery book- which says if you want a roast pheasant the first thing to do is catch the poor thing. All the rest of it, like killing it is next. Frankly, I'm lost.

On another forum, I was asking for a bit of no-how and people whom I know as exremely clever engineers- full time and hobby have advised me to--FORGET IT.

On that thought?


Norm


----------



## TorontoBuilder (Dec 11, 2014)

Well Norm, if you want a dividing head out of your arduino wait till I post my plans and step by step guide. 

I've attached one screen shot of the proto-breadboard version to see how easy the electronics can be to make permanent board. 

I may even do a video.


----------



## goldstar31 (Dec 11, 2014)

Thank you but I've finally 'caught my pheasant' after N numbers of attempts and even a Proto-Pic book.

I've gathered a collection of Easy Drivers, Velleman VMA 03 things and a 3 NEMA23 HY200 2215 0150 AZ08 which have 8 windings.


The last do not identify( or seem to) with ANY other motors.

However, I must offer you my sincerest thanks and in the meantime Keep Looking East. That, I understand is where the last miracles came from-- and I missed them.

My Appreciation and Good Wishes

Norman


----------



## ozzie46 (Dec 11, 2014)

TorontoBuilder; 

Thank you for taking this on.  I'm eagerly awaiting the finished project. I too am wondering about the torque rating for the motor.

 Ron


----------



## n7gtb (Dec 11, 2014)

Swifty said:


> Don't know what's going on, I have an ER20 straight shank holder and it measures 19.99mm Dia. May be worn a bit as I have used it a lot.
> 
> Maybe you have one that's slightly oversize, might have to polish it down.
> 
> Paul.



After about an hour of working it down with 180 and 320 grit abrasive, the bearings now fit snugly.  The local supplier didn't have the Timkens in stock (I only had one to begin with), but did have SKF equivalents, and at about half the cost.  Part number ( if anyone is interested) is 6204 2RSJEM ...

-Vern


----------



## harrzack (Jan 16, 2015)

Here is a link to yet another version of an Arduino based index head

I have a little different "user interface" - the way of entering the steps, degrees and such.  I'd like to hear/see how yours performs under the mill... I'm haven't fully tested mine yet and am wondering if the steppers will give the needed accuracy for (light duty) gear cutting.

=Alan R.


----------



## goldstar31 (Jan 16, 2015)

Just an update to trying to get Arduino to load on my old Vista laptop.#

I've finally done it-after re-installing etc several times using Internet Explorer.

I changed to Firefox- and all simply loaded. For some reason, I now have Ports showing in the Control Panel.

More anon- I hope.

Meanwhile, my thanks to those who took time to assist me.

Cheers

Norman


----------



## chucketn (Jan 16, 2015)

harrzack said:


> Here is a link to yet another version of an Arduino based index head
> 
> I have a little different "user interface" - the way of entering the steps, degrees and such. I'd like to hear/see how yours performs under the mill... I'm haven't fully tested mine yet and am wondering if the steppers will give the needed accuracy for (light duty) gear cutting.
> 
> =Alan R.


 
I have just ordered an Arduino Uno R3, Pololu Driver, 1602 LCD shield, and another kit to build a drive setup for my Vertex RT. Very interested in your version. Been looking at your website. Very nice...

Chuck


----------



## RonGinger (Jan 16, 2015)

Alan, I like your interface using the rotary encoder, that is very well done.

You make some comments about the indexer working with a small step motor and that the heavy indexers of the past are not needed. You may need to test that a bit- your stepper motor must resist the cutting forces and I suspect they may be a god bit larger that you think. if youused a rotary table with a worm gear and drive the worm by a stepper then you can use a small motor because the worm will lock the table against rotation. You may have trouble with a simple belt drive to a shaft.


----------



## goldstar31 (Jan 17, 2015)

I've a Vertex BSO dividing head that can be tilted into a sort of dividing head. Yea, Ive a couple or three but the Vertex has some nicer features. I was cutting a 10" radius( for a Stent t&C) and boy oh, boy, did it move. 

Food for thought, eh?

Cheers

Norman


----------



## TorontoBuilder (Jan 17, 2015)

harrzack said:


> Here is a link to yet another version of an Arduino based index head
> 
> I have a little different "user interface" - the way of entering the steps, degrees and such.  I'd like to hear/see how yours performs under the mill... I'm haven't fully tested mine yet and am wondering if the steppers will give the needed accuracy for (light duty) gear cutting.
> 
> =Alan R.



Nice work Alan. I had wanted to use a rotary encoder on my project but thats too much learning for my first attempt... the addition of divisions and jog functions is great... will you post some arduino code so people can learn more from your project?

John


----------



## cfellows (Jan 17, 2015)

The user interface using a rotary encoder and 8 segment display units is pretty slick.  I've thought about using a rotary encoder with included push button switch for setting values and selecting menu options.  

I would point out, however, that the electronic circuitry and Arduino programming required for this model is considerably more complex than is required for a simple Arduino dividing head.  I mention this only because I would hate to see folks pass up a very useful and fun project thinking it's beyond their capability.

This is the circuit I originally built...







And the sketch (Arduino Program) is attached below.  This is about as simple as you can get and still have pretty good functionality.  The program could  be changed to include degree functions or other changes.  It's also a good platform for learning more about how to program the Arduino.

By the way, module to the left is a Sainsmart LCD keypad module (shield) that plugs in on top of an Arduino UNO

Chuck 

View attachment dividing_head.zip


----------



## TorontoBuilder (Jan 17, 2015)

ozzie46 said:


> TorontoBuilder;
> 
> Thank you for taking this on.  I'm eagerly awaiting the finished project. I too am wondering about the torque rating for the motor.
> 
> Ron



I have an update for you. I wanted to design a divider head controller that is as universal as possible and would be pretty much plug and play to allow for different power supplies and stepper motor voltages.

My brother and I also have issues with our hands so I wanted bigger actuator buttons, and I thought lighted buttons would be nice, so I created a "break out board that would allow easy attachment of buttons to any case people wanted to make. This solution also allows greater clearance from the LCD screen, and solves issues with the height differential between the buttons and screen which makes mounting difficult.

I also designed my own Arduino board to allow for the voltage input to best match the stepper motor requirement (any input voltage between 5V-36V is acceptable). There are two voltage regulators drive the other components such as the lighted buttons, the cooling fan, the power indicator and of course the arduino control itself. 

Onboard connectors allow for easy plug in attachment of a two or 4 line LCD display, the button break out board, the stepper driver carrier, 5V regulator, power switch and LED power indicator. 

Once I have the system tested I'll be making the pcb source code available on OSH Park.com.


----------



## TorontoBuilder (Jan 17, 2015)

cfellows said:


> The user interface using a rotary encoder and 8 segment display units is pretty slick.  I've thought about using a rotary encoder with included push button switch for setting values and selecting menu options.
> 
> I would point out, however, that the electronic circuitry and Arduino programming required for this model is considerably more complex than is required for a simple Arduino dividing head.  I mention this only because I would hate to see folks pass up a very useful and fun project thinking it's beyond their capability.
> 
> ...



My sentiments exactly Chuck... which is why I wanted to take the next step and make it even easier for people to take advantage of your work...


----------



## TorontoBuilder (Jan 17, 2015)

In case anyone is interested I've attached my prototype schematics & pcb board layout drawing for an arduino compatible microcontroller optimized to run a stepper motor and sketches such as Chuck Fellows electronic indexing head. 

This smaller than normal controller has headers for plug and play 20x4 or 16x2 LCD displays, and an LED lighted 5 button break out board, and the main Arduino ATmega 328PU controller board. 

NOTE: try these now at your own risk since I havent yet assembled a test circuit.

Comments are very welcome.

In addition to these boards the controller will require two pololu parts, 
1. Pololu 5V, 500mA Step-Down Voltage Regulator D24V5F5
2. A4988 Stepper Motor Driver Carrier, Black Edition 

Once I get the schematic verified and tested I'll modify the circuit to include a slightly bigger board option that has jumpers to adapt the system to use any of the following Pololu stepper carrier boards which have slightly different voltage input configurations.

   DRV8825 Stepper Motor Driver Carrier, High Current or;
   DRV8824 Stepper Motor Driver Carrier, Low Current or;
   DRV8834 Low-Voltage Stepper Motor Driver Carrier

Attachments one, 
button schematic and break out pcb board
main board schematic and pcb board


----------



## Wizard69 (Jan 18, 2015)

harrzack said:


> Here is a link to yet another version of an Arduino based index head


Fresh ideas are always nice.  


> I have a little different "user interface" - the way of entering the steps, degrees and such.


Very nice minimalist interface.    The only thing I might suggest is a forward and reverse push button.   Of course then you have to deal with backlash.  


> I'd like to hear/see how yours performs under the mill... I'm haven't fully tested mine yet and am wondering if the steppers will give the needed accuracy for (light duty) gear cutting.
> 
> 
> 
> =Alan R.




Accuracy will depend a great deal on the ratio between the motor and the spindle on the indexer.   Think of a manual indexer with dual worm gear reduction of other methods to make each "step" fine.  In the end your stepper will have 200 full steps to work with or 1.8 degrees per step.  Micro stepping might cut that by a fourth reliably.   For many gears that will be too course.  

As for testing yours, the thing to consider is the ability to withstand or lock against cutting forces and the torque they may introduce.  Obviously that depends upon many factors, but in this case you have a light duty indexer.   That doesn't mean much as you can use the same electronics to drive a spindle via a worm reduction, use a bigger motor, brake or whatever.


----------



## n7gtb (Jan 18, 2015)

cfellows said:


> The user interface using a rotary encoder and 8 segment display units is pretty slick.  I've thought about using a rotary encoder with included push button switch for setting values and selecting menu options.
> 
> I would point out, however, that the electronic circuitry and Arduino programming required for this model is considerably more complex than is required for a simple Arduino dividing head.  I mention this only because I would hate to see folks pass up a very useful and fun project thinking it's beyond their capability.
> 
> ...



Here's a couple of photos of my version.  One mod I would make to mine, is to reduce the distance from the stepper to the spindle.  Other than that, it's nearly the same.  I used a 400 step motor, and a 4:1 ratio of the pulleys...  As Chuck mentions, this really was a simple build...er, well at least where the electronics were concerned.  In my case, the machine work was the challenge!


----------



## n7gtb (Jan 18, 2015)

TorontoBuilder said:


> In case anyone is interested I've attached my prototype schematics and pcb board layout drawing for the lLED lighted button break out board, and the main Arduino ATmega 328PU controller board.
> 
> NOTE: try these now at your own risk since I havent yet checked the values for the switching regulator & inductor circuit or yet assembled a test circuit in a breadboard for a test.
> 
> ...



Nice work TorontoBuilder!  If time allows, I may try your circuit(s).  I'm in the process of building up a second controller using a Texas Instruments MSP430 micro...using a launchpad and will add a bluetooth module.  That way, the display can be an android device (just thinking aloud here).

Regards,
-Vern


----------



## TorontoBuilder (Jan 18, 2015)

Hey Vern, dont use what I posted... I came up with simpler pcb layout and cheaper voltage reg. I'll post new design soon.


----------



## miller1nz (Feb 7, 2015)

Hi Chuck, I was mightily impressed with the way you put this together and so I built one for my Vertex 4".
The only issue I have is the size of the buttons on the 1602 display.Can you please advise how to rewire to a Matrix type keyboard or momentary switches.
Thanks and regards
Miler1


----------



## TorontoBuilder (Feb 7, 2015)

miller1nz said:


> Hi Chuck, I was mightily impressed with the way you put this together and so I built one for my Vertex 4".
> The only issue I have is the size of the buttons on the 1602 display.Can you please advise how to rewire to a Matrix type keyboard or momentary switches.
> Thanks and regards
> Miler1



Hi Miller

I had the same issue with the 6mm switches, they are tiny especially for people like me with joint issues. But there are options. 

IF you are comfortable soldering you can remove the the switches and solder in new ones with taller shafts. That still doesn't help much though, so you could design a keypad with 12mm switches, or go the route I did and design a keypad with wider spacing and wide switch caps.

I have a thread on my efforts to make a few improvements on Chuck's great work.

http://www.homemodelenginemachinist.com/showthread.php?t=24036


----------



## chucketn (Feb 8, 2015)

I have successfully configured a 4x4 matrix membrane keypad to input a 3 digit number. I will work on adding that code to Chuck F's version. Also waiting on another display with a serial interface. My goal is to be able to add # of divisions without having to push a button # times.
I will complete Chuck F's version, and set up another to experiment with my 'improvements'.

Chuck


----------



## cfellows (Feb 8, 2015)

As a matter of interest, this is an alternative setup I had for a while...






It used an Arduino Nano and a stand alone LCD display.  For input, it had an infrared sensor and I controlled it wirelesslely with a keypad like this:






It used cursor control, much like the keypad version, but the buttons are bigger and I was able to have the arduino and stepper controller assembly sitting on a shelf and control it with the remote.  The problem I had with it was that I sometimes had to press a button 2 or 3 times for the sensor to recognize it and there was always a bit of a delay which I didn't care for.  If I had worked with it, I probably could have improved it to the point where it was OK, but, being a bit impatient, I went back to the keyed version.  However this infrared setup might be of interest to others.

Chuck F.

Edit:  Here is a photo of the completed unit and remote.


----------



## cwebs (Feb 8, 2015)

miller1nz said:


> Hi Chuck, I was mightily impressed with the way you put this together and so I built one for my Vertex 4".
> The only issue I have is the size of the buttons on the 1602 display.Can you please advise how to rewire to a Matrix type keyboard or momentary switches.
> Thanks and regards
> Miler1


 This is the button pad that I used. It will solve all your problems. Buttons are bigger and you can use blue and/or yellow caps on the buttons. Spacing is a little bigger and it uses the same resistor voltage devider. Simple three wire hook up.   http://yourduino.com/sunshop2/index.php?l=product_detail&p=334

Let me now what you think. Carl


----------



## TorontoBuilder (Feb 8, 2015)

cwebs said:


> This is the button pad that I used. It will solve all your problems. Buttons are bigger and you can use blue and/or yellow caps on the buttons. Spacing is a little bigger and it uses the same resistor voltage devider. Simple three wire hook up.   http://yourduino.com/sunshop2/index.php?l=product_detail&p=334
> 
> Let me now what you think. Carl



Nice Carl. Had I only known I'd not have designed my own.


----------



## darkoford (Feb 9, 2015)

Great topic! Thm:

For the test I used parts of keys from old electronic devices.






G]​
Red key = Reset

I think the Arduino keys too small for any practical use. When all device buttons that I plan to use will be these:


----------



## panamaritch (Feb 23, 2015)

Chuck,
I have copied your sketch  However it only runs one direction.  I'm using uno wih the Sainsmart shield and a tb6560 driver.  Your picture seems to show you using pins 3 and 4 although the sketch says pins 2 and 3.  I have EN-, CW-, and CLK- going to ground.  Could you help me with the hookup for the CW,EN, and CLK   
I appreciate any help you can give me.  I'm going to adapt this to a 5c spin indexer.
Thanks

Ritch
[email protected]


----------



## cfellows (Feb 24, 2015)

I'm not familiar with the details of the TB6560.  Does your TB6560 look like this one?






If so, pin 2 of the Arduino should go to CW+, which sets the directon, and pin 3 of the Arduino goes to CLK+, which causes the motor to move 1 step. The EN+ is connected to +5v.  The sketch must first write a 1 or a 0 to Arduino pin 2.  This just sets the direction of spin.  Then the sketch must write a 1, delay a few milliseconds, then write a 0 to arduino pin 3, instructing the stepper to move 1 step.  

Let me know if this works.

Thx...
Chuck


----------



## panamaritch (Feb 27, 2015)

Chuck,

That is exactly what I am using.  I copied your text sketch and followed your posted picture.  CLK goes to pin 4 and CH goes to pin 3.  After the hookup, everything works as it should.  Thanks for the help.

Ritch


----------



## Donrecardo (Nov 24, 2015)

Hi Chuck

I want to use your design as a simple dividing head but also use it on my
rotary table.
Problem is its a 90:1 worm drive so with a 200 step motor thats far to many steps to
wait for  (18000).
Can you see any problem by going the opposite way to how you did it and where you used 1:5 gearing on your dividing head  to give you  200 X 5 = 1000steps I could use 
say 10:1 with the larger gear on the stepper and the smaller on the end of the worm drive to give me 200 /10 X 90 = 1800 steps which although still a lot is
sure better than 18000

Don


----------



## cfellows (Nov 25, 2015)

Donrecardo said:


> Hi Chuck
> 
> I want to use your design as a simple dividing head but also use it on my
> rotary table.
> ...



Hi Don,

The biggest issue with your idea is the amount of torque required of the stepper.  You'd almost certainly need a larger stepper motor and controller to drive the rotary table through that kind of gearing.

Chuck


----------



## rodw (Nov 26, 2015)

The Arduino can easilly manage 18000 pulses per revolution. The stepper controller I used on a 90:1 rotary controller was a 10x microstepper so I run at 180,000 steps per Rev using my code which is published elsewhere on this forum. I don't see any reason that Chuck's code can't keep up as I did some testing with similar code. In my experience, the maximum speed will be about 4 rpm (limited by the stepper motor, not the gearing or stepper controller unit) but I have  milled circular slots at this speed and it was fine.

In relation to torque, this is related by the voltage you use to drive the stepper motor. I  was missing steps at  19 volts on a small 1.5" long NEMA23 (laptop power supply). I purchased a new NEMA23 stepper motor double the length and a 48V power supply.  With the higher voltage power supply, I still to this day have not needed to use the larger stepper motor as the added voltage fixed the issue. I reccommend you check your stepper motor specs and choose the correct voltage power supply.

Finally, I will say that best practice is ramping up to speed rather than operating at a fixed speed right from the start like Chuck's code does. This allows you to start moving within the stepper motor's maximum torque range so you can do more with less (to get over the initial inertia on startup). Experimentation is required to set the correct ramp up speed range. My sketch allows you to do this without recompiling.

Rod


----------



## Donrecardo (Nov 26, 2015)

Thanks Chuck and RODW

I had worried about the torque needed for the higher gearing and also the holding torque  needed to stop the work backing up which is why I posted 
to ask advice 

but with regards to Chucks advice , I wasnt planning on using the pololu drivers as  I
 have several MSD 542 drivers ( 4.2Amp ) so can easily use a stepper with a higher torque such as the double length Nema 23s that I have and I do have 24 and 48 volt PSUs so I suppose I could still use the revese gearing if I choose to go that way

and to RODW . it was the ability of the arduino to provide pulses fast enough that concerned me . I assumed that sending 18000 pulses would take forever although thinking about it , most of the time I would use the unit to cut gears so would only be moving a fraction of a revolution each time and therefore it would be far less pulses sent . I will have a look for your code as the ability to use accleration is good . 
In the past I have tried starting a stepper at high speed and had skipping  but starting slower and accelerating did work

Thank you both for the replies . I will have another think about it 

Ultimately I would like to put an encoder on the mills spindle to control the speed of the rotary table and be able to hob gears . I once saw a post from John Stevenson about doing this so will have to have a look for it again

Don


----------



## Donrecardo (Nov 27, 2015)

A quick question for rodw

When you used your code with the 90:1 rotary table what gearing did you use between
the stepper and the RT ? was it still 5:1 like Chuck uses or was it just a direct 1:1 drive

Don


----------



## rodw (Nov 27, 2015)

Donrecardo said:


> A quick question for rodw
> 
> When you used your code with the 90:1 rotary table what gearing did you use between
> the stepper and the RT ? was it still 5:1 like Chuck uses or was it just a direct 1:1 drive
> ...



I used a straight 1:1 connection for my rotary table. You can see below, its a pretty small NEMA23 and I have a NEMA17 that has almost identical torque.







The Arduino is capable of 8,000,000 pulses per second. It has a 16 Mhz clock so its timer interrupt is called 16,000,000 times per second and a complete on/off cycle requires two clock cycles.

I don't want to take anything away from Chuck's work as he was the inspiration for me to do this and I got carried away building a better mousetrap because with what I wanted to do, I wanted to use interrupts which is the most efficient way to generate pulses.

I played with the Polou. It can handle 35 Volts but only  2 amps which in turn requires a heatsink mounted on the driver chip and if it gets too hot, it shuts down. Having said that, heaps of people have used them for Rotary Tables.

I read that doubling stepper input voltage quadruples torque. I'd try and run a Polou around 28-30 volts but  24 volts might do the trick.


----------



## cfellows (Nov 27, 2015)

One quick clarification to what rodw said... higher voltage only improves torque when the motor is turning.  It does not increase holding power when the stepper motor is stalled.  Torque is controlled by current (amps), so at a dead stall, voltage plays no part in torque at all, particularly since the stepper controller usually limits the current to a preset value.  When the stepper is turning, it is generating a counter EMF to the supply voltage.  So the faster the stepper is turning, the higher the counter EMF, which decreases the current, which decreases the torque.  Thus, using a higher supply voltage keeps the current higher as the stepper motor speed increases.   

So as rodw correctly states, usually increasing the supply voltage will increase the maximum speed and the amount of torque when the stepper is turning.

Chuck


----------



## Donrecardo (Nov 28, 2015)

Thanks both for the excellent answers 

It was just after asking Rod if it was direct drive that I felt a bit silly because
I realised that with 90 : 1 on the RT  . 10 micro steps and a 200 step motor 
using 180,000 steps had to be direct drive , the maths prove it to be so 

As I said in an earlier post I wont be using a Pololu type driver , I have some 
MSD 542s which will handle 50v @ up to 4.2 Amps , I will probably use 
24v the same as I did on my cnc router but I have 48v PSUs too if needed 
The drivers have 15 different microstep rates form  2 to 128 and 5 to 125.
They also have the ability to cut the power to 60% if they receive no pulses for
more than 1 second , That helps the motors to stay cool
I will try to attach a data sheet of the driver 

Don 

View attachment msd542-microstepping-driver.pdf


----------



## mikejr0046 (Feb 14, 2016)

I get "mismatch byte 0x000   0x!=0v0c
Avrdude verification error:content mismatch


----------



## rodw (Feb 15, 2016)

mikejr0046 said:


> I get "mismatch byte 0x000   0x!=0v0c
> Avrdude verification error:content mismatch



Sounds like you have a config error in your environment, go back to basics and see if you can compile and run the simple starting sketches like hello world. 

There have been enough people running this code to know its not a problem with this code.


----------



## mikejr0046 (Feb 15, 2016)

Found the problem, uno was bad..


----------



## Duncan.e (Nov 30, 2016)

Hi all,

I have just recently come across this thread and am keen to make myself a setup, based on Chuck's great work.  I have the Arduino, LCD shield, and driver module on order...  

Somewhere, I have some stepper motors, but I have no idea where they are at the moment, but I'll dig them out soon...

My question is to do with the software... Chuck's software is designed to work with two options, a 1000 step for the dividing head and 14400 for the RT.  If I wanted to add a third option for say a 40 turn dividing head, would I just add a line to the code like this?

_Existing code:_
#define stepperDiv 1000.0  // Stepper Resolution
#define rotaryDiv 14400.0  // Steps for 72 turn rotary table

_Modified code:_
#define stepperDiv 1000.0  // Stepper Resolution
#define rotaryDiv 14400.0  // Steps for 72 turn rotary table
#define dheadDiv 8000.0   // Steps for 40 turn dividing head - all assuming a 200 step stepper motor...

Then modify the following code:

_Existing code:_
void setup()
{
 lcd.begin(16, 2);  // start the library
 do 
 {
   lcd_key = read_LCD_buttons();
   if( lcd_key == btnUP ) numSteps = stepperDiv;
   if( lcd_key == btnDOWN ) numSteps = rotaryDiv;
...

_Modified Code:_
void setup()
{
 lcd.begin(16, 2);  // start the library
 do 
 {
   lcd_key = read_LCD_buttons();
   if( lcd_key == btnUP ) numSteps = stepperDiv;
   if( lcd_key == btnDOWN ) numSteps = rotaryDiv;
   if( lcd_key == btnDOWN ) numSteps = dheadDiv;
...

The idea is that I can select either the stepperDiv by default, or by successive presses of the button, select either the rotaryDiv, or the dheadDiv.  Pressing the up button should return to the top of the list.

I'm reasonably confident about the first code mod, but not at all sure about the key reading part... I should have learnt to program years ago, but now I can't figure it out. :wall:

Assuming this is correct (which I doubt), would this then give me the option to select whichever of the three options I want to use? And, assuming I could add more options, is there a limit?

Thanks in advance.

Best regards,

Duncan


----------



## Cogsy (Nov 30, 2016)

By the looks of that code, you've only read the button once and assigned it's value (up or down) and you're then evaluating the IF statements in order. In the case of a down value, the first IF will be false and not executed but both of the following IF statements will execute as they are both true. So this would set numSteps = dheadDiv (overwriting numSteps = rotaryDiv which is selected first) every time the button read is down with no way to select rotaryDiv.

Just looking at that small snippet of code, I'd guess you'd need to implement a counter variable and increment/decrement it with each button press to have more than 2 options. With a counter you could add as many options as you want.


----------



## Duncan.e (Dec 1, 2016)

Thanks guys, 

I guess I have some experimentation ahead of me - and a steep learning curve! 

The trouble is that this sort of coding is all gobbledegook to me.  I can code CSS and html, so I should be able to get my head round this, but none of it makes sense at the moment.  When I have the hardward set up and working with the existing code, I'll work something out, probably by trial and error....

Thanks again

Duncan


----------



## rodw (Dec 1, 2016)

If you are not much into programming, this is an alternative that saves all of the config in EEPROM permanent memory and provides a setup menu to let you configure it to suit your hardware without touching any code.

http://www.homemodelenginemachinist.com/showthread.php?t=25091


----------



## cfellows (Dec 1, 2016)

Duncan, the code is set up to toggle between one of two options.  Trying to implement more than 2 options is going to require pretty substantial changes to different parts of the program.  Obviously the simplest change to use your 40 turn table would be to replace the 14400.0 value with your 8000.0 value.

Chuck


----------



## Duncan.e (Dec 1, 2016)

Once again thanks for the response guys.  

I'm sorry, but the code in your message RodW is meaningless to me at this time.  Chuck, I can more or less follow your code - I don't yet understand it,  but I'll use it for now.  

It's important to me to be able to have an idea of what the code is doing, even if I don't fully understand it!  I will try to understand the code in due course, but I'm not sure I will be able to...  I should explain that I had a minor stroke earlier this year and, while I'm ok, I find it difficult learning new things - that and I'm not as young as I could be 

Questions for Chuck please;  

I have a 40:1 dividing head and a 90:1 rotary table, so can I put in the values of 8000.0 and 18000.0 without changing anything else?  

In other words, can I just amend the two lines as shown?

#define stepperDiv 8000.0 // for 40:1 dividing head - _could I change stepperDiv to dhDiv, or dividingheadDiv?_
#define rotaryDiv 18000.0 // for 90:1 rotary table

I presume that it doesn't matter which value I put first.  It will, if I understand it correctly, default to the value entered on the first line, requiring a down button action to select the alternative value. Am I right?

Thanks again!

Duncan


----------



## rodw (Dec 2, 2016)

Duncan.e said:


> I have a 40:1 dividing head and a 90:1 rotary table, so can I put in the values
> 
> #define stepperDiv 8000.0 // for 40:1 dividing head - _could I change stepperDiv to dhDiv, or dividingheadDiv?_
> #define rotaryDiv 18000.0 // for 90:1 rotary table
> ...



Duncan, nothing wrong with Chucks soultion.

A #define in C is simply a way to write understandable self-documenting code. Statements on a line commencing # is an instruction to C's precompiler and does not generate any CPU instructions. So whenever *stepperDiv* is in the code, it will be replaced by 8000 or 18000 depending on the value when executable code is generated.

But where do these numbers come from is what you need to ask on your path to enlightenment!

Most stepper motors take 200 pulses (steps) per revolution but this is not always the case. You do the maths but you will see why they are referred to 1.8 degree steppers if you divide 360 by 200. Some steppers are 0.9 degrees.

So if you have a 90:1 worm drive, it is going to take 90 turns of the motor to turn the table 1 revolution or 200 x 90 pulses = 18,000

So with your 40:1 worm drive 1 revolution will require 40 x 200 pulses = 8,000 pulses.

The other parameter that comes into play is if your stepper controller is microstepping. The Gecko 251x is a popular example. It is a 10x microstepping controller so it takes 2000 pulses to turn the stepper motor one revolution.

So if you were using one of these stepper controllers, you would need to multiply these values x 10 to get
90:1 180000
40:1  80000

So back to the C world, by convention #defines are shown as upper case to make it clear they are not variables. I would prefer to set defines like this:

#define STEPPER_STEPS 200  //200 steps per revolution drive
#define WORM_DRIVE 40       // 40:1 worm drive
#define MICRO_STEPS 10        // 10 x microstepping ( 1 if no microstepping)
#define STEPS_PER_REV  STEPPER_STEPS * WORM_DRIVE * MICRO_STEPS

So now all you have to do is fill out the variables and C does the calculations for you. Just use  *STEPS_PER_REV* instead of *stepperDiv *and when you revisit the code or share it with somebody later it is 100% clear what is going on.

One day you will understand my code if you play with C long enough. It is complex, but clear and concise. The very first version I posted does it all in 200 lines of code. Then I got carried away..... The flip side is the user does not need to change any code.....


----------



## xpylonracer (Dec 2, 2016)

Hi RodW
Wasn't there a problem encountered with counting such large numbers of pulses? something about "rounding" number of steps or pulses ?
Perhaps this was only in Chuck's original sketch. 

xpylonracer


----------



## cfellows (Dec 2, 2016)

Duncan.e said:


> Once again thanks for the response guys.
> 
> ..... (deleted)
> 
> ...



You are correct.  Simply changing the two values will make the program work with your dividing head and rotary table.  You can change the names to something more meaningful to you, just be careful to change those name in all parts of the program that reference them.  My approach to programming, after 50+ years off and on, is to change the program as little as I can get away with to make it do what I want.  

There are some things in the code that may not be clear.  For example, the math had to be worked out to ensure that rounding errors would cancel out as the spindle or table turns.  In other words, I had to be sure that one full revolution would always return to the starting point.  I'll take a look at the code to see if I can add some comments which might make it easier for you to understand.  I do love programming and try to keep it as simple as I can, mostly so I can go back a week or two later and understand what I was trying to do! 

Chuck


----------



## Duncan.e (Dec 2, 2016)

Thanks Chuck!  Your help is appreciated, as are the comments from other members...  :thumbup:

One more question - or maybe a few...

I want to be able to cut gears up to 127 teeth - Boxford Imperial to Metric screw cutting conversion...  

Can you, or anyone, suggest how many steps I need in 360 degrees to achieve this accurately?  

You stated in your earlier posts that with 1000 steps you should be able to accurately handle 30 divisions, so would 4000 steps get me to 127 divisions? Can this be achieved by microstepping?  If I use a 5:1 gear reduction like you are using and ¼ steps?

Alternatively, I have been looking at Nema 23 motors with epicyclic gearboxes and can get 15:1 and 27:1 easily - and reasonably priced.... Do you think one of these would be better, with direct drive to the spindle? Holding torque would not be an issue with such reduction gearing...

I'm not worried how long it takes to rotate from one position to the next, it's not a quick job turning the handle and ensuring the right number of holes are advanced each time on my dividing head - and it's all too easy to make a mistake! 

This is all new to me, so I apologise for all the questions....

Duncan


----------



## rodw (Dec 3, 2016)

xpylonracer said:


> Hi RodW
> Wasn't there a problem encountered with counting such large numbers of pulses? something about "rounding" number of steps or pulses ?
> Perhaps this was only in Chuck's original sketch.
> 
> xpylonracer



I think in Chuck's original code, he may have used floating point maths which can result in rounding errors. I don't use floating point maths. Instead I reduce all angles to seconds of a degree so 360 x 60 x 60 = 1,296,000 divisions in a circle. That way rounding results in +- 1 second of a degree.

Accuracy is dictated by the number of steps your stepper takes and your final drive ratios. Microstepping increase resolution to a certain extend but if you are microstepping (I can use 40 x microstepping with LinuxCNC, or 8000 steps per rev) but that does not mean that I can achieve accuracy of 360/8000 of a degree. Do your own maths to determine what angle you can do per step.

I would look carefully at the gearboxes you are considering, unless you spend a few hundred $, the backlash is around 1.5 degrees. You will get less backlash with a timing belt and there are plenty adding them to rotary tables. Heres a 3:1 I've built for a pinion drive.


----------



## DICKEYBIRD (Dec 3, 2016)

Duncan.e said:


> I will try to understand the code in due course, but I'm not sure I will be able to...  I should explain that I had a minor stroke earlier this year and, while I'm ok, I find it difficult learning new things - that and I'm not as young as I could be


Sorry for the thread drift as I'm not building an Arduino dividing head (yet) but I do read everything that Chuck writes.:thumbup:

Duncan I'd say you're doing great with your stroke recovery and this sort of mental/physical exercise is just what the doctor ordered.  I too suffered a stroke just over a year ago and am so fortunate to get back to where I was before it happened other than subtle changes in memory and occasional bouts of tongue-tiedness & frustrating clumsiness.  I'll take it though as a year ago this post would have taken at least an hour to finish and brushing my teeth consisted of using two hands to hold the brush still and nodding my head up & down clumsily against it.  I almost totally lost the use of my right arm & right leg and talked like a drunk.

Best of luck to you in your recovery and keep on doing what you're doing in the shop; it's the best therapy!:thumbup:


----------



## cfellows (Dec 3, 2016)

Duncan,

The accuracy depends on the number of motor steps it takes your spindle to go one full revolution, regardless of your calculating method.  My code does use floating point, but because of the way I recalculate each spindle position from the origin, the errors even out.  It's never off by more than +/- half a step relative to the origin.  See the attached spread sheet which shows the stepper positioning my software would provide.

If you have 4000 steps and want 127 gear teeth, you'd ideally want 31.496 steps per division.  My code would round down to 31 steps for the first tooth, then round up to 63 steps (from orgin) for the second tooth, etc.  This ensures that the error is never more than +/- 1/2 step or 1/8000th of a turn, in your case, per tooth relative to the origin.  For example, if your gear is 3 inches diameter which is about 9.5 inches circumference, the angular displacement of a tooth would be no more than .00118 inches.  I would consider this acceptable, but others may differ depending on the application.  

Half stepping would double your accuracy. Quarter stepping would quadruple your accuracy, etc.  I believe the A4988 stepper driver can go up to 16th step microstepping through the use of jumpers.  These are well documented on the internet and I can help if you want to go this route.

Chuck 

View attachment StepperMath.xls


----------



## Duncan.e (Dec 3, 2016)

Once again Chuck, thank you!

I have had a change of mind. I was going to make a dividing head like yours, but for simplicity, I have decided to convert my Tom Senior dividing head - 40:1 ratio.

I had a good look at it yesterday and it's very easy to convert.  In fact, I have done most of the conversion work today.  I just need to make the coupling between stepper motor and the dividing head shaft...  This means I will have 8000 steps per revolution of the dividing head, or more if I use micro-stepping...  Any recommendation for micro-stepping, or not to?

The 127 tooth gear I want to cut is 18DP, so will be just over 7" in diameter, which was a factor for deciding to use my existing dividing head as it will take a 7.5" blank for cutting.

Thanks for the explanation and spreadsheet for stepper positioning, I will look at the code and hopefully will be able to make more sense of it, with the spreadsheet info...

On that subject, where do I find the latest version of the code?  I have found two different versions, but do not know which is the most current.

I received my Arduino and LCD Shield today, so am very keen to try them out, but I'm still waiting for the driver board.... 

One final question, I have been given a stepper motor, part number HY 200 2220 100. This is an 8 lead motor rated at 1A current, voltage up to 75V, with holding torque of 69Ncm (98 oz/in, 9.99kg/cm) in bipolar mode. With the 40:1 worm drive, I'm confident the holding torque will be more than sufficient, but I'm not sure the motor will be powerful enough to turn the head...  I know I can try it and find out, but I'm wondering if you could offer an opinion?

Thanks again!


Dickeybird,  Thanks for your kind words.  Fortunately my stroke just left the left side numb for a day or two, but I am left with a permament lack of sensation on the left side of my head.  I too have notice a subtle change in memory and lose words sometimes.  And, I understand the clumsiness, my balance is very poor now...

I will not give in to it though and am doing as much as I possibly can, but am aware I have limitations...

Good luck!

Duncan


----------



## cfellows (Dec 3, 2016)

Duncan, I don't really think microstepping is necessary.  You certainly don't need it for accuracy.

I think the version of software on this website is the newest that has the option for two different devices.  I have a newer version that is only designed for a single device, dividing head or rotary table.  

I don't believe the stepper motor you've described is beefy enough to spin the dividing head reliably.  However, it wouldn't hurt to try it.  The A4988 stepper driver will handle current up to about 2 amps with a heat sink, although that's pushing it.  There is an adjustment available on the A4988 which lets you limit the current.  Also, I believe the A4988 is rated up to 35 volts, although, again, that would be pushing it.

Chuck


----------



## Foozer (Dec 4, 2016)

That was fun - Wanted to see your [cfellows] program in action, well at least as far as my little cigar box will allow. Had to do a little change over to use momentary switched in lieu of the voltage divider sainsmart uses. Bumped the read button delay up to 250 from 200 so I didn't get a double position move.

Once I got it, l Liked that passing of the direction var e.g. step (1); you did - So I learned something new . . . .


----------



## cfellows (Dec 4, 2016)

That's a tidy arrangement you have there, Foozer.  I like it!

Using functions with passed variables is a good way to keep your software modular and easier to follow.  In my early days of programming (many, many years ago), programming was all done in pretty much linear fashion so programs got complicated quickly.  Many a time I spent the first half of my work day trying to figure out my code from the day before!

Chuck


----------



## joco-nz (Dec 5, 2016)

This stuff looks very cool and having built my own 3d printer I'm pretty familiar with steppers, arduino etc.
Now I just need to justify in my head the NZD400-500 for the rotating table to connect it all up to.  :hDe:


----------



## RGS (Dec 21, 2016)

I have read this article with interest.  I now have my Arduino Uno, Sainsmart display and stepper driver on order.  

I have not order the motor yet.  When  looking at motors both NEMA 17 & 24 I see they have a torque rating.  I plan to use my dividing head for doing gears and it will be similar to the one Chuck made as seen in post 18.  Can someone give me a idea on what the minimum torq spec should be.

I also looked at the larger buttons someone recommended in this link. http://yourduino.com/sunshop//index.php?l=product_detail&p=334  Can I just hook these up and us either the ones on the display or these without doing any different coding?

Thanks for your help and I am sure I will have more questions in the future as this project and my learning progress.


----------



## rodw (Dec 23, 2016)

RGS said:


> I have read this article with interest.  I now have my Arduino Uno, Sainsmart display and stepper driver on order.
> 
> I have not order the motor yet.  When  looking at motors both NEMA 17 & 24 I see they have a torque rating.  I plan to use my dividing head for doing gears and it will be similar to the one Chuck made as seen in post 18.  Can someone give me a idea on what the minimum torq spec should be.
> 
> ...



I would go with a NEMA 23. I used one I salvaged so am not sure the specs but it was margjnal at 19 volts but was fine at 48 volts. I did a lot of my development with a nema 17 and I think it would be a bit light on for torque.  I bought a 269 Oz one which I would have used if it was required.

As far as the buttons go, you have 3 options.

1. Solder wires on either side of the switches in the board. 
2. Check the wiring specs for the display I used and just use some resistors to replicate the keyboard buttons externally  so you don't  have to modify the display shield.
3. Use buttons with built inresistors and iff different, modify the code to suit the different resistor values.

Persinally I'd just use separate switches and add the correct resistor values to replicate the onboard buttons.


----------



## Foozer (Dec 23, 2016)

The values in the sample sketch provided with the larger buttons are the same values as the smaller buttons, so first guess is that you could use a plain 20X2 or 20X4 LCD for display and the larger buttons for input . . .


----------



## Captain_Obvious (Jun 5, 2017)

Hi, new here, and frankly I'm not even a model engineer, but the topic caught my attention a while ago. 

I'm having a strange problem with this setup. I'm using the Liming 2.3 code available at the Digital Machinist website with an Arduino Uno clone. I've wired my setup just like Liming does here, except that I don't have temperature sensors at all. I have a 12 tooth HTD gear at the Nema 23 stepper motor and a 72 tooth gear at the spindle giving me a 6:1 gear ratio. I'm using a generic Chinese TB6560 at 24V 2A at the moment. I have tried other current settings, but it doesn't seem to make a difference.

Everything works like a charm... except that I'm not getting a full 360° rotation, but ever so slightly less. So if I choose, say a 10 step program, and at each stop I poke a mark on the workpiece with a sharp point, everything looks OK at first glance until I arrive back at the starting point. The needle doesn't align with the original hole, but is just a little bit off. If I go through the program again, the same happens with all the holes. If I keep repeating this over and over again, I'll end up with a line of dots. It's not far off, at about 40mm diameter it's only maybe 0.1-0.2mm off.

I've tried several things so far. I've changed the microstepping from 1 to 16 and it doesn't seem to change the situation. I've also changed the code so that the motors step number is 199 instead of 200 and with this setting it's way off, much more than it is when the all the numbers are correct. I've also tried different decay settings on the stepper driver. Some of them don't work at all and the motor keeps juddering randomly and only 0% setting is completely calm and quiet.

Within the code I've tried changing the pulse width, SpeedDelayIncrement and ADSettleTime settings without any significant change.

Any ideas what could be off? Am I missing something?


----------



## Cogsy (Jun 5, 2017)

As I see it, either it's a ratio problem, be it physical or within the program, or your setup is losing steps somewhere. To try and diagnose, could you set it to turn some decent amount in one direction, then the same amount back again and cycle that a few times? (Not sure if this is possible with the code you're using) If you can do this and it keeps hitting the same spots (the first two points may be slightly off to the rest as backlash is taken up, but subsequent points should be 'spot-on' to each other) then it's some sort of ratio error. If the spots keep shifting then it has to be a matter of losing steps.

Sorry I can't be more helpful but hopefully you can at least narrow down the possible errors.


----------



## Captain_Obvious (Jun 5, 2017)

I've tried this setup with another stepper motor and two other Chinese stepper drivers. I had other issues with those setups (namely just random juddering), but as I recall it I didn't have an alignment issue. 

I'm thinking the stepper driver is doing something funky, and I have ordered a Leadshine DM442 driver just in case.

It is possible to move back and forth with the Liming code. It has several different programs to choose from, and really the step program is the one I'll ever need with this setup. I'll give it a go and see what happens.


----------



## Captain_Obvious (Jun 6, 2017)

OK, so I tried the moving back and forth using a 2 step program, so 180° per step, and I also made a few more attempts in just going through a 22 step program. It seems I am losing random steps. The error seems more consistent when I'm moving forward only and more random when I'm forward and then back again. Sometimes the needle point aligns perfectly and sometimes it doesn't. During the test I was using 16 microsteps. 

This time the diameter was about 68mm and the error seems to be more or less 0.2mm in the 22 step program moving forward only.

Seems really weird to me. I guess my best bet is to just wait for the new stepper driver and trying if it makes a difference. I'm also tempted to buy a genuine Arduino Uno board, as I have had some pretty random issues with these Chinese clone boards in other projects.

But still, if anyone has any ideas what could be wrong, all suggestions are welcome.


----------



## rodw (Jun 6, 2017)

I think you are missing steps, probably when starting up when there is insufficient power to overcome the initial inertia. Also, 24 volt is not high enough (I first started with a 19v power supply). I would strongly recommend you order a 48 volt power supply to go with your new driver. I think doubling the voltage quadruples the torque or something like that.

I had similar issues, I bought a larger stepper motor but never bothered to install it because all problems disappeared when I increased the voltage to 48V so I never upgraded the motor.

Also, a good motion controller should ramp up to speed and then ramp down at the end of the move to prevent overshoot. If you find a spec sheet for your motor, it should show the RPM  for max torque. You need to start in this range and ramp up to speed. There is another Arduino based controller on this forum that deals with all of that. I wrote it so its probably not appropriate for me to link to it on this thread.


----------



## Foozer (Jun 6, 2017)

Last Good First Bad - - Take it your system is belt driven - Mayhaps disconnect the belt and cycle the motor, say one revolution at a time, see if the software cycles the motor itself now free of any drag properly . .  Belt too tight will lose steps . . .


----------



## Captain_Obvious (Jun 7, 2017)

rodw said:


> I think you are missing steps, probably when starting up when there is insufficient power to overcome the initial inertia. Also, 24 volt is not high enough (I first started with a 19v power supply). I would strongly recommend you order a 48 volt power supply to go with your new driver. I think doubling the voltage quadruples the torque or something like that.
> 
> I had similar issues, I bought a larger stepper motor but never bothered to install it because all problems disappeared when I increased the voltage to 48V so I never upgraded the motor.
> 
> Also, a good motion controller should ramp up to speed and then ramp down at the end of the move to prevent overshoot. If you find a spec sheet for your motor, it should show the RPM  for max torque. You need to start in this range and ramp up to speed. There is another Arduino based controller on this forum that deals with all of that. I wrote it so its probably not appropriate for me to link to it on this thread.



I will have a look at your code. I have enough parts to put together another unit so I can compare them.

I do have a 36V 8A PSU and I tried using that instead. It made absolutely no difference. I didn't change anything else. Unfortunately the new stepper driver only supports 40V, but I do have a 48v power supply coming in as well. I do have a stepper driver that supports 50V but as I recall it, it has some juddering issues.



Foozer said:


> Last Good First Bad - - Take it your system is belt driven - Mayhaps disconnect the belt and cycle the motor, say one revolution at a time, see if the software cycles the motor itself now free of any drag properly . .  Belt too tight will lose steps . . .



My belt tensioner is completely manual, so I get to choose the tension. It doesn't seem to make a difference either, as I've never tensioned the belt incredibly hard. The motor bracket is one of those flimsy ones made of sheet metal, so if the belt is tensioned too much, the bracket will bend.


----------



## rodw (Jun 7, 2017)

So assuming you are not loosing steps, and your gearing parameters are accurate, I would try turning the dividing head one revolution and measure the error. Then (and you may need to modify your script to do this), rotate the dividing head 10 turns and measure the error. if one reading is 10x the other, then you have a calibration issue. If the error is the same then you have a backlash issue. If its somewhere in between, I have no idea, could be electrical noise.

Also, if you have one of these slotted joiners, they can be a source of backlash. You could have a pulley moving on the shaft






Your timing belt needs to be tight to eliminate backlash.


----------



## Foozer (Jun 8, 2017)

"Juttering" AKA Fubar - Tried a GRBL compatibly shield on my little test platform and got a case of what could be described as 'Jutter' - Motors erratic, run a bit then do a dut,dut, dut, even change direction on their own. Tried an EZDriver - all was good - reconnected the shield and spotted a little glow - Bad solder spot Y Axis motor pins . . . Pulled the driver all is good - - Moral of the story - Just cause a controller seems to work, doesn't mean it is without fault . . .


----------



## Captain_Obvious (Jun 9, 2017)

After a bit more experimenting the stepper motor driver seems to be the culprit. The decay setting to be specific. I tried rodw's code from the other thread, which BTW I like better, but at first I had the same issue of missed steps. I played around with the decay setting switches and for the most part that solved the problem. I still get the occasional missed step, but it's not as far off as it used to be. 

The dividing unit is mounted directly to the spindle of a benchtop lathe, so there are only the 12 tooth pulley mounted to the motor and a 72 tooth pulley mounted to the spindle. No flexible couplings or anything like that, so practically there are no backlash issues, but of course there is a bit of flexing from the belt itself. However, in this application it is not an issue. I still have a few stepper drivers that I haven't tried with the new code, and I'm pretty sure one the new drivers will solve the issue for good. I'll just have to wait for my new toys to arrive in the mail.



Foozer said:


> "Juttering" AKA Fubar - Tried a GRBL compatibly shield on my little test platform and got a case of what could be described as 'Jutter' - Motors erratic, run a bit then do a dut,dut, dut, even change direction on their own. Tried an EZDriver - all was good - reconnected the shield and spotted a little glow - Bad solder spot Y Axis motor pins . . . Pulled the driver all is good - - Moral of the story - Just cause a controller seems to work, doesn't mean it is without fault . . .



That's my experience as well. I've had these strange issues with two drivers. I suppose you get what you pay for.


----------



## Wizard69 (Jun 11, 2017)

I hope this doesn't sound obvious but have you double checked the current setting on the drive?    One thing I've notice on other forums is that people sett the current settings too low because "the stepper gets hot".   This kills motor performance.   

Another suggestion would be to tie the direction signal input either high or low.  This is one way to isolate out noise and other problems on that line.


----------



## Captain_Obvious (Jun 12, 2017)

The motor is rated 2.8A and I'm driving it at 3A. I've tried all the settings between 1A and 3A and 3A works the best. I haven't tried the direction pin trick, but I'll give it a go.

The decay setting seems have the most significant effect on performance. At 0% the motor is quiet and the motion sounds good too, but the holding torque just isn't there. I can easily turn the lathe spindle with my hand and holding the upper belt pulley with my finger the motor stalls. At 100% it sounds a little different, but still good and the torque is what it should be. At 25% and 50% the motor is noisy and it starts to whine after it stops. So simply put, the 100% setting is the only one that works. I would call the system 95% stable at this point. I'm guessing it's just a matter of the driver not being quite good enough.


----------



## rodw (Jun 12, 2017)

Can you disable the decay mode totally? With the Geckos and Longs Motor drivers I've played, with decay mode does not exist and they have performed flawlessly with both Arduinos and LinuxCNC


----------



## Captain_Obvious (Jun 12, 2017)

OK I corrected a few umm... observations in my last post.

So yes, it is possible to disable the decay setting, but It seems this little driver is on its last legs. I was using the step program and I moved forward about one step per second and the motor driver just shut down. It came back to life after powering it off and leaving it for a minute or so and then power back on.

The driver worked for a few minutes but I wasn't getting the same results from the decay settings I did before. This time the motor didn't stall when I held the pulley with my finger, but I couldn't say for sure if there was a torque difference between the decay settings. It all seems pretty random with this driver.


----------



## Captain_Obvious (Jun 13, 2017)

A quick update: All the problems disappeared with the new Leadshine DM542T stepper driver. The motor runs so smooth it makes me smile. No missed steps, perfect alignment every time. I'm using it with 36V @ 2.84A. Also the old TB6560 driver pretty much died today. It stays on for a few steps and then just shuts down. 

I still have another stepper driver coming in for a second dividing head for my milling machine and I'll be using a slightly beefier motor for that one as well.

On that note, thanks all for your input. You've been genuinely helpful. I'm especially pleased to have found rodw's script as it suits my purposes better than the Liming one.


----------



## rodw (Jun 13, 2017)

Captain_Obvious said:


> A quick update: All the problems disappeared with the new Leadshine DM542T stepper driver. The motor runs so smooth it makes me smile. No missed steps, perfect alignment every time.



They are a very good driver. In my view superior to the Geckos and 1/3 of the cost.




Captain_Obvious said:


> I'm especially pleased to have found rodw's script as it suits my purposes better than the Liming one.



Thanks for the feedback. I'm glad you like it.  A rotary table controller seems to be a popular starter project for Arduino loving machinists. They don't realise to do it well, some advanced programming techniques are required and then the limited memory space bites so code has to be really lean & efficient. I don't think you can add any more features into an Arduino RT controller than I have!


----------



## rodw (Jun 13, 2017)

Captain_Obvious said:


> I still have another stepper driver coming in for a second dividing head for my milling machine and I'll be using a slightly beefier motor for that one as well.



Don't forget that my controller supports multiple devices numbered 0-n (limited by memory) so if there are different parameters between your two rotary tables, you can set one up as device 0 and the other one as device 1. Then just select the correct device config as you move from one machine to another. :thumbup:

Also a device can be configured as a linear one so you could  also use it to control a stepper driven milling feed table on device 2.


----------



## Captain_Obvious (Jun 13, 2017)

Yup, that's what I was thinking. I just need to get a suitable connector for my control box so it's easy to plug in. My second dividing head will be using a separate 48V PSU as well, so all I need is to connect the control box to the stepper driver. I do have a bunch of available Arduinos and LCD shields but why be wasteful, eh?

Faintly touching the subject, I thought I'd just write a word of modest wisdom here: I've made it a rule that if I buy these cheap Chinese industrial power supplies, I will never plug them to mains voltage before I check them internally. It has happened before and today I was reminded again why I do it every time. I got my 48V power supply in the mail today and for a fraction of a second I thought of skipping my standard procedure, but then decided to do it anyway. Good thing I did too, as I found immediately that one end of the beefy inductor inside was not connected at all, but the solder joint had failed and the inductor was just floating in there. I also found the Chinese had thought of using high quality "Rubycong" branded capacitors. They had also done a fine job heatsinking the unit, as pretty much every component was smeared with thermal paste. The unit has all the QC stickers and other cool stuff on it too. Oh well, after soldering the inductor back in and swapping the capacitors the PSU is working fine.


----------



## rodw (Jun 14, 2017)

I also have an experience with a failed 48v Chinese power supply but there may have been some user error involved. It was replaced under warranty after I returned it to an Australian address. But by the time it arrived, I had bought a quality Meanwell power supply.

I use these CB microphone plugs and sockets for stepper motors.







If you use the 5 pin one, you can use one pin to pass the shielding through the control box. and earth it right at the stepper controller (but leave the shield unconnected at the stepper motor end.


----------



## Ryan (Jun 15, 2017)

Hi Chuck. With your fixture for the collet chuck, was it difficult to bore the steel block for the bearings without runout or misalignment? I'm still trying to decide if it's easier to use pillow block bearing units (although they're more expensive)?


----------



## Captain_Obvious (Jun 15, 2017)

rodw said:


> I also have an experience with a failed 48v Chinese power supply but there may have been some user error involved. It was replaced under warranty after I returned it to an Australian address. But by the time it arrived, I had bought a quality Meanwell power supply.
> 
> I use these CB microphone plugs and sockets for stepper motors.
> 
> ...




I had one of these connectors in my junk box. This is what I ended up hammering together. Just the Arduino and the LCD shield hot snotted to the panel and a few tactile buttons soldered to a piece of perfboard. I only need 3 pins for the step and direction signals and ground, as the stepper driver will be bolted directly to the bottom of my bench and the stepper motor is hardwired to it.  So yeah, it's not pretty, but it works.


----------



## rodw (Jun 16, 2017)

Looks great!


----------



## Captain_Obvious (Jun 17, 2017)

Many thanks.

I don't know if should be posting this here, but here goes anyway...

I just got thinking about integrating a mechanical spindle brake to my dividing head. The brake itself wouldn't be very difficult to make, but I was just wondering about the Arduino code as I'm not exactly an expert on Arduino programming. Would it be as simple as adding a sort of go/no go line to the script? 

The Arduino could send a command to a relay card which controls an actuator of some sort and there could be a limit switch or something like that confirming the spindle brake is off and now it's safe to move the spindle.


----------



## rodw (Jun 17, 2017)

It would not be hard. You'd need two 2 spare ports. One would be an output to enable the brake. When it goes high (+5v), it would trigger the actuator. The other would be an input that would tell the Arduino  the state of the brake (on or off). You'd just need to make sure the current handling of the arduino pins was not overloaded or you will blow the pin. Optoisolators might be useful to separate the low volatage logic side from the higher voltage actuator side.


----------



## Foozer (Jun 17, 2017)

SparkFun Beefcake Relay Control Kit (v 2.0) < 10 bucks . . . 10A on the NC contacts and 20A on the NO contacts at 220VAC.


----------



## Wizard69 (Jun 17, 2017)

Captain_Obvious said:


> Many thanks.
> 
> I don't know if should be posting this here, but here goes anyway...
> 
> ...



There are a number of ways to do this but all involve using some sort of I/O on the Arduino.    Generally solenoids strong enough to act in a brake mechanism are pretty high current devices.    This high current requires a switching device external to the Arduino.   What you use in that external buffer is up to you, it could be a mechanical relay, an optically isolated solid state device or even an old fashion tube if you are into retro

One possibility worth considering is to go with a pneumatic solution that uses an air cylinder instead of a large solenoid.    Going this route you can use a much smaller buffer to drive the solenoid in the pilot operated valve.    A pneumatic solution gives you a lot of options as to how the mechanism would work for you.   

In any event as others have already indicated you really want to know the state of the brake before trying to index so an input that ascertains that the brake is in fact released is a good idea.   The problem here is that many breaks solutions have extremely short throws and thus are hard to get a reliable on/off signal from.


----------



## Captain_Obvious (Jun 17, 2017)

The Sparkfun relay card was exactly what I had in mind. There are plenty of similar relay cards designed specifically for Arduino So all the high voltage/current stuff would be separated from the signal side of things.

I was thinking something along the lines of a mechanical bicycle disc brake caliper driven by a simple electric actuator, solenoid or whatever. The travel of the brake lever would probably be something like 10mm so it would be long enough for reliable limit switch function. The brake could be mechanically engaged by default and switched off only when the stepper motor wants to move. The limit switch would give go/no go signal to the Arduino so even if the brake would be locked because of an electrical fault, and the Arduino wouldn't try to move the spindle.


----------



## Foozer (Jun 17, 2017)

At 6:1 leaving the stepper engaged -  writing stepper pin high -  thus acting as a brake, be hard pressed to get it to slip considering the size motor you're using . . .


----------



## Captain_Obvious (Jun 17, 2017)

True, but the belt will still have a bit of flex. I doubt it will be an issue, but hey, why not make it better if it's not very difficult or expensive. I think I'll order one of those brake calipers for testing. They are dirt cheap after all.

The lathe dividing head does have 6:1 ratio and an HTD 3 belt and that doesn't require any kind of a brake. The system is good enough as it is because it is almost exclusively used for cutting small gears. The motor is rated only 1.26Nm but it's plenty for this setup.

The milling machine dividing head still in the works will have a 2.83Nm motor, 4:1 ratio and an HTD 5 belt, which will be somewhat more rigid, but there will most probably be noticeable flexing from the belt if I ever choose to do slightly heavier milling operations than I usually do. This unit will have an ER32 collet spindle since I already have a set of collets and the spindle is on its way from China. I may add an adapter for a 4-jaw chuck later, but that's irrelevant.


----------



## tjwal (Jun 24, 2017)

I was thinking of putting an electric brake on a rotary table/ dividing head for gear cutting.  A car AC compressor has an electric clutch that might work.  Unfortunately they are too pricy at the local wreckers. YMMV


----------



## Captain_Obvious (Jun 25, 2017)

I have a few broken car AC compressors but I'm not sure if the clutches work on those. For a rotary table these would work fine, but my dividing head spindle has a 20mm bore so I can feed long bar stock through the whole thing. I suppose I could still use an AC clutch with some modifications, but for now it just seems like too much work.


----------



## Captain_Obvious (Jun 25, 2017)

Sorry for the long post again, but even at the risk of slight thread-jacking, I'll post my progress here... or lack thereof. It's officially not funny anymore, ladies and gentlemen. Yesterday I tried to engrave a graduation on a small rotary table. I wanted to have a longer line every 10 degrees and shorter lines every one degree. So, confident that my lathe dividing head finally works, I first used used four divisions, so every 90° I drew a line on the side of the table. Great, seemed to work fine. Then I divided by 36... fail. I was visibly off the mark. I couldn't believe it.

Today I did some testing and the results are strange to say the least. Every division from 2 to 33 is spot on. from 34 to 39 they're all off. All even tens, 30, 40, 50, 60 are spot on. I didn't go through every number of divisions from 2 to 65, but I picked random divisions and tried them. Here are my results:

These are dead on:

2-33
40
43
48
50   
60
64 

These are off:

34-39
46
49
51
61
65

The results are consistent, so if I go back from say 51 to 40, the results do not vary. 40 is still dead on. Microstepping doesn't change anything, so no matter if I use 8 or 10 or whatever, nothing changes.I even told the software that my stepper motor had 400 steps instead of 200, no change.

I can't think of any other reason for this than a rounding "error" in the maths. Since my timing belt ratio is only 6:1, it's not enough to compensate for the error. On a rotary table with a reduction of something like 90:1 you probably wouldn't even notice this but in my system you certainly do. Am I off to a gearbox shop or can you think of another solution? Software tweak maybe? Different pulley ratio?


----------



## rodw (Jun 25, 2017)

Are you still using my script?

What happens if you enter an angle rather than the number of divisions? (eg 10 degrees = 36 divisions)


----------



## Captain_Obvious (Jun 25, 2017)

Hello rodw, yes I'm still using your script. 

5° is off
8° is off
10° is off
20° is OK
36° is OK

These are the ones I tried so far.


----------



## Foozer (Jun 25, 2017)

From Chuck Fellows RT program:
"laststep  = round(stepsDiv * lastPosition);
  nextstep  = round(stepsDiv * currentPosition);
 divSteps    = abs(nextstep - laststep);"

Now to make simple, complicated. Best as my math challenged mind can figure, seems to recalculate each future move taking into account any error from the last move, adding a step here and there to spread the margin of error out over the whole. Say 65 divisions  - 6:1 @ 400 steps - 2400 steps / 65 - 36.9 something, near a step short each move. That 65 by .9, well it's not gonna end up where it started


----------



## Captain_Obvious (Jun 25, 2017)

I think I found the problem. It's seems the issue is mechanical, not software or electronics. My belt tensioning system just simply sucks. Still, not having a whole lot of experience in belt drive systems, I can't really figure out how I was getting such consistent results with the errors I was having. 

Now if I go through the step program a few times before I start, the belt tension has time to settle and after that I get an even division. When I was testing the system I didn't do this and it seems this is why I was getting the error. Lesson learned once again. Next I will probably ditch the separate tensioner wheel and just build a mechanism that moves the stepper motor up and down, thus tensioning and loosening the belt when needed.

These are my findings so far. I'm almost willing to bet I'm wrong again, though... I think I'll finish my second dividing head to some degree next week and that one doesn't have a separate tensioner, and the belt will stay on for all eternity as far as I care. This one will also have a shorter polyurethane belt, so I hope this setup will confirm the problem with my lathe is indeed the stupid tensioner thingy.

Oh boy, where's my dunce hat again?


----------



## rodw (Jun 26, 2017)

I think software can account for some of the error. I developed this on a 90:1 table with 18,000 steps per rev. I think your table is 1200 steps per rev. 

The base unit I use is seconds of a degree so there are 1,296,000 of them in a circle. Angles are entered as degrees, minutes and seconds but internally, it is converted and stored as the number of seconds.  Integer maths is used for the conversion so there is no risk of rounding errors. A division on the other hand is converted to an angle (in seconds) so there is an additional mathematical step.

In either case, the angle in seconds (gAngle in the code) is sent to goDivide where it is used to calculate the number of steps per division in this code:


```
stepsPerDiv = (long)(tmpSTEPS_PER_REV *((float)gAngle/(float)MINUTES_IN_CIRCLE));
   divisions = (long)((float) MINUTES_IN_CIRCLE / (float) gAngle);
```

When I looked at your example for 36 divisions, I made you were moving 200 x 6 = 1200 steps per rev. which is 33.3333 steps per division. The code drops the 0.33 and give you 33.0 steps per division. So by the end of the exercise, 36 x 0.3333 = 12 stepper steps of error per revolution.  

12/1200 * 360 = 3.6 degrees 

so your last division should be at 356.4 degrees 

So I'll take this as a  bug!

What I should be doing is to accumulate the 0.3333 error and when it is >= 1.0, add one step to the number of divisions. The subtract 1 from the error so any residual error is carried forward for the next one. This would mean that every third division, I would add 1 step to that division so the missing 12 steps were spread around so they were never noticed.

I'll see if I can post an updated goDivide() procedure for you to test in the next day or so


----------



## Captain_Obvious (Jun 26, 2017)

Excellent, thanks a lot for the effort!

I've been trying to eliminate my own goofs the whole day. I'm just trying to find the ideal settings for optimal stepper motor performance so I can be as certain as possible that I'm not losing steps. I already replaced the idler with a larger HTD pulley. The old idler was smooth and pushed the belt inwards but now the larger toothed pulley pushes it outwards. I don't understand why this would make any difference as long as the belt is at a reasonable tension but I guess it's worth a try. I also had an issue with a stubborn set screw that kept coming loose, but I got that sorted now, so I'm pretty sure the mechanical side is in order now. Yesterday's results can't be considered valid since I only noticed the set screw issue today, so that probably became a factor at some point during the test.

Today I found that no matter what microstepping and software settings I'm using I get the same results. Right now the settings are 25 microsteps, min 2000Hz max 5000Hz and these settings seem to work just fine, very smooth and quiet operation.

I have a piece of printer paper glued to a 120mm cast iron backplate on the lathe spindle and I'm using a small carbide needle on the tool holder to poke holes on the paper and checking alignment that way. I've been using a hole circle diameter of about 110-115mm which would be pretty much the largest piece I could ever have on this lathe. I set the software to 74 divisions, as I noticed this was giving me misalignment of about 0.2mm. I tried several microstepping and frequency settings, no change. The same amount of misalignment every time. Then I tried 81 divisions. Same thing, roughly the same amount of misalignment. I changed the setting to 80 divisions, perfect alignment. 60 divisions, perfect alignment. 61 divisions, about 0.2mm error. 36 divisions, perfect alignment. So yes indeed right now it seems the error is in the maths after all.

I will keep experimenting the rest of the day and I'll let you know if I find something strange (which honestly seems more than likely at this point).


----------



## rodw (Jun 26, 2017)

If its bang on one setting, and off on another, it is most likely my bug but you should be able to calculate the error and compare your result. You should find where its bang on, the divisions will have a whole number of steps.

You could also try Chucks script as I think he moves up or down one step on alternate steps or something.

I have to think about it but I think that a better algorithm might be to decide how many divisions cause a  full step of error (3 in the example) and add a an extra step every third division (for this example) so we are not using floating point any more than we need to.


----------



## Captain_Obvious (Jun 26, 2017)

rodw said:


> If its bang on one setting, and off on another, it is most likely my bug but you should be able to calculate the error and compare your result. You should find where its bang on, the divisions will have a whole number of steps.
> 
> You could also try Chucks script as I think he moves up or down one step on alternate steps or something.
> 
> I have to think about it but I think that a better algorithm might be to decide how many divisions cause a  full step of error (3 in the example) and add a an extra step every third division (for this example) so we are not using floating point any more than we need to.



Lazy me hasn't even read the whole thread and I didn't realize Chuck had written his own script...

I tried Chuck's script and I'm not getting the error. I tried divisions 33, 74, 81 and 80. Basically ones that were giving me trouble with your script and the 80, which works in both scripts. All were bang on using Chuck's script. The only trouble was that the script kept misinterpreting keystrokes, so I assume it's a debounce issue, maybe? I was pressing the same button forward and sometimes the speed would change and sometimes it would even move backwards, but the division was still bang on every time.

I hope this helps debugging your script, as I really like it otherwise and I would prefer it for its versatility.


----------



## Captain_Obvious (Jun 27, 2017)

I know this is starting to look like a monologue, but bear with me, this actually may be useful to others as well (I hope). I was messing around with Chuck's script and I modified it slightly to get the buttons to work reasonably well. It's not perfect, but good enough for testing. 

I tested the script with 2 microsteps at first. I did a 360 division program with a hole circle diameter of about 120mm. In other words I poked a hole in the paper every one degree. Looking through an eye loupe something didn't seem right but I went through the whole 360° program and the needle lined up perfectly with the first hole. I took the paper off the backplate and had a closer look... the holes were not evenly spaced. So the steps lined up but the holes were not at every 1 degree so this would be no good for engraving a graduation for example. I jacked up the microstepping to 10 microsteps, so in my case 30000 steps per spindle revolution in the software, and now there is no visible error even under my microscope.

The red arrow in the picture shows the most obvious division error.

Also added a picture of the rotary table engraving I just finished using Chuck's script. It worked just fine.


----------



## Foozer (Jun 27, 2017)

Chucks script is 'centered at these values: 0, 144, 329, 504, 741' Sainsmart shield buttons are voltage divided. If your buttons soldered to perboard have resistor values removed from the Sainsmart could see where the sketch might misinterpret the button press . . . 
VCC-- 2K // 330 // 620 //1K // 3.3K //


----------



## rodw (Jun 29, 2017)

Foozer and Captain_Obvious. I have revised my goDivide() procedure in an attempt to fix this bug. Please check this thread
http://www.homemodelenginemachinist.com/showthread.php?p=294834#post294834
for an updated goDivide() procedure which hopefully fixes this problem. Tye cutting and pasting it into your existing script to repalce the current buggy procedure.
Please report your findings on the other thread.


----------



## Fossilbones (Jul 16, 2017)

http://www.liming.org/millindex/


----------



## cfellows (Jul 17, 2017)

I think my positioning algorithm is accurate because I recalculate the position from zero (home) each time the forward or reverse button is pushed, rather than use an incremental number of motor steps.  This takes care of proper rounding and always assures that you wind up at the right position.

Chuck


----------



## rodw (Jul 17, 2017)

cfellows said:


> I think my positioning algorithm is accurate because I recalculate the position from zero (home) each time the forward or reverse button is pushed, rather than use an incremental number of motor steps.  This takes care of proper rounding and always assures that you wind up at the right position.
> 
> Chuck



I think that is a good approach. What is clear is that you need a strategy to deal with possible inaccuracies due to being out a step per division due to rounding errors. This is imperceptible on hardware with a large number of steps per revolution (18,000 in my case). But on hardware with coarse resolution, it becomes noticeable. So many people have written their own sketches to drive a rotary table, often  with very little knowledge of coding. That is great to see as people are making an effort to get conversant with new technology. I wonder how many of these people have made this same mistake? Lucky we are not building rocketships!


----------



## rodw (Jul 17, 2017)

Fossilbones said:


> http://www.liming.org/millindex/



Hmm, I think if Captain_Obvious applied his testing procedures to this script, it would also fail at coarse resolution.

There must be many more bugs out there masked by 40:1 or 90:1 gearing ratios.


----------



## Captain_Obvious (Jul 18, 2017)

I haven't done any proper testing with the Liming script with my new hardware, so I couldn't say for sure what the issue was. I was having so many problems with the whole setup that I really can't blame the script. I know for a fact that I had two dodgy stepper drivers, so that may have been the cause for all the issues. Right now I don't have the parts to put together another controller, and I won't take my finished control box apart unless I really really really have to. I'm afraid someone else has to do the testing. The Liming script is not bad, but I did have some button debounce issues with it. I wasn't able to find a really good setting for it, but it worked reasonably well. I did get the odd misinterpreted keystroke, but it was still OK-ish. The major issue I had was that sometimes when I pressed the forward button, the script would add another step in the program = ruined parts.

I had no issues with Chuck's script other than a few keystroke issues here and there, but I'm sure it's just a matter of tweaking the code slightly. I already got it working well enough for testing purposes. I'm using rodw's script now and it also works perfectly as far as I can tell.

I've taken some time off for a few weeks, but I'm about to build the milling machine dividing unit soon. I just need to fabricate a spindle housing and assemble it. This unit will have a 4:1 physical ratio while my lathe unit has 6:1 ratio. I'll post pictures once it's finished.


----------



## rodw (Jul 18, 2017)

Captain_Obvious said:


> I was having so many problems with the whole setup that I really can't blame the script.



But your enquiring mind and rigorous testing did identify bugs in my script that has been out there for a number of years. I did like Limings suggestions for hardware.

The sorry fact is that about 70-80% of code is taken up with the user interface. Key bounce is always an issue. There are some debouncing libraries for the Arduino, so it would not be hard to modify a script to solve the debounce problem.


----------



## markba633csi (Jul 18, 2017)

Chuck Fellows for president!  Great work Chuck, I'm sure you have inspired hundreds of code newbies, me included. 
I purchased a SainSmart clone on Aliexpress, I found it was giving pushbutton errors quite often and I checked the voltage divider resistor values and 3 of them were wrong.  The biggest error was that the top-most resistor was 3k instead of 2k.  Big improvement in stability now.  I'm thinking there might should be some decoupling caps on the shield Vcc? The stock board apparently has none. 
Mark S.


----------



## Foozer (Jul 18, 2017)

Chuck posted into this thread a steppermath.xls that shows the error rate for a 127 tooth gear cut. Easy enough to alter the values to check ones own mileage . . .

For myself am adding a 10th degree option somewhere in the script - i.e. for 7.2 degree,  - [stepsBy10thDegree = (Degrees * multiplier) / 10;]
At 400 steps & 36:1, can get away with a reasonable error rate . .


----------



## rodw (Jul 19, 2017)

I don't think there is any need to use hardware to debounce buttons when you've got the power of a microprocessor to do it in software. There are plenty of methods but here is one. https://www.arduino.cc/en/Tutorial/Debounce

Foozer, Chucks spreadsheet on page 19 of this thread is specific to his algorithm so it can't be universally applied. Having said that, Chuck's algorithm accumulates steps, my (revised) algorithm accumulates errors. The end result is identical. The missed steps from rounding are spread around the full 360 degree circle.


----------



## Foozer (Jul 19, 2017)

rodw said:


> The missed steps from rounding are spread around the full 360 degree circle.



Both do it well. Chucks was easier for me to adapt a NES controller as input device, yours being a bit more sophisticated left me at the time, like a deer in the headlights trying to adapt same controller . .


----------



## markba633csi (Jul 21, 2017)

My replica of Chuck's original design still glitches now and then, I thought it might be switch bounce but now I'm not so sure. I set up a 555 timer pulsing a transistor to simulate the "right" button closure and I still get occasional opposite rotations and sometimes the number of divisions will suddenly increment up or down by one count.  It could be emi noise from my 8825 driver getting into the arduino a/d or possibly a hiccup in the code itself- I need to get out the scope and do some more checking. I can't trust it yet for actual gear cutting till I get more consistent results.  Also I need to understand the code in more depth, especially the "move the stepper" section.
Mark S.
Mt. View, Ca


----------



## cfellows (Jul 22, 2017)

Thanks for all the comments, folks.  Very rewarding to see people are able to use the results of some of my work.   It would be interesting to know just how many people have built a dividing head based on my software.

For me, it was all in fun in developing a real world application for the Arduino.  Love that little computer!  My career started with programming in the Air Force back in 1962.  Of course, that was a long before the advent of the C language, but the Arduino took me back to some of those earlier year experiences when computers didn't have much, if any, of an operating system.

The most important test for me was to be sure that all my program values reset to their starting points after a full revolution in either direction.  If one could accomplish that with a wide variety of different circle division numbers, then the algorithm was most likely working properly.

Chuck


----------



## markba633csi (Jul 22, 2017)

I found a good tutorial on both hardware and software debouncing if anyone is interested: 

View attachment debouncing.pdf


----------



## Foozer (Jul 22, 2017)

I Made One . . .
Little 3" rotary table with stepper mount similar to BMac's design.
Trimming some trees, had a hunk of wood - First attempt at actually using it.
One hole, wrong spot  . . .


----------



## almarghi (Jul 22, 2017)

I have build two of them, using arduino nano with some small changes (regarding the outputs) and I didn't have any  problems with the algorithm, but with the key voltage levels on the analog input. Both worked perfectly from the first time, without any issues. 
Since I don't trust any contraption without feedback, I oversized all power components - motors and power supplies - and it worked. For supplying the arduino board, I have build a swithing 9V dc-dc converter and I have used its onboard 5V linear supply.
in the attached picture you can see a bearing cage with 64 holes. No position error detected.
Please excuse my bad english,
Alex


----------



## ShopShoe (Jul 26, 2017)

Ever since Chuck Fellows posted the original article, I have been working on this. My inability to get much shop time in has made it take so long, but now it is to a point where I can post my progress.

Originally, I started to make both the rotary table and this version, and I ordered a 4-inch rotary table from Grizzly which turned out to be so non-ridgid as to make the rotary table version a dead end for now, although I might revisit it at some point.

I chose a spindexer as the basis for the unit as I have  a selection of 5C collets and one thing I often do is use them with collet blocks to make 4-sided and hex ends on rods and get tired of indexing with the blocks, especially if my setup is somewhat tricky.




Before doing much else, I machined a key slot in the base parallel to the shaft and then carefully machined off the base casting to provide a way to also mount the entire assembly in my mill vise. I may never use the key slot, but at least it is there if I want to.




The next step was a piece of 0.25 aluminum, which was repeatedly modified as the project proceeded. It is a little rough, but I see this as a usable experiment rather than a bling contender.

I made things easier on myself by using Chuck's original drive ratio, choosing a timing belt and pulleys from McMaster-Carr (Usual disclaimer: No ties to them).
To avoid milling or drilling the spindexer shaft, a taper lock was made for the shaft drive pulley, although I later found out that the motor had enough torque make things slip and I decided to add a 0.125 key to keep things locked up.





I also used Chuck's version of the Arduino, Chuck's driver board, and Chuck's keyboard shield. I added sealed momentary switches and connected them in parallel to the switches on the keyboard shield, and just drilled a hole to allow using the reset switch with a paper clip or somesuch. I found few reasons to need reset, and fewer buttons simplifies the panel. The circuitry is mounted in a diecast aluminum box, and a piece of 0.25 plexiglass is milled to fit into a milled-out window in the box to see the display.




A separate power supply can be placed somewhere away from chips and coolant and saves having to cook up an elaborate enclosure. A modified square electrical box provides for enclosing the AC connections and also holds a separate 9-volt supply for the Arduino and other circuit boards. The motor power supply is 12-volts, which is adequate for this use. The red neon indicator signifies AC input to the box. The green indicator signifies the 12-volt supply is on. Connection to the control box is with 4-conductor cable, 2 conductors for each power supply. I used the square 4-conductor connectors to make sure that connections are never confused.




I find the indexing works well enough for my use. I did need to experiment with the numbers of steps just a little, but most problems were due to mechanical slippage or to electrical crosstalk during the breadboard stage. Once everything was buttoned up and enclosed it settled down.

https://youtu.be/B60SzUv1BEw

I still have a little bit of fiddling to do, cleaning up dykem and etc. I bought the Arduino experimenter kit and have another Arduino now and another driver board, so I may do some more experimenting.


----------



## jeep534 (Jul 28, 2017)

Your english looks fine from here :thumbup:    I would like to know more about your indexers with more (bad english) and pictures...
Thank You 
archie 


almarghi said:


> I have build two of them, using arduino nano with some small changes (regarding the outputs) and I didn't have any  problems with the algorithm, but with the key voltage levels on the analog input. Both worked perfectly from the first time, without any issues.
> Since I don't trust any contraption without feedback, I oversized all power components - motors and power supplies - and it worked. For supplying the arduino board, I have build a swithing 9V dc-dc converter and I have used its onboard 5V linear supply.
> in the attached picture you can see a bearing cage with 64 holes. No position error detected.
> Please excuse my bad english,
> Alex


----------



## cfellows (Jul 28, 2017)

Thanks for posting, Shopshoe.  It's great to see folks getting some good out of this thread.

Chuck


----------



## almarghi (Aug 1, 2017)

Hi jeep534,
there is not much to tell. You can see both of them in the photos. One of them is vertical, the other horizontal.
The vertical one is a gear belt type, 1:5, with an normal XL037  belt. There is only one bearing inside, double row angular contact, SKF3306 ATN9, to be as flat as possible. My milling machine is an Optimum BF20L, small but not very rigid , so I have to be as low as possible with the spindle.
The second dividing head, is a 1:80 HarmonicDrive personal construction. Unfortunatelly I lost all photos I made during construction. I have only the project drawings left and I can take some pictures of the completed head.
Since I work mostly with aluminium, large diameters with thin walls, the Harmonic Drive head has now a 6jaw , 100mm chuck to prevent deformation.


----------



## Captain_Obvious (Aug 2, 2017)

Hi all,

Sorry for the delay, but I've been a bit busy lately. I finally got the dividing head somewhat finished. I still need to make a box for the PSU and the stepper driver, but the actual dividing unit is now complete. I haven't tried it out yet, but I don't see why it wouldn't work just fine.

As I mentioned before, I did contemplate making some sort of a spindle brake, but it seems pretty pointless, as the steel reinforced polyurethane belt is much more rigid than the  original rubber belt I was planning to use. I'll have to take some test cuts and see how rigid this thing actually is.

The spindle housing is a solid chunk of steel with a hole bored through and a recess milled at both ends for the 6007 ball bearings. Not ideal bearings for this purpose, but they do seem good enough. If I choose to use angular contact bearings, I still have plenty of material so I can bore the bearing seats a bit larger. The motor bracket is aluminium.

The spindle is an ordinary straight shank ER32 collet holder and the stepper motor is a 3Nm Nema 23 unit running at 48V.


----------



## ddmckee54 (Aug 3, 2017)

Pink with white polka-dots?  Not exactly your average machine tool color scheme.  Did you lose a bet and have to paint it that color?

Don


----------



## Captain_Obvious (Aug 4, 2017)

No lost bets here. I firmly believe it should be mandatory to paint all metalworking machinery pink. Polka dots are optional due to their mildly psychedelic effects which may result in either futuristic machine designs or severed limbs. 

Besides my shop is already full of boring green and grey and black machines.


----------



## markba633csi (Aug 10, 2017)

Let's hope the severed limbs are just a hallucination


----------



## almarghi (Aug 12, 2017)

just finished a m0.8,  z153 gear. No problems on dividing


----------



## tjwal (Aug 12, 2017)

Nice.  Is that a focusing ring?  I 3d printed some for my son.  I've since acquired a cutter but haven't tried it yet.


----------



## almarghi (Aug 12, 2017)

yep!  You good guess! 115mm inside, 15mm wide


----------



## mwmkravchenko (Aug 3, 2018)

almarghi said:


> just finished a m0.8, z153 gear. No problems on dividing



Beautiful work on a difficult piece to make.


----------



## almarghi (Aug 4, 2018)

Thank you. In the meantime that mill got cnc-ed


----------



## harrzack (Aug 5, 2018)

Greetings!  I'd be curious to know how you handle odd-numbers of divisions.

Here is a link to my attempt 4 years ago:  

I'm afraid that when you work directly from the stepper, the odd number steps won't come out quite right ( like the problem dividing plates solve for a traditional dividing head.  

My latest idea (yet to be tried) is to drive a rotary table with it's big-reduction worm gear, and create a very fine number of steps-per-degree that would render the error inherent in the odd counts to an insignificant level.  So I'm curious as to how you've addressed this issue.

Love your mounting block/vise setup - a technique I will use when I resume the project.

=Alan R.


----------



## Anatol (Aug 6, 2018)

Captain_Obvious said:


> Hi all,



love the polka dots! But white is a bit ordinary, I'd have going with turquoise or lime green, - for full psychaledic effect. Mind you, having afterimage spots dancing before your eyes while machining *might* not be advisable


----------



## Anatol (Aug 6, 2018)

cfellows said:


> My career started with programming in the Air Force back in 1962.  Of course, that was a long before the advent of the C language, but the Arduino took me back to some of those earlier year experiences when computers didn't have much, if any, of an operating system.
> 
> The most important test for me was to be sure that all my program values reset to their starting points after a full revolution in either direction.  If one could accomplish that with a wide variety of different circle division numbers, then the algorithm was most likely working properly.
> 
> Chuck



Yes Chuck, 
I also love the bare bones, close to the machine quality of the small microprocessors.  Newbies to microprocessors think these are  "computers" in the modern sense, with (quasi)infinite memory and processing power. As someone trained on machines with limited resources, you understand the need for (and value of) 'elegant' code.  Quasi-infinite resources induces laziness and code bloat.  Another thing that is lost on many is the necessity for closed loop thinking - the code has to be in touch with the 'real world' ! Mechanics, power supplies, electronics, code - you have to think it all as one system.


----------



## Captain_Obvious (Aug 7, 2018)

Anatol said:


> love the polka dots! But white is a bit ordinary, I'd have going with turquoise or lime green, - for full psychaledic effect. Mind you, having afterimage spots dancing before your eyes while machining *might* not be advisable



Lime green sounds tempting...

Anyway, I haven't used the polka dot dividing head almost at all so far, but I've been using my lathe dividing head for a year now without any issues whatsoever. I make tiny stuff and I haven't been able to detect any division errors. In the type of stuff I do, division errors will be shown without mercy in the final product and I'm seeing absolutely none.

Here's an example of the things I've made using the lathe dividing unit:





The diameter of the larger gear is about 12mm and the smaller one is about 2.5mm.


----------



## liqwrench (Oct 27, 2018)

cfellows said:


> Thanks for posting, Shopshoe.  It's great to see folks getting some good out of this thread.
> 
> Chuck


Hi Chuck, did you happen to finish the larger Nema 34 project? liqwrench


----------



## kaolsen1728 (Oct 28, 2018)

Here in Seattle, WA, I am in the process of completing the Arduino  spin indexer project. Being my first Arduino project, if if were not for contributors like you Chuck as well as Gary Liming and many others, I would not have been able to nor would I have tackled this great project which will be a addition to my shop. Thank you so much for your input.


----------



## dwk (Nov 1, 2018)

I really must thank Chuck and others for their valuable information. Having no experience of coding the info here has been most useful.
My only problem with Chucks code (from post #50) or my setup is the lack of reverse direction. Can anyone tell me where I may be going wrong?


----------



## fubuddy (Nov 1, 2018)

so ive tried reading thru this , the table for dummies and the other one i could find, and im more lost and confused than when i started. 
im pretty sure im having the end problem of 1200 steps per rotation.
i changed the line, change line 'for(int i = 0; i < tm; i++)' to 'for(int i = 0; i < 1200; i++)' but...  i sstill get 1080 steps per 360 not 1200
my problems are compounded by the driver im using requiring an extra wire for enable.
i had it all figured out and moving, but in the process of trying to fix the numbers i have lost the working sketch for movement.
the scrolling is killing my wrist and the constant walking in and out from pc to shop is pissing my wife off, frustrated to the point im about to cry  

china 4th axis from ebay, all the info i can get is....
Angle: 0.3 degrees / step
Reduction ratio: 6:1 (Synchronous belt deceleration mode)
Stepper motor: 2 phase nema23 stepper motor

tb6600 driver, uses enable, pulse and direction signals.
i have enable set to pin 12. enable low or high seems to do something but im not exactly sure how to use it.
if someone who actually understands this code could look at it and tell me what i did wrong i would be so happy. 
i currently have it to where it hums when i try to move it, when i put in 360 degrees it says steps 1080


----------



## fubuddy (Nov 1, 2018)

if i could just enter the # of steps i want into the jog prompt i would be sooooo happy.  all i need is simple divisions of 2 3 4 5 6 and 8.
i can do that math real easy on my own, 240 steps = 5 divisions, a to jog..... im just not getting the code.


----------



## fubuddy (Nov 1, 2018)

lol, i got it, in //setup vars i changed it to 1200 steps 1 raito, and made the multiplayer 1 
also in , float getdivisions, at the botom of that snippet, i changed degrees to = 1200/num
this gives me 1200 steps labeled as degrees. im sure i can change that text too, but you know, gota find it.
and if i enter 240 steps, and hit A 5 times i get 5 divisions with my 0 back at 0.
hope this helps anyone else with the 1/3 problem.
and still, if anyone has a working program for 1/3 raitos with degrees and divisions, i would not mind it at all.


----------



## ray28450 (Nov 2, 2018)

cfellows said:


> I've made some strides on my Arduino powered dividing head the past few days. Here's a little background for what I am doing. First, the Arduino micro controller.
> 
> 
> 
> ...


----------



## ray28450 (Nov 2, 2018)

cfellows said:


> I've made some strides on my Arduino powered dividing head the past few days. Here's a little background for what I am doing. First, the Arduino micro controller.
> 
> 
> 
> ...


----------



## Foozer (Nov 2, 2018)

dwk said:


> My only problem with Chucks code (from post #50) or my setup is the lack of reverse direction. Can anyone tell me where I may be going wrong?



#define stepDir     2        //Digital Pin 2 outputs Step Direction
Pin 2 of the Arduino to the dir pin of the driver [TB6600 pin is balled DIR]


----------



## fubuddy (Nov 3, 2018)

i also cant get reverse to work using a tb6600,
im using the code from the dummies thread. 
i cannot find this or anything like it in the script
#define stepDir 2 //Digital Pin 2 outputs Step Direction


----------



## Foozer (Nov 3, 2018)

fubuddy said:


> i also cant get reverse to work using a tb6600,
> im using the code from the dummies thread.
> i cannot find this or anything like it in the script
> #define stepDir 2 //Digital Pin 2 outputs Step Direction



My Bad - looked at script post #50
The one you have in 276 shows dir as pin # 3 so pin 3 to dir+ on the 6600 with dir- of the 6600 connected to gnd.

const int dir = 3;               // connect pin 3 to dir


----------



## fubuddy (Nov 3, 2018)

yes, thats how i have it and what it says, line 276, im assuming you meant 27.... my editor does not have lines labeled... is there a better arduino code program ? im used to using context, where i can search words, and scroll straight to numbered lines, and this has none of the good stuff.

what currently happens, is when i hit A it moves forward, when i hit B it makes a clicking sound, when i hit A again it sometimes advances,  and sometimes makes the clicking sound, if i hit A again after the clicking sound it advances forward again.
yellow is on pin 3 and goes to Dir + , green is on pin 2 and goes to Pulse + ,  orange is connects to a ground, and goes to all 3 negatives. 
enable is wired but not used in the code.


----------



## fubuddy (Nov 3, 2018)

o i have not checked the polarity of the wires on the motor, i may have one set wrong. but im pretty sure its wired the same as all my other working motors.


----------



## Foozer (Nov 3, 2018)

fubuddy said:


> o i have not checked the polarity of the wires on the motor, i may have one set wrong. but im pretty sure its wired the same as all my other working motors.



Dug up my test platform. ill load up the code and see what happens. Hiding from the Honey Do List - Back later . .


----------



## chucketn (Nov 3, 2018)

fubuddy said:


> yes, thats how i have it and what it says, line 276, im assuming you meant 27.... my editor does not have lines labeled... is there a better arduino code program ? im used to using context, where i can search words, and scroll straight to numbered lines, and this has none of the good stuff.
> 
> what currently happens, is when i hit A it moves forward, when i hit B it makes a clicking sound, when i hit A again it sometimes advances,  and sometimes makes the clicking sound, if i hit A again after the clicking sound it advances forward again.
> yellow is on pin 3 and goes to Dir + , green is on pin 2 and goes to Pulse + ,  orange is connects to a ground, and goes to all 3 negatives.
> ...



fubuddy, if you want a code editor that displays line #'s, check out Notepad++. Lots of features. Check that your stepper is wired properly, that may be why you're getting the clicking...


----------



## Foozer (Nov 3, 2018)

Ok - Plugged in my data 400 steps per rev, table ratio 36 multiplier (400*36)/360 Works as written -




So having it operate will plug in your stepper numbers - After the honey do list - She Found Me . .
Back Later - - -

Back - OK just to check - your stepper is 0.3 degree -> 1200 steps per rotation -> 6:1 table ratio -> 7200 steps per 360 degree table rotation? Correct . .
So switches on 6600 1-off 2-on 3-on [Half Step]
StepsPerRotation 2400  
TableRatio 6
Multiplier (StepsPerRotation*TableRatio)/360

farther down for(int i=0; i < tm;

degrees = StepsPerRotation/num

and slowed down the motor
StepDelay = 2

LCD reads right and this motor (1.8 degree) spins as it should - 6 revolutions for 2400 steps which should be 1 revolution for yours. 
Bride found me again - Will check back . .


----------



## Scott_M (Nov 3, 2018)

FuBuddy
If you are using the "Arduino" editor, just go to "File" Tab  then "Preferences" and click    " display line numbers "

Scott


----------



## skankky (Nov 3, 2018)

You should try a mega 2650 with a ramps board, the stepper drivers plug into the ramps and makes programing much easier


----------



## Lindo (Nov 4, 2018)

cfellows said:


> I've made some strides on my Arduino powered dividing head the past few days. Here's a little background for what I am doing. First, the Arduino micro controller.
> 
> 
> 
> ...


----------



## Lindo (Nov 4, 2018)

Thanks Chuck
Reference your Indexer.
I built one similar, it includes Angular, Divisions, continual run , jog, and I can change the ratio either driving the indexing head or my different circular tables.
All Arduino based electronics.
I currently have a 12T/72T  a 6:1 ratio to the indexer, a 90: 1 and 72:1 ratios for my circular tables, the Arduino sketch can be altered to suit any integer ratio numbers as required.
The Indexing head I built from steel box section. originally as a horizontal head for my vertical mill, using 
the bevel and pinion gears out of an angle grinder. The pinion was brazed to a stub arbor for the mill quill, the
bevel gear machined to fit the indexer spindle.
The indexer spindle is a converted lathe tailstock quill with a#2 Morse taper. this runs in the indexing head steel box with tapered roller bearings and oil seal at the front.
I machine a lot of T5 timing belt pulleys in my hobby, and fly cut the teeth using the indexer.Works out well.
Certainly cuts down on the cost of purchasing pulleys.
Hope photos will be of interest, worth a thousand words.
John
Spain


----------



## fubuddy (Nov 4, 2018)

Foozer said:


> OK just to check - your stepper is 0.3 degree -> 1200 steps per rotation -> 6:1 table ratio -> 7200 steps per 360 degree table rotation? Correct . .
> So switches on 6600 1-off 2-on 3-on [Half Step]
> .



nope, its 200 steps per rev, 1/6 raito, = 1200 steps per rev total, i did not see the need for the code to do that math, so i just enter 1200 for steps and 1 for raito, ive tried the math for all my driver settings, and always get a 1/3 or 2/3 decimal.

the code works for you and goes in reverse ?
thats the only thing i actually want at this point, i got it installed on the mill and cut a 5 and 6 sided reamer's

using my f'd code with 1200 as degrees , i just do a lil quick head math, divisions of  1 2 3 4 5 6 8 and 16 by 1200 are all real easy


----------



## fubuddy (Nov 4, 2018)

Scott_M said:


> FuBuddy
> If you are using the "Arduino" editor, just go to "File" Tab  then "Preferences" and click    " display line numbers "
> 
> Scott



thanks Scott, that will definitely help a lotabit, i wont have to count arrows down to 276 again   but i still want those good old compare script and search features


----------



## Foozer (Nov 4, 2018)

fubuddy said:


> nope, its 200 steps per rev, 1/6 raito, = 1200 steps per rev total, i did not see the need for the code to do that math, so i just enter 1200 for steps and 1 for raito, ive tried the math for all my driver settings, and always get a 1/3 or 2/3 decimal.
> 
> the code works for you and goes in reverse ?
> thats the only thing i actually want at this point, i got it installed on the mill and cut a 5 and 6 sided reamer's



Works fine FWD and REV . . .  [Note - 276 referred to your post number not script line number] You should be able to change the numbers if your full stepping 200 for StepsPerRotation, 400 for half stepping [runs smoother on half stepping


Ok after the Bride lets me free I'll do a quick and dirty test script for FWD and REV - I'll Be Back . .
Back - Should run motor fwd and rev - 

#include <LiquidCrystal_I2C.h>
#include <LiquidCrystal_I2C.h>
int stp = 2;
int dir = 3;
int stepdelay = 2000; // Reduce number to speed up motor
int revolution = 400; // Half Stepping - Set TB6600 switches accordinly ie: 1 OFF, 2,3 ON
LiquidCrystal_I2C lcd(0x3F, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);  // Set the LCD I2C address
void setup() {
  pinMode(stp, OUTPUT);
  pinMode(dir, OUTPUT);
lcd.begin(20,4);
}
void loop() {
  delay(500);
  digitalWrite(dir,HIGH);
lcd.setCursor(6,2);
lcd.print("Forward");
  for (int x = 0; x < revolution; x++)
  {
    digitalWrite(stp, HIGH);
    delayMicroseconds(stepdelay);
    digitalWrite(stp, LOW);
    delayMicroseconds(stepdelay);
  }
  delay(500);
digitalWrite(dir,LOW);
lcd.setCursor(6,2);
lcd.print("Reverse");
for (int x = 0; x < revolution; x++)
  {
    digitalWrite(stp, HIGH);
    delayMicroseconds(stepdelay);
    digitalWrite(stp, LOW);
    delayMicroseconds(stepdelay);
  }
}
int stp = 2;
int dir = 3;
int stepdelay = 2000; // Reduce number to speed up motor
int revolution = 400; // Half Stepping - Set TB6600 switches accordinly ie: 1 OFF, 2,3 ON
LiquidCrystal_I2C lcd(0x3F, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);  // Set the LCD I2C address
void setup() {
  pinMode(stp, OUTPUT);
  pinMode(dir, OUTPUT);
lcd.begin(20,4);
}
void loop() {
  delay(500);
  digitalWrite(dir,HIGH);
lcd.setCursor(6,2);
lcd.print("Forward");
  for (int x = 0; x < revolution; x++)
  {
    digitalWrite(stp, HIGH);
    delayMicroseconds(stepdelay);
    digitalWrite(stp, LOW);
    delayMicroseconds(stepdelay);
  }
  delay(500);
digitalWrite(dir,LOW);
lcd.setCursor(6,2);
lcd.print("Reverse");
for (int x = 0; x < revolution; x++)
  {
    digitalWrite(stp, HIGH);
    delayMicroseconds(stepdelay);
    digitalWrite(stp, LOW);
    delayMicroseconds(stepdelay);
  }
}


----------



## fubuddy (Nov 4, 2018)

hmmm smoother but just as fast ? or does it also slow it down, i was under the impression that more micro steps = slower rotation
and i rather have it fast than smooth.
ive checked the wiring labeling to make sure i had it right and i do, according to china, but ive had stuff come with + and - mixed up before...
ill physically confirm that it is correct 
if the code i posted with my bad working for me code, makes yours go forward and back i would assume something is wrong in my wiring, or one of the lines i changed that you changed back only applies to forward.
still need to find a box for it...


----------



## Foozer (Nov 4, 2018)

fubuddy said:


> ill physically confirm that it is correct
> 
> 
> View attachment 105085


Smoother and slower . .

Thinking first to see if your motor will rotate both directions - Real simple one. . . 

// Begin
int stp = 2;
int dir = 3;
int stepdelay = 2000; // Reduce number to speed up motor Too low and the motor will just buzz not turn.
int revolution = 400; // Half Stepping - Set TB6600 switches accordinly ie: 1 OFF, 2,3 ON
void setup() {
  pinMode(stp, OUTPUT);
  pinMode(dir, OUTPUT);
}
void loop() {
  digitalWrite(dir, HIGH); // Switch to LOW for opposite direction ie: digitalWrite(dir, LOW);
  {
    digitalWrite(stp, HIGH);
    delayMicroseconds(stepdelay);
    digitalWrite(stp, LOW);
    delayMicroseconds(stepdelay);
  }
}
// End

Cut and paste into arduino, load, TB6600 set to half step motor should turn . Change the dir,HIGH to dir,LOW reload and motor should turn in opposite direction. 

Makes no difference to this if the TB6600 is set to full step [200] If you get it to forward reverse the rest is easy . .


----------



## fubuddy (Nov 4, 2018)

ohhh queso...tried that , high gives me a click, low rotates stepper.
switched motors same result, so bad driver ?


----------



## Foozer (Nov 4, 2018)

fubuddy said:


> ohhh queso...tried that , high gives me a click, low rotates stepper.
> switched motors same result, so bad driver ?



Low rotates stepper - take it rotates it a bit slower than the original script did [was the intent] The 6600 is grounded to the arduino ? all things share a common ground? Lacking a good kick may be that the 6600 is a tad flakey . .


----------



## fubuddy (Nov 4, 2018)

correct, a lil slower but not much.
yes all negative on driver are wired to a single negative terminal on arduino
is there another driver you might recommend, ordered another 6600
3.0 amp nema 23


----------



## Foozer (Nov 4, 2018)

fubuddy said:


> correct, a lil slower but not much.
> yes all negative on driver are wired to a single negative terminal on arduino
> is there another driver you might recommend, ordered another 6600
> 3.0 amp nema 23



I have three of those 6600, all work fine on nema 23's 3.5 amp.  Only time won't turn is if I try to run them too fast, [won't start is the pluses are too fast] and it's more of a buzz than a click. You can set the stepdelay down to 4000,  6000 - should run slower.
 Other that having in hard am at a lose right now as to your click noise . . .
Guess till your new 6600 comes in - shall wait . .


----------



## fubuddy (Nov 4, 2018)

yes sir, thanks for all the help, ill report back if the new driver fixes it or not.


----------



## Foozer (Nov 4, 2018)

fubuddy said:


> yes sir, thanks for all the help, ill report back if the new driver fixes it or not.



Yup - Tried to mimic the error but . . . So pulled the dir wire from arduino and tied it straight to gnd -> motor runs one direction, to +5 volts, motor runs the other way.

Till your driver comes in - - Bob . . .


----------



## Foozer (Nov 4, 2018)

dwk said:


> I really must thank Chuck and others for their valuable information. Having no experience of coding the info here has been most useful.
> My only problem with Chucks code (from post #50) or my setup is the lack of reverse direction. Can anyone tell me where I may be going wrong?



I'll give it a try but Chucks stuff is so far above my skill level, but what the heck . . .
Ok dug out the sainsmart - - First hookup - No reverse - Looked up the shield pin callout
Hooked to the wrong pins - Again. 

Left to Right D13 - D12 - D11 - D3 - D2 - D1 - D0 - GND - 5V
Had driver hooked to D2-D1 - [Looks on the shield they should be D2-D3 Right?] Moved over one spot to match the actual pin callout and all is good . . .


----------



## dwk (Nov 8, 2018)

ok, everything seems to be working fine except the reverse! So this is my setup:-
Arduino uno
Sainsmart lcd display shield
TB 6560 stepper motor controller.
Anyone with same setup show me how they have it connected or have any ideas.


----------



## chucketn (Nov 8, 2018)

I just finished 're-building' my controller. I had built it using a non I2c 2004' but, several months ago I tore it apart to use the mega in another project. About a month ago I decided to re-build it, designing a new case as I went. I decided to order a I2c 2004 lcd, and though shipped from California, it took 4 weeks to get here... I had previously added a 9 pin sub D connector and longer leads to the stepper,. This time I took the time to set up modular wiring as much as possible. I still need to draw up a schematic diagram. Short version, I also used a TB6560 driver board. My connections were as in the attached picture. My setup is again torn apart until I finish printing the new case, but if needed, I can re-assemble and take pictures.
Hope this helps


----------



## chucketn (Nov 8, 2018)

chucketn said:


> View attachment 105132
> 
> I just finished 're-building' my controller. I had built it using a non I2c 2004' but, several months ago I tore it apart to use the mega in another project. About a month ago I decided to re-build it, designing a new case as I went. I decided to order a I2c 2004 lcd, and to shipped from California, it took 4 weeks to get here... I had previously added a 9 pin sub D connector and longer leads to the stepper,. This time I took the time to set up modular wiring as much as possible. I still need to draw up a schematic diagram. Short version, I also used a TB6560 driver board. My connections were as in the attached picture.
> Hope this helps



Forgot to add, I tested the same setup with a UNO, only difference was the I2C pins on the UNO were in a different location. All the rest were the same pin #'s. No changes to the code provided.


----------



## rodw (Nov 8, 2018)

dwk said:


> ok, everything seems to be working fine except the reverse! So this is my setup:-
> Arduino uno
> Sainsmart lcd display shield
> TB 6560 stepper motor controller.
> Anyone with same setup show me how they have it connected or have any ideas.



If you cannot change direction, you have a problem with the DIR signal. Either its not connected or connected to the wrong pin.


----------



## Foozer (Nov 8, 2018)

dwk said:


> ok, everything seems to be working fine except the reverse! So this is my setup:-
> Arduino uno
> Sainsmart lcd display shield
> TB 6560 stepper motor controller.
> Anyone with same setup show me how they have it connected or have any ideas.



First hookup acted as you described - No reverse -> I had the hookup wrong, even though it looks like a straight plug to plug shield, it's not . .  Moved the step and dir to the per shield correct pin call out and all worked fine . . .


----------



## fubuddy (Nov 9, 2018)

chucketn said:


> View attachment 105132
> 
> though shipped from California, it took 4 weeks to get here..s



lol this pisses me off, a bunch of the ebay sellers i have been buying from are saying us stock, providing a tracking number, waiting for the item to get to them from china then shipping it out. actually had one that came straight from china the other day....


----------



## chucketn (Nov 9, 2018)

dwk said:


> ok, everything seems to be working fine except the reverse! So this is my setup:-
> Arduino uno
> Sainsmart lcd display shield
> TB 6560 stepper motor controller.
> Anyone with same setup show me how they have it connected or have any ideas.



DWK, did you get it working?


----------



## fubuddy (Nov 9, 2018)

so my new 6600 got here, its not a 6600 tho, at least it truly shipped from california.....
i figured out that having the enable ground wire connected at all was stopping it from rotating on the B button, but now that i fixed that it still only moves one direction.
i have ordered all of the parts to build a 2nd controller sense its cheap. 
i compared the script im using with the original 2016 script in context and there is nothing i see that would cause this there. 
not looking for help or advice right now, just giving an update.
ill post the status again when i get the 2nd controller built for testing.


----------



## dwk (Nov 9, 2018)

Finally got my setup to go in both directions, however the motor after doing a revolution in either direction starts to slowly creep a little then becomes faster. Only way to stop it is by pressing the reset button.
Seems to be a possible problem with either the lcd shield or the motor driver. Has anyone else encountered this problem?


----------



## fubuddy (Nov 9, 2018)

have not had that happen to me, my lcd is not a shield tho, i decided to go with the separate lcd and keypad for more inputs and compartmentalized problems. 
did you try the code for simple forward and back that fooser posted for me on page 15 of this thread ?
it does not use any of the lcd or touch pad
 stuff and lets you test the driver and motor with the board only.


----------



## pp2076 (Nov 9, 2018)

fubuddy said:


> thanks Scott, that will definitely help a lotabit, i wont have to count arrows down to 276 again   but i still want those good old compare script and search features


There are many programs that enable you to compare different versions of code (text).
I use winmerge from http://winmerge.org/


----------



## fubuddy (Nov 9, 2018)

pp2076 said:


> There are many programs that enable you to compare different versions of code (text).
> I use winmerge from http://winmerge.org/



is that an all in one with arduino also ? i have context thats what i was used to using 15 years ago, i was just hoping to use a single program for all of it


----------



## pp2076 (Nov 9, 2018)

at


fubuddy said:


> is that an all in one with arduino also ? i have context thats what i was used to using 15 years ago, i was just hoping to use a single program for all of it


No, just a simple standalone program. Quite powerful though.


----------



## dwk (Nov 9, 2018)

chucketn said:


> DWK, did you get it working?


Sort of working. Got both directions working but after a complete revolution the stepper stafts to creep.


----------



## dwk (Nov 9, 2018)

fubuddy said:


> have not had that happen to me, my lcd is not a shield tho, i decided to go with the separate lcd and keypad for more inputs and compartmentalized problems.
> did you try the code for simple forward and back that fooser posted for me on page 15 of this thread ?
> it does not use any of the lcd or touch pad
> stuff and lets you test the driver and motor with the board only.


Although have tried that in the past with no problems I will try again just to be sure.


----------



## pdsilva (May 9, 2019)

cfellows said:


> 12





cfellows said:


> Here's some pictures of the dividing head. I've hooked it up to the arduino and it works. More than enough torque and holding power using the NEMA 23 motor. The ratio of the timing pulleys is 12 : 60 or 1:5.
> 
> 
> 
> ...



I think something is wrong,  if you have a gear in the motor with 12 teeth an another with 60 teeth the ratio is 5:1 when gear with 12 teeth spins 5 times gear with 60 teeth will spins one time.


----------



## accelo (May 24, 2019)

*Have you read revwarguy's Arduino Indexing (Dividing) Head article?*
*Very well done and inculdes a link to the arduino software.*
*Below is a link;*
*http://www.liming.org/millindex/*


----------



## Muggs (Mar 25, 2021)

I realize that this is an old thread, BUT...
I'm in the process of making an indexer for my Mini Lathe, and I have looked at many, but I really like the simplicity of Alan R's (AKA harrzack) solution in post #263. There he shows a video of a very clean simple method of controlling stepped rotation. But, as he mentions below, his website was hacked and no longer has the files available.
So... my question is: does anyone have, or know where I can obtain the schematic & Arduino code for his project, OR does someone know of a similar solution where I can get the information.

TIA, Muggs


----------



## tjwal (Mar 26, 2021)

Have you looked at the “rotary table for dummies thread”?


----------



## Muggs (Mar 26, 2021)

tjwal,
No, but Thank you!!! I have my nights reading now. Thank you again, this looks like exactly what I wanted.


----------



## tjwal (Mar 26, 2021)

The original software had some integer and error accumulation issues.   By the end of the thread I believe these had all been resolved.  I use my version posted in message 149.  Kquiggle added in some enhancements after that.


----------



## Muggs (Mar 26, 2021)

Thank you. I know a fair amount about the Arduino, but I’m reading the thread with pencil and paper in hand!


----------



## SmithDoor (Mar 27, 2021)

Muggs said:


> Thank you. I know a fair amount about the Arduino, but I’m reading the thread with pencil and paper in hand!


You can buy a electronic counter that does job too from Durrant. 

Dave


----------



## SmithDoor (Apr 13, 2021)

Has anyone used a digital electronic controller/counter 
Like Durant type .



cfellows said:


> I've made some strides on my Arduino powered dividing head the past few days. Here's a little background for what I am doing. First, the Arduino micro controller.
> 
> 
> 
> ...


----------

