Welcome! Log In Create A New Profile

Advanced

Duet Board Custom Commands

Posted by ca3d 
Duet Board Custom Commands
August 18, 2015 03:02PM
I am using the Duet board to build a paste extrusion 3d printer, and I have some questions about creating custom commands using the board. Specifically, I am not sure whether I need to make firmware changes (hopefully not) or if I can use the existing board/firmware to add in extra features.

The extra features I want to add in:

1. Extruder max/min endstops
I know the extruder has endstop pins on the Duet board, so I should be able to plug in a limit switch and rewrite a home.g file. If this works, that would satisfy one endstop, let's say the min endstop, but then I still need to add in a max limit switch. Are the expansion headers specifically assigned pins or can I use them for my own expansion ideas?

2. Integrated camera
I would like to add in some sort of camera setup that could either monitor the print remotely or just take a picture when I send a command. Remote monitoring is a bit of a stretch, but I think sending a shutter command to an externally powered camera would be doable.

3. Extra heater and fan
For the fan, my first thought is to connect it to the Fan0 pins based on this post. That thread talks about how it is important to add in some protection against back EMF if the fan is highly inductive, but I still don't understand how the code would work to run the fan. Once again I am curious how the expansion pins can be used. I doubt they would be able to power a heater, but maybe they could control the logic for the heater?

Any help is greatly appreciated. I am not an electronics/software guru by any means and there is still a lot more research and work to be done for this project, but I was hoping someone could tell me how feasible it is to add in these features.

Thanks
Re: Duet Board Custom Commands
August 18, 2015 04:17PM
Hi,

1. Some of the expansion pins are allocated for the DuetX4 expansion board or Duet shield, 2 are allocated to the Z prober, 2 are used by the PanelDue touch screen add-on, and one is used for fan RPM monitoring. That leaves a reasonable number of unallocated pins. If you won't be using a Duet shield or DueX4, then you can also use the pins they would use.

2. The Duet doesn't have enough processing power to provide a camera feed, so for that I suggest as RPi or similar. Controlling a camera shutter should be simple enough though, I recall reading something on the Arduino forum about using a reed relay as the shutter switch.

3. What sort of fan will you be driving, and are you looking to control the 2 fans independently or together? If it's a brushless DC motor then you shouldn't need a flyback diode.

The recently-released Duet 0.8.5 supports 5 motors (including 2 extruder endstop inputs I believe), 2 extruder heaters, and 2 PWM fans. So it may be capable of doing most of what you want without extra electronics.



Large delta printer [miscsolutions.wordpress.com], E3D tool changer, Robotdigg SCARA printer, Crane Quad and Ormerod

Disclosure: I design Duet electronics and work on RepRapFirmware, [duet3d.com].
Re: Duet Board Custom Commands
August 18, 2015 07:39PM
Thanks for the response!

The new Duet 0.8.5 does look very nice and could suit my needs, but I am working with a 0.6 from Replikeo because it is about 1/3 of the price. (On a side note, is the Replikeo Duet so cheap because T3P3 just released the new version?)

I've been trying to figure out the Duet schematic from the Github page (here) and I am not sure how to read the document. The expansion headers on page 4 have a lot of different names like "PC6_PWML2," "PC7_PWMH2," "SPIO_NPCS1," "AD10"... Is there another reference that could explain the pins better because I am still quite confused after reading the Github schematic.

