Welcome! Log In Create A New Profile

Advanced

Arduino Mega

Posted by martinprice2004 
Arduino Mega
March 10, 2010 08:27AM
I have just bought an arduino mega and am looking to use it to control a reprap.

I'm looking for details on modified firmware and setups for controlling 3 steppers and a DC motor extruder and temperature control. Are there any blogs out there with further details of someone that has done this?

I would also really like to eliminate the extruder driver board and run this directly from the mega. And while I'm at it maybe remove the stepper driver boards as well!
Re: Arduino Mega
March 10, 2010 11:22AM
I also bought an Arduino Mega to use controlling a McWire, all four stepper motorts and the extruder heater. Will it be easier to adapted existing code for this single micro approach to controlling everything, or would I be better off just starting from scratch?

Mike


Team Open Air
Blog Team Open Air
rocket scientists think LIGHTYEARS outside the box!
Re: Arduino Mega
March 10, 2010 11:35AM
Try this out:
[github.com]

Let me know if it works since I was planning to try it out. Also, Triffid_Hunter was working on something that might eventually work, but still seems to be experimental still.
Re: Arduino Mega
March 10, 2010 11:05PM
I'm controlling all my steppers (plus heater plus thermocouple) from a regular ('168-based) arduino. My firmware is almost ready to go, just needs a bit more debugging. I'm trying to find a rather insidious bug where it'll accept a command and immediately mark it as finished, regardless of start point and target point being different. Feel free to help me find it! smiling smiley


-----------------------------------------------
Wooden Mendel
Teacup Firmware
Re: Arduino Mega
March 11, 2010 08:03AM
I know a little C code. I hate coding an arduino as you have to do it in a text editor so there is no trace / debugging facilities.

These problems are usually caused by incorrect variables settings either in a loop or other structure. Try explicitly declaring variables to zero or actual values before using them (including any boolean variables) if you haven't already done so.
It may be that the variable if not explicitly declared moves between true and false randomly.

I do know this is the case for pins on the arduino mega, they drift between 0 and 1 if not declared causing many intermittent problems. Maybe the arduino firmware does the same in the code.


Is your code available for viewing?
Re: Arduino Mega
March 11, 2010 08:29AM
I have read somewhere that the mega is part of the next generation electronics. I would rather run off a standard mega with breakout boards (similar to my version 1 set) than using a dedicated board, as it's easier to build several small boards than one 'Mega-' board.

I have a 'future' plan to build a 'Mega' RepRap shield, with 10-pin IDC connectors for the standard stepper boards and use the mega to control the extruder. I don't see a lot of extra use in a separate extruder chip controller, either.

I'm currently building the stepper driver boards at home
Re: Arduino Mega
March 11, 2010 08:36AM
the appeal for me was the arduino mega and pololu stepper carriers can be done for under $100 USD.

now i still need to put them into a working reprap.
Re: Arduino Mega
March 12, 2010 03:11AM
martinprice2004 Wrote:
-------------------------------------------------------
> I know a little C code. I hate coding an arduino
> as you have to do it in a text editor so there is
> no trace / debugging facilities.
>
> These problems are usually caused by incorrect
> variables settings either in a loop or other
> structure. Try explicitly declaring variables to
> zero or actual values before using them (including
> any boolean variables) if you haven't already done
> so.
> It may be that the variable if not explicitly
> declared moves between true and false randomly.

I ensure that all variables are initialised, and the vast majority are initialised to zero. This way they end up in BSS section and their values don't take any space in flash.

> I do know this is the case for pins on the arduino
> mega, they drift between 0 and 1 if not declared
> causing many intermittent problems. Maybe the
> arduino firmware does the same in the code.

I enable the internal pull-ups on all inputs so they read as 1 if unconnected.

>
> Is your code available for viewing?

yes, see FiveD on Arduino link in my sig. It's hosted on github


-----------------------------------------------
Wooden Mendel
Teacup Firmware
Re: Arduino Mega
March 20, 2010 10:11PM
i am using the arduino mega clone has well, though i am not as far along has i would like to be. but i am getting there.

i will need to place an order for some pololu drivers soon.


[mike-mack.blogspot.com]
Re: Arduino Mega
March 29, 2010 09:57AM
just finished soldering together a set of pololu boards myself and installed your firmware with some success, it at least shows the temp of both extruders and heats them properly, but any time i try to move a axies or extruder the entire host software locks up and nothing moves. also it keeps saying m113 is a illegal m code, still looking for the list of m codes for reprap though
Re: Arduino Mega
March 29, 2010 02:06PM
mcodes [reprap.org]

do you have end-stops connected?


-----------------------------------------------
[mfsamuel.blogspot.com]
Re: Arduino Mega
March 29, 2010 11:38PM
no, but in the past when this was a issue i could move in the positive direction but not in the negative. also i cant move the extruder stepper either
Re: Arduino Mega
March 29, 2010 11:57PM
well, looking at the m codes i see that 113 would be irrelevant to me. it shouldnt change anything so would be ignored. which is what appears to be happening. Ive been reading through buzz's source and see that there were issues with the order that certain pins were initialized in, I changed the pin outs to something that was easyer for me to work with and that may be my issue,
x step 50, x dir 52, x min 21, x max 21 , x max 8, x enable 48 (note: not sure why there are two max references and why both are the same pin but its how buzz had it, may remove this and try it again)

Y step 51, y dir 53, y min 20, y max 8, y enable 49
z step 44, z dir 46, z min 19, z max 8, z enable 42
base heater 4 power supply -1
ext0 motor speed 45
motor dir 47
heater 2
fan -1
temp 0
valve dir 8
valve enable 8
step enable 43

ext1 motor speed 38
motor dir 40
heater 3
fan -1
temp 1
valve dir -1
valve enable -1
step enable 36
debug pin 0

optoa 21 optob20 encoder0 19 (note: dont think i need the encoder but havent removed it)

right now im looking into wheither the enable is supposed to be inverted but not sure yet. also trying to figure out how to get the heated build platform control to work.

if anyone sees a problem with these pin outs let me know
Re: Arduino Mega
March 30, 2010 08:08AM
I know this is a simple question, but what would happen if I just installed the latest makerbot or reprap firmware into an arduino mega and connected the steppers (via stepper driver boards) up to the correct pins on the arduino mega board?

I understand I may not have extruder control, but would the steppers respond to XYZ G code?

How does the arduino mega recieve its serial G code data when running through its programming USB port?

What other problems will I encounter?

The reason I ask is that I want to gauge how much work I have to do as I may go along a different development route if its too much.

I think triffid hunters work is great, but with the price of arduino megas (and clones) decreasing so much I feel perhaps his efforts may be surpassed by the cheaper technology.
Sorry, only registered users may post in this forum.

Click here to login