Jump to content
Ultimaker Community of 3D Printing Experts
Sign in to follow this  

Extruder control lines....

Recommended Posts

Hey Jem, you are always doing cool stuff. Your question is a little unclear. If you want to control something through the printer using PWM, I believe the UM1 board and firmware actually support two PWM outputs for the type of servos used in radio control models (although you might need to rebuild the firmware).

If it is PWM output you want, that would be a good way to go because the firmware has commands that allow you to set the position via gcode.

The primary use of these outputs for automated probing that uses a small servo to flip the probe down, measure the bed and flip it back out.

If you look closely at this pic at just about the center of the board, you will see a 6 pin header location (the headers are populated) where up to two servos would connect.

Arduino MEGA Ultimaker Shield v1.5.7 Board

Looks like the topmost pin is gnd, middle is +5 and the bottom is the PWM signal.

Search for the word servo here: https://github.com/ErikZalm/Marlin


Share this post

Link to post
Share on other sites

Hello anon! Well I was looking at pump systems and I figured that all you needed was one control line to switch on and off those pumps. So you could in fact have quite a number of extruders or pumps or whatever running from the board... Like if you had two pwm devices you could switch two doc pumps on and off, causing liquid to flow in a semi controlled manner then use the two extruder ports to directly control screw driven extruders... Antsy way there are possibilities here me thinks...

Share this post

Link to post
Share on other sites

Well if you want to just turn something on and off like a single speed screw driven extruder, it think there are many unused pins that are brought to the top shield and these can be controlled with another gcode command.


  • [*]M42 - Change pin status via gcode Use M42 Px Sy to set pin x to value y, when omitting Px the onboard led will be used.


However, be aware that the pins can't drive much so you would need some electronics like a MOSFET and diodes to drive a motor load.

You certainly could use the heater outputs for this too and they already have the additional electronics to drive an inductive load. The big issue you would have is obviously the firmware is set up to run the temp control loop on them.

Also, unfortunately, the M42 command has protection code for the "special" pins like those that control the heater MOSFETs, stepper drivers and the other already wired pins.

You could probably comment out some things in the firmware to free up the MOSFET pins so you could use the M42 to turn the MOSFETs on and off in gcode.

Definitely doable...


Share this post

Link to post
Share on other sites

I assume you don't want any of the heating functions. So no nozzle 1 or nozzle 2 or hotbed heaters correct?

If this is the case, you can disable the code that manipulates the pins used for the software PWM to those three MOSFETs. Then you can remove the PINs from the excluded list of PINs you can't use with the M42 command.

Get the source for Marlin


and look at Temperature.cpp and search for ISR(TIMER0_COMPB_vect)

This is the interrupt service routine where the pins are toggled. After reviewing and understanding what's going on there, you will know what to comment out. You should also search all the source for other references to HEATER_0_PIN, HEATER_1_PIN and HEATER_BED_PIN to ensure they aren't being manipulated somewhere else.

You might need to change things in the manage_heater function of Temperature.cpp as there are a bunch of checks around the heaters to ensure the temp is rising when expected etc. However, if you don't call for the temperature to be anything other than 0, you might not run into the checks.

Then you could remove HEATER_0_PIN, HEATER_1_PIN and HEATER_BED_PIN from the sensitive list that prevents their use in the M42 command. Look for a section like this and remove HEATER_0_PIN, HEATER_1_PIN:

//List of pins which to ignore when asked to change by gcode, 0 and 1 are RX and TX, do not mess with those!





#define _E1_PINS





#define _E2_PINS



Then look at the end of the file for this and remove the HEATER_BED_PIN -





analogInputToDigitalPin(TEMP_0_PIN), analogInputToDigitalPin(TEMP_1_PIN), analogInputToDigitalPin(TEMP_2_PIN), analogInputToDigitalPin(TEMP_BED_PIN) }


Share this post

Link to post
Share on other sites

Hey anon! So it sounds like the three heater dealies on the main board could be repurposed as say a way to control three pumps or to switch on and off devices? Like could they be used to simply switch on say a print head? And then switch it off? I mean that is essentially pwm. So I guess this means you could have at least 5 extruding devices from the main board in theory...

Share this post

Link to post
Share on other sites

Well, using the M42 would NOT provide PWM. It would only provide on/off control. And on -> off and off-> on would only happen as quick as the gcode is executed. I don't think the execution is quick enough or predictable enough to be considered PWM. Plus you would need to have lots of M42 commands turning on and off.

If you really need PWM for something that you need to run at 10% or 60% or 43%, it would take more effort. There is an array of three values used by the ISR to produce the PWM for the heaters and bed at a speed and regularity required to be fairly accurate PWM.


Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Our picks

    • How to 3D print with reinforced engineering materials
      Ultimaker is hosting a webinar where we explain how you can achieve and maintain a high print success rate using these new reinforced engineering materials. Learn from Ultimaker's Product Manager of Materials and top chemical engineer Bart van As how you can take your 3D printing to that next level.
      • 2 replies
    • "Back To The Future" using Generative Design & Investment Casting
      Designing for light-weight parts is becoming more important, and I’m a firm believer in the need to produce lighter weight, less over-engineered parts for the future. This is for sustainability reasons because we need to be using less raw materials and, in things like transportation, it impacts the energy usage of the product during it’s service life.
        • Like
      • 12 replies

Important Information

Welcome to the Ultimaker Community of 3D printing experts. Visit the following links to read more about our Terms of Use or our Privacy Policy. Thank you!