RAMPS 1.4: Configuration for Generic Motor Control

Configuring the knockoff RAMPS 1.4 board went reasonably smoothly:

RAMPS 1.4 - First Light

RAMPS 1.4 – First Light

The DC (n.b., not an AC) solid state relay in the foreground switches the 20 V laptop supply brick to the RAMPS shield atop the knockoff Arduino Mega 2560, controlled by the PS_ON pin (black wire), with +5 V from a pin in the AUX header (yellow wire). The SSR includes a ballast resistor limiting the current to 12 mA, with an inconspicuous red LED behind the black dot showing when the output is turned on.

Because it’s a DC SSR, polarity matters: the supply goes to the + terminal, the RAMPS power inputs to the – terminal.

I haven’t applied much of a load to to the SSR, but it works as expected. Define POWER_SUPPLY 1 and PS_DEFAULT_OFF so the boards starts up with the SSR turned off, then use M80 / M81 to turn it on / off as needed.

Remove D1 on the RAMPS board to isolate the Mega power from the +20 V supply. Stuffed as shown, the Mega draws 70 mA from the USB port, although an external 8 V (-ish) supply is always a good idea.

The stepper is a random NEMA 17 from the heap in a mount intended for a DIY plotter. I adjusted the tiny trimpots on all the boards for 400 mA peak = 250 mA RMS into the windings, after finding 250 mApk didn’t produce nearly enough mojo, even for a demonstration:

X Axis Stepper Drive

X Axis Stepper Drive

Just to get it running, I used DEFAULT_AXIS_STEPS_PER_UNIT = 100 step/mm, MAX_FEEDRATE 100 mm/s, and (for lack of anything better)
DEFAULT_*_ACCELERATION 1000. Those all depend the torque produced by the motor current, which is still way too low.

The endstops require X_???_ENDSTOP_INVERTING true.

I set the ?_BED_SIZE parameters to a generous 2000, with ?_MIN_POS equal to -SIZE/2 to put the origin in the middle where I prefer it, with a similar setting for the Z axis. Obviously, those numbers don’t correspond to any physical reality.

Three little 100 kΩ thermistors sprout from their header and produce reasonable temperatures, although (being cheap eBay parts) they may not match the Type 4 curve. I don’t have any heaters connected. All the over / under temperature lockouts are disabled, because I don’t care right now.

The G-Code parser wants uppercase command letters, which means I get to press the Caps Lock key for the first time in nearly forever!

The header along the right edge of the board connects to the LCD control board, which is another story.

