Author Topic: X2 X-axis Stepper motor Power Feed - (possible CNC conversion?)  (Read 60901 times)

Offline raynerd

  • Madmodder Committee
  • Hero Member
  • *****
  • Posts: 2893
  • Country: gb
    • Raynerds Projects - Raynerd.co.uk
X2 X-axis Stepper motor Power Feed - (possible CNC conversion?)
« on: December 13, 2009, 04:42:03 PM »
Hi Guys

After the sucess and enjoyment of converting my Vertex rotary table to CNC, I thought I`d jump back onto the X-axis conversion. I did try this some time ago and it failed so I didn`t post anything but now looking back, the two shafts were not aligned, only a fraction out but it made the axis twist. Since then and during my rotab conversion, I learnt about Oldham couplings. So a fresh start on the build, a new connecting rod but the same motor mount. To be honest, the setup is going to be the "easy" bit, since it is a stepper motor I want the maximum control that I can get from it but I don`t want to be messing with computers and Mach3. This is where a little microprocessor, some coding and an a little circuit is going to come in which will run all this. Similar to what is running my rotab but I`m going to attempt to make this one !! I`m going to be making a start on that on Wednesday night so I`ll post updates then. As far as the rest of the setup goes, I`m now just waiting the Oldham couplings to joing the two shafts:

Stepper motor and motor mount fitted to the rear end of the X axis, great thing about this is that the handle stays on and no resistance in the motor when it is off means that it maintains full manual use.


This is the part that connects the lead screw of the x-axis to the motor shaft. The thin end will attach to the oldham coupling


This is looking into the end of the fat end. The bar going through the bore locks into the notch at the end of the lead screw and engages it.



Both parts held into position - the gap is the space for the Oldham coupling and spacer to sit.


More updates soon.... Oldham coupling, 0.25" to 6mm and spacer are on their way




Offline websterz

  • Sr. Member
  • ****
  • Posts: 415
Re: X2 X-axis Stepper motor Power Feed - (possible CNC conversion?)
« Reply #1 on: December 13, 2009, 04:51:45 PM »
I must admit, I had never heard of an Oldham coupling before. Brilliant little piece of engineering, filed away in the dark recesses of my brain for later use.  :thumbup:
"In the 60's, people took acid to make the world weird.  Now the world is weird and people take Prozac to make it normal."
 :med:

Offline raynerd

  • Madmodder Committee
  • Hero Member
  • *****
  • Posts: 2893
  • Country: gb
    • Raynerds Projects - Raynerd.co.uk
Re: X2 X-axis Stepper motor Power Feed - (possible CNC conversion?)
« Reply #2 on: December 14, 2009, 03:02:43 AM »
Webby, to be honest if you can engineer your part for a perfect fit then there is no problem using a straight link, however it does allow about 1mm of misalignment and so I need one!

Offline John Rudd

  • Hero Member
  • *****
  • Posts: 2525
  • Country: gb
Re: X2 X-axis Stepper motor Power Feed - (possible CNC conversion?)
« Reply #3 on: December 14, 2009, 07:11:34 AM »
Chris,

What size stepper motor are you using please?
eccentric millionaire financed by 'er indoors
Location:  Backworth Newcastle

Skype: chippiejnr

Offline raynerd

  • Madmodder Committee
  • Hero Member
  • *****
  • Posts: 2893
  • Country: gb
    • Raynerds Projects - Raynerd.co.uk
Re: X2 X-axis Stepper motor Power Feed - (possible CNC conversion?)
« Reply #4 on: December 14, 2009, 12:44:55 PM »
Hi John

I`m using some stepper motors that came with a lathe I aquired a while ago. They are 270 oz/in (190 Ncm ??) wired bipolar, 3.75V and 2.8A. Not huge but they should be well enough for this conversion and at slow speeds, the one on my rotary table can drive through a cut so I should be OK. I had to buy a new driver so I purchased a Arc Euro 4.2A driver so if I do need to upgrade the motors the motor will still be OK.

Chris

Offline raynerd

  • Madmodder Committee
  • Hero Member
  • *****
  • Posts: 2893
  • Country: gb
    • Raynerds Projects - Raynerd.co.uk
Re: X2 X-axis Stepper motor Power Feed - (possible CNC conversion?)
« Reply #5 on: December 16, 2009, 06:33:02 PM »
Well it has gone slower than I thought but I spent most of my night with a tutor learning to programme in C. We then used a development board to programme the chip with the compiled code and tested our software.

