Welcome! Log In Create A New Profile

Advanced

Arduino as simplified comm/controller board

Posted by Anonymous User 
Re: Arduino as simplified comm/controller board
November 11, 2007 03:43PM
Hello all. I'm glad I found this thread, it fits my project perfectly.

For a few months I've been working on a repstrap along the lines of Tommelise [www.3dreplicators.com] and wanted to use open source hardware/software to control it. Dr. Higgs made the source for his vb program that reads stl files available to me and I have written a Processing program that communicates with Arduino to control my three steppers.

You can find my mini blog of the work at [ar5in.tumblr.com] and either follow the links there or go to [www.freewebs.com] where I have the files stored.

Check em out. Looking forward to any comments. If you can use the source code you're welcome to it.

Now I need to finish working on the extruder head and really try it out.

Arvin
Re: Arduino as simplified comm/controller board
November 12, 2007 11:25AM
wow!

thats some awesome stuff Arvin. i'm going to have to check that out in more depth when i get some free time this week. looks like some good stuff.

i also subbed to your RSS. good stuff!
Re: Arduino as simplified comm/controller board
November 12, 2007 11:30AM
Hey Kevin,

here's where it stands: the electronics are all tested and working reliably. i've been working on creating the arduino code that takes SNAP commands from the RepRap host software, and then translates those into the commands for the electronics boards.

i'd say i'm about 75% done with that. i've written about 1000 lines of code, but i havent tested most of it. i'm going to be focusing primarily on that this week. i'll be testing the code on my now functioning machine.

once that is done, the arduino-based electronics will be fully compatible with the reprap host software. yay!
Re: Arduino as simplified comm/controller board
November 12, 2007 10:07PM
Damn, Zack. If I had know you were going to do all that I could have just sat back and waited. Could have used the time on making a working extruder head.

Thanks for the kind words. It was fun. 800+ lines of code for the Processing program and less than 300 in the Arduino code. There's still lots to do. Haven't done any work on temperature readings except to stub it out. Don't have a head yet so would just be whistling in the dark anyway! Consider it a work in progress.

Edited 1 time(s). Last edit at 11/12/2007 10:14PM by Arvin.
Re: Arduino as simplified comm/controller board
November 13, 2007 02:34PM
tis cool... i still want to take a look at your code to see if there are any ideas i can use. perhaps if you would like to look over my code as well to see if anything pops out at you that would be awesome: [svn.reprap.org]

last night i worked on the cartesian bot code. it looks like stuff is working fairly well. there are a couple minor bugs i'm tracking down, but it should be working well by this weekend.

also, that processing interface looks pretty good. i'd like to have something nice and easy to interface a machine with. the major thing i also like about processing is that it easily creates the files to distribute... very awesome indeed.

if you're interested in continuing with your gcode stuff, you should check out my arduino stuff... its all library based, so you could just have your gcode interpreter make calls to the library. then you could also help me find any bugs in it. that would help all of us out!
VDX
Re: Arduino as simplified comm/controller board
November 13, 2007 02:45PM
Hi Zach,

... it's the same for me, with the conversion from cartesian coordinates to tripod- moving.

When my electronic works, i have to focus on the conversion, so your library could help me a lot ...

Viktor
Re: Arduino as simplified comm/controller board
November 13, 2007 06:57PM
Hi Zach.

I'm looking at your code. My, it does look organized instead of hacked like mine. I'm not really a c programmer. Spent too long using Delphi. It does so much of the code for you that you just have to fill in the blanks.

I didn't make any libraries for the work in Arduino or Processing. Several files but all contained in one Sketch basically. It is nice that Processing can export the ap with one click. Only problem I had with that was the ini file I had in the data folder had to be copied by hand. Processing also wanted to read the new and write to the old ini file. Go figure. Fixed that.

Only reason I wrote all that I did, besides the fun of it, was to be able to use open source software to make an open source project and I wanted to only use one board for the hardware(stepper/extruder contoller). Just don't like the idea of four boards using four processors when one's enough. Kind of stuborn.

By the way, I used the SpringGUI library out of the Processing libraries web page. Lots of setup code to put buttons and text fields in place and to get a file dialog working was a bit of a challenge too. All fun.

