Welcome! Log In Create A New Profile

Advanced

I re-invented the wheel - extruder firmware for my EMC RepStrap

Posted by sam0737 
I re-invented the wheel - extruder firmware for my EMC RepStrap
September 02, 2009 02:30PM
I am converting my DIY CNC Mill controlled by Linux EMC to RepStrap. Changing the toolhead assembly is all I needed while keeping the Axis driving mechanism.

After studying the existing codes, I decided to rewrite...because they assumes I am using Sanguino mobo, but I am actually planning to drive the board with USB->TTL directly from the PC.

I just suspected this might be useful to someone.
Highly experimental. YMMV, and it only works with Magnetic Encoder + DC Motor.

Pictures: [picasaweb.google.com]
Source code (Firmware, EMC HAL/PyVCP): [sam0737.github.com]
M-Apps should come in a few days...

EMC AXIS Screenshot: [github.com]
Re: I re-invented the wheel - extruder firmware for my EMC RepStrap
September 02, 2009 06:34PM
Looks very good! I see that you are using a generation three extruder controller, we have thought about it for our project also.

The EMC allows you to drive a serial channel via G-code?
Re: I re-invented the wheel - extruder firmware for my EMC RepStrap
September 03, 2009 01:38AM
The 3-Axis are driver by some Stepper Controller, which is driven over Parallel Port using Bit-Bang.

For those who is not familiar to EMC...here is what it does in my setup:
1. EMC reads GCODE
2. For movement GCODE, it go through it's "stepgen" HAL (Hardware abstraction Library) library to generate the steps
3. The "stepgen" output is tied, through the HAL system, to the "parport" (Parallel port) HAL library
4. The parport library does the actual hardware call to change the pins on parallel port, which the stepper controller actually powers the steppers.
5. Profit!

Now more about the EMC...
1. I hook the End Stop signal to the parallel port,
2. Through the "parport" HAL library, I tied the signal back to the EMC Logic HAL which take care of the movement

Now about the Extruder status - this is what I have done so far
1. I have written the Userspace HAL library in Python, called "repstrap-extruder.py", which represent some integration points to EMC
2. Some of them are status report - like Thermistor status. They are tied to the UI through the HAL system. (UI itself is just another HAL component with "pins" that can be tied to any other HAL component)
3. UI can also "send command" to the "repstrap-extruder.py"
4. In "repstrap-extruder.py", it will periodically (like every 10ms) command the Gen 3 controller through serial port, it will retrieve status and represent in them in HAL component.
5. All EMC knows are the HAL component...it does not know it's behind Serial port or anything.

Now back to the actual extrusion part. Here is my plan.
1. EMC reads GCODE
2. For GCODE of M101, 102, 103..., which EMC designates as User GCode, it will call the M-Apps. M-Apps are just script or program that I am going to write.
3. So those little M-Apps, which will be Python again, will find it ways to send command down to the Gen 3 extruder controller.
4. The command must actually goes through "repstrap-extruder.py", because I couldn't have two process opening the same Serial port (or else we have serious collision problem). So I must find a way to signal the "repstrap-extruder.py" from the M-Apps. This is called InterProcess Communication problem, and I am actually planning to use HAL itself to do that. (Other options are Unix Pipe, Unix Socket, TCP socket, or some plain temp files lying somewhere...)

The last part is something I didn't complete yet.

brendanjerwin also made a similar stuff some while ago (HAL, M-Apps, etc.), [github.com]
But if I didn't mistaken, in his setup his PC is talking to the Sanguino motherboard through M-Code, then the Sanguino motherboard talk to the extruder controller. In my setup, I don't have the Sanguino motherboard - the PC talks directly to the extruder controller. So I have to re-invent the wheel.
Sorry, only registered users may post in this forum.

Click here to login