The current function is as follows:

4 Buttons:  Left, Right, Stop, Limit Sets
Variable Resistor/Pot - Speed
2 LEDS - Motor Running, Set Limits

Functions:
Left - jogs motor left
Right - jogs motor right
Stop - kills motor
Speed - Variable Resistor pot varies speed
Limits - Turning the circuit on from a hard reset sets the position to Zero. Press 'limit' button, light comes on. Move left & right until at position. Press 'mem' light starts to flash. Press left or right to set that limit, light goes out and the user can then press left and right to move between these limits.


So this was all coded in, complied and programmed onto the chip. A test board looks like this:



So basically ALL the buttons are on there and the pins for the outputs were connected to the driver and then stepper motor. We run this programme and it worked a treat so it is totally possible to make a circuit for this which is scarily simple! In all that board all we were using was obviously the PIC, 2 LEDS and 4 press buttons, a POT and about 6 resistors! That is it - maybe a few connectors to make connecting easier but not necessary! However I enjoyed this and although this works I want to understand more and learn how to move this forward further. Àlthough he was happy to programme a pic for me I want to see this project through from start to finish, especially since I just used the circuit in my Rotarytable CNC conversion, I wanted to have a part in all of this.

So for me, my next step is to get a simple development board (the one in the picture was like what we used but far too complex for what I need) probably about £40. Now it would be £20 for a PIC programming circuit alone so I may as well spend the extra and get the development function as well. Then I`ll acutally use the test board to actually run my controller on the mill and then when I`m happy, see exactly what is being used and put together the circuit required to run the controller.

Sorry, no pictures, there is nothing to take! I`m quite happy to provide the HEX. files if anyone has a use for them.

Chris

« Last Edit: December 17, 2009, 10:24:40 AM by craynerd »

Offline NickG

  • Madmodder Committee
  • Hero Member
  • *****
  • Posts: 1890
Re: X2 X-axis Stepper motor Power Feed - (possible CNC conversion?)
« Reply #6 on: December 17, 2009, 06:29:20 AM »
Very interesting the CNC stuff Chris. Have you put ball screws into your mill then? That circuit looks complex will be watching your updates.

Nick
Location: County Durham (North East England)

Offline raynerd

  • Madmodder Committee
  • Hero Member
  • *****
  • Posts: 2893
  • Country: gb
    • Raynerds Projects - Raynerd.co.uk
Re: X2 X-axis Stepper motor Power Feed - (possible CNC conversion?)
« Reply #7 on: December 17, 2009, 10:06:05 AM »
Nick - I`ve cranked down the acme's anti-backlash nut hard, it is stiff to turn manual but the motor is fine with it. I totally appreciate it won`t be good enough, or unlikely to be good enough for a CNC control (although there are some excellent setups on cnczone with acne screws!) but for the time being the acme screws will get me going. Remember, this is an eventual CNC conversion, right now my priority is to setup as an X-axis controller, build the circuit and get it in use. I can then spend more time in developing it into a fully blown CNC independent controller. My intention is to even have a USB port which you can stick into the controller and boot up a G-code and exicute the file!

The amazing thing about these PICs is that you can write the code and using a devlopment board immediately load the program and test it! Last night we literally had a fully working motor running and we kept updating as we added extra code and extra functions. The code that runs my X axis power feed will eventually be embedded within the code that runs the CNC controller - just extra buttons, LEDs and such needed on the circuit.

Offline raynerd

  • Madmodder Committee
  • Hero Member
  • *****
  • Posts: 2893
  • Country: gb
    • Raynerds Projects - Raynerd.co.uk
Re: X2 X-axis Stepper motor Power Feed - (possible CNC conversion?)
« Reply #8 on: December 17, 2009, 10:22:49 AM »
Nick - that circuit remember is the development board not the circuit of the controller!

