CNC machine v2.1 - aka "Valkyrie Reloaded"
| Attachment | Size |
|---|---|
| tiny2313_stepper.brd | 22.52 KB |
| tiny2313_stepper.sch | 336.57 KB |
| serial_gcode.py_.txt | 730 bytes |
Pictures:
- the front

- the back

- left

- right

- the power unit

- and some closeups here and there





Description:
This is the second third version of a homemade CNC machine build using mostly off the shelve parts.
The first one aka "The beast" had a lot of precision issues due to play in most parts which in turn was caused by mostly bad cutting. Also one of the biggest problems was that when I have build it I did not think to allow later adjustments to be done.
So this time almost every part of it allows for some adjustments. It is also easier to build due to the different design.
Purpose:
I have been asked many times over why I did this below are a few possible answers:
- because I wanted to see if I can
- because I like doing this kind of stuff
- because I think such a machine is useful
- because I want to use it to mill PCB's, I'm tired of messy etching, bad exposure, bad transfers ... etc
- because I also want to build some other stuff and I need precision
- because I learned a lot building it
- because maybe I can make some money out of it in the end
- etc, etc ...
Technical details:
- 250 by 160 265 by 225 mm maximum work area
- 50 by 35 by 35 cm machine size (could sit on my desktop :))
- with the material I have tested (laminate wood pretty tough material) it can cut at around 80 to 100 100 - ? (must still find out maybe as high as 400) mm per minute
Construction materials:
The main material used is 16 mm MDF - I used about a square meter all together.
The rails are 10 by 20 mm aluminum corners used for ... I don't know for what but the margins are slanted at an angle - I used 3 meters of it.
The lead screws are standard M8 type threaded, nothing fancy - 3 meters.
The bearings used are two types because I did not have enough of them, but you can get away with ABEC7 bearings - 16 for the X-axis + 8 for Y-axis + 8 for Z-axis + 8 for the lead screws = 40 bearings.
The motors I used are 7.5 degrees per step, 24 volt, canstack stepper motors, the kind you should find in almost all older printers.
The electronics used are all home build. The brain of the machine is an Arduino (the single sided version), and the motor drivers are created around Attiny 2313 paired with an l298.
The wires used are CAT 5 pairs used for power, and pairs from an old SCSI flat cable for data.
The screws used in the construction are standard M8 of different lengths and M6 screws to fix the rails.
Mechanics:
A. Lead screws
The design is as simple as it gets, it is all based on lead screw transmission.
I chose to use this kind of transmission because it has three advantages:
1. Force ratio is high - to move the nut along the screw the rotational force applied is low compared to the output. That allows the use of those small motors
2. Precision - even with the large step angles provided by the motors I still get pretty good sub millimeter precision: 76,8 steps/mm - good enough for my requirements for now at least.
3. Ease of implementation - you only need two bearings at the ends of the screw, two normal nuts to hold it in place, one long nut to move around.
The linear rail system allows the axes to move freely along their axis and ensure there is no side load on the lead screws.
B. Rail system
On this machine the linear rails are using a different system as on the first version, inspired by the new version of the CNC machines created by the guy here. Obviously the new system is a lot easier to implement than the one before due to it's simplicity. The only drawback is that it requires a strange type of bearing called a V-groove bearing which comes with a V shaped groove along the center of the other housing. I could not find any of those, so I used a pair of normal bearings put side by side to create a small groove in the center.
Electronics:
The electronics of this thing are composed of two parts: the Arduino board and the motor boards.
The Arduino is just a standard single side board, not much to say about it, if you want to build your own see here.
The motor boards I designed myself, they are based on an Attiny 2313 and l298. You can find the schematics below.
I have built my own controller because I did not want to have a mess of wires around the machine from the Arduino to the drivers. This way I can control all 3 axis by using just two wires trough the I2C protocol.
Software:
The software is divided in three parts:
- pc side
- Arduino side
- motor controller side
On the pc side I'm using the excellent Inkscape to draw the shapes, and a plugin to convert them to G-Code coordonates. Then I'm using a simple python script to send the G-Code to the Arduino, over the serial link.
On the Arduino I have a modified version of the code from the RepRap project (www.reprap.org), adapted to use I2C to command the motors instead of driving pins directly.
On the motor controller side the software takes different commands trough I2C and executes them.
Open source:
All code and driver schematics are available here:
http://github.com/TinHead/Valkyrie-CNC-source-code
Please ask for more info, I will add it, I do not have anything more on my mind now.
Update 15-Aug-2009 - hit a wall ...
I clearly remember updating this page about 2 -3 weeks ago but I must have been drunk ... O.o
I was saying back then that I still have an issue, that sometimes the I2C bus seems to bail out causing the machine to stop working.
I was finally able to do some testing last night and I managed to replicate this "bug" and the conclusion is that it only happens when the machine is under load, i.e. cutting something.
The question remaining is: Why? Is it a power issue? Wiring issue ?
No idea ... currently it uses a single 12 V rail from the ATX power source, I'm thinking on rewiring this fellows power lines to use one rail for each motor.
Ideas anyone?
Update 18-Aug-2009 - Here comes the source code
As promised I have made the source code available to the world. I do not like the way Drupal handles attachments (does not accept archives), so I decided to upload the code on GitHub.
Git (http://git-scm.com/) on which GitHub is based is a very nice version control system and pretty easy to use.
I have created a GitHub account, you can find my page here:
http://github.com/TinHead/Valkyrie-CNC-source-code/tree/master
To download the source code as a ZIP or TAR archive you can click on the "Download" button :)
For hardcore geeks install git and clone the code with:
git clone git://github.com/TinHead/Valkyrie-CNC-source-code.git
Have fun with it, clone it, fork it, patch it, optimize it ... eh write it in assembly if you wish.
Update 28-Sep-2009 - Some revelations
Lately I spent my time trying to understand the timers of the Attiny 2313.
While playing around with different PWM setups and frequencies I found out two things:
1. timers are not easy, but they are very useful beasts
2. why I could not get microstepping to work on the Valkyrie
While 1 is pretty obvious, 2 requires some explanations:
- microstepping requires that you adjust the power on the motor windings in such a way that a full step (say 100% an winding A and 100% in B) may be divided in multiple smaller steps.
- to achieve the above PWM has to be employed on the H-Bridge enable pins
- if PWM is employed and you drive the motors at their nominal voltage you loose torque so microstepping is a no go, the stepper might microstep without load but not under load (the PWM frequency plays an important role here, higher frequencies tend to amplyfy the problem)
- so the solution to be able to microstep is to have the motors powered at a (much?) higher voltage than the nominal voltage and apply PWM with the right frequency (which sadly varies from motor to motor) to control the power.
In my case the motors have an assumed nominal voltage of 12v (based on datasheets of similar motors) and I'm driving them with 12v -> no microstepping possible.
I have two options now:
- change the motors with 5v motors
- redesign the controllers to allow higher voltage input, the caps have to be replaced.
PS: I know this stuff is nothing new, I'm practically reinventing the wheel, but this is what it takes for me to really "get it" :)
Update 25-Nov-2009 - All work and no play makes TH a dull boy
Long time no update, sorry got lost in todo stuff and never finished the todo stuff ... bah.
Things I managed to do:
1. Redesigned the motor driver with the following things in mind:
- used a ground plane to reduce some noise
- linked all inputs of the L298 to PWM capable pins on the Attiny 2313
- moved the enable inputs to non PWM pins because of the above
- the driver is designed with two layers now ... looks nicer but it is also harder to build
- replaced power and motor pins with screw connectors so it is easier to connect the wires
- motor power is now independently routed so the driver has one power input with a voltage regulator for the logic and a separate one for the motor - on the logic power input you can use up to 12v (to be safe because the caps are 16V) on the motor up to around 40v.
- fixed a problem with the reset button in the schematic, now the reset works as it is supposed to. Before it would actually create a short, it worked but not really as it should have been.
- changed the diodes to schottky type, SB560 (not sure if they changed anything yet, but they do recommend them in the l298 datasheet)
- rearranged stuff around, I tried to follow the advices of B0SC0 on this, thanks B0SC0 :)
2. On the software side:
- found the problem with the Arduino code limiting the speed of movement (actually John_NY lead me up to this, thanks John)
- implemented full torque halfstepping on the driver trough PWM (still testing that)
Things I did not managed to do (in random order):
- really get into XK-1 to use it instead of Arduino for the XMOS challenge - needs lots of work I only got to blink a LED on it for now
- implement microstepping ... the short version is that it kind of works but totally unusable I think the torque loss is just to great or something, or a problem with my code.
- create two more new drivers to put them on the Valkyrie
- implement home sensors on the axes to home the machine
- work on the plastic extruder - still just an unclear recurring idea in my head
- squash the I2C lockup bug - but I have some ideas now
- other random stuff not related to Valkyrie
I will update the git repository with the new stuff soon, and also add the v1 controller re-designs by B0SC0 and John_NY in there.
Update 06-Dec-2009 - Bigger motors => bigger problems
So I finally got my hands on bigger motors with the kind help of a friend.
These guys are bipolar 1 Amp per coil 200 steps per revolution motors. Very cool Japanese motors.
But there of course to use them I have to recreate the motor holders 'cause those ones have a very different mount...
Also driving two of them with one driver for the X-axis... seems risky to say the least, an early test proves that they can easily blow up my driver and melt the hell out of CAT5 type wires because of current draw. I'm now considering trying to use a really big radiator on the Xaxis driver, and if that fails building a special driver for the Xaxis with two L298's on it.
Looks like I will never get to finish porting the code to the XK-1 this year ....
Update 20-Dec-2009 - Moving forwards to 2.1 (?)
So bigger motors are here (yey!) but not in use yet ... as usual I got side tracked with other stuff ...
The new ones need other mounts, and I just can't find an easy way to adapt the current mount for them. So I decided to delay mounting them, and go on using the old motors until I have a working machine which can do the mounts for me :)
Had it too long on my TODO list: New Z axis, to really take advantage of the Y axis length. As it was it "eat" about 100 mm usable workarea, just by the sheer size of it so I was pondering for a long time to fix that. This actually happened this weekend because I broke the old axis. So I had to rebuild, and I gained the missing mm on the Y axis :D
Also on my TODO was having some kind of home/eol sensors to make it easy to home the machine and stop it before destroying itself while trying to go further then possible. The drivers were designed with this in mind but I never got to try/test it. So today I finally got the drivers to respond back over I2C so they can yell "Hey I'm home already !" back to the Arduino. Which is very cool :D I'm going to implement this in the code ASAP.
One other thing waiting in my TODO is to try making an thermal plastic extruder as they have on the RepRap machine as a second tool for the Valkyrie, I was finally able to take a few steps in that direction. I played with a thermistor for the first time, and got it to show the room temperature properly, but not higher temperatures yet... I have no comparison to check it against.
And finally it looks like I'm going to hit the limits of the Arduino pretty soon with this project, I think reimplementing the extruder and the end stops will fill the rest of it up ... so I have to start working on the XMOS or get an Atmega 368 ... which I cannot seem to find locally ...
That's it for now, stay tuned ..
Update 21-Dec-2009 - Pythons
There have been several requests for the python script I use to send the g-code over to the Arduino trough the serial connection. It requires python and pyserial installed to work.
Here we go:
<code>
import serial,sys,time
serial = serial.Serial('/dev/ttyS0', 19200, timeout=1)
def check_conn():
serial.write("G21\n")
if serial.readline().strip()=="ok":
print "Connected"
else:
sys.exit("Serial connection could not be established")
def send_line(line):
print "Sending "+line
serial.write(line)
response = serial.readline()
while not response:
time.sleep(1)
response = serial.readline()
def main():
try:
filename = sys.argv[1]
except IndexError:
print "Usage: serial_gcode filename"
sys.exit
try:
g_code = open(filename, 'r').readlines()
except IOError:
print "An error occured opening the file "+filename
check_conn()
for line in g_code:
send_line(line)
if __name__ == "__main__":
main()
</code>
And attached above http://letsmakerobots.com/files/serial_gcode.py_.txt, please remove the .txt ending.
Have fun !
Update - 04 Jan 2010 -Valkyrie Reloaded
The last two days I worked on and off on the Valkyrie slowly putting it back together.
I mounted the new Z, got the motors mounted. I got the drivers checked, fixed and running.
I'm running the motors at around 30V now (give or take 5V) and with the help of the redesigned drivers, I'm running them in a so called "full torque half stepping" mode (at least it seems to work) see here for info on that:
http://www.piclist.com/tecHREF/io/stepper/linistep/halfstep.htm
I still have to re adjust the axis, right now I have problems with both X and Y, Z seems fine, I will do that tomorrow with a fresh mind.
I moved the drivers off of the machine to avoid EMF as much as possible, will run tests ASAP to see if I still get lockups on the I2C bus.
So basically I have the machine back online, I hope I will be able to start doing useful stuff with it soon.
12 - January - 2010 - 2.1 is here aka "Valkyrie Reloaded"
Check out the new video for now, I will update the rest in the
following days.
19 - Jan - 2010 - Video for Oddbot
Hi all,
Since China gouvernment seems to protect it's people form bad things like youtube, OddBot is unable to see any of my youtube videos.
So here you go Oddbot a download link:
http://www.4shared.com/file/200950593/5bfc7e36/valkyrie21avi.html
Let me know if it works.
17 - Feb - 2010
- Brain: We must prepare for tomorrow night.
- Pinky: Why? What are we going to do tomorrow night?
- Brain: The same thing we do every night, Pinky - try to take over the world!
Long time no update, well I didn't have much to say really. The machine is more or less done and more or less working ;) My biggest problem is still having the time to actually do stuff with it.
So here is some random stuff on my TODO/WIP list:
- implement G02/G03 in the Arduino while keeping the Atmega168 - done needs testing
- trying to get the code written by Triffid Hunter which is here: http://github.com/triffid/ATmega-Skeleton/tree/master/mendel/ to work with my I2C controllers - previous commit worked to some degree, last one does not work at all, the author is still heavily developing on it. But it shows a lot of promise and cool features.
- thinking on the next generation of the driver - a few choices here not sure which to go for:
a. keep it I2C based but add l297 on to take care of the stepping and currents (got 4 of l297 I might as well give it a shot)
b. drop I2C, use step/direction/enable with l297 - standard Reprap but keep the Arduino controlling the beast
c. drop I2C, use step/direction/enable with l297,drop Arduino, use parallel port and EMC2 directly to do all nasty G-code processing part
d. drop I2C, use step/direction/enable with l297, keep Arduino but do G-code processing on PC and send only stepping commands to Arduino. (This one would be future proof too)
e. keep I2C, add l297, keep Arduino but do G-code processing on PC and send only stepping commands to Arduino. (This one would be future proof also)
- working on the Valkyrie 3.0 which should have the following features (draft):
- CAD designed
- Open Source - all files including G-code for parts will be available
- Self replicating - yes you got that right, all structural parts will be designed in a way which will allow an existing machine to cut them for another
- More precise - parts will not be manufactured as before
- Light weight yet sturdy (well we'll see about light weight)
- Larger cutting area, yet same size or even smaller
- NEMA17 200 steps per revolution motors
- New drivers or electronics altogether
- Home/EOL sensors are a must
- ... and some other stuff
- working on the software side a lot
- working on a nice control panel for the machine
- thinking on creating a website for this project so I do not flood LMR :)
03 - Mar - 2010 - Every time you think you have it all nicely working - disaster strikes :P
Sunday evening I finished surgery on the v2 drivers to get them to work with Step / Enable / Direction signals instead of I2C (see here on why it took me all weekend). The code was 90% written but I was too tired to do any good about it so I decided to just mount the drivers back in the box and wire them up and leave software/testing for Monday.
That was a very bad decision since I ended up somehow with the motor power connections inverted and on Monday morning when I powered the thing up without checking, all L298's on the drivers were instantly killed ... not even some blue smoke :P
Good thing I tested without the Tiny's plugged in though or else I would have killed any hope to machine the PCB's for the V3 drivers.
Anyway I replaced the burned l298's this morning so probably tonight I'll have a live Valkyrie lurking around.
On the software side of things I have multiple firmware choices to play with on the Arduino. My old code does not work anymore since it used I2C, which has to be removed now and replaced with functions to do the step signals. While that isn't hard to do really, I have found several alternatives which provide some extra features or are simply better written:
1. The most complete candidate seems to be the one written by Chris Meighan (yes he did write his own firmware besides that nice java control panel) for which the only release ever done is to be found here . Note that it will not compile straight up and requires fixes here and there to fit on the Arduino, I got it to compile and fit but I still need to do some testing so I will not post it yet.
2. Triffid_Hunter has been writing on a very nice c only replacement for the Arduino 5D firmware, but currently it is in a fairly unstable stage.
3. grbl is another c only implementation, haven't played with it yet cause may goal now is to have acceleration in the movements and it does not provide any. But it might be the most stable code.
4. this one also seems cool, not tested yet.
Of course I can always start hacking on my own and take the best out of the above with credits to their respective owners, but it might not be necessary for now.
09 - Mar - 2010 - It's alive :)
Fixed the drivers yeah!
Acceleration Arduino firmware seems to do nicely, but it is not what I hoped PCB milling is a no go as it would take forever...
As I'm going to Spain I'm trying to finish the new design of V3, maybe I'll have it ready until then.
Here is a quick preview:

