RAMPS 1.4 & Marlin driving dual Y steppers

tobycatlin
Posts: 15
Joined: Thu Oct 25, 2012 4:04 pm

RAMPS 1.4 & Marlin driving dual Y steppers

Post by tobycatlin » Wed Jan 02, 2013 12:18 pm

I finally had some time to spend with our eShapeoko kit and successfully sent it some gcode via printrun, Marlin and a RAMPS board with Polou drivers.
My test pattern is a series of 15mm circles which i am drawing out with a ballpoint pen on paper. In general it moves very nicely but I have the dual Y motor upgrade fitted but only have one of the motors working. This means the other motor is adding friction and causing the whole gantry to twist as it moved back and forth. Most of my circles come out as ovals :(

So my question, what is the best way to drive both Y axis motors?
1) Connect both motors in parallel to one driver? I am concerned about heat as the driver chips already get pretty toasty
2) Connect the second motor to the spare extruder driver (E0)? I need help modifying Marlin, any suggestions very welcome.
3) Bridging the pins from the Y driver to the E0 driver (as suggested here http://forums.reprap.org/read.php?146,146056), nasty hacking about with the RAMPS board
4) some other genius suggestion?

Although I would rather keep a standard Marlin install to allow for easier updating, changing the code to mirror the Y axis to the E0 driver seems the best solution.
Please share your thoughts and wisdoms.

Thanks
toby
Proud owner of eShapeOko #3

cvoinescu
Posts: 4442
Joined: Thu Jul 19, 2012 6:50 pm
Location: Camberley, UK
Contact:

Re: RAMPS 1.4 & Marlin driving dual Y steppers

Post by cvoinescu » Wed Jan 02, 2013 1:52 pm

You can connect both motors to one driver. You have two choices: series and parallel. Series wiring gives you the same holding torque but much worse performance at high speed (the equivalent of running the drivers from half your supply voltage). So if you're running your RAMPS at the standard 12 V, series is not really an option. At 24 V, the performance is decent and it has the advantage that the driver chip runs somewhat cooler.

Parallel wiring splits the current, and hence the torque, between the two motors. It preserves high-speed performance. The driver chip will see a lower impedance; it will still limit current to the same value, but power dissipation will increase somewhat. The drivers get hot in use, and that's normal. Heatsinks help, but airflow helps even more, especially if you can get it to flow both over and under the Pololu boards. Don't worry about frying the chip; they're quite robust and their current and temperature protection is very good. They'll be hot enough to give you a serious burn before they are in any danger. Just don't connect or disconnect anything (especially the motors) while powered on. Many people, including myself (although not anymore), use parallel wiring with Pololu A4988 drivers with no ill effects. People using RAMPS with RepRaps, ORD Bots and other 3D printers wire their two Z motors in parallel.

You can connect the second motor to E0 or E1 and modify Marlin. It's about as easy to hack the hardware, too. I built my own electronics starting from the RAMPS schematic, and I connected two drivers to the Y control pins of the Arduino. Ideally, the second Y driver would have its own pins and Marlin would drive them together. Then, it could also drive them separately at the end of the homing cycle, when it could use separate homing switches on the left and right Y carriages to auto-square the gantry too. I may end up making that mod at some point, if nobody does it before me.

However, pie in the sky notwithstanding, hacking the RAMPS or Marlin are probably the best all-round options, depending on whether you are more confident with software or with the soldering iron (and pen knife). Do it on E1, though, not E0, because you may want to turn your eShapeOko into a 3D printer at some point, and then you'll want to have E0 available.

Edit: having read the RepRap forum discussion to the end, someone had the idea of unsoldering the STEP, DIR and #ENABLE pins of one Pololu driver and soldering them upside down. That seems easier and more easily reversible than cutting traces.
Proud owner of ShapeOko #709, eShapeOko #0, and of store.amberspyglass.co.uk

tobycatlin
Posts: 15
Joined: Thu Oct 25, 2012 4:04 pm

Re: RAMPS 1.4 & Marlin driving dual Y steppers

Post by tobycatlin » Wed Jan 02, 2013 3:00 pm

Thanks for the detailed reply Cat.

I do have some experience in programming so I think modifying Marlin to drive the second motor is my favoured approach. I have no idea how Marlin is put together and so would appreciate any help in modifying it. I did have a crack at changing the code as suggested in that reprap post by simply adding a write statement to E0 where ever I saw a write to Y in the stepper.cpp file
eg
WRITE(Y_DIR_PIN,INVERT_Y_DIR);
WRITE(E0_DIR_PIN,INVERT_Y_DIR);

and
WRITE(Y_STEP_PIN, INVERT_Y_STEP_PIN);
WRITE(E0_STEP_PIN, INVERT_Y_STEP_PIN);

This didn't work and the motor didn't get any current as i could freely spin it and the driver chip didn't warm up. So I then added a line to the st_init() function:

#if Y_DIR_PIN > -1
SET_OUTPUT(Y_DIR_PIN);
SET_OUTPUT(E0_DIR_PIN);
#endif

and still nothing. I ran out of time before I could finish all the changes so hopefully I have just missed something obvious assuming I am on the right track.