Looks like you have the source code in hand as far as I can see. What kinds of things still need to be worked on?

Arvin
Re: Arduino as simplified comm/controller board
November 14, 2007 02:33PM
hey arvin,

thanks for taking a look at the code. here's a list of things i'm working on:

* cartesian bot interface. basically, i need to be able to drive 3 stepper motors at different speeds, in different directions while still being able to do serial comms, etc. i came up with a way to do it in the regular loop, but the step signals were not always at the right time, so the motors werent as smooth as they could be.

i'm now working a better solution: to have a timer interrupt routine that happens regularly and steps the motors if needed. this should make them step *very* smoothly. if i get this to work... then i'll have a smoothly stepping 3 axis DDA machine. yay!

i dont know much about timers or interrupts but i've been able to get a good amount of info from the net so far. i wont be able to test anything until friday, but hopefully it will be something that is fairly easy to get working.

the biggest challenge i think is going to be getting the timer setup correctly. i'd like to set it up so that i have an interrupt that happens every 50 microseconds.

the second big hurdle is emulating the SNAP code. i've already converted most of the code from the current firmware. i just need to test it thoroughly. i gotta make sure my libraries are all working properly before i do that though.

the third major thing which i havent really started on yet is the extruder code. fortunately this is going to be alot simpler than the cartesian bot code. its alot more straightforward which is nice. the only real hiccup i can forsee is the temperature code since the new system uses and ADC and the old system is based on a timer. hopefully i can emulate it somehow.
Re: Arduino as simplified comm/controller board
November 14, 2007 02:37PM
last post was about my stuff, this post is about your stuff:

i also like that the Arduino allows you to put all the stuff on one board. well, almost. i did the math and you can put 3 steppers + min switches + one extruder on one arduino, but i'd rather do 3 steppers + min/max switches on one arduino and then the extruders on the second arduino. the idea of an extensible network of extruders is awesome and shouldnt be abandoned too hastily. also, the arduinos are just so darn easy to program!

i still need to look through your processing sketch. i'd love to see how you're doing things. making gui's in a host program is still quite a mystery to me. i'd love to learn more about it.
Re: Arduino as simplified comm/controller board
November 14, 2007 06:31PM
Hi Zach.

To make the gui in Processing, I used someone elses library (SpringGUI by Philipp Seifried) which then of course I had to learn how he did what. Kind of tedious, after using an ide that did all that for you, but just a lot of cut and paste mostly. In processing (Slice_Dice_xml_reader), the file called Setup has all that in it.

I'm using some code Dr.Higgs wrote in vb that takes an stl file and slices it to make layer paths which are just xyz coordinates stored in an xml file. I have Processing read the file and store all the xyz values in arrays then convert them to steps put them in a string ending in a line feed and shoot it off to the Arduino. CNC uses a 255 char max length packet so I picked that and added a * followed by a kinda sorta crc and end the packet with a linefeed. I plan to rewrite it all to use it for cnc later.

The timing of the xyz steppers was using millisecond timing but after looking at you code I thought I'd change it to Microseconds which is what I'm working on as we speak.

The code for the Arduino is pretty simple. It continuously listens for serial comms and reads the temp. (when I have an extruder. remmed out now) The arduino reads chars till it sees the lf and then parses the string. It gets xyz steps, extruder on/off, heater on/off pwm%, and feedrate(cnc uses 1 to 22. I can only get to 8 in/min). When it finishes drawing a line it sends an ACK back to Processing for the next line.

I make all three steppers step in different directions at differing speeds by using Breshenham line drawing like they do with plotters. It's really linear interpolation. In the Arudino code (xyz_gcode_interpreter) look at the linear_interpolation file. If you send step info for all three motors it will choose the largest number of steps to move and calculate how often to move the other two so that they all get finished at the same time. With reprap I send z steps separate from xy since it will only change between layers.

I'll use a second Arduino when I need one but will have the first one be the master and control the second as the extruders, heaters, fans controller and use software serial to talk to it on two pins not dedicated to serial like 0 and 1.