Once I find the unallocated pins (or the Duex4 pins since I don't plan to use one), do I need to edit the firmware or can I add in features via gcode commands? Or is there another method?

For editing the firmware, I would use Eclipse as shown in this post by T3P3, use the syntax shown in the ReprapFirmware Github page, and try to figure it out from there...

Lastly to answer your question about the fans, it would be a brushless DC fan but I would want one running at a constant speed all the time and I would want another one to be used to control the temperature in an enclosure, so it would have to vary its speed.
Re: Duet Board Custom Commands
August 19, 2015 03:58AM
Fans that need to run all the time (e.g. hot end fans) can be connected to the 12V pins on the large header block on the Duet 0.6 just above the stepper motor connectors. See the documentation for any of the current RepRapPro kits for the connections. The FAN0 pins are for a PWM-controllable print cooling fan. So it looks like your fan requirements are taken care of.

Does your paste extruder system need a heated bed? If not, then you could use the bed heater as your second heater channel. Otherwise, if you need 3 heaters in total. I suggest you download the DueX4 schematic or the Duet Shield schematic, and copy the electronics for the first heater channel on it, using the same pins on the expansion connector. That way, you will already have firmware support for that heater/thermistor combination.

The expansion header pins you refer to are named after the pins on the SAM3X8E chip that they are connected to.



Large delta printer [miscsolutions.wordpress.com], E3D tool changer, Robotdigg SCARA printer, Crane Quad and Ormerod

Disclosure: I design Duet electronics and work on RepRapFirmware, [duet3d.com].
Re: Duet Board Custom Commands
August 19, 2015 02:35PM
Just to double check, the "12V pins on the large header block on the Duet 0.6 just above the stepper motor connectors" for the fan connection are the same pins used for the Ormerod 2 (Ormerod 2 Wiring Diagram). If that is the case then my fan problem is solved.

Now there are still a couple steps I am not understanding:


1. How to identify the heater pins in the Expansion headers - Based on the input block from the Duex4 Schematic, I can see pins for extruders and thermistors but I don't see any heater pins specified. I see heater pins in the extruder blocks, but not in the input block so I don't know how they correlate to the Duet pins.


2. How to call out pins in gcode - From the schematic, I see 'E_Stop's for all 4 extruders. To create an additional extruder endstop, I would wire the extruder limit switch between one of these pins and ground, but then I don't know how to create gcode files to use these pins. I am guessing the pin names are in one of the other files on the Github page, but I couldn't find it.

For example just on the Duet board (not Duex4) if I wanted to create an extruder homing gcode, would it look like what I have below? (I just altered the homey.g from the RepRapFirmware Github)

G90 ; set movement to absolute mode
G92 E0 ; set position to E=0
G1 E-250 F2000 S1 ; home E
G92 E0 ; set position to E=0
G1 E3 F200 ; move Extruder out
G1 E-5 F200 S1 ; home E again, slower
G92 E0 ; set position to E=0

Any help/advice is greatly appreciated!

Edited 1 time(s). Last edit at 08/19/2015 02:36PM by ca3d.
Re: Duet Board Custom Commands
August 19, 2015 03:34PM
Quote
ca3d
Just to double check, the "12V pins on the large header block on the Duet 0.6 just above the stepper motor connectors" for the fan connection are the same pins used for the Ormerod 2 (Ormerod 2 Wiring Diagram). If that is the case then my fan problem is solved.

You can use the connections that the "Hot end fan" are connected to. The Ormerod 1 wiring diagram is better, the wires have more sensible colours in that one.

Quote
ca3d
1. How to identify the heater pins in the Expansion headers - Based on the input block from the Duex4 Schematic, I can see pins for extruders and thermistors but I don't see any heater pins specified. I see heater pins in the extruder blocks, but not in the input block so I don't know how they correlate to the Duet pins.

For example, if you looks at the "E1 mosfet control" block, you will see that the input to it is the E1_PWM signal, which connects to PC6_PWML2 on the expansion connector.

Quote
ca3d
2. How to call out pins in gcode - From the schematic, I see 'E_Stop's for all 4 extruders. To create an additional extruder endstop, I would wire the extruder limit switch between one of these pins and ground, but then I don't know how to create gcode files to use these pins. I am guessing the pin names are in one of the other files on the Github page, but I couldn't find it.

The current firmware doesn't support homing of extruders, and I've never come across it before. I could possibly add it when I am a little less busy. What does it mean to home an extruder - can you describe the mechanical arrangement?



Large delta printer [miscsolutions.wordpress.com], E3D tool changer, Robotdigg SCARA printer, Crane Quad and Ormerod

Disclosure: I design Duet electronics and work on RepRapFirmware, [duet3d.com].
Re: Duet Board Custom Commands
August 19, 2015 06:37PM
Thanks for explaining that schematic, I see now how the different drawings match up. This leads me to my next issue of how to control these pins (or any pin in general). If I wanted to trigger the camera for example, I'd set a specific pin HIGH or LOW to trigger a switch, but how do I control a specific pin. In the heater idea, I would want to control PC6_PWML2, which I could do in an Arduino script but I don't know how to use the Duet to do that.

It really comes down to what code/syntax is required to control specific pins on the Duet. And maybe RepRapFirmware is not customizable enough (or too complicated for my skills) to do these extra tasks, which is not the end of the world.

Quote
dc42
What does it mean to home an extruder - can you describe the mechanical arrangement?

The paste extruder would have a syringe and plunger to push out material with the plunger being compressed with a screw similar to the 3Drag Chocolate Extruder. The issue is that the system doesn't know when it has fully compressed the plunger so it will keep trying to compress an empty syringe and cause all sorts of problems.

For homing the extruder I had two different ideas, one with a min endstop and one with a max endstop. With the min endstop I would "home" the extruder with the plunger at the top and set a max extruder steps allowed with M208. The max endstop idea would be more of a kill switch where the limit switch is hit and the extruder will automatically turn off.

Now that I think about it, maybe I could just accomplish the second idea with a NC switch that is triggered once the syringe is fully compressed...

Edited 1 time(s). Last edit at 08/19/2015 07:01PM by ca3d.
Re: Duet Board Custom Commands
August 20, 2015 02:05AM
RepRapPro has done some work on paste extrusion using the Duet. I think their blog has an entry on it. The firmware supports the M571 command, which puts a PWM signal on the Fan0 pins whenever extrusion is taking place. Maybe they use this to apply force to the syringe.

How were you thinking of wiring your NC switch?

Edited 1 time(s). Last edit at 08/20/2015 02:07AM by dc42.



Large delta printer [miscsolutions.wordpress.com], E3D tool changer, Robotdigg SCARA printer, Crane Quad and Ormerod

Disclosure: I design Duet electronics and work on RepRapFirmware, [duet3d.com].
Re: Duet Board Custom Commands
August 20, 2015 11:12AM
Quote
dc42
How were you thinking of wiring your NC switch?

Honestly, I just came up with the idea while typing that yesterday and it is still very fuzzy. But my idea would be to have it wired in series with the extruder motor such that when it is pressed (if the syringe is fully compressed) then it will create an open circuit and stop the motor. This would then require some manual intervention to reverse the motor because it could not receive power while the switch is compressed.

From David's Paste Extruder wiki page it says:

"I'm currently trying to figure if there is a simple electronic circuit which will activate a solenoid valve to close off the nozzle when the stepper is set to 'hold' (ie both coils activated and static). Preferably drawing power for operation from the stepper driver to avoid extra wiring"

From my understanding, when the stepper is set to 'hold' that indicates that it is trying to rotate but is stuck. This would be the case when the syringe is fully compressed. I could maybe have a similar idea that shuts off the motor (instead of closing the nozzle) when the stepper is set to 'hold'.
Re: Duet Board Custom Commands
August 20, 2015 11:57AM
Quote
ca3d
Quote
dc42
How were you thinking of wiring your NC switch?

Honestly, I just came up with the idea while typing that yesterday and it is still very fuzzy. But my idea would be to have it wired in series with the extruder motor such that when it is pressed (if the syringe is fully compressed) then it will create an open circuit and stop the motor. This would then require some manual intervention to reverse the motor because it could not receive power while the switch is compressed.

Stepper motor driver ICs don't like having the motors connected or disconnected with power applied, it tends to break them. So you need to think of something else. I guess one possibility is to have the machine do an emergency stop in that situation - or is that too drastic?

If you get the mechanics and stepper motor current right, the motor will skip steps harmlessly if the syringe can't be moved any more - the same as a filament extruder does when the nozzle is obstructed.



Large delta printer [miscsolutions.wordpress.com], E3D tool changer, Robotdigg SCARA printer, Crane Quad and Ormerod

Disclosure: I design Duet electronics and work on RepRapFirmware, [duet3d.com].
Re: Duet Board Custom Commands
August 20, 2015 03:22PM
That is a good point. I would like to avoid having to re-home the axes, but an emergency stop is definitely an option. Maybe instead of disconnecting the motor I could have the button trigger a "M18 E0" command that will disable the extruder motor.

Quote
dc42

If you get the mechanics and stepper motor current right, the motor will skip steps harmlessly if the syringe can't be moved any more

I have been running a non captive linear stepper motor at only 300ma [M906 E300] and it skips steps when it doesn't have enough torque to spin (empty syringe or with too thick of a paste). However, I assumed this noise was very bad for the motor and usually turned it off if this ever happened.

Can you explain how I would know whether or not it is "harmlessly" skipping steps?

Edited 1 time(s). Last edit at 08/20/2015 03:24PM by ca3d.
Re: Duet Board Custom Commands
August 20, 2015 03:50PM
Skipping steps does not harm the motor. But you need to make sure that the mechanics connected to the motor can handle the torque without damage.



Large delta printer [miscsolutions.wordpress.com], E3D tool changer, Robotdigg SCARA printer, Crane Quad and Ormerod

Disclosure: I design Duet electronics and work on RepRapFirmware, [duet3d.com].
Re: Duet Board Custom Commands
August 20, 2015 05:16PM
Ok that is good to know about the motor being unharmed, I will just make sure my mechanics can handle the torque.

I'm still trying to think of another way around this issue using software...

Could I hijack one of the other limit switches (XYZ max endstop) and use it for the extruder? Or is there another firmware that I could use like Marlin that would allow extruder endstops?
Sorry, only registered users may post in this forum.

Click here to login