I shall heed your advice and change over to use E1 instead of E0 as I think some 3d printing is likely in the near future.

Oh and can I legitimately say I have eShapeoko #1?
Proud owner of eShapeOko #3

cvoinescu
Posts: 4442
Joined: Thu Jul 19, 2012 6:50 pm
Location: Camberley, UK
Contact:

Re: RAMPS 1.4 & Marlin driving dual Y steppers

Post by cvoinescu » Wed Jan 02, 2013 3:52 pm

I believe you missed duplicating Y_ENABLE_PIN on E0_ENABLE_PIN, and configuring E0_STEP_PIN and E0_ENABLE_PIN as outputs in st_init(); other than that, you should be good.

According to my spreadsheet, you have eShapeOko #3. :)
Proud owner of ShapeOko #709, eShapeOko #0, and of store.amberspyglass.co.uk

tobycatlin
Posts: 15
Joined: Thu Oct 25, 2012 4:04 pm

Re: RAMPS 1.4 & Marlin driving dual Y steppers

Post by tobycatlin » Wed Jan 02, 2013 5:11 pm

Thanks I will check those and be a bit more diligent.

Added a new signature ;)
Proud owner of eShapeOko #3

cvoinescu
Posts: 4442
Joined: Thu Jul 19, 2012 6:50 pm
Location: Camberley, UK
Contact:

Re: RAMPS 1.4 & Marlin driving dual Y steppers

Post by cvoinescu » Wed Jan 02, 2013 11:56 pm

I searched for Z_DUAL_STEPPER_DRIVERS and mimicked the same mechanism for supporting two Y drivers. In my case, I allocated some unused pins for my second Y driver (I have my own "board", not a true RAMPS, so I can take some liberties). If you use MOTHERBOARD 33, it makes sense to use the E1 pins (which is also the default for the built-in dual-Z support). I've just tested my changes and they seem to work fine. This is Marlin 1.0.0 RC2, by the way -- diff attached. I had changed a few other things, and couldn't be bothered to remove them from the diff. :)

Now on to homing the two Ys together and then separately, for self-squaring. That promises to be significantly more difficult, and I have receipts to sort, taxes to file, wife, children and a day job. And a bunch of eShapeOko kits to ship.
Attachments
Marlin-1.0.0RC2-patch-dual-Y.diff.zip
(3.53 KiB) Downloaded 502 times
Proud owner of ShapeOko #709, eShapeOko #0, and of store.amberspyglass.co.uk

tobycatlin
Posts: 15
Joined: Thu Oct 25, 2012 4:04 pm

Re: RAMPS 1.4 & Marlin driving dual Y steppers

Post by tobycatlin » Thu Jan 03, 2013 10:33 pm

Thanks for the diff but I am afraid i don't really understand how your changes work. I have attached my stepper.cpp and would very much appreciate it if you could have a quick look as it still isn't enabling the motor on E1. I have commented my changes with a //tc coment. There might well be something else i have missed.

I think your kit is great and I have had a lot of fun building it so far. I can't imaging how you have time to do it all. I barely have time to build the kit let alone design and sell it.

Oh while i am here i wanted to ask you about belt anchors as the kit i got only has zip ties and i would like to buy some metal ones.

ta
toby
Attachments
stepper.cpp
modified stepper.cpp to drive E1 as second Y motor
(29.87 KiB) Downloaded 463 times
Proud owner of eShapeOko #3

cvoinescu
Posts: 4442
Joined: Thu Jul 19, 2012 6:50 pm
Location: Camberley, UK
Contact:

Re: RAMPS 1.4 & Marlin driving dual Y steppers

Post by cvoinescu » Thu Jan 03, 2013 10:51 pm

I will take a look at your stepper.cpp, but I'm swamped right now.

The metal belt anchors I had planned for the kits turned out to be useless (way too soft). Also, they were time consuming to make. They were made out of the small mild steel plates in cheap Chinese 15 A screw terminal blocks (like this one), with one of the screw holes drilled out. I have a laser-cut version on its way, if those work better I'll put them up for sale.
Proud owner of ShapeOko #709, eShapeOko #0, and of store.amberspyglass.co.uk

tobycatlin
Posts: 15
Joined: Thu Oct 25, 2012 4:04 pm

Re: RAMPS 1.4 & Marlin driving dual Y steppers

Post by tobycatlin » Thu Jan 03, 2013 11:02 pm

I am sure you have many better things to do than look at my code so please leave it until you have time.

The zip ties are working for now but some nice laser cut ones sound much better so I will wait until those are available.

Did you see this?
http://www.indiegogo.com/rumba

Looks like great value for £37. I am pretty sure we paid £70+ for a RAMPS with drivers and that didn't include the mega

t
Proud owner of eShapeOko #3

tobycatlin
Posts: 15
Joined: Thu Oct 25, 2012 4:04 pm

Re: RAMPS 1.4 & Marlin driving dual Y steppers

Post by tobycatlin » Thu Jan 03, 2013 11:04 pm

Oh it's $99 for a board with drivers but still cheap
Proud owner of eShapeOko #3

Post Reply