Sorry I talked your ear off! Should have just put all this in my blog. Hmm. Just might.
Arvin
Anonymous User
Re: Arduino as simplified comm/controller board
November 15, 2007 07:09AM
You can put both the min and max switches on the same line. Software will always know which is which anyways. And you need only one pin (extruder select) to control two extruders since you won't be using them at the same time.

--Blerik
Re: Arduino as simplified comm/controller board
November 15, 2007 08:29AM
Comments about you comments about your code:....got that?

Quote

* cartesian bot...i need to be able to drive 3 stepper motors...able to do serial comms
I was worried about the blocking nature of the steppers as well as the serial comms basically fighting each other. I stopped worrying about it and only sent from Processing when Arduino said it was ready. Only problem I saw was not having an emergency stop that could restart from where it had stopped. Got over that by creating a pause button that would restart from where it had been paused and just use the Arduino's reset button for emergency stop. Then pause processing since it would be waiting for ACK from arduino it would restart at the same place or at least at the beginning of the last line. No non-blocking code needed.

Quote

i dont know much about timers or interrupts
Oh, you will. By the time you get it working!

Quote

emulating the SNAP code
before starting any coding I went over and looked at the host software and didn't get very far. Too many classes doing tiny amounts of work. Was discouraged and said to myself "you could just write your own" That's when I looked at the stl files and had no clue how to slice them into layers and that led me to Tommelise and Forrest's Slice and Dice. If I could have hust had a look at what the packet being sent consisted of I'd been happy just receiveing it and going from there.
Got any magic document with it summarized?

Quote

the extruder code...is going to be alot simpler
I agree. It should be. All I have in my code is extruder on/off. Speed control is just pwm but reversing the motor may be necessary too.

Quote

ADC and the old system is based on a timer
ADC is what I was planning. I wouldn't even know how to use a timer for checking the temperature.

have fun
Arvin
Re: Arduino as simplified comm/controller board
November 15, 2007 11:06AM
interesting. thats a great idea... i'll have to try that!

as for multiple extruders... well i wouldnt say that we'll 'never' need to use 2 extruders at once. we may want/need to in the future.

blerik Wrote:
-------------------------------------------------------
> You can put both the min and max switches on the
> same line. Software will always know which is
> which anyways. And you need only one pin (extruder
> select) to control two extruders since you won't
> be using them at the same time.
>
> --Blerik
Anonymous User
Re: Arduino as simplified comm/controller board
November 15, 2007 12:01PM
And next to the min and max switches you should put limit switches that cut the power to the steppers. In case of software malfunction (a standard feature on cnc stepper boards).

--Blerik

Oh, and I love the work you're doing with the McWire RepStrap and the Arduino controller. Finally a simple design to get the ball rolling. And it has about the same number of reprapable components, just a lot less of each type. I mean if you're allowed to buy motors, slides, studding, pcb's, nuts and bolts for Darwin, it is also allowed for the McWire RepRap.
Re: Arduino as simplified comm/controller board
November 15, 2007 01:26PM
blerik:

what do you mean by 'limit switches'?

if you mean some sort of panic button you can hit that will cut power, then i think its a great idea and i would love to make something like that. the current stepper controller boards have a 'enable' line that when tied high enables the motors, and when its brought low it disables any current to them.

it would be really simple to wire up all the enable wires to a switch that would bring them all low when you trigger it. that would be excellent. of course you'd have to do something similar with the extruder, but thats totally do-able too.

ps. thanks for the support!
Anonymous User
Re: Arduino as simplified comm/controller board
November 15, 2007 05:31PM
With limit switches I mean switches outside the min and max switches like so:

(L)--(-)------------------[EEE]-----------------------------(+)--(L)

-------- is the linear slide mechanism, [EEE] is the extruder or another axis slide, (-) is the min switch, (+) is the max switch and (L) are the limit switches. They prevent the stepper and slide destroying itself if the software goes haywire. Say there is an overflow in your code, and it decides to send the slide to position -32768 and pushes the stepper at great speed beyond the limits of the slide (hence limit switches). You use the min and max switches for calibration and sensing, and the limit swtiches make sure the machine stays in one piece. A drawback is that when one gets triggered, everything stops and the only way to get the machine running again is by manually rotating the stepper to release the switch.