The diffs for the Configuration.h and Configuration_adv.h files as a GitHub Gist:



  1. #1 by Vedran on 2017-10-25 - 11:35

    If you’re ignoring the temperature anyway, you can set TEMP_SENSOR_x to dummy thermistor tables. Fresh Marlins have two defined, one that always returns 25C and the other for 100C. Great for testing without hotends and also for burning your printer with them :)

    • #2 by Ed on 2017-10-25 - 16:24

      I saw those settings in the configuration, then decided to gimmick up a fake heater for pedagogic purposes: a thermistor epoxied to a resistor dissipating half a watt. Turns out the thermistor inputs actually work, which wasn’t a sure thing … [sigh]

      • #3 by Vedran on 2017-10-26 - 06:37

        Last week I noticed thermistor table 55 – normal 100k thermistor but with 1k pullup instead of standard (for Marlin and RAMPS) 4k7 one. A little quick math revealed that it gives a LOT better resolution beyond 220C so i swapped the pullups, flashed the Marlin and voila – rock steady hotend temperature at 250C – before the swap, reading was jumping some 3-5C around the setpoint, making for really long heatup times and occasional false thermal runaway error.
        I’ll swap all hotend pullups with 1k next time around, but leave the bed with 4k7 which does better around 30-50C

        • #4 by Ed on 2017-10-26 - 08:28

          That’s a good idea: trade off room-temperature accuracy for more bits where they’ll do the most good.

          Most of the time, though, an unstable thermistor reading comes from mechanical problems at the thermistor: a loose setscrew holding it in place, a failing thermistor, or fatigue-failing wires. Might not apply to your setup, but the reports on the M2 forums always seem to converge on those solutions.

          • #5 by Vedran on 2017-10-27 - 06:48

            Haven’t had any of that so far (knocks on wood). E3D does pretty much perfect on thermistor mounting and strain relief on the wires is decent enough. I have seen some videos of recent Chinese printers where wires from the heater and thermistor are supported just on the printer frame some 30cm away from the block and you can see them bending just outside the block as the carriage moves. Yikes :)

            • #6 by Ed on 2017-10-30 - 18:04

              And explaining to a new user why loose wires are a terrible idea is surprisingly difficult …

  2. #7 by Vedran on 2017-10-25 - 11:46

    Somewhat off topic, I finally got to finish the 1000W heated bed and it’s really great. Heating to PLA temperatures is only 3-5 minutes, PETG 5-10 and ABS is done in 15 max :)
    It does seem I’ll have to manually tweak PID values. The autotuned ones work fine in normal situations, but fall on their face when the bed temp is already falling and you try to set it a few degrees over the current temp. PID controller sees only a small error in that case, but it takes a lot of power to change the thermal gradient in a 5kg bed :)

    • #8 by Ed on 2017-10-25 - 19:04

      That’s a lot of heater! I assume the ceiling lights pulse slightly as the heater cycles …

      • #9 by Vedran on 2017-10-26 - 06:31

        Actually no, at 220V it’s pretty non-significant load and it’s purely resistive so lights stay on. Before this one though, I was running a nominally 250W@24V heater at 750W@45ishV, and having no adequate power supply I cobbled together two rewound 700VA microwave transformers with primaries in parallel and secondaries in series. That baby regularly dimmed the lights and occasionally popped the 25A breaker when core magnetization on turn-on happened to be opposite of what the mains were trying to force. I toyed with the (somebody elses) idea to have a zero cross detector and turn the power on and off only when the core is demagnetized, but then came to my senses and ordered a proper heater :)

        • #10 by Ed on 2017-10-26 - 08:29

          Ah! Not only do you have sensible graduations on your rulers, you have sensible utility voltages!

          • #11 by RCPete on 2017-10-26 - 22:32

            I never did quite understand 50Hz though. IMHO, it would make more sense for the US to be at 50Hz with Eurospec at 60. On the gripping hand, the Pacific Intertie is DC, so radiative losses aren’t a factor.

            Off topic: anybody else get clobbered by the Amazon no-image problem? Looks like it went down when they changed certificates on Oct 19th. Amazon would eventually load, but no images. I thought it was a DNS lookup on my end, but no. Learned more about SSL than I want to, but the hint came with last night’s ssllabs analysis test showed the new cert, but this morning’s showed the old one. When it showed the new one again, I figured it was a propagation problem. It’s up now; I think the information took the scenic route.

            Oh well, now I finally showed Julie the stuff we’re buying as a gift. Only a week. Sigh.

          • #12 by Vedran on 2017-10-27 - 06:37

            Yeah 110V mains really sound like a drag. I don’t remember ever plugging anything remotely legit and popping a breaker due to too much load. Shocks are a bit unpleasant though :)

          • #13 by Vedran on 2017-10-27 - 06:43

            There is something nice about imperial… all your stuff is available in couple of standard sizes. You’ve got your 1/4″, 1/2″, 1″ stock, 2×4, 1×8, 1×6 lumber, all in nice round packages. Around here when I buy lumber it’s something like 48x26mm – makes no sense at all :)

            But I do love how our dial indicators are twice as precise as yours, 1 thou being ~ 2 hundreths of a milimeter :)
            Metric FTW :)

            • #14 by RCPete on 2017-10-27 - 09:23

              Don’t get too envious of our lumber sizing. [grin] 2 x 4 lumber was 2.0″ x 4.0″ when it was sawn, but after it was dried and surfaced, it ends as 1.5″ x 3.5″. Pieces for stud construction are cut to proper length, but 8′ or longer nominal runs longer–a half inch at 8′ for the stuff I get.

              I think one of the dial indicators on hand is good to tenths of a thou. Not much range, though.

            • #15 by Vedran on 2017-10-28 - 10:26

              Yeah, my 1um Mitutoyo dial indicator only does 1mm of travel as well, although the plunger can move in additional 5mm so you can mess up a little bit and not bugger it up instantly :)
              I find that I mostly use a Mahr dial test indicator as I rarely need precise absolute measurements, and DTI shape is much easier to use then regular dial indicator. Also, the arm is held just by friction, so if I overdo it it just moves to a new position without breaking – a big plus for a goof like me :)

  1. MPCNC: Stepper Motor Power Control | The Smell of Molten Projects in the Morning

Spam comments vanish. Comment moderation may cause a delay.

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s