Project of the Month built by mayhugh1

Help Support Home Model Engine Machinist by donating using the link above or becoming a Supporting Member.
Home Model Engine Machinist > CNC and 3-D Printers > Software and Programming > Electronic Dividing Head using the Arduino

Reply
 
Thread Tools
Old 06-26-2017, 03:30 PM   #231
Captain_Obvious
 
Join Date: Jun 2017
Posts: 29
Liked 9 Times on 8 Posts
Likes Given: 12

Default

Quote:
Originally Posted by rodw View Post
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.



Last edited by Captain_Obvious; 06-26-2017 at 03:31 PM. Reason: added quote
Captain_Obvious is offline  
 
Reply With Quote
Old 06-27-2017, 07:44 AM   #232
Captain_Obvious
 
Join Date: Jun 2017
Posts: 29
Liked 9 Times on 8 Posts
Likes Given: 12

Default

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.


Attached Thumbnails
holes.jpg   rotary.jpg  
Captain_Obvious is offline  
 
Reply With Quote
Old 06-27-2017, 03:51 PM   #233
Foozer
HMEM_LIFETIMESUPPORTER.png
 
Join Date: Nov 2008
Location: Camano Island, WA
Posts: 1,098
Liked 71 Times on 64 Posts
Likes Given: 2

Default

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 //
__________________
"Nothing is more irritating than that which exposes the pedigree of ideas"----Lord Acton----
Foozer is offline  
 
Reply With Quote
Old 06-29-2017, 10:07 AM   #234
rodw
 
Join Date: Dec 2012
Posts: 1,025
Liked 306 Times on 239 Posts
Likes Given: 157

Default

Foozer and Captain_Obvious. I have revised my goDivide() procedure in an attempt to fix this bug. Please check this thread
http://www.homemodelenginemachinist....834#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.
__________________
RodW
Brisbane, Australia
vehiclemods.net.au
rodw is offline  
 
Reply With Quote
Old 07-16-2017, 02:46 PM   #235
Fossilbones
 
Join Date: Apr 2016
Location: .au
Posts: 1
Default Electronic Dividing head

http://www.liming.org/millindex/
Fossilbones is offline  
 
Reply With Quote
Old 07-17-2017, 11:32 AM   #236
cfellows
Project of the Month Winner!!!
 
cfellows's Avatar
 
Join Date: Aug 2007
Posts: 3,876
Liked 755 Times on 484 Posts
Likes Given: 3

Default

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
cfellows is offline  
rodw Likes This 
Reply With Quote
Old 07-17-2017, 09:17 PM   #237
rodw
 
Join Date: Dec 2012
Posts: 1,025
Liked 306 Times on 239 Posts
Likes Given: 157

Default

Quote:
Originally Posted by cfellows View Post
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
Brisbane, Australia
vehiclemods.net.au
rodw is offline  
 
Reply With Quote
Old 07-17-2017, 09:47 PM   #238
rodw
 
Join Date: Dec 2012
Posts: 1,025
Liked 306 Times on 239 Posts
Likes Given: 157

Default

Quote:
Originally Posted by Fossilbones View Post
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.
__________________
RodW
Brisbane, Australia
vehiclemods.net.au
rodw is offline  
 
Reply With Quote
Old 07-18-2017, 05:58 AM   #239
Captain_Obvious
 
Join Date: Jun 2017
Posts: 29
Liked 9 Times on 8 Posts
Likes Given: 12

Default

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.
Captain_Obvious is offline  
rodw Likes This 
Reply With Quote
Old 07-18-2017, 10:11 AM   #240
rodw
 
Join Date: Dec 2012
Posts: 1,025
Liked 306 Times on 239 Posts
Likes Given: 157

Default

Quote:
Originally Posted by Captain_Obvious View Post
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.


__________________
RodW
Brisbane, Australia
vehiclemods.net.au
rodw is offline  
Captain_Obvious Likes This 
Reply With Quote
Reply


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Electronic Dividing Head cfellows Tools 23 08-10-2013 02:29 AM
Rotary Head/Dividing Head Question chucketn General Engine Discussion 6 02-13-2012 03:18 PM
Dividing head m_kilde Tools 25 04-11-2011 09:17 AM
Dividing head Richard1 General Engine Discussion 9 09-15-2009 07:47 AM
Look Ma, no dividing head. John S Photos and Videos 7 07-15-2008 05:08 PM



Newest Threads






- Top - Member List