--Blerik
Re: Arduino as simplified comm/controller board
November 15, 2007 07:31PM
It depends how strong your motors are relative to your mechanics. On my machine if it hits the physical end stop the motors just stall, causing no harm. On the other hand if the extruder hits something then it can be damaged but that is harder to detect.


[www.hydraraptor.blogspot.com]
Anonymous User
Re: Arduino as simplified comm/controller board
November 16, 2007 11:24AM
When using threaded rod and big steppers (that have to turn fast to get anything done), the momentum alone might be enough to bend the rods. And when using more expensive stuff like ballscrews it is even more of an issue. The chance for messing up isn't big, the cost is. Both in materials and labor. But even when that isn't a consideration, I always like my machines to stop when something goes badly wrong. And since RepRap is supposed to be working unattended that would be extra nice. And since it only costs a couple of switches it is something I will add to it. Whether other people do the same is up to them.

Adding pressure sensors to the extruder to sense it hitting something is a bit more complicated, but I think it is worth it as well. Too bad the current model is so big and heavy, otherwise some microswitches would be all you need.

But this discussion is getting pretty offtopic, time to return to the main act...

--Blerik
Re: Arduino as simplified comm/controller board
November 18, 2007 10:27PM
blerik,

i guess i had been assuming that the min/max sensors *are* the limit switches. we're interpreting them in software, but i guess it would be nice to have a hardware based cutoff in there as well.

perhaps we can put that into the next version of the stepper controller boards. technically you could do it now, as there is an 'enable' jumper that you could instead wire the switches to.

i agree that its required on systems that need it for safety reasons, but at least on my McWire design its not a big deal in either direction. if they go to far home, the silicon tube motor coupling pops off (easy fix, no damage) if they go to far the other way, the threaded rod just unscrews and its also an easy fix. yay mcwire design!
Re: Arduino as simplified comm/controller board
November 27, 2007 01:24PM
Zach,

What is the limitation that would require two Arduinos? Is it the Digital Input Outputs or Analog Input outputs or something else?

I'm very new to RepRap and am interested in building a Darwin. I was about to purchase some PCBs from rrrf when I came across this thread. I like the idea of using an Arduino but using two just seems unessesary to my "amature" mind.

From viewing some of the Video Podcast on Make I've learned that the I/O's of the Arduino are easily extendable using Multiplexing. So if this is the limitation then why not simply multiplex? I'm just trying to get a better understanding of the limitations here.

David
Re: Arduino as simplified comm/controller board
November 27, 2007 04:03PM
Hey David,

Well, multiplexing is a tricky issue and is not a very good solution for what we're trying to do here. its probably do-able, but it also creates alot of extra complexity and overhead that we dont need at this point in time. we need a set of electronics that is versatile and easily reconfigurable to allow us to be flexible in our development.

on a technical issue there are a few things.

1. currently with the stepper motors, we're running out of pins. putting all 3 stepper controllers + extruder controller means you have to cut corners on the arduino to make it happen. its possible and i'm sure if there is enough demand, someone will come up with a single-arduino variant firmware.

2. its expandable! having 2 arduinos means you have free pins to experiment with stuff. you can add extra heads, you can play with lasers, you are free to tinker without having to do some really ugly hacks. you can even expand the token ring to include more arduinos and have lots of stuff going on. modularity lets people do things with your project that you cant think of yourself. this is good. =)

3. with the current method of driving stepper motors, we're overriding the timer stuff on the atmega168. that means the PWM stuff no longer functions correctly on that arduino. that means the extruder wouldnt be able to work. we're working on a way around this.

4. its easier, logically. having one arduino that handles the 3 axis stuff, another that handles the extruder (or extruders) means that the code is easier to write, debug, and understand.

Squintz Wrote:
-------------------------------------------------------
> Zach,
>
> What is the limitation that would require two
> Arduinos? Is it the Digital Input Outputs or
> Analog Input outputs or something else?
>
> I'm very new to RepRap and am interested in
> building a Darwin. I was about to purchase some
> PCBs from rrrf when I came across this thread. I
> like the idea of using an Arduino but using two
> just seems unessesary to my "amature" mind.
>
> From viewing some of the Video Podcast on Make
> I've learned that the I/O's of the Arduino are
> easily extendable using Multiplexing. So if this
> is the limitation then why not simply multiplex?
> I'm just trying to get a better understanding of
> the limitations here.
>
> David
Re: Arduino as simplified comm/controller board
November 27, 2007 05:17PM
Quote

