Electronic Dividing Head using the Arduino

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.
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.
 
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

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
 
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
 
Last edited:
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

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.
 
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
 
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,

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
 
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
 
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.
 
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
 
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:
 
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:
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.
 
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
 
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.
 
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.
 
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.
 
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
 
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]
 
Back
Top