It looks complex and remember I`m a noob at this too but in actual fact it is quite simple. If you look at the PIC (or actually there are a few different PIC craddles) all the controller does is connect every (well nearly) pin on the pic to an LED, a push switch, a connector, a pot, an LCD etc....   The point is, that each pin is connected to one of each so that when you programe the PIC you tell the PIC what is connected to it and that is totally your choice! So basically the first programme we made last night was like this:

PortB pin1 an input
PortB pin2 an output

If
PortBPin1= 1     // if the button is pressed, i.e 1
PortBpin2 is 1   // the LED is on i.e 1
else               // otherwise if it is not pressed     
Port B pin 2 is 0   // the LED is off  i.e 0

Infact it was pretty much as simple as that! You then pressed the button connected to PortBpin1 and the LED connected to PortBpin2 came on!  And because one of everything is connected to each pin, you can do whatever you like on each pin!
A code almost identical could be used to turn the motor on, instead of the LED have a motor coming on (1) but you`d just need to set the pulse to high and then low for the step. Also it would only go one way, so you`d need another button to alter between 1 (left) or 0 (right).

I know I`m probably going a bit over the top here in my explanation but it is even easier to read than what I wrote above if you use Define statements to define the ports:

Define (button) = portBpin1
Define (LED) = portBpin2

Then use the code like above but in terms of making sense to us, it should help:

If
button= 1     // if the button is pressed, i.e 1
LED is 1   // the LED is on i.e 1
else               // otherwise if it is not pressed     
LED  is 0   // the LED is off  i.e 0

 At that would work exactly the same but it makes more sense to us and is easier to read when defining the ports. I`ve picked all this up in one night, don`t get me wrong it can get bloody complex but it is not too bad to pick up.

Offline NickG

  • Madmodder Committee
  • Hero Member
  • *****
  • Posts: 1890
Re: X2 X-axis Stepper motor Power Feed - (possible CNC conversion?)
« Reply #9 on: December 17, 2009, 10:32:12 AM »
Sounds good. My dad was a technology teacher and had a denford mircromill and lathe in his classroom - I always intended to go and have a play with it. They hardly ever used it as were a little scared of it / wasn't really in the curriculum so all they used it for was making signs, milling letters out of plastic I think. Don't think they ever used the lathe. I should have put an offer in before he left! Very small but pretty neat bits of kit. I think he said the software was basic and seemed very limited but am sure you could get other software or if you got the right controllers etc could have made them really good.

I've just skipped over your info below a bit but it won't go in at the moment with square eyes, so will have to read properly later!

Nick
Location: County Durham (North East England)

tumutbound

  • Guest
Re: X2 X-axis Stepper motor Power Feed - (possible CNC conversion?)
« Reply #10 on: December 17, 2009, 04:57:49 PM »
I'm looking to put a power feed on my X2 and was going to use a motor from an old cordless drill.
Having read your thread, I might have to dig through the stepper motors to see if I have anything that will suit.

Offline raynerd

  • Madmodder Committee
  • Hero Member
  • *****
  • Posts: 2893
  • Country: gb
    • Raynerds Projects - Raynerd.co.uk
Re: X2 X-axis Stepper motor Power Feed - (possible CNC conversion?)
« Reply #11 on: December 18, 2009, 03:28:07 AM »
Tumutbound - if  I manage to get this controller running you are welcome to have the code, pic or circuit to run it!

Chris

Offline raynerd

  • Madmodder Committee
  • Hero Member
  • *****
  • Posts: 2893
  • Country: gb
    • Raynerds Projects - Raynerd.co.uk
Re: X2 X-axis Stepper motor Power Feed - (possible CNC conversion?)
« Reply #12 on: December 19, 2009, 02:25:37 PM »
Well I got a bit further today. Managed to get hold of a Development board, load the PIC and test the circuit with an osciloscope. Here is the setup:



EasyPIC5 dev board


Osc, shows us when we are pulsing and is easier to test and calculate from than actually hooking up a motor. Although a motor in its place would run!



Chris
« Last Edit: August 31, 2010, 07:45:51 PM by craynerd »

Offline NickG

  • Madmodder Committee
  • Hero Member
  • *****
  • Posts: 1890
Re: X2 X-axis Stepper motor Power Feed - (possible CNC conversion?)
« Reply #13 on: December 20, 2009, 03:24:21 AM »
Chris,

That's really good stuff there, very interesting - think it'd take a lot to explain that in writing, a video was worth 1,000,000 words in this case! Did you loan the development board then? How much would one like that set you back? And what software is required to drive it?

Cheers,

Nick
Location: County Durham (North East England)

Offline spuddevans

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1618
  • Country: 00
  • Portadown, Northern Ireland
    • My Photo website