Still a lot to think and work on it, but I think it is coming up nicely :D
02 - Apr - 2010 - Done!
This is it ! The Valkyrie 2.1 is officially done! It is doing it's job as well as possible considering it's birth :)



@ Sun, 2010-07-18 04:34
TinHead, I have started
TinHead, I have started building my machine. Hopefully I'll finish it over the weekend. If not, I'll get back to it after 3 days of work. See it here:
http://letsmakerobots.com/node/21754
@ Wed, 2010-05-05 14:17
answ.
http://letsmakerobots.com/node/8089 link seems vaporized..
As you mentioned the use of steel would be better, maybe stainless steel angles?.
@ Wed, 2010-05-05 14:30
Ups ... sneaky spaces in the link :)
Try now http://letsmakerobots.com/node/8089
@ Tue, 2010-05-04 13:37
next time
I thin next time I ll go with this kind of rail..
deserve a try.
good wok mate.
@ Tue, 2010-05-04 13:51
Hi thanks,
I had a try with the rail system you are using, well it worked ... but I had many troubles with it because I lack the tools to do the cuts correctly and precise. See here http://letsmakerobots.com/node/8089
The rail system I'm using now is easier to implement but it has it's own issues. To get real good sturdiness and reliability the rails must be made of steel not aluminium.
I think I have found a solution as a mix of both ways, I just applied it on the Y and Z axis, it remains to be seen how well it performs.
@ Fri, 2010-02-12 13:21
Thank you very much! :Di
Thank you very much! :D
i like how you have diferent types of boards, one sided, double sided ETC :D hopefully these will be the last boards i etch lol :P
props on making such an awsome machine!
@ Fri, 2010-02-12 14:12
You are welcome,
Arm yourself with patience, money and good tools, you will require all of them.
10x for the props, I think I'll start working on a new machine soon, this time it will have building instructions, and I might be able to provide kits for people who want them.
@ Sat, 2010-02-13 22:35
I'd be interested in a
I'd be interested in a simple kit, if you do make it eventually, seen as we are both in europe it shouldn't be much of a hassle i think...
i have another question :D
the two motors that make part of the same axis, are they wired in parallel to the motor driver?
i have 11 stepper motors, and they are all diferent, so i think i will need to make a smaller machine with some liner guides(i have just the perfect ones from printers)
@ Sat, 2010-02-13 22:48
Hi,
Yup they are on the same driver in parallel so they got to be the same.
Another way is to have two drivers for the X axis with the same I2C id, 2, but if the motors ar not equal in torque you might end up with one part going well and the other skipping steps ...
@ Thu, 2010-02-11 16:20
congrats
It's looking awsome, bet it saves time on PCB making, i hate the etching way, i dont have a laser printer, so i have to go to town everytime i want a new board D:
So i was thinking of making a clone of valkyrie! i have a few big and small stepper motors, from printers and scanners, though you say
''The motor boards I designed myself, they are based on an Attiny 2313 and l298. You can find the schematics below.''
i didnt find the schematics though, i would apreciate it a lot, if you showed me where they are.
i intend to spend as little as possible, i will try to recycle as much as i can, and keep it low cost.
thanks for the inpiration!
@ Thu, 2010-02-11 16:49
Hi,
With below I meant below, i.e. down below :D
The source and schematics for the electronics are available here:
http://github.com/TinHead/Valkyrie-CNC-source-code
Click on the download source button and choose the archive format.
After downloading you will find the directory driver_schematic in there which contains the variations of the v.1 driver contributed by our fellow builders (John_NY, B0SC0) and the v.2 version.
The schematics are in EagleCAD format.
@ Sat, 2010-02-06 23:23
Hmm im Lost..
@ Sat, 2010-02-06 23:57
Hi,
Sorry no layout, I just built it around the base plate.
Basically choose the size of the base plate (by that I mean the table in the center where the Y-Z assembly rails stay on), and then go from there, I chose 50 by 35 cm for that, the rest was made with 15 cm wide sheets.
It's an eyeballing based project mosty :)
@ Sun, 2010-02-07 03:07
Oh..?
@ Sun, 2010-02-07 08:17
Not really ...
... you can go as small or large as you wish, though if you go too big it might become wobbly, if you go too small your work area will be too small.
John has some drafts with the measures of his machine have a look here:
http://letsmakerobots.com/node/12713
@ Sun, 2010-01-31 04:04
Here's my clone
Hi!
I made a page for my CNC machine:
http://letsmakerobots.com/node/16392
Not that much content til now but i will add more while i'm going on.
Greets
Daniel
@ Sun, 2010-01-31 03:01
Diagnostic opportunity
Hi TinHead,
I noticed an upgraded power supply and the drivers moved off the machine. I was wondering if you made these changes at the same time, or if there was a time in between where either you had drivers on the machine but a new supply, or drivers off the machine with the old supply. I ask because I changed my power wiring before moving drivers off the machine and noticed increased lockups. I blamed it on the driver mounting, but moving the drivers did not fix the problem. What I did with the power wiring that may have caused the difference is to change from a bunch of +12V wires supplying the +12V to having a single +12V wire. Since I am using a single -12V wire I did not think it would make a difference. I figure either one of two things is wrong -- either my power supply is failing (through abuse of the -12V line), or the change to a single +12V wire made a difference.
So for scientific curiousity, I was wondering whether there was a time when you had changed the supply or the driver mounting and tried to run the machine. I would speculate that the power supply would make the difference (if our problems are the same).
-John
(I plan to switch to multiple +12V wires, and if that fails, swap ATX supplies, but probably not this weekend.)
@ Sun, 2010-01-31 08:02
Hi John,
It was a two stage move, first I moved the drivers off the machine working with the old supply, and a new 30 V supply. But that setup destroyed the two 30 V supplies I had cause they did not supply enough amps. Before killing the supplies the machine worked well though, no lockups.
Then I remembered I still had a 24V power supply around from an old laser printer which should be fit for the job, but it has no enclosure so I had to improvise with the old pc case. Since in the case there were enough place I also moved the drivers and the Arduino in there.
Currently the setup works well, although I did have three strange lockups which I cannot explain while playing with pcb board.
I think using the -12 V could cause the problems since you basically moved the potential ground below 0 V if I understand correctly how this actually works.
@ Tue, 2010-01-26 19:02
A question about the Arduino Code...
How do these 4 files interact? Only the Parameters.h is included. But what about the rest? And what ist the main-file?
I tried to open them in arduino all together in one folder, but Arduino puts all files in seperated folders when opening them....and when i'm trying to verify/compile there is an error becaue the functions from the other file. Do i need to use them as Library?
Sorry this is my first project with more than 1 file....
Greets
Daniel
@ Tue, 2010-01-26 20:05
Here's how I did it
@ Tue, 2010-01-26 20:54
Ok! that was the trick. No
Ok! that was the trick. No problems opening and compiling the project!
Thanks!!!
@ Tue, 2010-01-26 22:51
It should ...
@ Mon, 2010-01-25 17:17
The next clone
Hi!
Inspired by your work, this weekend I started also building a CNC machine. My hardware is a littlebit different from yours. Instead of moving the Y/Z axis for the x direction i'm moving the table. And a lttle less wood and more aluminium. But im going to use your steering electronics. I already etched and soldered a stepper board and at the meoment im programming the tiny. And here comes my first question:
How do i have to set the fuses for the tiny? (This is the first tiny i'm programming...)
And another question:
In the arduino source i saw something about a motortest. How do i start this? And is it per axis?
And one suggestion from my side:
To limit the current going to the steppers have a look at this document:
http://www.pollin.de/shop/downloads/D810027B.PDF
Its in german, but i think the circuit is easy to understand. It uses a simple comparator and a poti to limit the current.
Greets
Daniel
@ Mon, 2010-01-25 19:08
Motor Test
Hi Daniel,
For the motor test, send an I2C command "5" or "6". The other I2C commands I think control enable/disable, and forward/backward half step. The Arduino code doesn't have any serial/gcode commands to run the test, so you'll have to use the "Wire.h" library and add it to the Arduino code yourself (or start a new I2C example using the Arduino Wire library example). The I2C ID for the drivers as you probably know are "2" for the X axes, "3" for the Y axis and "4" for the Z axis. As you probably know, each I2C command contains a destination (2/3/4 for the axis) and a value (1/2/3/4/5/6 for the command). Hope this helps!
-John
@ Tue, 2010-01-26 17:02
Hi TinHead, Hi John! Thanks
Hi TinHead, Hi John!
Thanks for your help! I flashed the Tiny (til now i have only one board ready) yesterday and it seems to work (Led blinking). I hope i'm gonna do some motortests this evening. I will also try to take some photos this evening! At the moment I'm trying to write a Motortest programm for the arduino.
@ Tinhead:
If I read right your thinking of moving away from arduino as a controlboard for the CNC? Have you heard from the sanguino? its a arduino clone using the ATmega644P which gives you a lot mor space and some additional I/Os. (not sure but perhaps - possible to run at 20 MHz + all pins can be used as interrupts) I don't know where you hitted the limits of your arduino-board but perhaps this could help you to go further with arduino...
Greets
Daniel
@ Tue, 2010-01-26 18:05
Would a ATMEGA328 help?
@ Tue, 2010-01-26 17:39
Hi Daniel,
The limits of the Arduino based on the AtMega 168, which is what I have, are hit if I try adding some more stuff in the current code which like the original extruder code (I'm thinking on having an extruder just like the RepRap one on the machine for 3d printing, but that is still a long way to get done). I know about the Sanguino and the RepRap guys did too since they switchced to using it currently, but I would have to build a Sanguino myself because I don't like to buy such things :) which I probably will eventually.
On a sidenote the AtMega 168 is not the problem, if the code were written in pure avr-c without the bloat of the Arduino and the floating point calculations, a lot more could be achieved with it ... but the Arduino way is very confortable for low quality programmer like myself.
I'm not intending to switch for now anyway, what you read about was of trying to use the Xmos instead because of the challenge they have, and also because it can run 8 threads in parallel. But that is just another thing in my never ending TODO list ...
Currently I'm trying to do a first real project using the machine, namely PCB milling, but I only got to do some early tests .... maybe the next weekend...
@ Mon, 2010-01-25 18:21
Hi Daniel,
Cool you like it and have fun building it :) Post some pictures I'd like to see your design.
Now to your questions:
1. For the tiny you need to set the lfuse to FF that all what is needed (to work with the external crystal 16 Mhz).
2. There is a motor test ideed both in the arduino and in the driver code ... eh I don't know if that works anymore anyway. Let me check on that and I'll let you know.
Thanks for the suggestion, good thing I understand german fairly well :D Danke shön, I'll check it out.
@ Thu, 2010-01-21 03:46
i can't believe i am about
i can't believe i am about to build a cnc machine because of your build and your link to buildyourcnc.com.
this type of linear rails realy simplifies the mechanical aspect of the machine, i think alignment becomes easier too.
here is a source for v groove bearings:
http://www.vxb.com/page/bearings/CTGY/V-Groove-Bearings
@ Thu, 2010-01-21 08:00
Hi,
Have fun building it :) Make sure you have the right tools for the job.
The v-groove bearings will reduce the number of used bearings with 16, but at 9 bucks per piece I don't think it is worth.
@ Sat, 2010-01-16 00:15
easy
only have to edit the reprap code deleting al the extruder comands, variables etc, then hit compile and the arduino GUI will tell toy what elese is mising............
i did it and worked well....... in my case edited the "do step" in order to make it work on my stepper drivers.....(thanks carlos...)
@ Tue, 2010-01-12 00:33
Local...
Thank John_NY for your answer.
Your explanation is very useful for me:)
I will try to find a motor at the local flea market, first.
Then try to find it online.
But, I'm sure I'll get the motor here.
I just do not have time to find out :)
Update:
Thanks for datasheet too. Very detail information there.
Trying to understand... That is too advance for me :)
@ Mon, 2010-01-11 02:59
Motor with 1.8 degree
I found stepper motor with 1.8 degree from old machine (200 steps... wow)
Can I use that motor?
Which code to modify?
Thanks.
@ Mon, 2010-01-11 05:38
Modify Arduino code but test the driver first
I'm hoping to use some similar motors with 200 steps/rotation. One thing you'll have to change is the Arduino code -- the "parameters.h" file. The "steps per millimeter" will be determined by the pitch of your lead screws and the resolution of your motor. With half-stepping, there are 400 steps per rotation. If you have an M8-1.25 lead screw and half-stepping, there are 400 steps per 1.25 mm or 360 steps per millimeter. "X motor steps" will be 400.
One problem I encountered was that the stepper motors burned out my L298N IC. The resistance of the motor coils were measured with a multimeter to be 1.4ohms; Ohm's law says that at 24V/1.4ohms = 17Amps of draw (unless the L298N limits the current somehow). I didn't have a heat sink on it, and I should have probably started at 12V instead of 24V, and I may have wanted to try putting some current-limiting resistors in the line to start with, or at least comparing my circuit with something like the "EZ Driver" Stepper Driver to see whether there are any extra components to handle big motors. I'm going to be trying to wrap my head around this problem before I try burning another stepper driver. You may do better if you know what you're doing (I'm just copying from the smart kids or making it up as I go along).
@ Mon, 2010-01-11 19:15
No better driver build yet
I did mean the HobbyCNC EZ Driver. The EZ Driver and the Probotics SideStep driver both feature "current limiting". Why is that important? Without current limiting, Ohm's law says my motors (24V & 1.4Ohms) will draw 17Amps/coil (34Amps). The L298 does have the ability to current-limit, but it involves the "Sense" pins (Sense A and Sense B), and I think the motor driver must be able to read these pins. TinHead has researched this better than I have, I think, and even investigated how to use the Sense pins in his driver design.
Regarding the driver, I haven't built anything better just yet. I plan to spend my spare moments before next weekend reviewing TinHead's notes on the L298 sense problem (I think the problem was that the ATTINY has no analog inputs), and perhaps evaluating a few different driver options that support current-limiting. If you are designing a Valkyrie CNC, you may want to stick with the little motors (like Minebea PM-42 motors), since the Valkyrie driver (the August 12th 2009 design) does not limit the current and the L298 may fail on bigger motors.
Update: I've seen on the data sheet that the L298N sense pins should be pulled down for current limiting (but for some example circuits they are connected to the driver controller IC as well). So is controlling current as easy as pulling down the sense pins? Doesn't the Valkyrie driver pull down the Sense pins (1&15) already? Research to follow, collaboration welcome.
Update: 5xL297 controllers (one spare) would cost $56 at Mouser! That's not an option for this machine.
@ Mon, 2010-01-11 20:52
Motor
Thanks for the tips.
Where I can buy PM-42 motors? I try to find it in Futurlec, but they dont have PM-42.
Which motor I can use in this page?
http://www.futurlec.com/StepperMotors.shtml
Can I use "Small Stepper Motor - MP24GA"?
What is the different of Unipolar and Bipolar?
Can we use both?
@ Mon, 2010-01-11 23:49
I got "(5) MINEBEA 24V 48
I got "(5) MINEBEA 24V 48 STEP 7.5 DEG UNIPOLAR STEPPER MOTORS" from eBay seller "cpr05"
I got the five PM42S motors for $2 each, with shipping it was $18, and the seller was willing to put more motors in the package at $2 each. I like the geared motors because the gear is almost as big as the M8 thread. With the MP24GA you may need an adapter to hook it to the lead screw, and it is a 12V motor with no data sheet, and it is half the size of a 42mm motor so the torque may be pretty bad. I would recommend 24VDC drive voltage because more volts generally means more power.
Unipolar motors can be used as bipolar motors if you disconnect center tap.
I also took a look at the PM35L (sold out). Although the PM35L motor is a chunky little thing, it only has the (bipolar) torque of a PM42S, according to the catalog, so I'd say get the bigger, cheaper motor. I'd check the data sheet and look for torque at least equal to my PM42S motors (in bipolar config).
The torque curves show that a big PM55L motor ($7) is several times as powerful as the PM42S motors (but a bit bigger in all dimensions). This would be great for the Z-axis, but you can also manage with the PM42S if your stage is built well and runs smoothly (unlike mine), if you reduce the weight, or if you add springs or a counterweight (or rubber bands).
http://www.eminebea.com/content/html/en/engineering/motors/pm_motor/selection_pm/pdf/pm_select.pdf
http://www.eminebea.com/content/html/en/motor_list/pm_motor/pdf/pmall.pdf
@ Tue, 2010-01-12 09:04
PM55L
Hai John,
I got eMinebeaPM55L-48. 7.5o per step.
I found wiring description from this page
http://www.stepperboard.com/motor_wiring_examples.htm
But I dont know how to wire to the stepper driver.
1. Should I connect circuit ground to stepper common?
2. Should I connect both stepper commons?
If you have wiring diagram please share to me.
Many thanks for your helps.
@ Tue, 2010-01-12 18:19
Hi Pino
@ Tue, 2010-01-12 09:12
Hi Pino,
Please do not take this as an offence but please use John's blog or robot page to talk to John, this thread is long enough as it is.
10x
@ Mon, 2010-01-11 14:03
EZ Drivers
Hi John,
Do you mean "EZ Driver" from www.hobbycnc.com ?
What IC used in that kit? L298N?
I'm a newbie to motor driving.
Please share your schematic if you have successfully
make better circuit, like EZ driver.
Thanks
@ Sat, 2010-01-09 04:46
hi buddy
@ Sat, 2010-01-09 04:05
Python to C
I dont have Python and want to make standalone .exe program with C.
Do you have sample code in C?
Thanks.
@ Sat, 2010-01-09 09:02
You need python and pyserial for the code to run ...
... get python from here: www.python.org
Pyserial from here: http://pyserial.sourceforge.net/
And you need to change the serial port from linux style /dev/ttyS0 to windows style COM1 or what your port is.
@ Sat, 2010-01-09 11:52
Ok
Ok, thanks.
But I also plan to make GUI mode in VB or C.
So user can browse and select G-CODE file.
Now I'making PCB for stepper driver.
Tomorrow I will buy stepper motor in flea market.
@ Sat, 2010-01-09 04:17
Download python, its free
Download python, its free and easy.
@ Sat, 2010-01-09 03:59
How much motor drivers?
Sorry for this newbie question.
How much motor driver board needed by this machine?
Just one or four (one board for each motor) ?
Thanks.
@ Sat, 2010-01-09 08:59
hi
@ Sat, 2010-01-09 11:46
Wiring Arduino to stepper drivers.
How to wire Arduino to stepper driver?
Pin ? Arduino <----> ? pin stepper driver
What is the function of SV2, SV4 and SV5 in schematic?
Thanks.
@ Sat, 2010-01-09 20:25
The drivers ...
... take commands trough I2C. So on the Arduino you connect them to analog pins 4 and 5 (4 is SDA, 5 is SCL).
SV2 is the I2C connector pin 1 is SCL pin3 is SDA.
SV4 and 5 are there so you can connect a home/eol sensor to them, they are not used currently.