Let's Make Robots!

My First Robot

Draft Robot Page: http://letsmakerobots.com/node/12713

My first robot is a Valkyrie CNC using TinHead's example: http://letsmakerobots.com/node/9006

clone_CNC_Dec09_small.jpg
http://letsmakerobots.com/files/clone_cnc_closeup_1500px.jpg
http://letsmakerobots.com/files/clone_cnc_1500px.jpg

Vector Drawings: http://letsmakerobots.com/files/clone_cnc_vector.pdf (draft)
Measurements will be available for these drawings by December 2009 or if somebody bugs me for it.

Cost will be more than $200 -- The motor drivers were the most expensive bit of it.  One could bring down the cost by hand-building the driver boards, but I sourced the PCBs from BatchPCB.

Plans for this robot: learn about CNC machines and control systems, and machine prototype PCBs for other robots. [...]

Credit where credit is due: My CNC is deeply indebted to TinHead's work on the motor driver (node/6967), driver software, Arduino controller software, and hardware design, along with the discussions on the "Valkyrie" robot page (node/9006).  Driver software is http://github.com/TinHead/Valkyrie-CNC-source-code/tree/master .  Somewhere in the driver and Arduino source code, the RepRap project gets kudos as well.  Debt is also owed to http://buildyourcnc.com for some of the construction tips.  I wouldn't be able to join the wood so well without learning good drilling technique.  Also, ladyada's AVR tutorial ( http://www.ladyada.net/learn/avr/ ) was essential to programming the ATTINY2313 used in the stepper drivers.  The controllers were programmed on a minimalist target board from evilmadscientist.com ( http://www.evilmadscientist.com/article.php/avrtargetboards ). 

Giving back: I'll be posting more detailed plans for my iteration of this machine.  It is TinHead's design, but where there needed to be alterations (e.g. the PCB design needed changes before BatchPCB would accept it) I made changes, and where there were ambiguities, I had to figure them out (for example, the views of the robot from the back, sides, and bottom I wished I could see).  Also, I ground a copper-clad board into my first prototype circuit board (first ever!) while waiting for BatchPCB, and if I wanted to spend many hours grinding copies of that prototype motor driver board, I could have saved easily $70 on manufacturing the boards (toner transfer would have been quicker but I had a new rotary tool to try out).  If the proto driver board works, I'll post that as well.  My plans for this homage to the Valkyrie is to document the building as best I can, so that more pics and plans are available online for folks like me who want to tinker.

AttachmentSize
Budget example for sourcing components from the USA37.42 KB
clone_CNC_skate_bearings.JPG383.87 KB
clone_CNC_pcb_backlit.JPG350.28 KB
clone_CNC_pcb_front.JPG285.59 KB
clone_CNC_pcb_back.JPG372.71 KB
clone_CNC_copper_front1.JPG347.72 KB
clone_CNC_copper_backlit.JPG336.59 KB
tiny2313_stepper.brd23.75 KB
clone_cnc_600px.jpg125.03 KB
clone_cnc_floating_block.PNG5.74 KB
clone_CNC_1101_front_s.JPG23.07 KB
clone_CNC_1101_back_s.JPG26.48 KB
clone_cnc_captive_nut.png2.44 KB
clone_cnc_1500px.jpg877.57 KB
clone_cnc_vector.pdf99.8 KB
clone_cnc_closeup_sm.jpg102.22 KB
clone_cnc_closeup_1500px.jpg705.01 KB
clone_cnc_I2C_test.PNG7.14 KB
clone_CNC_Dec09_med.jpg319.46 KB
clone_CNC_Dec09_small.jpg122.25 KB

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
I've messed up fuses on some AVR chips and when i try to fix it I get a "0x00000000 device not found" or something similiar. I think I'll invest in a high power if I find one at a good price. It's so irritating to lose those chips due to experimenting with fuses.