Re: X2 X-axis Stepper motor Power Feed - (possible CNC conversion?)
« Reply #14 on: December 20, 2009, 04:11:35 AM »
How much would one like that set you back? And what software is required to drive it?

Funnily enough, I have been looking into those particular development boards recently. The latest version can be found here

You can use different programming languages like C, Basic and Pascal, or you can learn the PIC specific coding. There are complete starter development packs that come with your choice of programming language and a few other accessories Clicky

The manufacturers site holds a lot more detail about the different development boards, as well as a load of downloadable pdf's of user manuals, projects and schematics. Linky


Hope this helps,

Tim
« Last Edit: December 20, 2009, 04:22:59 AM by spuddevans »
Measure with a micrometer, mark with chalk, cut with an axe  -  MI0TME

Offline raynerd

  • Madmodder Committee
  • Hero Member
  • *****
  • Posts: 2893
  • Country: gb
    • Raynerds Projects - Raynerd.co.uk
Re: X2 X-axis Stepper motor Power Feed - (possible CNC conversion?)
« Reply #15 on: December 20, 2009, 04:54:16 AM »
Hi, Tim has answered the question but yes, I did loan the board. I wanted it over Christmas otherwise things come to a halt. This board is $130 dollars I think but from the UK distributor is £95 - it is the EasyPIC5. The software can be downloaded on evaluation - google "MikroC Pro download" - it is the evalutation version but does not restrict features, just the size of the code which is way big enough to get more than going. Infact I bet my final code will still fit within the limits!

I`m just setting off to Maplin now, they do this board:

http://www.maplin.co.uk/Module.aspx?ModuleNo=37192

It is a cheap development board with an onboard programmer! At this price, I`m actually going to USE this board for the actual final circuit. It is a decent size and with the programmer onboard it means that the chip can be updated in situ whenever needed without removing the chip from the controller. OK, it is serial and not USB but good enough for what I want. Infact, its great just to have the components needed at this price and adapt the circuit to suit. I`ll probably pull some of the circuit onto a custom board for anything extra needed. This does not support pic18XXX 40 pin pics but to be honest, they are overkill for anything I`ll be able to do.


I`ll post later when I have it home. Tim, is this an interest of yours? - now I know who to call on when I need help !! lol

Offline John Rudd

  • Hero Member
  • *****
  • Posts: 2525
  • Country: gb
Re: X2 X-axis Stepper motor Power Feed - (possible CNC conversion?)
« Reply #16 on: December 20, 2009, 04:59:17 AM »
Chris, I use that board too....

Its cheap cheerful and works...I also have a pickit2 but havent gotten round to using it yet...

Too many projects and not enough toy room time... :doh:
eccentric millionaire financed by 'er indoors
Location:  Backworth Newcastle

Skype: chippiejnr

Offline spuddevans

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1618
  • Country: 00
  • Portadown, Northern Ireland
    • My Photo website
Re: X2 X-axis Stepper motor Power Feed - (possible CNC conversion?)
« Reply #17 on: December 20, 2009, 08:38:06 AM »
Tim, is this an interest of yours? - now I know who to call on when I need help !! lol

Well it is an interest that I am looking into, I have yet to actually DO anything with PIC's yet. I am looking to get the easypic6 development board, but will just be getting by with the demo version of the mikroBasic PRO compiler.

My initial interest is with learning to use PICs in decoding digital train signals on my dad's LGB layout. I am also keen to see your development of a CNC controller as I plan a full CNC conversion for my X2 mill. I have a spare PC for it, but would also like to have a simple method of controlling it without having to wait for windoze to load.

So feel free to call on me, but I am only just starting on this PIC journey myself so you probably know more about it than I do.


Tim
Measure with a micrometer, mark with chalk, cut with an axe  -  MI0TME

Offline NickG

  • Madmodder Committee
  • Hero Member
  • *****
  • Posts: 1890
Re: X2 X-axis Stepper motor Power Feed - (possible CNC conversion?)
« Reply #18 on: December 20, 2009, 08:40:44 AM »
Thanks Tim / Chris / John,

At the Maplin price it might be worth a dabble - I've always been interested in electronics since a young age too but it was only a couple of years back I realised what was available for DIY these days. Somebody at our club had done the rotary table like Chris and he also built a flash steam boiler that I think it controlled by a pic. Monitors gas, water etc and applies more or less to gas and feed pump through solenoids etc and a car windscreen wiper motor.

Amazing stuff really. Keep up the good work Chris.

Nick
Location: County Durham (North East England)

Offline cfellows

  • In Memoriam
  • Sr. Member
  • *****
  • Posts: 303
Re: X2 X-axis Stepper motor Power Feed - (possible CNC conversion?)
« Reply #19 on: December 20, 2009, 11:32:28 AM »
Very nice, informative thread.  Appreciate the time and effort you're spending to document this for us.  I've been playing with the PICAXE microcontroller which is a hybrid version of a PIC.  It has a built in bootloader and basic interpreter which makes learning quite a bit easier, cheaper, and simpler although I suspect it is also more limited, at least in it's basic configuration.  I've been working on an electronic dividing head, more as an exercise than anything else, although I do expect it to have a practical application.

Chuck

Offline raynerd

  • Madmodder Committee
  • Hero Member
  • *****
  • Posts: 2893
  • Country: gb
    • Raynerds Projects - Raynerd.co.uk
Re: X2 X-axis Stepper motor Power Feed - (possible CNC conversion?)
« Reply #20 on: December 20, 2009, 12:45:22 PM »
Hi Chuck - it was a dividing head or at least a conversion of a rotary table to indexing head that inspired me to go down this route. This is my thread on the indexer here:

http://madmodder.net/index.php?topic=2242.0

I have to say, it has to be one of the most brilliant concepts I have seen and the electronics probably cost about £30 max. I was so impressed but disappointed that I didn`t actually know what was happening, that I decided to start looking into it. I thought this X-axis controller would be a good project.

