Gallery, Projects and General > Project Logs
X2 X-axis Stepper motor Power Feed - (possible CNC conversion?)
<< < (2/19) > >>
raynerd:
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

NickG:
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
raynerd:
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.
raynerd:
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.
NickG:
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
Navigation
Message Index
Next page
Previous page

Go to full version