CNC Dividing Head - PICAXE microcontroller

Home Model Engine Machinist Forum

Help Support Home Model Engine Machinist Forum:

This site may earn a commission from merchant affiliate links, including eBay, Amazon, and others.
You could do a couple more iterations of MOD and divide, sort of like a leap-year algorithm to figure out when to insert 'leap steps', but I'm thinking there ought to be a cleverer way. Marv may be on to something with his approach as well.. have to think on that.
 
To test my thinking, I wrote a brief program using 1024 rather than 1000 as the scale factor (sf). In the results below, each line is:

K K*I K*A K*B/sf S

where the variables are defined in my previous post.

Examining the output for N=49, you can see that it's always true that:

S = int[K*I]

as desired.

Unfortunately, there are cases (e.g. N=55) where there can be a one count error due to the rounding inherent in the finite size of the scale factor. While I haven't proved it, I'm fairly sure that that error can never exceed one count, however. Still, that's 0.25 deg which is too much for gear cutting. On top of that you've got the fact that truncating rather than rounding can introduce nearly another count of error bringing the total possible error to 0.5 deg.

You're welcome to a copy of the program code if you want it although it's probably just as easy to write it yourself.

I've got to go do Xmas stuff now...


Code:
N=49
I,A,B = 29.387755, 29, 397

0 0.000000 0 0 0
1 29.387755 29 0 29
2 58.775510 58 0 58
3 88.163265 87 1 88
4 117.551020 116 1 117
5 146.938776 145 1 146
6 176.326531 174 2 176
7 205.714286 203 2 205
8 235.102041 232 3 235
9 264.489796 261 3 264
10 293.877551 290 3 293
11 323.265306 319 4 323
12 352.653061 348 4 352
13 382.040816 377 5 382
14 411.428571 406 5 411
15 440.816327 435 5 440
16 470.204082 464 6 470
17 499.591837 493 6 499
18 528.979592 522 6 528
19 558.367347 551 7 558
20 587.755102 580 7 587
21 617.142857 609 8 617
22 646.530612 638 8 646
23 675.918367 667 8 675
24 705.306122 696 9 705
25 734.693878 725 9 734
26 764.081633 754 10 764
27 793.469388 783 10 793
28 822.857143 812 10 822
29 852.244898 841 11 852
30 881.632653 870 11 881
31 911.020408 899 12 911
32 940.408163 928 12 940
33 969.795918 957 12 969
34 999.183673 986 13 999
35 1028.571429 1015 13 1028
36 1057.959184 1044 13 1057
37 1087.346939 1073 14 1087
38 1116.734694 1102 14 1116
39 1146.122449 1131 15 1146
40 1175.510204 1160 15 1175
41 1204.897959 1189 15 1204
42 1234.285714 1218 16 1234
43 1263.673469 1247 16 1263
44 1293.061224 1276 17 1293
45 1322.448980 1305 17 1322
46 1351.836735 1334 17 1351
47 1381.224490 1363 18 1381
48 1410.612245 1392 18 1410

Code:
N = 55
I,A,B = 26.181818, 26, 186

0 0.000000 0 0 0
1 26.181818 26 0 26
2 52.363636 52 0 52
3 78.545455 78 0 78
4 104.727273 104 0 104
5 130.909091 130 0 130
6 157.090909 156 1 157
7 183.272727 182 1 183
8 209.454545 208 1 209
9 235.636364 234 1 235
10 261.818182 260 1 261
11 288.000000 286 1 287
error
12 314.181818 312 2 314
13 340.363636 338 2 340
14 366.545455 364 2 366
15 392.727273 390 2 392
16 418.909091 416 2 418
17 445.090909 442 3 445
18 471.272727 468 3 471
19 497.454545 494 3 497
20 523.636364 520 3 523
21 549.818182 546 3 549
22 576.000000 572 3 575
error
23 602.181818 598 4 602
24 628.363636 624 4 628
25 654.545455 650 4 654
26 680.727273 676 4 680
27 706.909091 702 4 706
28 733.090909 728 5 733
29 759.272727 754 5 759
30 785.454545 780 5 785
31 811.636364 806 5 811
32 837.818182 832 5 837
33 864.000000 858 5 863
error
34 890.181818 884 6 890
35 916.363636 910 6 916
36 942.545455 936 6 942
37 968.727273 962 6 968
38 994.909091 988 6 994
39 1021.090909 1014 7 1021
40 1047.272727 1040 7 1047
41 1073.454545 1066 7 1073
42 1099.636364 1092 7 1099
43 1125.818182 1118 7 1125
44 1152.000000 1144 7 1151
error
45 1178.181818 1170 8 1178
46 1204.363636 1196 8 1204
47 1230.545455 1222 8 1230
48 1256.727273 1248 8 1256
49 1282.909091 1274 8 1282
50 1309.090909 1300 9 1309
51 1335.272727 1326 9 1335
52 1361.454545 1352 9 1361
53 1387.636364 1378 9 1387
54 1413.818182 1404 9 1413
 
Thanks, Marv, I was hoping to pique your interest in this problem! ::) To increase the resolution, I could half step the bipolar stepper. This would give me 2880 steps per revolution. If I was off 1 step one way or the other, this would reduce the error to 1/8th of a degree. Would that be accurate enough?

Chuck
 
You all forgetting something here, the 1440 step will further be divided by the dividing head's reduction.

I have a small 1:50 worm gearbox that's waiting for a controller build for a 200 step motor, this would give a resolution of 10000 steps per rotation in whole steps and double that in half steps. That's 0,036/0,018º precision. I bet it would take some sophisticated measuring equipment to find that error in a part. ;)
 
Noitoen said:
You all forgetting something here, the 1440 step will further be divided by the dividing head's reduction.

I have a small 1:50 worm gearbox that's waiting for a controller build for a 200 step motor, this would give a resolution of 10000 steps per rotation in whole steps and double that in half steps. That's 0,036/0,018º precision. I bet it would take some sophisticated measuring equipment to find that error in a part. ;)

Not planning to use a dividing head with this setup. The shaft that holds the work will be driven directly with the stepper gearmotor output shaft, although I might use timing pulleys and a belt with some slight gear reduction, maybe another 2 or 3 :1.

Chuck
 
Marv, you came up with pretty much the same solution I was working toward yesterday before I got hauled off to the Christmas Festivities. I was multiplying the number of steps per division by 100, then dividing the remainder to get the decimal part of the steps per interval, the storing this "decimal" value in a different register. Hadn't worked out all the details yet on how to use that "decimal" number. Looks like your work will help me get there.

I'm probably losing sight of the fact that this is supposed to be a learning project to become familiar with microcontrollers, but I would like the final product to be useful!

Chuck
 
Bump.

Chuck,

What, if anything, is happening with your divider math?

While in the shower this morning (I do my best work there) I realized that the problem I had had before with the N=55 case could be solved simply by rounding, as opposed to truncating, to obtain the value of B. I tried it and it works. (Since B is computed external to the m/c - in a conventional computer - working with its extended decimal value is legitimate.)

The next step will be to write a program to test it against all values of N up to some rational maximum to see if it eliminates errors everywhere.
 
A few pages back someone mentioned an LCD Display... they have ones that can be written to serially, can be handy in a lot of of ways.

http://www.sparkfun.com/commerce/product_info.php?products_id=9395

There's others out there, but I figured I'd post one. It makes it dead easy to use with most microcontrollers. (Arduino fan myself... been hacking together a lightsaber driver.)

[ame]http://www.youtube.com/watch?v=YowVHboU-oQ&feature=channel[/ame]


 

Latest posts

Back
Top