Just curious, what are you guys planning on using to code the pic? I`ve decided to go down the C route as this is the way my mate knows how to programme and how he does it but I do believe BASIC or Assembly language are more appropriate as the first to learn.

Offline spuddevans

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1618
  • Country: 00
  • Portadown, Northern Ireland
    • My Photo website
Re: X2 X-axis Stepper motor Power Feed - (possible CNC conversion?)
« Reply #21 on: December 20, 2009, 01:27:01 PM »
Just curious, what are you guys planning on using to code the pic? I`ve decided to go down the C route as this is the way my mate knows how to programme and how he does it but I do believe BASIC or Assembly language are more appropriate as the first to learn.

I've kinda decided on using Basic as many many years ago I used to mess around with basic programming on an old Amstrad CPC464, so that is what I am more familiar with. I am thinking about trying my hand at Assembly route as well as it is the cheapest ( ie free ) and apparantly it results in smaller code for the same results.

I havent fully decided, I think I'll have to do a little more research on it to see if it worth the time/effort learning a new language ( assembler ) verses the money for a Basic compiler  :scratch: :coffee:

Tim
Measure with a micrometer, mark with chalk, cut with an axe  -  MI0TME

Offline raynerd

  • Madmodder Committee
  • Hero Member
  • *****
  • Posts: 2893
  • Country: gb
    • Raynerds Projects - Raynerd.co.uk
Re: X2 X-axis Stepper motor Power Feed - (possible CNC conversion?)
« Reply #22 on: December 20, 2009, 01:35:03 PM »
I`m being encouraged to use C as it is the industry standard but apparently BASIC and especially assembly code give the writer a better understanding of what it going on inside the PIC. I know quite a few choose one of those first and then move to C.

Chris

Offline raynerd

  • Madmodder Committee
  • Hero Member
  • *****
  • Posts: 2893
  • Country: gb
    • Raynerds Projects - Raynerd.co.uk
Re: X2 X-axis Stepper motor Power Feed - (possible CNC conversion?)
« Reply #23 on: December 21, 2009, 03:11:00 AM »
I was going to say this is offtopic, which it is a little but this is my first code wrote entirely by me from scratch. The intention is that it is a set of traffic lights, Road1 and Road2.

Road1 is always green

Unless:

Sensor at road2 is triggered, road1 lights go red, road2 lights go green




Offline Darren

  • Madmodder Committee
  • Hero Member
  • *****
  • Posts: 3795
  • N/Wales
Re: X2 X-axis Stepper motor Power Feed - (possible CNC conversion?)
« Reply #24 on: December 21, 2009, 05:34:42 AM »
I see you're having fun with that Chris, that's what it's all about  :thumbup:
You will find it a distinct help… if you know and look as if you know what you are doing. (IRS training manual)