ZachHoeken Wrote:
> 3. with the current method of driving stepper
> motors, we're overriding the timer stuff on the
> atmega168. that means the PWM stuff no longer
> functions correctly on that arduino. that means
> the extruder wouldnt be able to work. we're
> working on a way around this.
I can agree with what you say Zach except for #3. I think I'll stick with my way of moving the steppers instead of your non-blocking code. I didn't realize no PWM with yours! eye popping smiley Arduinos have SIX pwm pins available. I plan to use them! I've got all my steppers getting to the right place anyway.

David. I might use some multiplexing when I get to trying the second print head. (Limit switches come to mind.) I haven't been able to make the first head yet. Been too cold for me to play right now.
Re: Arduino as simplified comm/controller board
November 27, 2007 05:37PM
well, there is one more idea i have that might work. it would only require one timer so it would only disable a few of the PWM pins.

personally, with cheapo boarduinos from ladyada, its not that big of a deal to me.
Re: Arduino as simplified comm/controller board
November 27, 2007 09:22PM
Thanks for the response.

Just as a reference this is where I got the idea of multiplexing with the arduino.
[www.makezine.com]

Here is a schematic of the multiplexing used
[www.fluidforms.at]

and here is a more detailed writeup of the punching bag project
[www.fluidforms.at]

Just for the record I don't have enough electronics experience to know who's right and who's wrong. Hopefully one day I will after digging into this project a little more. I do have an electronics background but its basic.

Edited 1 time(s). Last edit at 11/27/2007 09:24PM by Squintz.
Hey have you guy's heard of Wiring? It's the precourser to Arduino, it's essentially a much larger ATMega32 with 40 digital i/o pins and 8 analog i/o pins? It too has a USB converter<->serial converter. In essence it is a souped up Arduino. More information here: [www.wiring.org.co]
Re: Arduino as simplified comm/controller board
December 02, 2007 01:59PM
yeah, wiring is pretty rad. unfortunately there is no place (that I can find) where you can buy them pre-assembled, or as a kit.

that board would be really awesome, and we would be able to easily control all the parts of a reprap machine with one. if anyone knows where we could get some, please let me know!
You can get them at Sparkfun [www.sparkfun.com] for $82.95 (or (
Re: Arduino as simplified comm/controller board
December 03, 2007 05:11PM
oh wow, thats really cool. i might have to grab one of those to play around with. it definitely is a good candidate to be the brains of the system.
Re: Arduino as simplified comm/controller board
December 03, 2007 07:31PM
The only down side is that unlike the Arduino, Wiring is not designed for shields. Also in the pictures the connections seem to be standard jumper pins. This is not helpful. I may buy one and then get standard female headers to replace them, or even some form of terminal bocks which also have a 2.54mm spacing. However like you said, it's hard to source them.

Although once found, the Arduino code should be fairly easy to port.

{edit}
It appears Wiring is a one-man effort, the information for buying hte boards, although well hidden) is:
Quote
www.wiring.org.co
Where can I get and how much does it cost the Wiring I/O board?

The board costs US$60, shipping costs depends on volume and location, please contact hbarragan at uniandes.edu.co for payment and shipping details.

Edited 1 time(s). Last edit at 12/03/2007 07:36PM by TheFallen.
Re: Arduino as simplified comm/controller board
December 04, 2007 10:11AM
hmm... well from what i gather, the design is open source, so if we do decide to go with the wiring board in the future we could take the design and modify it for our needs.

i'm going to be doing something similar with the arduino board here soon. specifically, ladyada has made an arduino clone called the 'boarduino' which is a small, compact arduino version that is designed to be inserted into a breadboard. instead, i'm going to create a PCB that you will be able to insert it to (or solder it into...) which then has all of the pins broken out into screw terminals.

the cool thing is that ladyada has agreed to give us discounts on the boarduino kits, which brings the whole cost down quite a bit.

anyway, i'll post more about this when i have actually started the breakout board design.
Sorry, only registered users may post in this forum.

Click here to login