So the fuses on ATTINY2313 should be set -lfuse 0xff to set the 16MHz external crystal. I bricked my extra attiny2313 while learning (so that it's now set to use an external clock instead of a crystal), which reinforces a learned lesson: always order an extra.

avrdude -c usbtiny -p t2313 -U lfuse:w:0xff:m

The stepper wiring was quite a debugging problem, solved by accident: The wires out of the stepper are two rows of 3 wires, the middle of each row is ignored.  Allegedly, these should be in order {A1,A2,A3} and {B1,B2,B3}.  Initially I wired the A1 to pin 0 (A1 pin in the code), B1 to pin 1 (B1), A3 to pin 2 (A2), B3 to pin 3 (B2).  This was wrong, which I figured out by noticing that the stepper vibrated, and slowing down the test pattern just slowed down the back-and-forth stepping.  Reading the data sheet which gave the order as A1,A3,B1,B3 (which matched the sequence in the code, I switched A3 and B1 accidentally and it solved the problem: the stepper rotated.  So {A1,A3,B1,B3} wires go to {A1,B1,A2,B2} pins.  Lesson: learn the sequence by reading the documentation!

 So the I2C is all that remains.  I don't know whether I can use a seperate power supply for the Arduino that is not linked to the drivers (so far the separate supply isn't working).  The drivers run off an ATX PSU 12V with a regulator that gives 5V to the attiny2313 driver microcontroller.  The Arduino uses a DC adaptor plugged into the wall.  The "Wire.h" library reference indicates that Analog Pin 5 is SCK and Analog Pin 4 is the data line.  SCK is pin 19 on the attiny2313, and data is pin 17.  No success yet, so I'll check my driver circuit for shorts or errors and the nearest Radio Shack for a plug to power my Arduino from the 12V ATX PSU.

-John

The motors are Minebea PM42S-48 steppers.  There are some nice torque curves listed here:

http://www.eminebea.com/content/html/en/motor_list/pm_motor/pm42s048.shtml

Thinking like a physics student who likes simple examples (that's me!): as long as the torque can overcome the static friction of the machine, I can compensate for torque by giving the motor more time to act.  As you mentioned though, too slow a movement and the steppers will cause resonance and efficiency will be lost -- allowing the resonance to settle is an option, but will slow down the machine.

 The feedrate calculation is one of the steps in the Arduino/RepRap code I have my eye on.  I suspect that the delay between steps serves two purposes: to let the motor do its work, and also to allow the extruder time to extrude more plastic.  I intend to tinker with that calculation until the only delay is the one to let the motor move the machine.  The delay caused by running the calculations on a 16MHz processor I could subtract from the calculated feedrate, or I could try to trim down the code to a lighter program.  All theory for now, testing on Friday or Saturday to see how fast the Arduino and I2C driver can drive an unloaded stepper.

Thanks!
-John

These are more or less  the same I use so things should work more or less as they do with my machine at 12V.

My programming skills are rather poor so it would be great to have a different pair of eyes on the software part :)

The limiting factor for speed of a stepper motor is probably the length of time the motor takes to heave its coils and the load it is moving a half or whole step.  I am picturing a motor driver circuit (oblivious to the motor position) sending a signal to the L298, which switches the 12 volt motor current to a different winding in the stepper.  The stepper motor now is exerting a torque on the drive shaft.  The drive shaft is lifting or moving an inertial load and needs time for the force to do its work.  Optimizing the time I give the driver to move the half-step will allow the CNC to move faster while not missing steps.  If the driver code is too eager, it will skip steps since the load cannot be moved by the force I am applying in the short time I am applying the force.  If I give the driver code all the time in the world to apply the force, the steppers will be moving slowly.

For a RepRap, the amount of time I give the motor to work will not be the speed-limiting factor.  The extruder speed is probably more limiting than the stepper speed in terms of how quickly the machine can fabricate a flyswatter or hairbrush or a corner block for another RepRap.  If the speed of the motor driver/Arduino system was based on the RepRap speed, there should be room for adjustments.

Since the inertial load and friction are different between the CNC and RepRap (and between individual CNCs) there is room for optimization of a particular machine.  In fact, if I do not optimize, and my machine has more friction or weight than the driver was built to handle, I'll end up with a CNC that does not go where it is told to go. I expect that a CNC that I build with the motors and hardware I am using will have different requirements than the Valkyrie CNC or the Beast CNC due to friction, weight, and motor capability.

All theory for now, experimentation to follow.

-John

 

The theory is sound, let's see about what problems I have been confronted with:

1.Hardware

All stepper motors are defined by their maximum speed to torque ratio. This means that all of them have a speed where the torque is maximum at nominal voltage.

Now if you drive the motor too slow the torque will be great but due to step resonance it will be canceled out to the point where the torque is lost.

If you drive the motor too fast, torque will be lost because the time while the coils are energized get's shorter and shorter with higher speed. 

For both issues there are solutions:

- half stepping helps reducing resonance, microstepping even more

- driving the motor at higher voltages allows driving the motor faster 

These are what I'm working on now for the Valkyrie. 

Of course you have to adapt  to your particular motors/ machine.

The driver does not limit speed right now in the software, it steps as fast as possible (well of course there are delays that apply due to I2C and overhead but I think they are not longer then 1 ms).

2. Software

The RepRap  software limits the speed in two ways:

- it applies a delay of 5 milliseconds for each step - that is what I have to keep as it is right now even though I could get down to 2 milliseconds because changing that breaks the feedrate calculations - for a reason that escapes me to date

- due to the overhead of the calculations it must do it will not go faster then a feedrate of around 300mm/min (I must check on that I do not remember exactly) no mater how I set the maximum  feedrate

I will have a take on fixing that after I'm done with the drivers, maybe you can take a look before that. 

 

It looks like I do have some success on the microstepping side of things, still need to work on it though.

 

PS: You mentioned  you are using 7.5 degrees pe step motors but nothing else about them. What is their nominal voltage and current rating?

Nice to see my design inspired you, if you need any  specific info please ask, I will help you as much as I can.

As for improvements there is a lot of room for them. The first on my mind would be to change the width or the Y and Z axis plate so you get more travel on Y axis, resulting in a larger work area. A second would be the rotary tool mount, as it is now it has some play, not much but there is some.

I can't wait to see how it works out for you ;)

PS: I took a look at the prices and I must say those PCB guys charge a lot...

 

Thank you for the advice and the welcome!  I was thinking about slimming the Y and Z axis plate, but was a little concerned that I might mess up the positioning accuracy or stability.  If I make the Y-axis too thin, the set of 4 Y-bearings will be closer together, they'll lose some of the benefit of being paired up.  I might envision the motion of the stage being more like having one bearing on each side.  That said, I have plenty of particle board to play with, so if I get wiggle in my Y-stage and need to replace the Y and Z axis, I'll be able to do it.

The design definitely inspired me: the CNC was on a list of "10 [20?] cool things to do with an Arduino", which included the Blimpduino, Ardupilot, et cetera.  What better use for a robot could there be than to build other robots?  I had a ton of used skate bearings lying around and had been thinking about a "RepRap CNC" since I heard of the RepRap project.  Thanks for putting all the Arduino and driver code online!

 I'll be sure to get some pictures up when I have the chance.  I think it will look very familiar to you (as it is a clone and all).

 -John

"10 [20?] cool things to do with an Arduino"? What/where is that?

Regarding the design, I got lazy after being done with mounting it, so I never got back to really refine it. But that is going to happen at some point. Right now the Y axis plate is 15 cm wide and the Z plate about 21 (just enough to fit), that because I had 15 cm wide strips of mdf. I think you can get safely away with 10 cm wide for Y plate and maybe 15 for the Z. Of course the design can be changed/improved, I'm already thinking on a V3 of the machine.

Right now I'm working on implementing microstepping on the controllers (if that is actually possible), later I wil have to do some digging in the arduino code to get more speed out of it.

Hmm... I thought it was on the HackNMod Top 40 page, but it since I don't see it on that list it might have been in the sidebar.

It's featured as an Arduino application:

http://hacknmod.com/topics/arduino/

http://hacknmod.com/hack/incredible-100-arduino-based-cnc-machine/

 -John